Skip to content

Issue/1926#1939

Open
leoniedickson wants to merge 3 commits into
mainfrom
issue/1926
Open

Issue/1926#1939
leoniedickson wants to merge 3 commits into
mainfrom
issue/1926

Conversation

@leoniedickson
Copy link
Copy Markdown
Collaborator

Summary

  • readPopulationExpressions was adding children of itemPopulationContext repeat groups to the global initialExpressions map, causing generateExpressionValues to pre-evaluate them against the full resource collection. FHIRPath functions like toString() that require a single-item input would then throw, producing a spurious OperationOutcomeIssue warning. Population itself was never broken — 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.
  • Also adds explicit @jest/globals imports to all sdc-populate test files to resolve IDE type errors (matches the pattern already used in smart-forms-renderer).

leoniedickson and others added 3 commits May 22, 2026 11:55
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Condition onsetDateTime Causes Form Pre-population Failure

1 participant