diff --git a/build.gradle.kts b/build.gradle.kts index 3c205711c1..add5c84a6d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,13 @@ allprojects { configureSpotless() } -subprojects { configureLicensee() } +subprojects { + // We have some empty folders like the :contrib root folder, which Gradle recognizes as projects. + // Don't configure plugins for those folders. + if (project.buildFile.exists()) { + configureLicensee() + } +} // Create a CI repository and also change versions to include the build number afterEvaluate { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index aad5f596e1..8adf2ab719 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -92,13 +92,18 @@ object Dependencies { const val runtime = "androidx.room:room-runtime:${Versions.Androidx.room}" } + object Mlkit { + const val barcodeScanning = + "com.google.mlkit:barcode-scanning:${Versions.Mlkit.barcodeScanning}" + const val objectDetection = + "com.google.mlkit:object-detection:${Versions.Mlkit.objectDetection}" + const val objectDetectionCustom = + "com.google.mlkit:object-detection-custom:${Versions.Mlkit.objectDetectionCustom}" + } + const val androidFhirCommon = "com.google.android.fhir:common:${Versions.androidFhirCommon}" - const val barcodeScanning = "com.google.mlkit:barcode-scanning:${Versions.Mlkit.barcodeScanning}" const val lifecycleExtensions = "androidx.lifecycle:lifecycle-extensions:${Versions.Androidx.lifecycle}" - const val objectDetection = "com.google.mlkit:object-detection:${Versions.Mlkit.objectDetection}" - const val objectDetectionCustom = - "com.google.mlkit:object-detection-custom:${Versions.Mlkit.objectDetectionCustom}" const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:${Versions.desugarJdkLibs}" const val fhirUcum = "org.fhir:ucum:${Versions.fhirUcum}" const val guava = "com.google.guava:guava:${Versions.guava}" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 2a14ea98b4..ba7fc9de93 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -63,6 +63,14 @@ object Releases { override val name = "Android FHIR Workflow Library" } + object Contrib { + object Barcode : LibraryArtifact { + override val artifactId = "contrib-barcode" + override val version = "0.1.0-beta3" + override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" + } + } + // Demo apps object Demo { diff --git a/catalog/build.gradle.kts b/catalog/build.gradle.kts index 4898f6b715..279c2411b7 100644 --- a/catalog/build.gradle.kts +++ b/catalog/build.gradle.kts @@ -61,6 +61,7 @@ dependencies { implementation(Dependencies.Navigation.navUiKtx) implementation(project(path = ":datacapture")) + implementation(project(path = ":contrib:barcode")) testImplementation(Dependencies.junit) } diff --git a/catalog/src/main/assets/paginated_layout_questionnaire.json b/catalog/src/main/assets/paginated_layout_questionnaire.json index 511a9ea2c2..29c6b50e62 100644 --- a/catalog/src/main/assets/paginated_layout_questionnaire.json +++ b/catalog/src/main/assets/paginated_layout_questionnaire.json @@ -21,33 +21,117 @@ ], "item": [ { - "linkId": "1", + "linkId": "1.1", "type": "display", "text": "Personal information", "prefix": "1." }, { - "linkId": "2", + "linkId": "1.2", "type": "string", - "text": "First Name" + "item": [ + { + "linkId": "1.2.1", + "text": "First Name", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "3", + "linkId": "1.3", "type": "string", - "text": "Family Name" + "item": [ + { + "linkId": "1.3.1", + "text": "Family Name", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "4", + "linkId": "1.4", "type": "integer", - "text": "ID number" + "item": [ + { + "linkId": "1.4.1", + "text": "ID number", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "5", + "linkId": "1.5", "type": "integer", - "text": "Mobile number" + "item": [ + { + "linkId": "1.5.1", + "text": "Mobile number", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "6", + "linkId": "1.6", "type": "choice", "repeats": true, "extension": [ @@ -77,7 +161,7 @@ ] }, { - "linkId": "1", + "linkId": "2", "type": "group", "extension": [ { @@ -96,13 +180,13 @@ ], "item": [ { - "linkId": "7", + "linkId": "2.1", "type": "date", "text": "Date of birth", "prefix": "2." }, { - "linkId": "9", + "linkId": "2.2", "type": "choice", "repeats": true, "extension": [ @@ -132,7 +216,7 @@ ] }, { - "linkId": "1", + "linkId": "3", "type": "group", "extension": [ { @@ -151,40 +235,145 @@ ], "item": [ { - "linkId": "10", + "linkId": "3.1", "type": "display", "text": "Address", - "prefix": "3." + "prefix":"3." }, { - "linkId": "11", + "linkId": "3.2", "type": "string", - "text": "House number and street" + "item": [ + { + "linkId": "10.1", + "text": "House number and street", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "12", + "linkId": "3.3", "type": "string", - "text": "Apartment, unit" + "item": [ + { + "linkId": "11.1", + "text": "Apartment, unit", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "13", + "linkId": "3.4", "type": "string", - "text": "City, town or village" + "item": [ + { + "linkId": "12.1", + "text": "City, town or village", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "14", + "linkId": "3.5", "type": "string", - "text": "County" + "item": [ + { + "linkId": "13.1", + "text": "County", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "15", + "linkId": "3.6", "type": "string", - "text": "Postal Code" + "item": [ + { + "linkId": "14.1", + "text": "Postal Code", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] } ] }, { - "linkId": "1", + "linkId": "4", "type": "group", "extension": [ { @@ -203,20 +392,47 @@ ], "item": [ { - "linkId": "16", + "linkId": "4.1", "type": "display", "text": "Alternative contact person", - "prefix": "4." + "prefix":"4.", + "item": [ + { + "linkId": "15.1", + "text": "The alternative contact would be used in the case of an emergency situation and could be next of kin (e.g. partner, mother, sibling.)", + "type": "display" + } + ] }, { - "linkId": "18", + "linkId": "4.2", "type": "string", - "text": "Name" + "item": [ + { + "linkId": "16.1", + "text": "Name", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] }, { - "linkId": "19", + "linkId": "4.3", "type": "choice", - "text": "Relationship", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", @@ -232,6 +448,28 @@ } } ], + "item": [ + { + "linkId": "17.1", + "text": "Relationship", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ], "answerOption": [ { "valueCoding": { @@ -266,14 +504,35 @@ ] }, { - "linkId": "20", + "linkId": "4.4", "type": "string", - "text": "Phone number" + "item": [ + { + "linkId": "18.1", + "text": "Phone number", + "type": "display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/questionnaire-item-control", + "code": "flyover", + "display": "Fly-over" + } + ], + "text": "Flyover" + } + } + ] + } + ] } ] }, { - "linkId": "1", + "linkId": "5", "type": "group", "extension": [ { @@ -292,7 +551,7 @@ ], "item": [ { - "linkId": "20", + "linkId": "5.1", "type": "choice", "text": "What is the highest level of education achieved?", "prefix": "5.", @@ -341,7 +600,7 @@ ] }, { - "linkId": "1", + "linkId": "6", "type": "group", "extension": [ { @@ -360,7 +619,7 @@ ], "item": [ { - "linkId": "21", + "linkId": "6.1", "type": "choice", "repeats": true, "text": "Who does the client live with?", @@ -422,7 +681,7 @@ ] }, { - "linkId": "1", + "linkId": "7", "type": "group", "extension": [ { @@ -441,7 +700,7 @@ ], "item": [ { - "linkId": "22", + "linkId": "7.1", "type": "choice", "text": "Has the client received this year’s seasonal flu vaccine?", "prefix": "7.", @@ -484,7 +743,7 @@ ] }, { - "linkId": "1", + "linkId": "8", "type": "group", "extension": [ { @@ -503,7 +762,7 @@ ], "item": [ { - "linkId": "23", + "linkId": "8.1", "type": "date", "text": "When was their last menstrual period? (LMP)", "prefix": "8." @@ -511,7 +770,7 @@ ] }, { - "linkId": "1", + "linkId": "9", "type": "group", "extension": [ { @@ -530,7 +789,7 @@ ], "item": [ { - "linkId": "24", + "linkId": "9.1", "type": "integer", "text": "How many times have they been pregnant?", "prefix": "9.", @@ -553,7 +812,7 @@ ] }, { - "linkId": "1", + "linkId": "10", "type": "group", "extension": [ { @@ -572,7 +831,7 @@ ], "item": [ { - "linkId": "25", + "linkId": "10.1", "type": "dateTime", "text": "What was the date and time of the ultrasound?", "prefix": "10." diff --git a/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt b/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt index 80741f2e0c..8ecb35cf39 100644 --- a/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt +++ b/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt @@ -19,8 +19,6 @@ package com.google.android.fhir.catalog import android.os.Bundle import android.view.Gravity import android.view.LayoutInflater -import android.view.Menu -import android.view.MenuInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup @@ -38,6 +36,7 @@ import androidx.navigation.fragment.navArgs import com.google.android.fhir.catalog.ModalBottomSheetFragment.Companion.BUNDLE_ERROR_KEY import com.google.android.fhir.catalog.ModalBottomSheetFragment.Companion.REQUEST_ERROR_KEY import com.google.android.fhir.datacapture.QuestionnaireFragment +import com.google.android.fhir.datacapture.QuestionnaireFragment.Companion.SUBMIT_REQUEST_KEY import kotlinx.coroutines.launch class DemoQuestionnaireFragment : Fragment() { @@ -59,6 +58,9 @@ class DemoQuestionnaireFragment : Fragment() { setFragmentResultListener(REQUEST_ERROR_KEY) { _, bundle -> isErrorState = bundle.getBoolean(BUNDLE_ERROR_KEY) } + childFragmentManager.setFragmentResultListener(SUBMIT_REQUEST_KEY, viewLifecycleOwner) { _, _ -> + onSubmitQuestionnaireClick() + } updateArguments() if (savedInstanceState == null) { addQuestionnaireFragment() @@ -90,11 +92,6 @@ class DemoQuestionnaireFragment : Fragment() { } } - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - super.onCreateOptionsMenu(menu, inflater) - inflater.inflate(getMenu(), menu) - } - private fun setUpActionBar() { (requireActivity() as AppCompatActivity).supportActionBar?.apply { setDisplayHomeAsUpEnabled(true) @@ -146,7 +143,6 @@ class DemoQuestionnaireFragment : Fragment() { } private fun onSubmitQuestionnaireClick() { - // TODO https://github.com/google/android-fhir/issues/1088 val questionnaireFragment = childFragmentManager.findFragmentByTag( QuestionnaireContainerFragment.QUESTIONNAIRE_FRAGMENT_TAG diff --git a/catalog/src/main/res/layout/activity_main.xml b/catalog/src/main/res/layout/activity_main.xml index a9109b4595..a394ba0677 100644 --- a/catalog/src/main/res/layout/activity_main.xml +++ b/catalog/src/main/res/layout/activity_main.xml @@ -32,11 +32,11 @@ > diff --git a/catalog/src/main/res/layout/fragment_modal_bottom_sheet.xml b/catalog/src/main/res/layout/fragment_modal_bottom_sheet.xml index 5a0c034a93..1fefa98520 100644 --- a/catalog/src/main/res/layout/fragment_modal_bottom_sheet.xml +++ b/catalog/src/main/res/layout/fragment_modal_bottom_sheet.xml @@ -9,12 +9,12 @@ > @@ -43,11 +43,11 @@ app:layout_constraintTop_toBottomOf="@id/subTitle_tv" />