Skip to content

Commit

Permalink
Merge branch 'master' into quirks-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin authored Feb 7, 2024
2 parents 6ebc36d + 6140c8a commit 320ee39
Show file tree
Hide file tree
Showing 97 changed files with 4,242 additions and 1,390 deletions.
177 changes: 91 additions & 86 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Google LLC
* Copyright 2023-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,7 @@
*/

import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.DependencyConstraint
import org.gradle.kotlin.dsl.exclude

object Dependencies {
Expand Down Expand Up @@ -42,34 +43,53 @@ 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}"

const val guavaCaching = "ca.uhn.hapi.fhir:hapi-fhir-caching-guava:${Versions.hapiFhir}"
const val fhirBaseModule = "ca.uhn.hapi.fhir:hapi-fhir-base"
const val fhirClientModule = "ca.uhn.hapi.fhir:hapi-fhir-client"
const val structuresDstu2Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2"
const val structuresDstu3Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3"
const val structuresR4Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4"
const val structuresR4bModule = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4b"
const val structuresR5Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r5"

const val validationModule = "ca.uhn.hapi.fhir:hapi-fhir-validation"
const val validationDstu3Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3"
const val validationR4Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4"
const val validationR5Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r5"

const val fhirCoreDstu2Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2"
const val fhirCoreDstu2016Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may"
const val fhirCoreDstu3Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu3"
const val fhirCoreR4Module = "ca.uhn.hapi.fhir:org.hl7.fhir.r4"
const val fhirCoreR4bModule = "ca.uhn.hapi.fhir:org.hl7.fhir.r4b"
const val fhirCoreR5Module = "ca.uhn.hapi.fhir:org.hl7.fhir.r5"
const val fhirCoreUtilsModule = "ca.uhn.hapi.fhir:org.hl7.fhir.utilities"
const val fhirCoreConvertorsModule = "ca.uhn.hapi.fhir:org.hl7.fhir.convertors"

const val guavaCachingModule = "ca.uhn.hapi.fhir:hapi-fhir-caching-guava"

const val fhirBase = "$fhirBaseModule:${Versions.hapiFhir}"
const val fhirClient = "$fhirClientModule:${Versions.hapiFhir}"
const val structuresDstu2 = "$structuresDstu2Module:${Versions.hapiFhir}"
const val structuresDstu3 = "$structuresDstu3Module:${Versions.hapiFhir}"
const val structuresR4 = "$structuresR4Module:${Versions.hapiFhir}"
const val structuresR4b = "$structuresR4bModule:${Versions.hapiFhir}"
const val structuresR5 = "$structuresR5Module:${Versions.hapiFhir}"

const val validation = "$validationModule:${Versions.hapiFhir}"
const val validationDstu3 = "$validationDstu3Module:${Versions.hapiFhir}"
const val validationR4 = "$validationR4Module:${Versions.hapiFhir}"
const val validationR5 = "$validationR5Module:${Versions.hapiFhir}"

const val fhirCoreDstu2 = "$fhirCoreDstu2Module:${Versions.hapiFhirCore}"
const val fhirCoreDstu2016 = "$fhirCoreDstu2016Module:${Versions.hapiFhirCore}"
const val fhirCoreDstu3 = "$fhirCoreDstu3Module:${Versions.hapiFhirCore}"
const val fhirCoreR4 = "$fhirCoreR4Module:${Versions.hapiFhirCore}"
const val fhirCoreR4b = "$fhirCoreR4bModule:${Versions.hapiFhirCore}"
const val fhirCoreR5 = "$fhirCoreR5Module:${Versions.hapiFhirCore}"
const val fhirCoreUtils = "$fhirCoreUtilsModule:${Versions.hapiFhirCore}"
const val fhirCoreConvertors = "$fhirCoreConvertorsModule:${Versions.hapiFhirCore}"

const val guavaCaching = "$guavaCachingModule:${Versions.hapiFhir}"
}

object Jackson {
Expand All @@ -79,13 +99,14 @@ object Dependencies {
private const val datatypeGroup = "$mainGroup.datatype"
private 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.jacksonCore}"
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}"
const val annotationsBase = "$coreGroup:jackson-annotations:${Versions.jackson}"
const val bomBase = "$mainGroup:jackson-bom:${Versions.jackson}"
const val coreBase = "$coreGroup:jackson-core:${Versions.jacksonCore}"
const val databindBase = "$coreGroup:jackson-databind:${Versions.jackson}"
const val dataformatXmlBase = "$dataformatGroup:jackson-dataformat-xml:${Versions.jackson}"
const val jaxbAnnotationsBase =
"$moduleGroup:jackson-module-jaxb-annotations:${Versions.jackson}"
const val jsr310Base = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}"
}

object Kotlin {
Expand Down Expand Up @@ -148,7 +169,10 @@ object Dependencies {
const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:${Versions.desugarJdkLibs}"
const val fhirUcum = "org.fhir:ucum:${Versions.fhirUcum}"
const val gson = "com.google.code.gson:gson:${Versions.gson}"
const val guava = "com.google.guava:guava:${Versions.guava}"

const val guavaModule = "com.google.guava:guava"
const val guava = "$guavaModule:${Versions.guava}"

const val httpInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.http}"
const val http = "com.squareup.okhttp3:okhttp:${Versions.http}"
const val mockWebServer = "com.squareup.okhttp3:mockwebserver:${Versions.http}"
Expand Down Expand Up @@ -231,7 +255,7 @@ object Dependencies {
const val caffeine = "2.9.1"
const val fhirUcum = "1.0.3"
const val gson = "2.9.1"
const val guava = "32.1.2-android"
const val guava = "32.1.3-android"

const val hapiFhir = "6.8.0"
const val hapiFhirCore = "6.0.22"
Expand Down Expand Up @@ -294,57 +318,38 @@ object Dependencies {
exclude(group = "org.apache.httpcomponents")
exclude(group = "org.antlr", module = "antlr4")
exclude(group = "org.eclipse.persistence", module = "org.eclipse.persistence.moxy")
}

fun Configuration.forceGuava() {
// Removes caffeine
exclude(module = "hapi-fhir-caching-caffeine")
exclude(group = "com.github.ben-manes.caffeine", module = "caffeine")

resolutionStrategy {
force(guava)
force(HapiFhir.guavaCaching)
}
}

fun Configuration.forceHapiVersion() {
// Removes newer versions of caffeine and manually imports 2.9
// Removes newer versions of hapi and keeps on 6.0.1
// (newer versions don't work on Android)
resolutionStrategy {
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)
}
}

fun Configuration.forceJacksonVersion() {
resolutionStrategy {
force(Jackson.annotations)
force(Jackson.bom)
force(Jackson.core)
force(Jackson.databind)
force(Jackson.jaxbAnnotations)
force(Jackson.jsr310)
force(Jackson.dataformatXml)
}
fun hapiFhirConstraints(): Map<String, DependencyConstraint.() -> Unit> {
return mutableMapOf<String, DependencyConstraint.() -> Unit>(
guavaModule to { version { strictly(Versions.guava) } },
HapiFhir.fhirBaseModule to { version { strictly(Versions.hapiFhir) } },
HapiFhir.fhirClientModule to { version { strictly(Versions.hapiFhir) } },
HapiFhir.fhirCoreConvertorsModule to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreDstu2Module to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreDstu2016Module to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreDstu3Module to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreR4Module to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreR4bModule to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreR5Module to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.fhirCoreUtilsModule to { version { strictly(Versions.hapiFhirCore) } },
HapiFhir.structuresDstu2Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.structuresDstu3Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.structuresR4Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.structuresR5Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.validationModule to { version { strictly(Versions.hapiFhir) } },
HapiFhir.validationDstu3Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.validationR4Module to { version { strictly(Versions.hapiFhir) } },
HapiFhir.validationR5Module to { version { strictly(Versions.hapiFhir) } },
Jackson.annotationsBase to { version { strictly(Versions.jackson) } },
Jackson.bomBase to { version { strictly(Versions.jackson) } },
Jackson.coreBase to { version { strictly(Versions.jacksonCore) } },
Jackson.databindBase to { version { strictly(Versions.jackson) } },
Jackson.jaxbAnnotationsBase to { version { strictly(Versions.jackson) } },
Jackson.jsr310Base to { version { strictly(Versions.jackson) } },
Jackson.dataformatXmlBase to { version { strictly(Versions.jackson) } },
)
}
}
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Releases.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Google LLC
* Copyright 2023-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -48,13 +48,13 @@ object Releases {

object Engine : LibraryArtifact {
override val artifactId = "engine"
override val version = "0.1.0-beta05"
override val version = "1.0.0"
override val name = "Android FHIR Engine Library"
}

object DataCapture : LibraryArtifact {
override val artifactId = "data-capture"
override val version = "1.0.0"
override val version = "1.1.0"
override val name = "Android FHIR Structured Data Capture Library"
}

Expand Down
4 changes: 0 additions & 4 deletions catalog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Dependencies.forceGuava

plugins {
id(Plugins.BuildPlugins.application)
id(Plugins.BuildPlugins.kotlinAndroid)
Expand Down Expand Up @@ -42,8 +40,6 @@ android {
kotlin { jvmToolchain(11) }
}

configurations { all { forceGuava() } }

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.Espresso.espressoCore)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,7 +78,6 @@ class BehaviorListFragment : Fragment(R.layout.behavior_list_fragment) {
backgroundContext = coroutineContext,
fileName = behavior.questionnaireFileName,
),
workflow = behavior.workFlow,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package com.google.android.fhir.catalog

import android.app.Application
import android.content.Context
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.lifecycle.AndroidViewModel
Expand All @@ -31,7 +32,6 @@ class BehaviorListViewModel(application: Application) : AndroidViewModel(applica
@DrawableRes val iconId: Int,
@StringRes val textId: Int,
val questionnaireFileName: String,
val workFlow: WorkflowType = WorkflowType.BEHAVIOR,
) {
CALCULATED_EXPRESSION(
R.drawable.ic_calculations_behavior,
Expand Down Expand Up @@ -64,4 +64,7 @@ class BehaviorListViewModel(application: Application) : AndroidViewModel(applica
"behavior_dynamic_question_text.json",
),
}

fun isBehavior(context: Context, title: String) =
getBehaviorList().map { context.getString(it.textId) }.contains(title)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -109,7 +109,6 @@ class ComponentListFragment : Fragment(R.layout.component_list_fragment) {
fileName = it,
)
},
workflow = component.workflow,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Google LLC
* Copyright 2023-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package com.google.android.fhir.catalog

import android.app.Application
import android.content.Context
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.lifecycle.AndroidViewModel
Expand Down Expand Up @@ -46,7 +47,6 @@ class ComponentListViewModel(application: Application, private val state: SavedS
* answer the required questions, an error may be displayed on the particular question.
*/
val questionnaireFileWithValidation: String? = null,
val workflow: WorkflowType = WorkflowType.COMPONENT,
) {
BOOLEAN_CHOICE(
R.drawable.ic_booleanchoice,
Expand Down Expand Up @@ -172,4 +172,10 @@ class ComponentListViewModel(application: Application, private val state: SavedS
ViewItem.ComponentItem(Component.ITEM_ANSWER_MEDIA),
ViewItem.ComponentItem(Component.INITIAL_VALUE),
)

fun isComponent(context: Context, title: String) =
viewItemList
.filterIsInstance<ViewItem.ComponentItem>()
.map { context.getString(it.component.textId) }
.contains(title)
}
Loading

0 comments on commit 320ee39

Please sign in to comment.