You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix multi-component stratifier alignment for list + scalar (#1042)
* Fix multi-component stratifier alignment for list + scalar (CDO-715)
A boolean (subject) basis stratifier with two components — one returning
a per-patient List and one returning a per-patient scalar — emitted one
stratum per component value with a single component, instead of one
stratum per unique (list-element, scalar) tuple with both components.
Root cause: collectFunctionRowKeys only collected alignment row keys from
function (Map) results, so a scalar component sharing a subject with an
iterable component fell back to a subject-only row key. The iterable's
composite per-element keys and the scalar's subject-only key never
intersected, producing disjoint single-component strata.
Generalize the collector (renamed collectAlignmentRowKeys) to also
gather row keys from iterable results, so scalars expand alongside list
elements via the existing expandScalarToAlignmentRowKeys path. Tighten
the scalar fallback: when the stratifier has multi-value components but
a given subject produced none (empty Map or List), the subject
contributes no stratum — matching the existing empty-list semantic.
Adds single-subject and multi-subject MeasureStratifierTest cases plus a
CohortBooleanMultiComponentListScalarStrat fixture that pairs the
existing "Distinct Encounter Statuses" list expression with the
"Gender Stratification String" scalar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Reduce cognitive complexity of collectAlignmentRowKeys
Extract per-entry work into a helper method to flatten nesting and
remove duplicated qualifiedSubject/computeIfAbsent setup across the
Map and Iterable branches.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
"value stratifier is invalid for expression: [All Encounters] with result types: [Encounter] for measure URL: http://example.com/Measure/CohortBooleanValueStratListExpression. Expected a scalar type");
1507
1507
}
1508
+
1509
+
/**
1510
+
* boolean (subject) basis stratifier with two components — one returning a
1511
+
* per-patient {@code List} ("Distinct Encounter Statuses") and one returning a per-patient
1512
+
* scalar ("Gender Stratification String") — must emit one stratum per unique
1513
+
* (list-element, scalar) tuple, with each stratum carrying BOTH component values.
1514
+
* <p/>
1515
+
* Before the fix, scalar components were only expanded to align with function (Map) row keys,
1516
+
* never iterable row keys, so the iterable's composite row key and the scalar's subject-only
1517
+
* row key landed in disjoint groups — producing one stratum per component value with only that
1518
+
* single component, instead of strata with both components.
1519
+
* <p/>
1520
+
* Patient-9 has two Encounters (statuses {@code finished}, {@code in-progress}) and gender
0 commit comments