Commit ce78e93
authored
Introduce MeasureEnvironment: consolidate endpoint params, resolve at construction (#981)
* Introduce MeasureReference sealed interface
Replace Either3<CanonicalType, IdType, Measure> and the three-separate-lists
pattern (List<IdType>, List<String>, List<String>) with a single sealed type:
sealed interface MeasureReference {
record ById(IIdType id)
record ByIdentifier(String identifier)
record ByCanonicalUrl(String url)
}
HAPI providers convert at the boundary via fromOperationParams().
R4MeasureServiceUtils.getMeasures() dispatches on the sealed type.
R4CareGapsParameters uses List<MeasureReference> instead of 3 fields.
R4MultiMeasureService, R4CareGapsProcessor accept List<MeasureReference>.
R4CareGapsService.liftMeasureParameters() deleted -- boundary conversion
now happens once in the transport layer.
R4CollectDataService reads Measure directly via repository.read() instead
of wrapping in Either3.
The type is self-documenting: a measure can be referenced by ID,
identifier, or canonical URL. Compiler enforces exhaustive handling.
* Fix benchmark test: replace Either3 with MeasureReference
* spotless
* Introduce MeasureEnvironment: consolidate endpoint params
contentEndpoint, terminologyEndpoint, dataEndpoint, and additionalData
were passed as four separate parameters through every layer of the
measure evaluation stack -- both public interfaces and internal methods.
Replace all four with MeasureEnvironment.
record MeasureEnvironment(
IBaseResource contentEndpoint,
IBaseResource terminologyEndpoint,
IBaseResource dataEndpoint,
IBaseBundle additionalData)
Per the pipeline architecture, environment resolution is step 2 --
separate from the operation parameters. HAPI providers (the transport
boundary) now construct MeasureEnvironment from the resolved endpoint
params before calling the service layer. All downstream code receives
a single typed object.
R4MultiMeasureService.evaluateToListOfList() now delegates repository
construction to a private resolveRepository(MeasureEnvironment) helper,
making the step explicit and testable in isolation.
MeasureEnvironment.EMPTY is used by R4CareGapsBundleBuilder (which has
no endpoint configuration) and by test helpers that only set additionalData.
IBaseResource / IBaseBundle carry the endpoints version-agnostically,
consistent with the domain-core invariant (no version-specific types).
* Pull up additionalData federation as explicit pipeline step
federateWithAdditionalData(IRepository, MeasureEnvironment) is now a
named private method alongside resolveRepository(MeasureEnvironment),
making the two-step environment setup explicit in evaluateToListOfList:
var effectiveRepo = resolveRepository(environment); // endpoint proxy
var subjectRepo = federateWithAdditionalData(effectiveRepo, environment); // bundle overlay
Previously the FederatedRepository construction was buried inside
getSubjectsForEvaluateSingle, which also hardcoded this.repository as
the federation base instead of effectiveRepo. That meant additional-data
subjects were resolved against the base repository even when an endpoint
proxy was active.
getSubjectsForEvaluateSingle now takes the already-prepared subjectRepo
directly — one job, one level of abstraction.
* resolveRepository is the single environment setup step
All environment config is resolved upfront in resolveRepository():
- endpoint proxy (all three endpoints → Repositories.proxy)
- additional data federation (bundle → FederatedRepository overlay)
The CQL engine receives resolvedRepo and null for additionalData —
the bundle is already accessible through the federated repository.
Passing it twice was wrong: the repo is the resolved environment.
* Remove repo branching: resolvedRepo is the only repo
Once resolveRepository() runs, there is one repo. No switching.
The pre-cached standard processor and utils fields were a remnant
of the old conditional — delete them and construct directly from
resolvedRepo every time.
* Environment resolved at construction: MeasureEnvironment gone from eval signatures
The resolved IRepository is now a constructor parameter, not a method
parameter threaded through the call stack.
MeasureEnvironment.resolve(IRepository) composes the final repository:
endpoint proxy (when all three endpoints present) then additional-data
federation. This is the single place that knows how to build the repo.
Operation providers (HAPI transport boundary) resolve environment
before constructing the service via the factory:
factory.create(requestDetails, environment)
→ environment.resolve(repositoryFactory.create(requestDetails))
→ new R4MultiMeasureService(resolvedRepo, ...)
R4MeasureEvaluatorSingle, R4MeasureEvaluatorMultiple, and
Dstu3MeasureEvaluatorSingle no longer carry MeasureEnvironment.
R4MultiMeasureService.resolveRepository() is deleted. The service
receives a repo that is already fully configured; it just uses it.
* feat: test for measure enviornment
* bug: spotless issues1 parent 8ffcaad commit ce78e93
18 files changed
Lines changed: 226 additions & 141 deletions
File tree
- cqf-fhir-benchmark/src/test/java/org/opencds/cqf/fhir/benchmark/measure/r4
- cqf-fhir-cr-hapi/src/main/java/org/opencds/cqf/fhir/cr/hapi
- config
- dstu3
- r4
- dstu3
- measure
- r4
- measure
- cqf-fhir-cr/src
- main/java/org/opencds/cqf/fhir/cr/measure
- common
- dstu3
- r4
- test/java/org/opencds/cqf/fhir/cr/measure
- common
- r4
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | 152 | | |
157 | 153 | | |
158 | 154 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
87 | | - | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | | - | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
| 159 | + | |
| 160 | + | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 169 | | |
173 | 170 | | |
174 | 171 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 22 | + | |
27 | 23 | | |
0 commit comments