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

Engage experiment #3353

Draft
wants to merge 84 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
77e4bca
Engage custom
FikriMilano Aug 4, 2023
efb57b5
Added custom datacapture lib
FikriMilano Aug 7, 2023
7d1e1f6
Custom dependency setting
FikriMilano Aug 7, 2023
81a1646
IPC Task generation tests
f-odhiambo Jul 23, 2023
2e44299
revised plandef
f-odhiambo Jul 25, 2023
586cac0
Generate unique tasks for each ActivityDefinition
Jul 27, 2023
d380fd0
IPC Tasks
Aug 3, 2023
b347890
Remove reason of build error
FikriMilano Aug 7, 2023
c1031c5
Use project level datacapture
FikriMilano Aug 8, 2023
4f83cb6
Fix skip logic delay
FikriMilano Aug 8, 2023
9b9fb1c
Update datacapture dependency to 14.4-SNAPSHOT
FikriMilano Aug 8, 2023
40ca57a
Update profile with Session cards and also ability to move back to pr…
Aug 10, 2023
6841ba9
Add support for enableWhenExpression with variable extension
FikriMilano Aug 14, 2023
d4614fc
Fix item image resizing bug
FikriMilano Aug 14, 2023
9fc0b67
FHIRCore adjustment for enableWhenExpression with variable
FikriMilano Aug 14, 2023
c2a8aaf
Remove overflow menu icons when configs is null or empty
ellykits Aug 14, 2023
fbde03b
Run spotlessApply
ellykits Aug 14, 2023
8be93e2
Merge branch 'main' of github.com:opensrp/fhircore into new-engage-cu…
FikriMilano Aug 15, 2023
0d7b9fb
Fix post merge conflict issue
FikriMilano Aug 15, 2023
640b703
Remove unused comments
FikriMilano Aug 15, 2023
b317b8d
Merge branch 'new-engage-custom' of github.com:opensrp/fhircore into …
FikriMilano Aug 15, 2023
ddfc5b4
Fix post merge conflict issue
FikriMilano Aug 15, 2023
78f382e
Fix evaluateToBoolean param
FikriMilano Aug 15, 2023
7b2b73a
Allows LAUNCH_PROFILE to go back to previous screen
FikriMilano Aug 15, 2023
bb66b06
Html support for CQF expression
FikriMilano Aug 17, 2023
63b5a66
Fix MediaView sizing bug and blurry image when going back pages from …
FikriMilano Aug 19, 2023
f4b18cd
Fix launch profile back button issue
FikriMilano Aug 21, 2023
7f8e242
Add NOTHING workflow
FikriMilano Aug 22, 2023
304c31b
Temp fix of too large image
FikriMilano Aug 22, 2023
87c9034
Make default behavior for close task to make ready next set of tasks …
Aug 22, 2023
14d381c
Merge branch 'main' of github.com:opensrp/fhircore into engage-experi…
FikriMilano Oct 30, 2023
d24a102
Add loading next button and do background thread process
FikriMilano Nov 2, 2023
f7f4c00
Fix to only show circular progress next button indicator when the var…
FikriMilano Nov 7, 2023
cd51f7e
Fix cropped tip icon
FikriMilano Nov 7, 2023
3910e28
Add configurable Questionnaire config type
FikriMilano Nov 20, 2023
3207201
Use latest SDC library
FikriMilano Dec 4, 2023
2e2fd9a
Remove unused logging
FikriMilano Dec 4, 2023
bf82bb0
Fix test failure
FikriMilano Dec 7, 2023
54f59a1
Update media view styling
FikriMilano Dec 15, 2023
fb71091
Update minimum options to use dialog as 1
FikriMilano Dec 15, 2023
dd385ee
Save the help card visibility in a state flow #2357
FikriMilano Dec 15, 2023
c6661fa
Get dialog title from flyover text
FikriMilano Dec 20, 2023
610b8fc
Add HTML font-size support
FikriMilano Dec 20, 2023
27e7fc2
Fix blurry and blinking image bug
FikriMilano Jan 2, 2024
1479043
Add config to hide disabled prev and next button
FikriMilano Jan 2, 2024
98f0fab
Change help card container color from purple to grey
FikriMilano Jan 2, 2024
61d51b5
Receive descending result of X-FHIR-Query
FikriMilano Jan 14, 2024
500830a
Fix enableWhen not triggered when initiating Questionnaire
FikriMilano Jan 17, 2024
ee4d75f
Clear text to re-generate the text with HTML from SDK
FikriMilano Jan 24, 2024
991b19e
Revert to the correct latest SDC
FikriMilano Feb 23, 2024
36ed6fe
Fix calculatedExpression for passing answer for multi choice type
FikriMilano Feb 27, 2024
acfb0a1
Ensure progress bar shows
FikriMilano Feb 27, 2024
022d5e0
Fix delay when opening next and previous page
FikriMilano Feb 27, 2024
32cdaef
Change open choice hint to "Other"
FikriMilano Mar 4, 2024
0c543f6
Fix width bug of 'Add another answer' button for open-choice
FikriMilano Mar 8, 2024
a485135
Update Submit buttons for all forms (#3174)
sharon2719 Mar 28, 2024
b439bd5
Improve initial load for calculated expression
FikriMilano Apr 23, 2024
202e445
Fix populating missing string value for open-choice
FikriMilano Apr 23, 2024
7201bb1
Fix keyboard disappears when using open-choice widget text box Android 9
FikriMilano Apr 29, 2024
573aaeb
Fix cursor goes to the front when typing fast
FikriMilano May 9, 2024
5199ae2
Create PdfGenerator class to launch WebView
FikriMilano May 14, 2024
0c82692
Create HtmlPopulator class
FikriMilano May 14, 2024
f83151b
Allow specific date formatting on extension functions
FikriMilano May 14, 2024
605fbeb
Use allItems extension from SDK
FikriMilano May 14, 2024
97b4a42
Update documentation in PdfGenerator class
FikriMilano May 19, 2024
a0bc93d
Launch PDF Generation via config
FikriMilano May 19, 2024
3accfb6
Add default html title to strings.xml
FikriMilano May 20, 2024
15a20b4
Add contains tag
FikriMilano May 22, 2024
abfa58d
Prevent crash if there is missing link ID
FikriMilano May 22, 2024
0b50774
Remove un-used
FikriMilano May 22, 2024
f8ac569
Add is-enabled tag
FikriMilano May 24, 2024
7af6d5f
Allow nesting of is-not-empty tag and contains tag
FikriMilano May 26, 2024
2bf85f5
Fix non necessary operation on initially loading a form
FikriMilano May 31, 2024
384dbfd
Revert "Fix cursor goes to the front when typing fast"
FikriMilano May 31, 2024
367c373
Hide list item spacer and divider if the item is not visible
FikriMilano Jun 1, 2024
3b39f5d
Add htmlTitle property in QuestionnaireConfig
FikriMilano Jun 4, 2024
8a65d5d
Prevent printing a pdf when webview client is not ready
FikriMilano Jun 5, 2024
e535998
Refactor HtmlPopulator
FikriMilano Jun 7, 2024
ebacc33
Set X as forms back icon
FikriMilano Jun 13, 2024
0c80be9
Fix blank hint in edit text
FikriMilano Jun 13, 2024
5a622a5
Only define pdfGenerator from outside for test
FikriMilano Jul 4, 2024
dee4f0b
Add debugNonProxy for datacapture
FikriMilano Jul 4, 2024
4203f5e
Fix keyboard cursor goes to the front
FikriMilano Jul 4, 2024
929b8ef
Add patient name as html title
FikriMilano Jul 5, 2024
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
1 change: 1 addition & 0 deletions android/common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
49 changes: 49 additions & 0 deletions android/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
id(Plugins.BuildPlugins.mavenPublish)
jacoco
}

publishing {
repositories {
maven {
credentials(PasswordCredentials::class)
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
name = "sonatype"
}
}
}

publishArtifact(Releases.Common)

createJacocoTestReportTask()

android {
compileSdk = Sdk.compileSdk

defaultConfig {
minSdk = Sdk.minSdk
targetSdk = Sdk.targetSdk
}
compileOptions {
sourceCompatibility = Java.sourceCompatibility
targetCompatibility = Java.targetCompatibility
}
kotlinOptions { jvmTarget = Java.kotlinJvmTarget.toString() }
configureJacocoTestOptions()
}

configurations { all { exclude(module = "xpp3") } }

dependencies {
api(Dependencies.HapiFhir.structuresR4)

implementation(Dependencies.fhirUcum)

testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.AndroidxTest.core)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.truth)
}
22 changes: 22 additions & 0 deletions android/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2020 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.
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.fhir.common"
>

</manifest>
97 changes: 97 additions & 0 deletions android/common/src/main/java/com/google/android/fhir/MoreTypes.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright 2021 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.
*/

package com.google.android.fhir

import java.util.Calendar
import java.util.Date
import java.util.Locale
import org.hl7.fhir.r4.model.Coding
import org.hl7.fhir.r4.model.Quantity
import org.hl7.fhir.r4.model.StringType
import org.hl7.fhir.r4.model.Type

/**
* Returns whether two instances of the [Type] class are equal.
*
* Note this is not an operator because it is not possible to overload the equality operator as an
* extension.
*/
fun equals(a: Type, b: Type): Boolean {
if (a::class != b::class) return false

if (a === b) return true

if (a.isPrimitive) return a.primitiveValue() == b.primitiveValue()

// Codes with the same system and code values are considered equal even if they have different
// display values.
if (a is Coding && b is Coding) return a.system == b.system && a.code == b.code

throw NotImplementedError("Comparison for type ${a::class.java} not supported.")
}

operator fun Type.compareTo(value: Type): Int {
if (!this.fhirType().equals(value.fhirType())) {
throw IllegalArgumentException(
"Cannot compare different data types: ${this.fhirType()} and ${value.fhirType()}"
)
}
when {
this.fhirType().equals("integer") -> {
return this.primitiveValue().toInt().compareTo(value.primitiveValue().toInt())
}
this.fhirType().equals("decimal") -> {
return this.primitiveValue().toBigDecimal().compareTo(value.primitiveValue().toBigDecimal())
}
this.fhirType().equals("date") -> {
return clearTimeFromDateValue(this.dateTimeValue().value)
.compareTo(clearTimeFromDateValue(value.dateTimeValue().value))
}
this.fhirType().equals("dateTime") -> {
return this.dateTimeValue().value.compareTo(value.dateTimeValue().value)
}
this.fhirType().equals("Quantity") -> {
val quantity = UnitConverter.getCanonicalForm(UcumValue((this as Quantity).code, this.value))
val anotherQuantity =
UnitConverter.getCanonicalForm(UcumValue((value as Quantity).code, value.value))
if (quantity.code != anotherQuantity.code) {
throw IllegalArgumentException(
"Cannot compare different quantity codes: ${quantity.code} and ${anotherQuantity.code}"
)
}
return quantity.value.compareTo(anotherQuantity.value)
}
else -> {
throw NotImplementedError()
}
}
return 0
}

private fun clearTimeFromDateValue(dateValue: Date): Date {
val calendarValue = Calendar.getInstance()
calendarValue.time = dateValue
calendarValue.set(Calendar.HOUR_OF_DAY, 0)
calendarValue.set(Calendar.MINUTE, 0)
calendarValue.set(Calendar.SECOND, 0)
calendarValue.set(Calendar.MILLISECOND, 0)
return calendarValue.time
}

fun StringType.getLocalizedText(lang: String = Locale.getDefault().toLanguageTag()): String? {
return getTranslation(lang) ?: getTranslation(lang.split("-").firstOrNull()) ?: value
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2021 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.
*/

package com.google.android.fhir

import java.lang.NullPointerException
import java.math.BigDecimal
import java.math.MathContext
import kotlin.jvm.Throws
import org.fhir.ucum.Decimal
import org.fhir.ucum.Pair
import org.fhir.ucum.UcumEssenceService
import org.fhir.ucum.UcumException

/**
* Canonicalizes unit values to UCUM base units.
*
* For details of UCUM, see http://unitsofmeasure.org/
*
* For using UCUM with FHIR, see https://www.hl7.org/fhir/ucum.html
*
* For the implementation of UCUM with FHIR, see https://github.com/FHIR/Ucum-java
*/
object UnitConverter {
private val ucumService by lazy {
UcumEssenceService(this::class.java.getResourceAsStream("/ucum-essence.xml"))
}

/**
* Returns the canonical form of a UCUM Value.
*
* The canonical form is generated by normalizing [value] to UCUM base units, used to generate
* canonical matches on Quantity Search
*
* For example a value of 1000 mm will return 1 m.
*/
@Throws(ConverterException::class)
fun getCanonicalForm(value: UcumValue): UcumValue {
try {
val pair =
ucumService.getCanonicalForm(Pair(Decimal(value.value.toPlainString()), value.code))
return UcumValue(
pair.code,
pair.value.asDecimal().toBigDecimal(MathContext(value.value.precision()))
)
} catch (e: UcumException) {
throw ConverterException("UCUM conversion failed", e)
} catch (e: NullPointerException) {
// See https://github.com/google/android-fhir/issues/869 for why NPE needs to be caught
throw ConverterException("Missing numerical value in the canonical UCUM value", e)
}
}
}

class ConverterException(message: String, cause: Throwable) : Exception(message, cause)

data class UcumValue(val code: String, val value: BigDecimal)
Loading