Skip to content
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

Bump CQL Translator/Evaluator to 2.4 #1771

Merged
merged 21 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6ab643a
Migrating CQL Evaluator and its dependencies to 2.4 to fix #1733
vitorpamplona Nov 29, 2022
98c3533
Merge remote-tracking branch 'origin/HEAD' into Evaluator2_4
vitorpamplona Dec 19, 2022
d9a5bbc
Evaluator 2.4's generate care plan returns an IBaseResource to prepar…
vitorpamplona Dec 19, 2022
0d8f7c9
Migrates to evaluator 2.4
vitorpamplona Dec 19, 2022
3f8e911
Removes outdated antlr dependency fix of 2.4
vitorpamplona Dec 19, 2022
276d5f5
Forces Jackson 2.14.1 due to a dependency bug when using Gradle and t…
vitorpamplona Dec 19, 2022
750ce81
Forces Jackson 2.14.1 due to a dependency bug when using Gradle and t…
vitorpamplona Dec 19, 2022
5859748
Fixing tests to match CQL-Evaluator's tests
vitorpamplona Dec 19, 2022
7712fca
Merge branch 'Evaluator2_4' of https://github.com/Path-Check/android-…
vitorpamplona Dec 19, 2022
25782d8
Spotless apply
vitorpamplona Dec 19, 2022
f0784e1
Force version of caffeine
vitorpamplona Dec 20, 2022
a9e4d85
Forces HAPI and FHIR CORE to earlier versions due to https://github.c…
vitorpamplona Dec 21, 2022
646680d
deleting non existant r4b
vitorpamplona Dec 21, 2022
7255d71
Fixing imports of the Benchmark module
vitorpamplona Dec 21, 2022
1ce0bc3
Moving common blocks to Dependencies.
vitorpamplona Dec 23, 2022
28498cd
Merge remote-tracking branch 'origin/HEAD' into Evaluator2_4
vitorpamplona Dec 23, 2022
e8cc1a7
spotless apply
vitorpamplona Dec 23, 2022
5d0f25b
Merge remote-tracking branch 'origin/HEAD' into Evaluator2_4
vitorpamplona Dec 23, 2022
078af19
Merge branch 'master' into Evaluator2_4
vitorpamplona Jan 3, 2023
af7ed0c
Merge branch 'master' into Evaluator2_4
vitorpamplona Jan 4, 2023
be8c1f0
Merge branch 'master' into Evaluator2_4
vitorpamplona Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Dependencies.forceHapiVersion
import Dependencies.removeIncompatibleDependencies

plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
Expand Down Expand Up @@ -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()
}
}

Expand Down
120 changes: 109 additions & 11 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -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}"

Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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"
vitorpamplona marked this conversation as resolved.
Show resolved Hide resolved

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"
Expand Down Expand Up @@ -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)
}
}
}
4 changes: 0 additions & 4 deletions buildSrc/src/main/kotlin/LicenseeConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions workflow-testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Dependencies.forceHapiVersion
import Dependencies.removeIncompatibleDependencies

plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
Expand All @@ -18,6 +21,13 @@ android {
kotlinOptions { jvmTarget = Java.kotlinJvmTarget.toString() }
}

configurations {
all {
removeIncompatibleDependencies()
forceHapiVersion()
}
}

dependencies {
compileOnly(Dependencies.Cql.engine)
compileOnly(Dependencies.Cql.evaluator)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -218,7 +217,7 @@ object PlanDefinition : Loadable() {
}
}

class GeneratedCarePlan(val carePlan: CarePlan) {
class GeneratedCarePlan(val carePlan: IBaseResource) {
fun isEqualsTo(expectedCarePlanAssetName: String) {
try {
JSONAssert.assertEquals(
Expand All @@ -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
}
}
}
Expand Down
Loading