Skip to content

Commit

Permalink
Move CRMI operations to Visitors (#408)
Browse files Browse the repository at this point in the history
* Start of visitors and adapters; release operation

* merge master - further updates

* WIP reorganizing adapters

* WIP need to merge master

* [APHL-551] $release, $draft, $package all working in r4

* [APHL-551] updated r4 draft tests

* [APHL-551] Release operation tests

* [APHL-551] $package tests updated

* [APHL-551] package warning test

* [APHL-551] fix style and API compatibility errors

* [APHL-551] use existing packagehelper

* [APHL-551] use existing searchhelper

* [APHL-551] use existing searchhelper

* [APHL-551] remove condition filter and remove duplication

* [APHL-551] typo

* [APHL-551] remove duplication

* cleanup

* cleanup

* [APHL-551] cleanup

* cleanup

* merge conflict issues

* cleanup

* cleanup

* cleanup

* [APHL-551] remove vsm specific functionality

* spotless

* [APHL-551] update dependency tracing, add $approve support and make params in line with operation definitions

* [APHL-551] fix VS dependency tracing

* [APHL-551] cleanup

* cleanup

* [APHL-551] add coverage

* [APHL-551] add coverage

* [APHL-551] add coverage

* [APHL-551] add coverage

* [APHL-551] add coverage

* [APHL-551] add coverage

* fix pom

* [APHL-551] add coverage

* [APHL-551] spotless

* [APHL-551] move transaction stub out of inMemoryFhirRepository

* [APHL-551] make transaction stub generic

* [APHL-551] spotless

* [APHL-551] change to var

* [APHL-551] line between methods

* [APHL-551] line between methods

* [APHL-551] propagate packagehelper changes to all versions

* [APHL-551] fixed duplicate dependency

* [APHL-551] DependencyInfo in the right folder

* spotless

* [APHL-551] DependencyInfo in the right folder

* Apply suggestions from code review

add missing Extension generic params per suggestion

Co-authored-by: Brenin Rhodes <[email protected]>

* [APHL-551] versionless interfaces

* [APHL-551] Rename

* spotless

* consistent errors

* [APHL-551] Rename

* [APHL-551] update coverage

* [APHL-551] update coverage

* [APHL-551] better class check

* spotless

* [APHL-551] update coverage

* [APHL-551] add support for dstu3 and r5

* [APHL-551] cleanup

* [APHL-551] cleanup

* [APHL-551] cleanup and test bugs

* [APHL-551] cleanup

* [APHL-551] cleanup

* [APHL-551] cleanup

* spotless

* Add hasRelatedArtifact to KnowledgeArtifactAdapter and use adapter in version PackageHelpers

---------

Co-authored-by: Adam Stevenson <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Brenin Rhodes <[email protected]>
Co-authored-by: Brenin Rhodes <[email protected]>
  • Loading branch information
5 people committed Mar 19, 2024
1 parent 42ec12b commit 0d344ed
Show file tree
Hide file tree
Showing 123 changed files with 621,711 additions and 566 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.fhir.api.Repository;
import org.opencds.cqf.fhir.cr.common.IPackageProcessor;
import org.opencds.cqf.fhir.utility.BundleHelper;

public class PackageProcessor implements IPackageProcessor {
protected final Repository repository;
Expand Down Expand Up @@ -42,7 +43,8 @@ protected IBaseBundle packagePlanDefinition(IBaseResource planDefinition, boolea
protected IBaseBundle packageDstu3(org.hl7.fhir.dstu3.model.PlanDefinition planDefinition, boolean isPut) {
var packageBundle = new org.hl7.fhir.dstu3.model.Bundle();
packageBundle.setType(org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION);
packageBundle.addEntry(org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(planDefinition, isPut));
BundleHelper.addEntry(
packageBundle, org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(planDefinition, isPut));
// The CPG IG specifies a main cql library for a PlanDefinition
var libraryCanonical = planDefinition.hasLibrary()
? new org.hl7.fhir.dstu3.model.StringType(
Expand All @@ -53,7 +55,8 @@ protected IBaseBundle packageDstu3(org.hl7.fhir.dstu3.model.PlanDefinition planD
org.opencds.cqf.fhir.utility.dstu3.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
packageBundle.addEntry(org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(library, isPut));
BundleHelper.addEntry(
packageBundle, org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.dstu3.PackageHelper.addRelatedArtifacts(
packageBundle, library.getRelatedArtifact(), repository, isPut);
Expand All @@ -71,7 +74,8 @@ protected IBaseBundle packageDstu3(org.hl7.fhir.dstu3.model.PlanDefinition planD
protected IBaseBundle packageR4(org.hl7.fhir.r4.model.PlanDefinition planDefinition, boolean isPut) {
var packageBundle = new org.hl7.fhir.r4.model.Bundle();
packageBundle.setType(org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION);
packageBundle.addEntry(org.opencds.cqf.fhir.utility.r4.PackageHelper.createEntry(planDefinition, isPut));
packageBundle.addEntry((org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(planDefinition, isPut));
// The CPG IG specifies a main cql library for a PlanDefinition
var libraryCanonical =
planDefinition.hasLibrary() ? planDefinition.getLibrary().get(0) : null;
Expand All @@ -80,7 +84,8 @@ protected IBaseBundle packageR4(org.hl7.fhir.r4.model.PlanDefinition planDefinit
org.opencds.cqf.fhir.utility.r4.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
packageBundle.addEntry(org.opencds.cqf.fhir.utility.r4.PackageHelper.createEntry(library, isPut));
packageBundle.addEntry((org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.r4.PackageHelper.addRelatedArtifacts(
packageBundle, library.getRelatedArtifact(), repository, isPut);
Expand All @@ -98,7 +103,8 @@ protected IBaseBundle packageR4(org.hl7.fhir.r4.model.PlanDefinition planDefinit
protected IBaseBundle packageR5(org.hl7.fhir.r5.model.PlanDefinition planDefinition, boolean isPut) {
var packageBundle = new org.hl7.fhir.r5.model.Bundle();
packageBundle.setType(org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION);
packageBundle.addEntry(org.opencds.cqf.fhir.utility.r5.PackageHelper.createEntry(planDefinition, isPut));
packageBundle.addEntry((org.hl7.fhir.r5.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(planDefinition, isPut));
// The CPG IG specifies a main cql library for a PlanDefinition
var libraryCanonical =
planDefinition.hasLibrary() ? planDefinition.getLibrary().get(0) : null;
Expand All @@ -107,7 +113,8 @@ protected IBaseBundle packageR5(org.hl7.fhir.r5.model.PlanDefinition planDefinit
org.opencds.cqf.fhir.utility.r5.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
packageBundle.addEntry(org.opencds.cqf.fhir.utility.r5.PackageHelper.createEntry(library, isPut));
packageBundle.addEntry((org.hl7.fhir.r5.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.r5.PackageHelper.addRelatedArtifacts(
packageBundle, library.getRelatedArtifact(), repository, isPut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.fhir.api.Repository;
import org.opencds.cqf.fhir.cr.common.IPackageProcessor;
import org.opencds.cqf.fhir.utility.BundleHelper;
import org.opencds.cqf.fhir.utility.Constants;

public class PackageProcessor implements IPackageProcessor {
Expand Down Expand Up @@ -43,8 +44,10 @@ protected IBaseBundle packageQuestionnaire(IBaseResource questionnaire, boolean
protected IBaseBundle packageDstu3(IBaseResource questionnaire, Boolean isPut) {
var bundle = new org.hl7.fhir.dstu3.model.Bundle();
bundle.setType(org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION);
bundle.addEntry(org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(
(org.hl7.fhir.dstu3.model.Resource) questionnaire, isPut));
BundleHelper.addEntry(
bundle,
org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(
(org.hl7.fhir.dstu3.model.Resource) questionnaire, isPut));
var libraryExtension =
((org.hl7.fhir.dstu3.model.Questionnaire) questionnaire).getExtensionByUrl(Constants.CQF_LIBRARY);
if (libraryExtension != null) {
Expand All @@ -53,7 +56,8 @@ protected IBaseBundle packageDstu3(IBaseResource questionnaire, Boolean isPut) {
org.opencds.cqf.fhir.utility.dstu3.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
bundle.addEntry(org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(library, isPut));
BundleHelper.addEntry(
bundle, org.opencds.cqf.fhir.utility.dstu3.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.dstu3.PackageHelper.addRelatedArtifacts(
bundle, library.getRelatedArtifact(), repository, isPut);
Expand All @@ -66,8 +70,9 @@ protected IBaseBundle packageDstu3(IBaseResource questionnaire, Boolean isPut) {
protected IBaseBundle packageR4(IBaseResource questionnaire, Boolean isPut) {
var bundle = new org.hl7.fhir.r4.model.Bundle();
bundle.setType(org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION);
bundle.addEntry(org.opencds.cqf.fhir.utility.r4.PackageHelper.createEntry(
(org.hl7.fhir.r4.model.Resource) questionnaire, isPut));
bundle.addEntry((org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(
(org.hl7.fhir.r4.model.Resource) questionnaire, isPut));
var libraryExtension =
((org.hl7.fhir.r4.model.Questionnaire) questionnaire).getExtensionByUrl(Constants.CQF_LIBRARY);
if (libraryExtension != null) {
Expand All @@ -76,7 +81,8 @@ protected IBaseBundle packageR4(IBaseResource questionnaire, Boolean isPut) {
org.opencds.cqf.fhir.utility.r4.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
bundle.addEntry(org.opencds.cqf.fhir.utility.r4.PackageHelper.createEntry(library, isPut));
bundle.addEntry((org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.r4.PackageHelper.addRelatedArtifacts(
bundle, library.getRelatedArtifact(), repository, isPut);
Expand All @@ -89,8 +95,9 @@ protected IBaseBundle packageR4(IBaseResource questionnaire, Boolean isPut) {
protected IBaseBundle packageR5(IBaseResource questionnaire, Boolean isPut) {
var bundle = new org.hl7.fhir.r5.model.Bundle();
bundle.setType(org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION);
bundle.addEntry(org.opencds.cqf.fhir.utility.r5.PackageHelper.createEntry(
(org.hl7.fhir.r5.model.Resource) questionnaire, isPut));
bundle.addEntry((org.hl7.fhir.r5.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(
(org.hl7.fhir.r5.model.Resource) questionnaire, isPut));
var libraryExtension =
((org.hl7.fhir.r5.model.Questionnaire) questionnaire).getExtensionByUrl(Constants.CQF_LIBRARY);
if (libraryExtension != null) {
Expand All @@ -99,7 +106,8 @@ protected IBaseBundle packageR5(IBaseResource questionnaire, Boolean isPut) {
org.opencds.cqf.fhir.utility.r5.SearchHelper.searchRepositoryByCanonical(
repository, libraryCanonical);
if (library != null) {
bundle.addEntry(org.opencds.cqf.fhir.utility.r5.PackageHelper.createEntry(library, isPut));
bundle.addEntry((org.hl7.fhir.r5.model.Bundle.BundleEntryComponent)
org.opencds.cqf.fhir.utility.PackageHelper.createEntry(library, isPut));
if (library.hasRelatedArtifact()) {
org.opencds.cqf.fhir.utility.r5.PackageHelper.addRelatedArtifacts(
bundle, library.getRelatedArtifact(), repository, isPut);
Expand Down
14 changes: 9 additions & 5 deletions cqf-fhir-utility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<artifactId>cqf-fhir-api</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opencds.cqf.fhir</groupId>
<artifactId>cqf-fhir-test</artifactId>
<version>3.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
Expand Down Expand Up @@ -66,10 +72,8 @@
<artifactId>hapi-fhir-validation-resources-r5</artifactId>
</dependency>
<dependency>
<groupId>org.opencds.cqf.fhir</groupId>
<artifactId>cqf-fhir-test</artifactId>
<version>3.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit 0d344ed

Please sign in to comment.