Skip to content

Commit

Permalink
Merge branch 'master' into fix-sync-state-excepiton
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin authored Sep 13, 2023
2 parents adcba26 + 87c3437 commit b84237e
Show file tree
Hide file tree
Showing 104 changed files with 3,155 additions and 2,265 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.6.0")

implementation("com.android.tools.build:gradle:8.0.2")
implementation("com.android.tools.build:gradle:8.1.1")

implementation("app.cash.licensee:licensee-gradle-plugin:1.3.0")
implementation("com.osacky.flank.gradle:fladle:0.17.4")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Releases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object Releases {

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

Expand Down
2 changes: 0 additions & 2 deletions catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ android {
// Flag to enable support for the new language APIs
// See https://developer.android.com/studio/write/java8-support
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

packaging {
Expand Down
74 changes: 74 additions & 0 deletions catalog/src/main/assets/behavior_skip_logic_with_expression.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"resourceType": "Questionnaire",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "has-fever",
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='1').answer.value"
}
}
],
"item": [
{
"linkId": "1",
"type": "boolean",
"text": "Does patient has fever?",
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-display-category",
"code": "instructions"
}
]
}
}
],
"linkId": "1.1",
"text": "Define the questionnaire variable 'has-fever' based on the answer to the question 'Does the patient have a fever?",
"type": "display"
}
]
},
{
"linkId": "2",
"text": "Since when?",
"type": "date",
"extension": [
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%has-fever"
}
}
],
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-display-category",
"code": "instructions"
}
]
}
}
],
"linkId": "2.1",
"text": "Enabled if variable 'has-fever' evaluates to true",
"type": "display"
}
]
}
]
}
124 changes: 124 additions & 0 deletions catalog/src/main/assets/component_initial_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1.0",
"type": "choice",
"text": "Initially selected single choice",
"answerOption": [
{
"valueCoding": {
"code": "Y",
"display": "Yes",
"system": "custom"
}
},
{
"valueCoding": {
"code": "N",
"display": "No",
"system": "custom"
},
"initialSelected": true
},
{
"valueCoding": {
"code": "unknown",
"display": "Unknown",
"system": "custom"
}
}
]
},
{
"linkId": "2.0",
"type": "choice",
"text": "Initially selected multiple choice",
"repeats": true,
"answerOption": [
{
"valueCoding": {
"code": "1st",
"display": "First",
"system": "custom"
}
},
{
"valueCoding": {
"code": "2nd",
"display": "Second",
"system": "custom"
},
"initialSelected": true
},
{
"valueCoding": {
"code": "3rd",
"display": "Third",
"system": "custom"
},
"initialSelected": true
}
]
},
{
"linkId": "3.0",
"type": "string",
"text": "Initially provided text value",
"initial": [
{
"valueString": "Here is a sample text"
}
]
},
{
"linkId": "4.0",
"type": "boolean",
"text": "Initially provided boolean value",
"initial": [
{
"valueBoolean": false
}
]
},
{
"linkId": "5.0",
"type": "date",
"text": "Initially provided date value",
"initial": [
{
"valueDate": "2022-01-22"
}
]
},
{
"linkId": "6.0",
"type": "quantity",
"text": "Initially provided quantity value",
"initial": [
{
"valueQuantity": {
"value": 30,
"unit": "$",
"system": "http://measureunit.org",
"code": "USD"
}
}
]
},
{
"linkId": "7.0",
"type": "quantity",
"text": "Initially provided quantity unit only",
"initial": [
{
"valueQuantity": {
"unit": "$",
"system": "http://measureunit.org",
"code": "USD"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Google LLC
* Copyright 2022-2023 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,6 +48,11 @@ class BehaviorListViewModel(application: Application) : AndroidViewModel(applica
R.string.behavior_name_skip_logic,
"behavior_skip_logic.json"
),
SKIP_LOGIC_WITH_EXPRESSION(
R.drawable.ic_skiplogic_behavior,
R.string.behavior_name_skip_logic_with_expression,
"behavior_skip_logic_with_expression.json"
),
DYNAMIC_QUESTION_TEXT(
R.drawable.ic_dynamic_text_behavior,
R.string.behavior_name_dynamic_question_text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ class ComponentListFragment : Fragment(R.layout.component_list_fragment) {
fileName = component.questionnaireFile,
),
questionnaireWithValidationJsonStringKey =
getQuestionnaireJsonStringFromAssets(
context = requireContext(),
backgroundContext = coroutineContext,
fileName = component.questionnaireFileWithValidation,
),
component.questionnaireFileWithValidation?.let {
getQuestionnaireJsonStringFromAssets(
context = requireContext(),
backgroundContext = coroutineContext,
fileName = it
)
},
workflow = component.workflow
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ComponentListViewModel(application: Application, private val state: SavedS
* Path to the questionnaire json file with some or all required fields. If the user doesn't
* answer the required questions, an error may be displayed on the particular question.
*/
val questionnaireFileWithValidation: String = "",
val questionnaireFileWithValidation: String? = null,
val workflow: WorkflowType = WorkflowType.COMPONENT
) {
BOOLEAN_CHOICE(
Expand Down Expand Up @@ -140,6 +140,11 @@ class ComponentListViewModel(application: Application, private val state: SavedS
R.drawable.ic_item_answer_media,
R.string.component_name_item_answer_media,
""
),
INITIAL_VALUE(
R.drawable.ic_initial_value_component,
R.string.component_name_initial_value,
"component_initial_value.json"
)
}

Expand All @@ -164,5 +169,6 @@ class ComponentListViewModel(application: Application, private val state: SavedS
ViewItem.ComponentItem(Component.HELP),
ViewItem.ComponentItem(Component.ITEM_MEDIA),
ViewItem.ComponentItem(Component.ITEM_ANSWER_MEDIA),
ViewItem.ComponentItem(Component.INITIAL_VALUE),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ suspend fun getQuestionnaireJsonStringFromAssets(
context: Context,
backgroundContext: CoroutineContext,
fileName: String
): String {
): String? {
return withContext(backgroundContext) {
context.assets.open(fileName).bufferedReader().use { it.readText() }
if (fileName.isNotEmpty()) {
context.assets.open(fileName).bufferedReader().use { it.readText() }
} else {
null
}
}
}

Expand Down
23 changes: 23 additions & 0 deletions catalog/src/main/res/drawable/ic_initial_value_component.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="194dp"
android:height="128dp"
android:viewportWidth="194"
android:viewportHeight="128"
>
<group>
<clip-path
android:pathData="M0,64C0,49.641 11.641,38 26,38H194V90H26C11.641,90 0,78.359 0,64V64Z"
/>
<path
android:pathData="M66,52C66,48.134 69.134,45 73,45L195,45V83L73,83C69.134,83 66,79.866 66,76V52Z"
android:strokeWidth="2"
android:fillColor="#ffffff"
android:strokeColor="#4285F4"
/>
<path
android:pathData="M90.086,70V58.57H86.468V57.112H95.216V58.57H91.616V70H90.086ZM99.714,70.288C98.826,70.288 98.034,70.078 97.338,69.658C96.654,69.238 96.114,68.662 95.718,67.93C95.334,67.198 95.142,66.364 95.142,65.428C95.142,64.552 95.322,63.742 95.682,62.998C96.054,62.254 96.57,61.66 97.23,61.216C97.902,60.76 98.688,60.532 99.588,60.532C100.5,60.532 101.28,60.736 101.928,61.144C102.588,61.54 103.092,62.092 103.44,62.8C103.8,63.508 103.98,64.318 103.98,65.23C103.98,65.314 103.974,65.398 103.962,65.482C103.962,65.566 103.956,65.638 103.944,65.698H96.672C96.72,66.418 96.894,67.018 97.194,67.498C97.506,67.966 97.89,68.32 98.346,68.56C98.802,68.788 99.276,68.902 99.768,68.902C100.44,68.902 100.992,68.746 101.424,68.434C101.868,68.11 102.222,67.714 102.486,67.246L103.782,67.876C103.422,68.572 102.906,69.148 102.234,69.604C101.562,70.06 100.722,70.288 99.714,70.288ZM99.588,61.918C98.844,61.918 98.226,62.152 97.734,62.62C97.242,63.088 96.918,63.694 96.762,64.438H102.36C102.348,64.09 102.246,63.724 102.054,63.34C101.874,62.944 101.586,62.608 101.19,62.332C100.794,62.056 100.26,61.918 99.588,61.918ZM104.945,70L108.185,65.338L105.017,60.82H106.745L109.121,64.222L111.389,60.82H113.189L109.967,65.338L113.243,70H111.461L109.085,66.472L106.727,70H104.945ZM115.838,67.588V62.206H114.236V60.82H115.838V58.228H117.368V60.82H119.618V62.206H117.368V67.21C117.368,67.69 117.464,68.062 117.656,68.326C117.86,68.59 118.19,68.722 118.646,68.722C118.85,68.722 119.036,68.692 119.204,68.632C119.372,68.572 119.522,68.5 119.654,68.416V69.91C119.498,69.982 119.324,70.036 119.132,70.072C118.952,70.12 118.706,70.144 118.394,70.144C117.626,70.144 117.008,69.922 116.54,69.478C116.072,69.022 115.838,68.392 115.838,67.588Z"
android:fillColor="#1A73E8"
/>
</group>
</vector>
4 changes: 4 additions & 0 deletions catalog/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@
<string name="layout_name_review">Review</string>
<string name="layout_name_read_only">Read only</string>
<string name="behavior_name_skip_logic">Skip logic</string>
<string
name="behavior_name_skip_logic_with_expression"
>Skip logic with expression</string>
<string
name="behavior_name_skip_logic_info"
>If Yes is selected, a follow-up question is displayed. If No is selected, no follow-up questions are displayed.</string>
<string name="behavior_name_context_variables">Context variable</string>
<string
name="behavior_name_dynamic_question_text"
>Dynamic question text</string>
<string name="component_name_initial_value">Initial Value</string>
<string
name="behavior_name_calculated_expression_info"
>Input age to automatically calculate birthdate until birthdate is updated manually.</string>
Expand Down
4 changes: 0 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ android {
defaultConfig { minSdk = Sdk.minSdk }
configureJacocoTestOptions()
kotlin { jvmToolchain(11) }
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}

configurations { all { exclude(module = "xpp3") } }
Expand Down
4 changes: 0 additions & 4 deletions contrib/barcode/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ android {

testOptions { animationsDisabled = true }
kotlin { jvmToolchain(11) }
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}

configurations { all { exclude(module = "xpp3") } }
Expand Down
2 changes: 0 additions & 2 deletions datacapture/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ android {
// Flag to enable support for the new language APIs
// See https://developer.android.com/studio/write/java8-support
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

packaging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class QuestionnaireItemDialogMultiSelectViewHolderFactoryEspressoTest {
}

@Test
fun `shouldHideErrorTextviewInHeader`() {
fun shouldHideErrorTextviewInHeader() {
val questionnaireItem = answerOptions(true, "Coding 1")
questionnaireItem.addExtension(openChoiceType)
val questionnaireViewItem =
Expand Down
Loading

0 comments on commit b84237e

Please sign in to comment.