fix: resolve and extract nested profile answers - #1108
Closed
rob-reynolds wants to merge 6 commits into
Closed
rob-reynolds wants to merge 6 commits into
rob-reynolds wants to merge 6 commits into
Conversation
|
Formatting check succeeded! |
rob-reynolds
marked this pull request as draft
September 9, 2026 17:40
|
rob-reynolds
marked this pull request as ready for review
September 9, 2026 19:04
rob-reynolds
marked this pull request as draft
September 9, 2026 19:06
barhodes
force-pushed
the
feature-definition-based-population
branch
from
September 19, 2026 11:48
336c4e1 to
e7c5179
Compare
This was referenced Sep 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.



Superseded by #1119, which contains only the four-file extraction patch on the current population branch.
Definition-based extraction can drop a Coding answer when the target requires CodeableConcept. Nested Extension answers can also borrow an unrelated root value constraint or be attached at the resource root instead of their declared location.
This resolves the answer type from the item's profile canonical and full element identity before converting in
transformAnswer. A converted value is used only when it matches the resolved target type; the original answer remains available to the existing fallback.Named nested paths now construct the complete resource tree for flat and grouped questionnaire items. Sibling answers share the correct enclosing slice; repeated groups remain separate, including groups without a definition. Named Observation components retain their identity. Absolute child definitions return to the resource root before assignment. QR-only requests use the same root extraction declaration as dispatch. Inline and referenced Extension profiles supply scoped URLs and defaults; defaults initialize containers once and are copied before use. Repeated Coding answers append within their CodeableConcept instead of replacing it. Repeated QR groups keep fields of each record associated while preserving enclosing ancestors, including root-routed child definitions. Separate fields of a repeated record belong in the same QR group; independent answer arrays are not implicitly paired by index.
The tests cover DSTU3/R4/R5, Coding metadata, typed aliases, snapshot defaults, similarly named slices, nested referenced profiles, flat/grouped/repeated forms, named component ancestors, unanswered items, and isolation across extraction calls. Extension URLs may come from profile defaults or answers and are validated after item traversal. A named extraction path that still cannot resolve a required URL reports the path rather than creating an orphan Extension. Unanswered paths remain no-ops. General profile validation and discriminator-based selection of pre-existing repository resources are outside this change.
This PR targets
feature-definition-based-populationand supersedes #1101.Validation: 145 passed, one pre-existing disabled test (
populateWithLaunchContextResolvesParametersR5) across the affected extraction and questionnaire/response processor suites. Main Checkstyle and Java formatting checks pass.Checks:
./gradlew spotlessJavaCheck :cqf-fhir-cr:test --tests '*questionnaireresponse.*' --tests '*QuestionnaireProcessorTests' :cqf-fhir-cr:checkstyleMain.