diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts
index f91bfb8f4c..3244a97bd2 100644
--- a/benchmark/build.gradle.kts
+++ b/benchmark/build.gradle.kts
@@ -1,3 +1,6 @@
+import Dependencies.forceHapiVersion
+import Dependencies.removeIncompatibleDependencies
+
plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
@@ -67,15 +70,8 @@ android {
configurations {
all {
- exclude(module = "xpp3")
- exclude(module = "xpp3_min")
- exclude(module = "xmlpull")
- exclude(module = "javax.json")
- exclude(module = "jcl-over-slf4j")
- exclude(group = "org.apache.httpcomponents")
- // Remove this after this issue has been fixed:
- // https://github.com/cqframework/clinical_quality_language/issues/799
- exclude(module = "antlr4")
+ removeIncompatibleDependencies()
+ forceHapiVersion()
}
}
diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt
index bca802bd0c..62f812dc6f 100644
--- a/buildSrc/src/main/kotlin/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/Dependencies.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.gradle.api.artifacts.Configuration
+import org.gradle.kotlin.dsl.exclude
+
/*
* Copyright 2022 Google LLC
*
@@ -34,10 +53,6 @@ object Dependencies {
const val openCdsGroup = "org.opencds.cqf.cql"
const val translatorGroup = "info.cqframework"
- // Remove this after this issue has been fixed:
- // https://github.com/cqframework/clinical_quality_language/issues/799
- const val antlr4Runtime = "org.antlr:antlr4-runtime:${Versions.Cql.antlr}"
-
const val engine = "$openCdsGroup:engine:${Versions.Cql.engine}"
const val engineJackson = "$openCdsGroup:engine.jackson:${Versions.Cql.engine}"
@@ -54,8 +69,32 @@ object Dependencies {
}
object HapiFhir {
+ const val fhirBase = "ca.uhn.hapi.fhir:hapi-fhir-base:${Versions.hapiFhir}"
+ const val fhirClient = "ca.uhn.hapi.fhir:hapi-fhir-client:${Versions.hapiFhir}"
+ const val structuresDstu2 = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:${Versions.hapiFhir}"
+ const val structuresDstu3 = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3:${Versions.hapiFhir}"
const val structuresR4 = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4:${Versions.hapiFhir}"
+ const val structuresR4b = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4b:${Versions.hapiFhir}"
+ const val structuresR5 = "ca.uhn.hapi.fhir:hapi-fhir-structures-r5:${Versions.hapiFhir}"
+
const val validation = "ca.uhn.hapi.fhir:hapi-fhir-validation:${Versions.hapiFhir}"
+ const val validationDstu3 =
+ "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3:${Versions.hapiFhir}"
+ const val validationR4 =
+ "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:${Versions.hapiFhir}"
+ const val validationR5 =
+ "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r5:${Versions.hapiFhir}"
+
+ const val fhirCoreDstu2 = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2:${Versions.hapiFhirCore}"
+ const val fhirCoreDstu2016 =
+ "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may:${Versions.hapiFhirCore}"
+ const val fhirCoreDstu3 = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu3:${Versions.hapiFhirCore}"
+ const val fhirCoreR4 = "ca.uhn.hapi.fhir:org.hl7.fhir.r4:${Versions.hapiFhirCore}"
+ const val fhirCoreR4b = "ca.uhn.hapi.fhir:org.hl7.fhir.r4b:${Versions.hapiFhirCore}"
+ const val fhirCoreR5 = "ca.uhn.hapi.fhir:org.hl7.fhir.r5:${Versions.hapiFhirCore}"
+ const val fhirCoreUtils = "ca.uhn.hapi.fhir:org.hl7.fhir.utilities:${Versions.hapiFhirCore}"
+ const val fhirCoreConvertors =
+ "ca.uhn.hapi.fhir:org.hl7.fhir.convertors:${Versions.hapiFhirCore}"
// Runtime dependency that is required to run FhirPath (also requires minSDK of 26).
// Version 3.0 uses java.lang.System.Logger, which is not available on Android
@@ -64,9 +103,19 @@ object Dependencies {
}
object Jackson {
- const val annotations = "com.fasterxml.jackson.core:jackson-annotations:${Versions.jackson}"
- const val core = "com.fasterxml.jackson.core:jackson-core:${Versions.jackson}"
- const val databind = "com.fasterxml.jackson.core:jackson-databind:${Versions.jackson}"
+ const val mainGroup = "com.fasterxml.jackson"
+ const val coreGroup = "$mainGroup.core"
+ const val dataformatGroup = "$mainGroup.dataformat"
+ const val datatypeGroup = "$mainGroup.datatype"
+ const val moduleGroup = "$mainGroup.module"
+
+ const val annotations = "$coreGroup:jackson-annotations:${Versions.jackson}"
+ const val bom = "$mainGroup:jackson-bom:${Versions.jackson}"
+ const val core = "$coreGroup:jackson-core:${Versions.jackson}"
+ const val databind = "$coreGroup:jackson-databind:${Versions.jackson}"
+ const val dataformatXml = "$dataformatGroup:jackson-dataformat-xml:${Versions.jackson}"
+ const val jaxbAnnotations = "$moduleGroup:jackson-module-jaxb-annotations:${Versions.jackson}"
+ const val jsr310 = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}"
}
object Kotlin {
@@ -188,9 +237,9 @@ object Dependencies {
object Cql {
const val antlr = "4.10.1"
- const val engine = "2.1.0"
- const val evaluator = "2.1.0"
- const val translator = "2.2.0"
+ const val engine = "2.4.0"
+ const val evaluator = "2.4.0"
+ const val translator = "2.4.0"
}
object Kotlin {
@@ -204,9 +253,17 @@ object Dependencies {
const val caffeine = "2.9.1"
const val fhirUcum = "1.0.3"
const val guava = "28.2-android"
+
+ // Hapi FHIR and HL7 Core Components are interlinked.
+ // Newer versions of HapiFhir don't work on Android due to the use of Caffeine 3+
+ // Wait for this to release (6.3): https://github.com/hapifhir/hapi-fhir/pull/4196
const val hapiFhir = "6.0.1"
+ // Newer versions don't work on Android due to Apache Commons Codec:
+ // Wait for this fix: https://github.com/hapifhir/org.hl7.fhir.core/issues/1046
+ const val hapiFhirCore = "5.6.36"
+
const val http = "4.9.1"
- const val jackson = "2.12.2"
+ const val jackson = "2.14.1"
const val jsonToolsPatch = "1.13"
const val jsonAssert = "1.5.1"
const val kotlinPoet = "1.9.0"
@@ -245,4 +302,45 @@ object Dependencies {
const val objectDetectionCustom = "16.3.1"
}
}
+
+ fun Configuration.removeIncompatibleDependencies() {
+ exclude(module = "xpp3")
+ exclude(module = "xpp3_min")
+ exclude(module = "xmlpull")
+ exclude(module = "javax.json")
+ exclude(module = "jcl-over-slf4j")
+ exclude(group = "org.apache.httpcomponents")
+ }
+
+ fun Configuration.forceHapiVersion() {
+ // Removes newer versions of caffeine and manually imports 2.9
+ // Removes newer versions of hapi and keeps on 6.0.1
+ // Removes newer versions of HL7 core and keeps it on 5.6.36
+ // (newer versions don't work on Android)
+ resolutionStrategy {
+ force(HapiFhir.caffeine)
+
+ force(HapiFhir.fhirBase)
+ force(HapiFhir.fhirClient)
+ force(HapiFhir.fhirCoreConvertors)
+
+ force(HapiFhir.fhirCoreDstu2)
+ force(HapiFhir.fhirCoreDstu2016)
+ force(HapiFhir.fhirCoreDstu3)
+ force(HapiFhir.fhirCoreR4)
+ force(HapiFhir.fhirCoreR4b)
+ force(HapiFhir.fhirCoreR5)
+ force(HapiFhir.fhirCoreUtils)
+
+ force(HapiFhir.structuresDstu2)
+ force(HapiFhir.structuresDstu3)
+ force(HapiFhir.structuresR4)
+ force(HapiFhir.structuresR5)
+
+ force(HapiFhir.validation)
+ force(HapiFhir.validationDstu3)
+ force(HapiFhir.validationR4)
+ force(HapiFhir.validationR5)
+ }
+ }
}
diff --git a/buildSrc/src/main/kotlin/LicenseeConfig.kt b/buildSrc/src/main/kotlin/LicenseeConfig.kt
index f0a0861004..c58957f235 100644
--- a/buildSrc/src/main/kotlin/LicenseeConfig.kt
+++ b/buildSrc/src/main/kotlin/LicenseeConfig.kt
@@ -100,10 +100,6 @@ fun Project.configureLicensee() {
allowDependency("org.antlr", "antlr4-runtime", "4.10.1") {
because("BSD 3-clause. http://www.antlr.org/license.html")
}
- // ANTLR 4
- allowDependency("org.antlr", "antlr4", "4.10.1") {
- because("BSD 3-clause. http://www.antlr.org/license.html")
- }
// Utilities
// https://developers.google.com/android/reference/com/google/android/gms/common/package-summary
diff --git a/workflow-testing/build.gradle.kts b/workflow-testing/build.gradle.kts
index 11041b5a9f..2b58bb375b 100644
--- a/workflow-testing/build.gradle.kts
+++ b/workflow-testing/build.gradle.kts
@@ -1,3 +1,6 @@
+import Dependencies.forceHapiVersion
+import Dependencies.removeIncompatibleDependencies
+
plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
@@ -18,6 +21,13 @@ android {
kotlinOptions { jvmTarget = Java.kotlinJvmTarget.toString() }
}
+configurations {
+ all {
+ removeIncompatibleDependencies()
+ forceHapiVersion()
+ }
+}
+
dependencies {
compileOnly(Dependencies.Cql.engine)
compileOnly(Dependencies.Cql.evaluator)
@@ -28,6 +38,16 @@ dependencies {
compileOnly(Dependencies.Cql.translatorElm)
compileOnly(Dependencies.Cql.translatorModel)
+ // Forces the most recent version of jackson, ignoring what dependencies use.
+ // Remove these lines when HAPI 6.4 becomes available.
+ compileOnly(Dependencies.Jackson.annotations)
+ compileOnly(Dependencies.Jackson.bom)
+ compileOnly(Dependencies.Jackson.core)
+ compileOnly(Dependencies.Jackson.databind)
+ compileOnly(Dependencies.Jackson.dataformatXml)
+ compileOnly(Dependencies.Jackson.jaxbAnnotations)
+ compileOnly(Dependencies.Jackson.jsr310)
+
compileOnly(Dependencies.junit)
compileOnly(Dependencies.jsonAssert)
compileOnly(Dependencies.woodstox)
diff --git a/workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt b/workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt
index b7c521076a..32355391cc 100644
--- a/workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt
+++ b/workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt
@@ -21,7 +21,6 @@ import ca.uhn.fhir.context.FhirVersionEnum
import org.hl7.fhir.instance.model.api.IBaseBundle
import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.model.Bundle
-import org.hl7.fhir.r4.model.CarePlan
import org.hl7.fhir.r4.model.Coding
import org.hl7.fhir.r4.model.Endpoint
import org.hl7.fhir.r4.model.IdType
@@ -49,7 +48,7 @@ import org.opencds.cqf.cql.evaluator.fhir.adapter.r4.AdapterFactory
import org.opencds.cqf.cql.evaluator.fhir.dal.FhirDal
import org.opencds.cqf.cql.evaluator.library.CqlFhirParametersConverter
import org.opencds.cqf.cql.evaluator.library.LibraryProcessor
-import org.opencds.cqf.cql.evaluator.plandefinition.r4.OperationParametersParser
+import org.opencds.cqf.cql.evaluator.plandefinition.OperationParametersParser
import org.opencds.cqf.cql.evaluator.plandefinition.r4.PlanDefinitionProcessor
import org.skyscreamer.jsonassert.JSONAssert
@@ -218,7 +217,7 @@ object PlanDefinition : Loadable() {
}
}
- class GeneratedCarePlan(val carePlan: CarePlan) {
+ class GeneratedCarePlan(val carePlan: IBaseResource) {
fun isEqualsTo(expectedCarePlanAssetName: String) {
try {
JSONAssert.assertEquals(
@@ -229,6 +228,9 @@ object PlanDefinition : Loadable() {
} catch (e: JSONException) {
e.printStackTrace()
fail("Unable to compare Jsons: " + e.message)
+ } catch (e: AssertionError) {
+ println("Actual: " + jsonParser.encodeResourceToString(carePlan))
+ throw e
}
}
}
diff --git a/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_careplan.json b/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_careplan.json
index 69235ed8f4..aac0090b55 100644
--- a/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_careplan.json
+++ b/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_careplan.json
@@ -1,66 +1,90 @@
{
"resourceType": "CarePlan",
- "contained": [ {
- "resourceType": "RequestGroup",
- "id": "1",
- "status": "draft",
- "intent": "proposal",
- "action": [ {
- "title": "Child Monthly Routine Visit",
- "description": "This action will performed every month for a patient < 5 years old. The start date with be next month after registration while the end date will be the 60th week after birth.",
- "timingTiming": {
- "repeat": {
- "countMax": 59,
- "duration": 2,
- "durationMax": 4,
- "durationUnit": "h",
- "frequency": 1,
- "frequencyMax": 1,
- "period": 1,
- "periodMax": 1,
- "periodUnit": "mo"
+ "contained": [
+ {
+ "resourceType": "RequestGroup",
+ "id": "ChildRoutineVisit-PlanDefinition-1.0.0",
+ "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/ChildRoutineVisit-PlanDefinition-1.0.0" ],
+ "status": "draft",
+ "intent": "proposal",
+ "subject": {
+ "reference": "Patient/ChildRoutine-Reportable"
+ },
+ "action": [
+ {
+ "title": "Child Monthly Routine Visit",
+ "description": "This action will performed every month for a patient < 5 years old. The start date with be next month after registration while the end date will be the 60th week after birth.",
+ "timingTiming": {
+ "repeat": {
+ "countMax": 59,
+ "duration": 2,
+ "durationMax": 4,
+ "durationUnit": "h",
+ "frequency": 1,
+ "frequencyMax": 1,
+ "period": 1,
+ "periodMax": 1,
+ "periodUnit": "mo"
+ }
+ },
+ "resource": {
+ "reference": "https://fhir.labs.smartregister.org/fhir/Questionnaire/105056"
+ }
+ }
+ ]
+ },
+ {
+ "resourceType": "Goal",
+ "id": "1",
+ "category": [
+ {
+ "coding": [
+ {
+ "system": "https://www.hl7.org/fhir/codesystem-goal-category.html",
+ "code": "nursing",
+ "display": "Nursing"
+ }
+ ]
}
+ ],
+ "priority": {
+ "coding": [
+ {
+ "system": "https://www.hl7.org/fhir/codesystem-goal-priority.html",
+ "code": "high-priority",
+ "display": "High Priority"
+ }
+ ]
},
- "resource": {
- "reference": "https://fhir.labs.smartregister.org/fhir/Questionnaire/105056"
+ "startCodeableConcept": {
+ "coding": [
+ {
+ "system": "http://www.snomed.org/",
+ "code": "32485007",
+ "display": "Admission to hospital"
+ }
+ ]
}
- } ]
- }, {
- "resourceType": "Goal",
- "id": "2",
- "category": [ {
- "coding": [ {
- "system": "https://www.hl7.org/fhir/codesystem-goal-category.html",
- "code": "nursing",
- "display": "Nursing"
- } ]
- } ],
- "priority": {
- "coding": [ {
- "system": "https://www.hl7.org/fhir/codesystem-goal-priority.html",
- "code": "high-priority",
- "display": "High Priority"
- } ]
- },
- "startCodeableConcept": {
- "coding": [ {
- "system": "http://www.snomed.org/",
- "code": "32485007",
- "display": "Admission to hospital"
- } ]
}
- } ],
- "instantiatesCanonical": [ "ChildRoutineVisit-PlanDefinition-1.0.0" ],
+ ],
+ "instantiatesCanonical": [
+ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/ChildRoutineVisit-PlanDefinition-1.0.0"
+ ],
"status": "draft",
+ "intent": "proposal",
"subject": {
"reference": "Patient/ChildRoutine-Reportable"
},
- "goal": [ {
- "reference": "#2"
- } ],
- "activity": [ {
- "reference": {
+ "goal": [
+ {
"reference": "#1"
}
- } ]
+ ],
+ "activity": [
+ {
+ "reference": {
+ "reference": "#ChildRoutineVisit-PlanDefinition-1.0.0"
+ }
+ }
+ ]
}
\ No newline at end of file
diff --git a/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_plan_definition.json b/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_plan_definition.json
index 39f12c53a9..f83bb1e92f 100644
--- a/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_plan_definition.json
+++ b/workflow-testing/src/main/resources/plan-definition/child-routine-visit/child_routine_visit_plan_definition.json
@@ -7,6 +7,7 @@
"resource": {
"resourceType": "PlanDefinition",
"id": "ChildRoutineVisit-PlanDefinition-1.0.0",
+ "url": "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/ChildRoutineVisit-PlanDefinition-1.0.0",
"name": "Child Routine visit PlanDefinition",
"title": "Child Routine visit PlanDefinition",
"status": "active",
diff --git a/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-careplan.json b/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-careplan.json
index ce1fd01ac2..64dca49fbb 100644
--- a/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-careplan.json
+++ b/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-careplan.json
@@ -3,15 +3,31 @@
"contained": [
{
"resourceType": "RequestGroup",
- "id": "1",
+ "id": "hello-world-patient-view",
+ "instantiatesCanonical": [
+ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/hello-world-patient-view"
+ ],
"status": "draft",
- "intent": "proposal"
+ "intent": "proposal",
+ "subject": {
+ "reference": "helloworld-patient-1"
+ },
+ "encounter": {
+ "reference": "helloworld-patient-1-encounter-1"
+ },
+ "action": [
+ {
+ "title": "Hello World!",
+ "description": "The CDS Service is alive and communicating successfully!"
+ }
+ ]
}
],
"instantiatesCanonical": [
- "hello-world-patient-view"
+ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/hello-world-patient-view"
],
"status": "draft",
+ "intent": "proposal",
"subject": {
"reference": "helloworld-patient-1"
},
@@ -21,7 +37,7 @@
"activity": [
{
"reference": {
- "reference": "#1"
+ "reference": "#hello-world-patient-view"
}
}
]
diff --git a/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-patient-view-bundle.json b/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-patient-view-bundle.json
index 32679b690f..fa4c0bf862 100644
--- a/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-patient-view-bundle.json
+++ b/workflow-testing/src/main/resources/plan-definition/hello-world/hello-world-patient-view-bundle.json
@@ -47,7 +47,7 @@
} ],
"purpose": "The purpose of this is to test the system to make sure we have complete end-to-end functionality",
"usage": "This is to be used in conjunction with a patient-facing FHIR application.",
- "copyright": "© CDC 2016+.",
+ "copyright": "息 CDC 2016+.",
"library": [ "http://fhir.org/guides/cdc/opioid-cds/Library/HelloWorld" ],
"action": [ {
"title": "Hello World!",
diff --git a/workflow-testing/src/main/resources/plan-definition/med-request/med_request_careplan.json b/workflow-testing/src/main/resources/plan-definition/med-request/med_request_careplan.json
index 0d08995d54..9dd3a72582 100644
--- a/workflow-testing/src/main/resources/plan-definition/med-request/med_request_careplan.json
+++ b/workflow-testing/src/main/resources/plan-definition/med-request/med_request_careplan.json
@@ -1,43 +1,37 @@
{
"resourceType": "CarePlan",
- "contained": [
- {
- "resourceType": "RequestGroup",
- "id": "1",
- "status": "draft",
- "intent": "proposal",
- "action": [
- {
- "resource": {
- "reference": "#2"
- }
- }
- ]
+ "contained": [ {
+ "resourceType": "RequestGroup",
+ "id": "MedRequest-Example",
+ "status": "draft",
+ "intent": "proposal",
+ "subject": {
+ "reference": "Patient/Patient-Example"
},
- {
- "resourceType": "MedicationRequest",
- "id": "2",
- "intent": "order",
- "medicationCodeableConcept": {
- "text": "Medication 1"
- },
- "subject": {
- "reference": "Patient/Patient-Example"
+ "action": [ {
+ "resource": {
+ "reference": "MedicationRequest/MedicationRequest-1"
}
+ } ]
+ }, {
+ "resourceType": "MedicationRequest",
+ "id": "MedicationRequest-1",
+ "intent": "order",
+ "medicationCodeableConcept": {
+ "text": "Medication 1"
+ },
+ "subject": {
+ "reference": "Patient/Patient-Example"
}
- ],
- "instantiatesCanonical": [
- "MedRequest-Example"
- ],
+ } ],
"status": "draft",
+ "intent": "proposal",
"subject": {
"reference": "Patient/Patient-Example"
},
- "activity": [
- {
- "reference": {
- "reference": "#1"
- }
+ "activity": [ {
+ "reference": {
+ "reference": "#MedRequest-Example"
}
- ]
+ } ]
}
\ No newline at end of file
diff --git a/workflow-testing/src/main/resources/plan-definition/opioid-Rec10-patient-view/opioid-Rec10-patient-view-careplan.json b/workflow-testing/src/main/resources/plan-definition/opioid-Rec10-patient-view/opioid-Rec10-patient-view-careplan.json
index 87e1e49df6..fdbf59938b 100644
--- a/workflow-testing/src/main/resources/plan-definition/opioid-Rec10-patient-view/opioid-Rec10-patient-view-careplan.json
+++ b/workflow-testing/src/main/resources/plan-definition/opioid-Rec10-patient-view/opioid-Rec10-patient-view-careplan.json
@@ -1,42 +1,65 @@
{
"resourceType": "CarePlan",
- "contained": [ {
- "resourceType": "RequestGroup",
- "id": "1",
- "status": "draft",
- "intent": "proposal",
- "action": [ {
- "resource": {
- "reference": "#2"
- }
- } ]
- }, {
- "resourceType": "ServiceRequest",
- "id": "2",
- "status": "draft",
- "intent": "order",
- "code": {
- "coding": [ {
- "system": "http://snomed.info/sct",
- "code": "310627008",
- "display": "Urine drug screening (procedure)"
- } ]
+ "contained": [
+ {
+ "resourceType": "RequestGroup",
+ "id": "opioidcds-10-patient-view",
+ "instantiatesCanonical": [
+ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/opioidcds-10-patient-view"
+ ],
+ "status": "draft",
+ "intent": "proposal",
+ "subject": {
+ "reference": "example-rec-10-patient-view-POS-Cocaine-drugs"
+ },
+ "encounter": {
+ "reference": "example-rec-10-patient-view-POS-Cocaine-drugs-prefetch"
+ },
+ "action": [
+ {
+ "title": "Positive Cocaine or PCP in Urine Screening",
+ "description": "
*Positive for Cocaine:
2022-06-02, 2022-02-23
Note: result may be false positive result or indicate patient is occasional user or addicted to the illicit drug.",
+ "resource": {
+ "reference": "ServiceRequest/opioidcds-urine-screening-request"
+ }
+ }
+ ]
},
- "subject": {
- "reference": "example-rec-10-patient-view-POS-Cocaine-drugs"
+ {
+ "resourceType": "ServiceRequest",
+ "id": "opioidcds-urine-screening-request",
+ "status": "draft",
+ "intent": "order",
+ "code": {
+ "coding": [
+ {
+ "system": "http://snomed.info/sct",
+ "code": "310627008",
+ "display": "Urine drug screening (procedure)"
+ }
+ ]
+ },
+ "subject": {
+ "reference": "example-rec-10-patient-view-POS-Cocaine-drugs"
+ }
}
- } ],
- "instantiatesCanonical": [ "opioidcds-10-patient-view" ],
+ ],
+ "instantiatesCanonical": [
+ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/opioidcds-10-patient-view"
+ ],
"status": "draft",
+ "intent": "proposal",
"subject": {
"reference": "example-rec-10-patient-view-POS-Cocaine-drugs"
},
"encounter": {
"reference": "example-rec-10-patient-view-POS-Cocaine-drugs-prefetch"
},
- "activity": [ {
- "reference": {
- "reference": "#1"
+ "activity": [
+ {
+ "reference": {
+ "reference": "#opioidcds-10-patient-view"
+ }
}
- } ]
+ ]
}
\ No newline at end of file
diff --git a/workflow-testing/src/main/resources/plan-definition/rule-filters/NotReportableCarePlan.json b/workflow-testing/src/main/resources/plan-definition/rule-filters/NotReportableCarePlan.json
index 761a62c945..742c3c02ac 100644
--- a/workflow-testing/src/main/resources/plan-definition/rule-filters/NotReportableCarePlan.json
+++ b/workflow-testing/src/main/resources/plan-definition/rule-filters/NotReportableCarePlan.json
@@ -1,432 +1,572 @@
{
- "resourceType": "CarePlan",
- "contained": [ {
+ "resourceType": "CarePlan",
+ "contained": [
+ {
"resourceType": "RequestGroup",
- "id": "1",
+ "id": "plandefinition-RuleFilters-1.0.0",
+ "instantiatesCanonical": [
+ "http://hl7.org/fhir/us/ecr/PlanDefinition/plandefinition-RuleFilters-1.0.0"
+ ],
"status": "draft",
"intent": "proposal",
- "action": [ {
- "resource": {
- "reference": "#start"
- }
- }, {
- "resource": {
- "reference": "#ckr-is-encounter-reportable"
- }
- }, {
- "resource": {
- "reference": "#ckr-is-encounter-in-progress"
- }
- }, {
- "resource": {
- "reference": "#check-reportable"
- }
- }, {
- "resource": {
- "reference": "#car-report-eicr"
- }
- }, {
- "resource": {
- "reference": "#car-is-encounter-complete"
- }
- }, {
- "resource": {
- "reference": "#car-is-encounter-in-progress"
- }
- }, {
- "resource": {
- "reference": "#create-and-report-eicr"
- }
- }, {
- "resource": {
- "reference": "#create-eicr"
- }
- }, {
- "resource": {
- "reference": "#validate-eicr"
- }
- }, {
- "resource": {
- "reference": "#route-and-send-eicr"
+ "subject": {
+ "reference": "NotReportable"
+ },
+ "action": [
+ {
+ "resource": {
+ "reference": "Task/start"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/ckr-is-encounter-reportable"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/ckr-is-encounter-in-progress"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/check-reportable"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-report-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-is-encounter-complete"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-is-encounter-in-progress"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/create-and-report-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/create-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/validate-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/route-and-send-eicr"
+ }
}
- } ]
- }, {
+ ]
+ },
+ {
"resourceType": "Task",
"id": "start",
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/targetStatus",
- "valueString": "ready"
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 1,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#check-reportable"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/targetStatus",
+ "valueString": "ready"
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 1,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/check-reportable"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "ready",
"description": "This action represents the start of the reporting workflow in response to the encounter-start event"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "ckr-is-encounter-reportable",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#create-and-report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Reportable",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/create-and-report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists()"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "conditions",
- "type": "Condition",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "encounters",
- "type": "Encounter",
- "codeFilter": [ {
- "path": "reasonCode",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "immunizations",
- "type": "Immunization",
- "codeFilter": [ {
- "path": "vaccineCode",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labOrders",
- "type": "ServiceRequest",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labTests",
- "type": "Observation",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "procedureOrders",
- "type": "ServiceRequest",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "procedures",
- "type": "Procedure",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationOrders",
- "type": "MedicationRequest",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationDispenses",
- "type": "MedicationDispense",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationAdministrations",
- "type": "MedicationAdministration",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Reportable",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists()"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "conditions",
+ "type": "Condition",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "encounters",
+ "type": "Encounter",
+ "codeFilter": [
+ {
+ "path": "reasonCode",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "immunizations",
+ "type": "Immunization",
+ "codeFilter": [
+ {
+ "path": "vaccineCode",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labOrders",
+ "type": "ServiceRequest",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labTests",
+ "type": "Observation",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "procedureOrders",
+ "type": "ServiceRequest",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "procedures",
+ "type": "Procedure",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationOrders",
+ "type": "MedicationRequest",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationDispenses",
+ "type": "MedicationDispense",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationAdministrations",
+ "type": "MedicationAdministration",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labResults",
+ "type": "Observation",
+ "codeFilter": [
+ {
+ "path": "value",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-ostc-example"
+ }
+ ]
+ }
}
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labResults",
- "type": "Observation",
- "codeFilter": [ {
- "path": "value",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-ostc-example"
- } ]
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
"status": "draft",
"description": "Check Encounter Reportable"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "ckr-is-encounter-in-progress",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 6,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#check-reportable"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter In Progress",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 6,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/check-reportable"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'in-progress'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter In Progress",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'in-progress'"
+ }
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Check Reportable Is Encounter in progress"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "check-reportable",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the check for suspected reportability of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-report-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#report-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/report-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Report Eicr"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-is-encounter-complete",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 24,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter Complete",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 24,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'finished'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter Complete",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'finished'"
+ }
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
"status": "draft",
"description": "Check If Encounter Complete"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-is-encounter-in-progress",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 24,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#create-and-report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter In Progress",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 24,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/create-and-report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'in-progress'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter In Progress",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'in-progress'"
+ }
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Check If Encounter In Progress"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "create-and-report-eicr",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the creation and reporting of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "create-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#validate-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/validate-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the creation of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "validate-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#route-and-send-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/route-and-send-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the validation of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "route-and-send-eicr",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the routing and sending of the eICR."
- } ],
- "instantiatesCanonical": [ "plandefinition-RuleFilters-1.0.0" ],
- "status": "draft",
- "subject": {
- "reference": "NotReportable"
- },
- "activity": [ {
+ }
+ ],
+ "instantiatesCanonical": [
+ "http://hl7.org/fhir/us/ecr/PlanDefinition/plandefinition-RuleFilters-1.0.0"
+ ],
+ "status": "draft",
+ "intent": "proposal",
+ "subject": {
+ "reference": "NotReportable"
+ },
+ "activity": [
+ {
"reference": {
- "reference": "#1"
+ "reference": "#plandefinition-RuleFilters-1.0.0"
}
- } ]
- }
\ No newline at end of file
+ }
+ ]
+}
\ No newline at end of file
diff --git a/workflow-testing/src/main/resources/plan-definition/rule-filters/ReportableCarePlan.json b/workflow-testing/src/main/resources/plan-definition/rule-filters/ReportableCarePlan.json
index c735dc83e1..e8cc80bfa7 100644
--- a/workflow-testing/src/main/resources/plan-definition/rule-filters/ReportableCarePlan.json
+++ b/workflow-testing/src/main/resources/plan-definition/rule-filters/ReportableCarePlan.json
@@ -1,432 +1,572 @@
{
- "resourceType": "CarePlan",
- "contained": [ {
+ "resourceType": "CarePlan",
+ "contained": [
+ {
"resourceType": "RequestGroup",
- "id": "1",
+ "id": "plandefinition-RuleFilters-1.0.0",
+ "instantiatesCanonical": [
+ "http://hl7.org/fhir/us/ecr/PlanDefinition/plandefinition-RuleFilters-1.0.0"
+ ],
"status": "draft",
"intent": "proposal",
- "action": [ {
- "resource": {
- "reference": "#start"
- }
- }, {
- "resource": {
- "reference": "#ckr-is-encounter-reportable"
- }
- }, {
- "resource": {
- "reference": "#ckr-is-encounter-in-progress"
- }
- }, {
- "resource": {
- "reference": "#check-reportable"
- }
- }, {
- "resource": {
- "reference": "#car-report-eicr"
- }
- }, {
- "resource": {
- "reference": "#car-is-encounter-complete"
- }
- }, {
- "resource": {
- "reference": "#car-is-encounter-in-progress"
- }
- }, {
- "resource": {
- "reference": "#create-and-report-eicr"
- }
- }, {
- "resource": {
- "reference": "#create-eicr"
- }
- }, {
- "resource": {
- "reference": "#validate-eicr"
- }
- }, {
- "resource": {
- "reference": "#route-and-send-eicr"
+ "subject": {
+ "reference": "Reportable"
+ },
+ "action": [
+ {
+ "resource": {
+ "reference": "Task/start"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/ckr-is-encounter-reportable"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/ckr-is-encounter-in-progress"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/check-reportable"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-report-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-is-encounter-complete"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/car-is-encounter-in-progress"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/create-and-report-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/create-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/validate-eicr"
+ }
+ },
+ {
+ "resource": {
+ "reference": "Task/route-and-send-eicr"
+ }
}
- } ]
- }, {
+ ]
+ },
+ {
"resourceType": "Task",
"id": "start",
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/targetStatus",
- "valueString": "ready"
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 1,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#check-reportable"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/targetStatus",
+ "valueString": "ready"
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 1,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/check-reportable"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "ready",
"description": "This action represents the start of the reporting workflow in response to the encounter-start event"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "ckr-is-encounter-reportable",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#create-and-report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Reportable",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/create-and-report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists()"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "conditions",
- "type": "Condition",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "encounters",
- "type": "Encounter",
- "codeFilter": [ {
- "path": "reasonCode",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "immunizations",
- "type": "Immunization",
- "codeFilter": [ {
- "path": "vaccineCode",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labOrders",
- "type": "ServiceRequest",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labTests",
- "type": "Observation",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "procedureOrders",
- "type": "ServiceRequest",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "procedures",
- "type": "Procedure",
- "codeFilter": [ {
- "path": "code",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationOrders",
- "type": "MedicationRequest",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationDispenses",
- "type": "MedicationDispense",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "medicationAdministrations",
- "type": "MedicationAdministration",
- "codeFilter": [ {
- "path": "medication",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
- } ]
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Reportable",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists()"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "conditions",
+ "type": "Condition",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "encounters",
+ "type": "Encounter",
+ "codeFilter": [
+ {
+ "path": "reasonCode",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-dxtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "immunizations",
+ "type": "Immunization",
+ "codeFilter": [
+ {
+ "path": "vaccineCode",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labOrders",
+ "type": "ServiceRequest",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labTests",
+ "type": "Observation",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-lotc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "procedureOrders",
+ "type": "ServiceRequest",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "procedures",
+ "type": "Procedure",
+ "codeFilter": [
+ {
+ "path": "code",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-pctc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationOrders",
+ "type": "MedicationRequest",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationDispenses",
+ "type": "MedicationDispense",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "medicationAdministrations",
+ "type": "MedicationAdministration",
+ "codeFilter": [
+ {
+ "path": "medication",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-mrtc-example"
+ }
+ ]
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
+ "valueDataRequirement": {
+ "id": "labResults",
+ "type": "Observation",
+ "codeFilter": [
+ {
+ "path": "value",
+ "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-ostc-example"
+ }
+ ]
+ }
}
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/input",
- "valueDataRequirement": {
- "id": "labResults",
- "type": "Observation",
- "codeFilter": [ {
- "path": "value",
- "valueSet": "http://hl7.org/fhir/us/ecr/ValueSet/valueset-ostc-example"
- } ]
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
"status": "draft",
"description": "Check Encounter Reportable"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "ckr-is-encounter-in-progress",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 6,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#check-reportable"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter In Progress",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 6,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/check-reportable"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'in-progress'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter In Progress",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'in-progress'"
+ }
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Check Reportable Is Encounter in progress"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "check-reportable",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the check for suspected reportability of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-report-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#report-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/report-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Report Eicr"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-is-encounter-complete",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 24,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter Complete",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 24,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'finished'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter Complete",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'finished'"
+ }
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
"status": "draft",
"description": "Check If Encounter Complete"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "car-is-encounter-in-progress",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
- "valueDuration": {
- "value": 24,
- "system": "http://unitsofmeasure.org",
- "code": "h"
- }
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#create-and-report-eicr"
- }
- } ]
- }, {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
- "valueExpression": {
- "extension": [ {
- "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
- "valueExpression": {
- "language": "text/cql-identifier",
- "expression": "Is Encounter In Progress",
- "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/offset",
+ "valueDuration": {
+ "value": 24,
+ "system": "http://unitsofmeasure.org",
+ "code": "h"
+ }
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/create-and-report-eicr"
+ }
}
- } ],
- "language": "text/fhirpath",
- "expression": "%encounter.status = 'in-progress'"
+ ]
+ },
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/condition",
+ "valueExpression": {
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/us/ecr/StructureDefinition/us-ph-alternativeExpression",
+ "valueExpression": {
+ "language": "text/cql-identifier",
+ "expression": "Is Encounter In Progress",
+ "reference": "http://aphl.org/fhir/ecr/Library/RuleFilters|1.0.0"
+ }
+ }
+ ],
+ "language": "text/fhirpath",
+ "expression": "%encounter.status = 'in-progress'"
+ }
}
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "Check If Encounter In Progress"
- }, {
+ },
+ {
"resourceType": "Task",
"id": "create-and-report-eicr",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the creation and reporting of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "create-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#validate-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/validate-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the creation of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "validate-eicr",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
- "extension": [ {
- "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
- "valueReference": {
- "reference": "#route-and-send-eicr"
- }
- } ]
- } ],
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/next",
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/aphl/StructureDefinition/target",
+ "valueReference": {
+ "reference": "Task/route-and-send-eicr"
+ }
+ }
+ ]
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the validation of the eICR."
- }, {
+ },
+ {
"resourceType": "Task",
"id": "route-and-send-eicr",
- "basedOn": [ {
- "reference": "#1",
- "type": "RequestGroup"
- } ],
+ "basedOn": [
+ {
+ "reference": "#RequestGroup/plandefinition-RuleFilters-1.0.0",
+ "type": "RequestGroup"
+ }
+ ],
"status": "draft",
"description": "This action represents the routing and sending of the eICR."
- } ],
- "instantiatesCanonical": [ "plandefinition-RuleFilters-1.0.0" ],
- "status": "draft",
- "subject": {
- "reference": "Reportable"
- },
- "activity": [ {
+ }
+ ],
+ "instantiatesCanonical": [
+ "http://hl7.org/fhir/us/ecr/PlanDefinition/plandefinition-RuleFilters-1.0.0"
+ ],
+ "status": "draft",
+ "intent": "proposal",
+ "subject": {
+ "reference": "Reportable"
+ },
+ "activity": [
+ {
"reference": {
- "reference": "#1"
+ "reference": "#plandefinition-RuleFilters-1.0.0"
}
- } ]
- }
\ No newline at end of file
+ }
+ ]
+}
\ No newline at end of file
diff --git a/workflow/build.gradle.kts b/workflow/build.gradle.kts
index 41d637f53b..e13f0078e2 100644
--- a/workflow/build.gradle.kts
+++ b/workflow/build.gradle.kts
@@ -1,3 +1,5 @@
+import Dependencies.forceHapiVersion
+import Dependencies.removeIncompatibleDependencies
import java.net.URL
plugins {
@@ -73,15 +75,8 @@ android {
configurations {
all {
- exclude(module = "xpp3")
- exclude(module = "xpp3_min")
- exclude(module = "xmlpull")
- exclude(module = "javax.json")
- exclude(module = "jcl-over-slf4j")
- exclude(group = "org.apache.httpcomponents")
- // Remove this after this issue has been fixed:
- // https://github.com/cqframework/clinical_quality_language/issues/799
- exclude(module = "antlr4")
+ removeIncompatibleDependencies()
+ forceHapiVersion()
}
}
@@ -102,10 +97,6 @@ dependencies {
implementation(Dependencies.Androidx.coreKtx)
- // Remove this after this issue has been fixed:
- // https://github.com/cqframework/clinical_quality_language/issues/799
- implementation(Dependencies.Cql.antlr4Runtime)
-
implementation(Dependencies.Cql.engine)
implementation(Dependencies.Cql.engineJackson) // Necessary to import Executable XML/JSON CQL libs
implementation(Dependencies.Cql.evaluator)
@@ -118,6 +109,16 @@ dependencies {
implementation(Dependencies.Cql.translatorModel) // Overrides HAPI's old versions
implementation(Dependencies.Cql.translatorModelJackson) // Necessary to import XML/JSON ModelInfos
+ // Forces the most recent version of jackson, ignoring what dependencies use.
+ // Remove these lines when HAPI 6.4 becomes available.
+ implementation(Dependencies.Jackson.annotations)
+ implementation(Dependencies.Jackson.bom)
+ implementation(Dependencies.Jackson.core)
+ implementation(Dependencies.Jackson.databind)
+ implementation(Dependencies.Jackson.dataformatXml)
+ implementation(Dependencies.Jackson.jaxbAnnotations)
+ implementation(Dependencies.Jackson.jsr310)
+
// Runtime dependency that is required to run FhirPath (also requires minSDK of 26).
// Version 3.0 uses java.lang.System.Logger, which is not available on Android
// Replace for Guava when this PR gets merged: https://github.com/hapifhir/hapi-fhir/pull/3977
diff --git a/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt b/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt
index 94b3800a02..d2bcc1da6b 100644
--- a/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt
+++ b/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt
@@ -21,8 +21,8 @@ import ca.uhn.fhir.context.FhirVersionEnum
import com.google.android.fhir.FhirEngine
import java.util.function.Supplier
import org.hl7.fhir.instance.model.api.IBaseParameters
+import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.model.Bundle
-import org.hl7.fhir.r4.model.CarePlan
import org.hl7.fhir.r4.model.Coding
import org.hl7.fhir.r4.model.Endpoint
import org.hl7.fhir.r4.model.IdType
@@ -52,7 +52,7 @@ import org.opencds.cqf.cql.evaluator.fhir.adapter.r4.AdapterFactory
import org.opencds.cqf.cql.evaluator.library.CqlFhirParametersConverter
import org.opencds.cqf.cql.evaluator.library.LibraryProcessor
import org.opencds.cqf.cql.evaluator.measure.r4.R4MeasureProcessor
-import org.opencds.cqf.cql.evaluator.plandefinition.r4.OperationParametersParser
+import org.opencds.cqf.cql.evaluator.plandefinition.OperationParametersParser
import org.opencds.cqf.cql.evaluator.plandefinition.r4.PlanDefinitionProcessor
class FhirOperator(fhirContext: FhirContext, fhirEngine: FhirEngine) {
@@ -279,7 +279,7 @@ class FhirOperator(fhirContext: FhirContext, fhirEngine: FhirEngine) {
)
}
- fun generateCarePlan(planDefinitionId: String, patientId: String): CarePlan {
+ fun generateCarePlan(planDefinitionId: String, patientId: String): IBaseResource {
return generateCarePlan(planDefinitionId, patientId, encounterId = null)
}
@@ -287,7 +287,7 @@ class FhirOperator(fhirContext: FhirContext, fhirEngine: FhirEngine) {
planDefinitionId: String,
patientId: String,
encounterId: String?
- ): CarePlan {
+ ): IBaseResource {
return planDefinitionProcessor.apply(
IdType("PlanDefinition", planDefinitionId),
patientId,
@@ -307,6 +307,6 @@ class FhirOperator(fhirContext: FhirContext, fhirEngine: FhirEngine) {
/* dataEndpoint= */ null,
/* contentEndpoint*/ null,
/* terminologyEndpoint= */ null
- )
+ ) as IBaseResource
}
}