[WIP] fix: allergy manifestation not pre-populated in Aboriginal Health Check (issue #1975)#1976
Draft
MaryamMehd wants to merge 4 commits into
Draft
[WIP] fix: allergy manifestation not pre-populated in Aboriginal Health Check (issue #1975)#1976MaryamMehd wants to merge 4 commits into
MaryamMehd wants to merge 4 commits into
Conversation
FHIRPath v4 requires internal __path__ metadata on resources when navigating nested BackboneElements (e.g. reaction.manifestation.select(...)). Without it, evaluate() throws silently, leaving fields like Allergies > Manifestation empty. Add stampFhirpathMetadata() in evaluateExpressions.ts and apply it when storing itemPopulationContext values and contextMap entries. Update populate.test.ts to use the same helper and add diagnostic tests proving the __path__ requirement. Fixes the Allergies population failure in the Aboriginal/Torres Strait Islander Health Check integration tests (Vitest Questionnaire 715 Behaviour Tests). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…s and OpenChoiceAutocompleteItem Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Related issue
Closes #1975
Status
Work in progress - investigation not yet complete. Opening as a draft PR to link the branch to the issue and share progress with the team.
The
Patient with no fixed addresstest is now passing. TheAllergiesmanifestation test is still failing.What has been done
sdc-populate fixes
evaluateExpressions.ts- AddedstampFhirpathMetadata()helper:FHIRPath v4 requires an internal
__path__property on resources used as context variables for nested BackboneElement navigation (e.g.reaction.manifestation.coding). This helper does a JSON round-trip (to strip any stale__path__inherited from Bundle navigation) then callsfhirpath.evaluate(resource, '$this', {}, r4model)to re-stamp the correct path.populate.ts- Upfront stamping of all root FHIR resources infhirPathContextbefore any FHIRPath evaluation begins.readPopulationExpressions.ts- FixedchildrenUnderContextlogic so that children of non-repeatingitemPopulationContextgroups are not incorrectly excluded from global evaluation. This fixed the Patient with no fixed address regression.smart-forms-renderer fix
OpenChoiceAutocompleteField.tsx- Removedvalue={input}prop that was being passed toStandardTextFieldinside MUI Autocomplete. This prop was overriding Autocomplete's internalinputValuemanagement and preventing populated values from displaying.Diagnostic tests added
sdc-populate/test/populate.test.ts- New unit tests that prove__path__stamping works and the fullselect()expression withasync: truereturnsRashafter Bundle extraction and stamping (using the exact integration test allergy data).Investigation document
docs/investigation-allergy-rash-population-failure.md- Full investigation log with confirmed facts, decision table, and next steps.Still failing - open question
Debug logging in
OpenChoiceAutocompleteItemshows the renderer receives an answer with only a random ID and novalueCodingfor the SNOMED allergy manifestation. The random ID confirms the manifestation QR item is absent from the populated QR for allergy 1.Yet the Jest unit test of the exact same FHIRPath expression passes. The gap between Jest and the Playwright integration test environment is not yet understood. See issue #1975 for the full question to the team.