Repository navigation
Export every payer transition referenced by exported claim transactions - #1734
Merged
hadleynet merged 1 commit intoOct 19, 2026
Merged
Conversation
exportPayerTransitions was called with a lower bound of 0L, which is the Unix epoch rather than "no cutoff". Plans that ended before 1970 were dropped from payer_transitions.csv while the claim transactions made under them still carried their member ids in PATIENTINSURANCEID, so the documented foreign key did not resolve for patients born before 1970 when exporter.years_of_history keeps the full history. Drop the lower bound and write every plan that started before the end of the simulation. Add a test that generates older patients with the full history kept and checks that every PATIENTINSURANCEID in claims_transactions.csv matches a MEMBERID for the same patient in payer_transitions.csv. Fixes synthetichealth#1725
Contributor
Author
|
@hadleynet requesting review |
Contributor
Author
|
Friendly ping on this one. Without it, |
hadleynet
approved these changes
Oct 19, 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 #1725
What was broken
claims_transactions.PATIENTINSURANCEIDis documented as a foreign key topayer_transitions.MEMBERID, and since #1602 it holds the member id of the claim's plan record. Some of those ids have no row inpayer_transitions.csv: in the official sample data every unresolved id belongs to a claim dated before 1970, and the earliestpayer_transitions.START_DATEin that file is 1969-02-22.Root cause
CSVExporter.export(Person, long)calledexportPayerTransitions(person, 0L, time). The0Lwas meant as "no lower bound" but it is the Unix epoch, soexportPayerTransitionsonly kept plans withgetStopTime() >= 1970-01-01. Plans that ended before 1970 were never written, while the claims made under them were (whenexporter.years_of_historykeeps the full history), so the member ids inPATIENTINSURANCEIDhad nothing to join to.What changed
exportPayerTransitionsno longer takes a lower bound. It writes every plan that started on or before the end of the simulation, so the plan behind every exported claim transaction is present inpayer_transitions.csv. The column set of both files is unchanged.CSVExporterTest.testClaimTransactionsReferenceExportedPayerTransitionsgenerates a seeded population aged 60-90 withexporter.years_of_history = 0, checks that the export contains claim transactions dated before 1970, and asserts that every non-emptyPATIENTINSURANCEIDmatches a(PATIENT, MEMBERID)pair inpayer_transitions.csv. It fails onmaster(hundreds of unresolved rows, all dated 1968) and passes with this change.Testing