Improve performance of Organization endpoint#395
Merged
spopelka-dsac merged 7 commits intomainfrom Feb 11, 2026
Merged
Conversation
This was referenced Feb 10, 2026
Merged
rmillergv
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
module-name: Improve performance of Organization endpoint
Jira Ticket #NDH-795
Problem
The Organization endpoint was not optimized for performance and was quite slow to query.
Solution
Result
Organization queries that once took ~20 seconds now take seconds
Here is a screenshot showing 1.6 seconds across the full 3+ million organization Halloween dataset.

Test Plan
make upfrom roothttps://localhost:8000/fhir/Organization)Note: The view logic is a big complex to account for the potential of multiple and/or no organization names listed as being primary, due to the fact that the organization name data we currently have does not specify which organization names are primary. We will likely be able to clean it up in the future, with a better understanding of what the shape of the data will look like in a post-Halloween CSV world.
Credit where credit is due: this PR builds off the work that Adam started in #283