Fix stratum value placement for component-based stratifiers (CDO-656)#1034
Draft
lukedegruchy wants to merge 1 commit into
Draft
Fix stratum value placement for component-based stratifiers (CDO-656)#1034lukedegruchy wants to merge 1 commit into
lukedegruchy wants to merge 1 commit into
Conversation
For Measure stratifiers declared with `stratifier.component[]`, the
resulting MeasureReport put the stratum value at `stratum.value` instead
of inside `stratum.component[].value`. Multi-component stratifiers worked
by accident; a single component fell through to the non-component path
because the gate was `valueDefs.size() > 1`.
Drive the output shape from the Measure definition
(`stratifierDef.components()`), not the runtime value count, in both
`R4StratifierBuilder.buildStratum` and `R4MeasureReportUtils
.matchesStratumValue`. Also populate `stratum.component[].id` from the
Measure component def.
Example - non-subject value stratifier (Encounter basis):
CQL:
define function "Age Function" (e Encounter):
AgeInYearsAt(start of e.period)
Measure.stratifier:
{ "id": "stratifier-age", "code": { "text": "Age" },
"component": [{
"id": "strat-1-comp-1",
"code": { "text": "Age" },
"criteria": { "language": "text/cql.identifier",
"expression": "Age Function" }}]}
MeasureReport.stratum, before:
{ "value": { "text": "35" }, "population": [ ... ] }
MeasureReport.stratum, after:
{ "component": [{
"id": "strat-1-comp-1",
"code": { "text": "Age" },
"value": { "text": "35" }}],
"population": [ ... ] }
Behavior change: consumers reading `stratum.value.text` for
single-component stratifiers must now read
`stratum.component[0].value.text`. DSTU3 is unaffected (no
`stratifier.component` in spec); no dedicated R5 builder exists.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Formatting check succeeded! |
|
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.



For Measure stratifiers declared with
stratifier.component[], the resulting MeasureReport put the stratum value atstratum.valueinstead of insidestratum.component[].value. Multi-component stratifiers worked by accident; a single component fell through to the non-component path because the gate wasvalueDefs.size() > 1.Drive the output shape from the Measure definition (
stratifierDef.components()), not the runtime value count, in bothR4StratifierBuilder.buildStratumandR4MeasureReportUtils .matchesStratumValue. Also populatestratum.component[].idfrom the Measure component def.Example - non-subject value stratifier (Encounter basis):
CQL:
Measure.stratifier:
{ "id": "stratifier-age", "code": { "text": "Age" }, "component": [ { "id": "strat-1-comp-1", "code": { "text": "Age" }, "criteria": { "language": "text/cql.identifier", "expression": "Age Function" } } ] }MeasureReport.stratum, before:
{ "value": { "text": "35" }, "population": [ ... ] }MeasureReport.stratum, after:
{ "component": [ { "id": "strat-1-comp-1", "code": { "text": "Age" }, "value": { "text": "35" } } ], "population": [ ... ] }Behavior change: consumers reading
stratum.value.textfor single-component stratifiers must now readstratum.component[0].value.text. DSTU3 is unaffected (nostratifier.componentin spec); no dedicated R5 builder exists.