Repository navigation
Index a patient profile at the first observation period when the person has no records - #2593
Merged
chrisknoll merged 1 commit intoNov 13, 2026
Conversation
…on has no records getPersonProfile takes day 0 from the requested cohort's start date, or else from the person's earliest record. A person with observation periods but no clinical records (an enrollee without claims, or a profile opened for a cohort the person is not in) had neither, so the index date stayed null and computing the observation period offsets threw a NullPointerException, returning a server error instead of the profile. Fall back to the earliest observation period start, as the endpoint's documentation describes, so these profiles load with their observation periods and age at index.
chrisknoll
approved these changes
Nov 13, 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.
Fixes #2592
getPersonProfiletakes day 0 from the requested cohort's start date, or else from the person's earliest record. A person with observation periods but no clinical records has neither when the profile is opened without a cohort, or for a cohort the person is not in. For example, an enrollee with coverage but no claims. The index date stayednull, and computing the observation period offsets threwso the endpoint returned a server error instead of the profile.
Change
PersonService.getPersonProfile: when there is no cohort entry and no record, fall back to the earliest observation period start date. This is the "initial date of observation" the endpoint's documentation already describes. Profiles that have a cohort entry or any record are indexed exactly as before.OHDSI/Atlas#2121 asks whether the no-cohort index should always be the observation period start. This PR doesn't settle that; it only covers the case that currently crashes.
Tests
New
PersonServiceProfileTest(embedded Postgres, small CDM schema) callsgetPersonProfilefor:masterwith the NullPointerException; with the fix, the profile has day 0 at the first observation period and the age at index from that year.The test stubs the source repository and JDBC template on a spy and calls
getPersonProfiledirectly, so@PreAuthorizeisn't exercised.