Fix multi-component stratifier alignment for list + scalar (CDO-715)#1042
Draft
lukedegruchy wants to merge 1 commit into
Draft
Fix multi-component stratifier alignment for list + scalar (CDO-715)#1042lukedegruchy wants to merge 1 commit into
lukedegruchy wants to merge 1 commit into
Conversation
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>
|
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.



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.