-
Notifications
You must be signed in to change notification settings - Fork 41
Introduce MeasureEnvironment: consolidate endpoint params, resolve at construction #981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ed46813
Introduce MeasureReference sealed interface
JPercival 74d1ea6
Fix benchmark test: replace Either3 with MeasureReference
JPercival 39d8d1a
spotless
JPercival 323c5c6
Introduce MeasureEnvironment: consolidate endpoint params
JPercival 622bafb
Pull up additionalData federation as explicit pipeline step
JPercival 042b726
resolveRepository is the single environment setup step
JPercival 7375997
Remove repo branching: resolvedRepo is the only repo
JPercival 38d0e49
Environment resolved at construction: MeasureEnvironment gone from ev…
JPercival 79ba397
feat: test for measure enviornment
JPercival 1ad677f
Merge branch 'main' into measure-environment
JPercival cd7bfaa
bug: spotless issues
JPercival 7dcfdaf
Merge branch 'main' into measure-environment
JPercival aaaafc9
Merge branch 'main' into measure-environment
JPercival a7c5649
Merge branch 'main' into measure-environment
JPercival File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
3 changes: 2 additions & 1 deletion
3
...fhir-cr-hapi/src/main/java/org/opencds/cqf/fhir/cr/hapi/dstu3/IMeasureServiceFactory.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| package org.opencds.cqf.fhir.cr.hapi.dstu3; | ||
|
|
||
| import ca.uhn.fhir.rest.api.server.RequestDetails; | ||
| import org.opencds.cqf.fhir.cr.measure.common.MeasureEnvironment; | ||
| import org.opencds.cqf.fhir.cr.measure.dstu3.Dstu3MeasureService; | ||
|
|
||
| @FunctionalInterface | ||
| public interface IMeasureServiceFactory { | ||
| Dstu3MeasureService create(RequestDetails requestDetails); | ||
| Dstu3MeasureService create(RequestDetails requestDetails, MeasureEnvironment environment); | ||
| } |
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
3 changes: 2 additions & 1 deletion
3
...hapi/src/main/java/org/opencds/cqf/fhir/cr/hapi/r4/R4MeasureEvaluatorMultipleFactory.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| package org.opencds.cqf.fhir.cr.hapi.r4; | ||
|
|
||
| import ca.uhn.fhir.rest.api.server.RequestDetails; | ||
| import org.opencds.cqf.fhir.cr.measure.common.MeasureEnvironment; | ||
| import org.opencds.cqf.fhir.cr.measure.r4.R4MeasureEvaluatorMultiple; | ||
|
|
||
| @FunctionalInterface | ||
| public interface R4MeasureEvaluatorMultipleFactory { | ||
| R4MeasureEvaluatorMultiple create(RequestDetails requestDetails); | ||
| R4MeasureEvaluatorMultiple create(RequestDetails requestDetails, MeasureEnvironment environment); | ||
| } |
3 changes: 2 additions & 1 deletion
3
...r-hapi/src/main/java/org/opencds/cqf/fhir/cr/hapi/r4/R4MeasureEvaluatorSingleFactory.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| package org.opencds.cqf.fhir.cr.hapi.r4; | ||
|
|
||
| import ca.uhn.fhir.rest.api.server.RequestDetails; | ||
| import org.opencds.cqf.fhir.cr.measure.common.MeasureEnvironment; | ||
| import org.opencds.cqf.fhir.cr.measure.r4.R4MeasureEvaluatorSingle; | ||
|
|
||
| @FunctionalInterface | ||
| public interface R4MeasureEvaluatorSingleFactory { | ||
| R4MeasureEvaluatorSingle create(RequestDetails requestDetails); | ||
| R4MeasureEvaluatorSingle create(RequestDetails requestDetails, MeasureEnvironment environment); | ||
| } |
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
58 changes: 58 additions & 0 deletions
58
cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/common/MeasureEnvironment.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package org.opencds.cqf.fhir.cr.measure.common; | ||
|
|
||
| import ca.uhn.fhir.repository.IRepository; | ||
| import jakarta.annotation.Nullable; | ||
| import org.hl7.fhir.instance.model.api.IBaseBundle; | ||
| import org.hl7.fhir.instance.model.api.IBaseResource; | ||
| import org.opencds.cqf.fhir.utility.repository.FederatedRepository; | ||
| import org.opencds.cqf.fhir.utility.repository.InMemoryFhirRepository; | ||
| import org.opencds.cqf.fhir.utility.repository.Repositories; | ||
|
|
||
| /** | ||
| * Version-agnostic environment configuration for measure evaluation. | ||
| * | ||
| * <p>Separates the <em>infrastructure inputs</em> (where data, content, and terminology come from) | ||
| * from the <em>operation parameters</em> (what to evaluate). Per the pipeline architecture, | ||
| * environment resolution happens before domain logic: the service layer composes a | ||
| * {@code ProxyRepository} from these endpoints and passes it to the evaluator. | ||
| * | ||
| * <p>Endpoint resources are typed as {@link IBaseResource} so both R4 and DSTU3 | ||
| * {@code Endpoint} instances can be carried without version coupling. | ||
| * {@code Repositories.proxy()} already accepts {@code IBaseResource} endpoints directly. | ||
| * | ||
| * @param contentEndpoint endpoint for library/content resolution (nullable) | ||
| * @param terminologyEndpoint endpoint for terminology resolution (nullable) | ||
| * @param dataEndpoint endpoint for clinical data retrieval (nullable) | ||
| * @param additionalData supplemental data bundle for repository federation and CQL engine | ||
| * configuration (nullable) | ||
| */ | ||
| public record MeasureEnvironment( | ||
| @Nullable IBaseResource contentEndpoint, | ||
| @Nullable IBaseResource terminologyEndpoint, | ||
| @Nullable IBaseResource dataEndpoint, | ||
| @Nullable IBaseBundle additionalData) { | ||
|
|
||
| /** Empty environment — no endpoints, no additional data. */ | ||
| public static final MeasureEnvironment EMPTY = new MeasureEnvironment(null, null, null, null); | ||
|
|
||
| /** | ||
| * Resolves this environment against a base repository. | ||
| * | ||
| * <p>If any endpoint is present, wraps {@code base} in a {@code ProxyRepository}; null | ||
| * endpoints fall back to {@code base}. If {@code additionalData} is present, federates | ||
| * the result with an in-memory repository seeded from that bundle. | ||
| * | ||
| * @param base the base repository to build on top of | ||
| * @return the resolved repository, possibly wrapped | ||
| */ | ||
| public IRepository resolve(IRepository base) { | ||
| IRepository repo = base; | ||
| if (dataEndpoint() != null || contentEndpoint() != null || terminologyEndpoint() != null) { | ||
| repo = Repositories.proxy(repo, true, dataEndpoint(), contentEndpoint(), terminologyEndpoint()); | ||
| } | ||
| if (additionalData() != null) { | ||
| repo = new FederatedRepository(repo, new InMemoryFhirRepository(repo.fhirContext(), additionalData())); | ||
| } | ||
| return repo; | ||
| } | ||
| } | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.