Issue/1926#1939
Open
leoniedickson wants to merge 3 commits into
Open
Conversation
…up initialExpressions Children of an itemPopulationContext repeat group were being added to the global initialExpressions map and pre-evaluated against the full collection, causing fhirpath's toString() (and similar single-item functions) to throw when 2+ resources were present. The per-item evaluation in constructRepeatGroupInstances always worked correctly and never used the pre-computed value. Fix: exclude repeat group children from the global map in readPopulationExpressions, and read expressions directly from the questionnaire item in constructRepeatGroupInstances so they are always evaluated against the correctly scoped per-item context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces implicit global jest identifiers with explicit imports from @jest/globals, matching the pattern used in smart-forms-renderer and eliminating IDE type errors in test files excluded from tsconfig.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
readPopulationExpressionswas adding children ofitemPopulationContextrepeat groups to the globalinitialExpressionsmap, causinggenerateExpressionValuesto pre-evaluate them against the full resource collection. FHIRPath functions liketoString()that require a single-item input would then throw, producing a spuriousOperationOutcomeIssuewarning. Population itself was never broken — the per-item evaluation inconstructRepeatGroupInstancesalways worked correctly and never used the pre-computed value.readPopulationExpressions, and read expressions directly from the questionnaire item inconstructRepeatGroupInstancesso they are always evaluated against the correctly scoped per-item context.@jest/globalsimports to allsdc-populatetest files to resolve IDE type errors (matches the pattern already used insmart-forms-renderer).