Skip to content

Commit f315d06

Browse files
committed
Merge remote-tracking branch 'origin/main' into main-validate-extracted-resources
2 parents 70a4486 + 5d72b3e commit f315d06

File tree

80 files changed

+1713
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1713
-684
lines changed

.github/workflows/docs.yml

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ jobs:
4444
uses: actions/setup-java@v1
4545
with:
4646
java-version: 17
47+
48+
- name: Add empty local.properties
49+
run: touch local.properties
50+
working-directory: android
51+
52+
- name: Add empty keystore.properties
53+
run: touch keystore.properties
54+
working-directory: android
4755

4856
- name: Grant execute permission for gradlew
4957
run: chmod +x gradlew

.github/workflows/manual-apk-release.yml .github/workflows/manual-release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Manual APK Release
2-
run-name: Generating a FHIR Core Release APK 🚀
1+
name: Manual Release
2+
run-name: Generating a FHIR Core Release 🚀
33
on:
44
workflow_dispatch:
55
inputs:
66
buildType:
7-
description: 'Select APK Build Type'
7+
description: 'Select Build Type'
88
required: true
99
default: 'Release'
1010
type: choice
@@ -13,7 +13,7 @@ on:
1313
- DebugNonProxy
1414
- Release
1515
flavor:
16-
description: 'APK flavor e.g. sidBunda'
16+
description: 'Release flavor e.g. sidBunda'
1717
type: string
1818
required: true
1919
isAab:

android/build.gradle.kts

+3-4
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,17 @@ subprojects {
5858
}
5959

6060
configure<SpotlessExtension> {
61-
val lintVersion = "0.49.0"
6261

6362
kotlin {
6463
target("**/*.kt")
65-
ktlint(lintVersion)
64+
ktlint(BuildConfigs.ktLintVersion)
6665
ktfmt().googleStyle()
6766
licenseHeaderFile("${project.rootProject.projectDir}/license-header.txt")
6867
}
6968

7069
kotlinGradle {
7170
target("*.gradle.kts")
72-
ktlint(lintVersion)
71+
ktlint(BuildConfigs.ktLintVersion)
7372
ktfmt().googleStyle()
7473
}
7574

@@ -91,7 +90,7 @@ subprojects {
9190
resolutionStrategy {
9291
eachDependency {
9392
when (requested.group) {
94-
"org.jacoco" -> useVersion("0.8.11")
93+
"org.jacoco" -> useVersion(BuildConfigs.jacocoVersion)
9594
}
9695
}
9796
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object BuildConfigs {
2+
const val minSdk = 26
3+
const val compileSdk = 34
4+
const val targetSdk = 34
5+
const val versionCode = 10
6+
const val versionName = "1.1.0"
7+
const val applicationId = "org.smartregister.opensrp"
8+
const val jvmToolchain = 17
9+
const val kotlinCompilerExtensionVersion = "1.5.8"
10+
const val jacocoVersion ="0.8.11"
11+
const val ktLintVersion = "0.49.0"
12+
}

android/engine/build.gradle.kts

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ plugins {
1515
}
1616

1717
android {
18-
compileSdk = 34
18+
compileSdk = BuildConfigs.compileSdk
1919

2020
namespace = "org.smartregister.fhircore.engine"
2121

2222
defaultConfig {
23-
minSdk = 26
23+
minSdk = BuildConfigs.minSdk
2424
testInstrumentationRunner = "org.smartregister.fhircore.engine.EngineTestRunner"
2525
consumerProguardFiles("consumer-rules.pro")
2626
buildConfigField(
@@ -62,7 +62,7 @@ android {
6262
dataBinding = true
6363
buildConfig = true
6464
}
65-
composeOptions { kotlinCompilerExtensionVersion = "1.5.8" }
65+
composeOptions { kotlinCompilerExtensionVersion = BuildConfigs.kotlinCompilerExtensionVersion }
6666

6767
packaging {
6868
resources.excludes.addAll(
@@ -100,7 +100,7 @@ android {
100100

101101
lint { baseline = file("lint-baseline.xml") }
102102

103-
testCoverage { jacocoVersion = "0.8.11" }
103+
testCoverage { jacocoVersion = BuildConfigs.jacocoVersion }
104104
}
105105

106106
tasks.withType<Test> {

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

+28-13
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ constructor(
482482
.toRequestBody(NetworkModule.JSON_MEDIA_TYPE),
483483
)
484484

485-
processResultBundleEntries(resultBundle, patientRelatedResourceTypes)
485+
processResultBundleEntries(resultBundle.entry, patientRelatedResourceTypes)
486486

487487
return resultBundle
488488
}
@@ -492,23 +492,36 @@ constructor(
492492
searchPath: String,
493493
patientRelatedResourceTypes: MutableList<ResourceType>,
494494
) {
495-
val resultBundle =
496-
if (gatewayModeHeaderValue.isNullOrEmpty()) {
497-
fhirResourceDataSource.getResource(searchPath)
498-
} else
499-
fhirResourceDataSource.getResourceWithGatewayModeHeader(
500-
gatewayModeHeaderValue,
501-
searchPath,
502-
)
495+
val resultBundle = fetchResourceBundle(gatewayModeHeaderValue, searchPath)
496+
val nextPageUrl = resultBundle.getLink(PAGINATION_NEXT)?.url ?: ""
497+
498+
processResultBundleEntries(resultBundle.entry, patientRelatedResourceTypes)
499+
500+
if (nextPageUrl.isNotEmpty()) {
501+
processCompositionManifestResources(
502+
gatewayModeHeaderValue,
503+
nextPageUrl,
504+
patientRelatedResourceTypes,
505+
)
506+
}
507+
}
503508

504-
processResultBundleEntries(resultBundle, patientRelatedResourceTypes)
509+
private suspend fun fetchResourceBundle(
510+
gatewayModeHeaderValue: String?,
511+
searchPath: String,
512+
): Bundle {
513+
return if (gatewayModeHeaderValue.isNullOrEmpty()) {
514+
fhirResourceDataSource.getResource(searchPath)
515+
} else {
516+
fhirResourceDataSource.getResourceWithGatewayModeHeader(gatewayModeHeaderValue, searchPath)
517+
}
505518
}
506519

507520
private suspend fun processResultBundleEntries(
508-
resultBundle: Bundle,
521+
resultBundleEntries: List<Bundle.BundleEntryComponent>,
509522
patientRelatedResourceTypes: MutableList<ResourceType>,
510523
) {
511-
resultBundle.entry?.forEach { bundleEntryComponent ->
524+
resultBundleEntries.forEach { bundleEntryComponent ->
512525
when (bundleEntryComponent.resource) {
513526
is Bundle -> {
514527
val bundle = bundleEntryComponent.resource as Bundle
@@ -711,7 +724,8 @@ constructor(
711724
resourceGroup.value.forEach {
712725
processCompositionManifestResources(
713726
gatewayModeHeaderValue = FHIR_GATEWAY_MODE_HEADER_VALUE,
714-
searchPath = "${resourceGroup.key}/${it.focus.extractId()}",
727+
searchPath =
728+
"${resourceGroup.key}?$ID=${it.focus.extractId()}&_page=1&_count=$DEFAULT_COUNT",
715729
patientRelatedResourceTypes = patientRelatedResourceTypes,
716730
)
717731
}
@@ -770,6 +784,7 @@ constructor(
770784
const val ORGANIZATION = "organization"
771785
const val TYPE_REFERENCE_DELIMITER = "/"
772786
const val DEFAULT_COUNT = 200
787+
const val PAGINATION_NEXT = "next"
773788

774789
/**
775790
* The list of resources whose types can be synced down as part of the Composition configs.

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/QuestionnaireConfig.kt

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ data class QuestionnaireConfig(
8686
),
8787
planDefinitions = planDefinitions?.map { it.interpolate(computedValuesMap) },
8888
readOnlyLinkIds = readOnlyLinkIds?.map { it.interpolate(computedValuesMap) },
89+
extraParams = extraParams?.map { it.interpolate(computedValuesMap) },
8990
onSubmitActions = onSubmitActions?.map { it.interpolate(computedValuesMap) },
9091
barcodeLinkId = barcodeLinkId?.interpolate(computedValuesMap),
9192
cqlInputResources = cqlInputResources?.map { it.interpolate(computedValuesMap) },

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/event/EventWorkflow.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import kotlinx.parcelize.Parcelize
2222
import kotlinx.serialization.Serializable
2323
import kotlinx.serialization.json.Json
2424
import kotlinx.serialization.json.JsonElement
25+
import org.hl7.fhir.r4.model.ResourceType
2526
import org.smartregister.fhircore.engine.domain.model.ResourceConfig
2627
import org.smartregister.fhircore.engine.domain.model.ResourceFilterExpression
2728

@@ -32,24 +33,27 @@ data class EventWorkflow(
3233
val triggerConditions: List<EventTriggerCondition> = emptyList(),
3334
val eventResources: List<ResourceConfig> = emptyList(),
3435
val updateValues: List<UpdateWorkflowValueConfig> = emptyList(),
35-
val resourceFilterExpression: ResourceFilterExpression? = null,
36+
val resourceFilterExpressions: List<ResourceFilterExpression>? = null,
3637
) : java.io.Serializable, Parcelable
3738

3839
@Serializable
3940
data class UpdateWorkflowValueConfig(
4041
val jsonPathExpression: String,
4142
val value: JsonElement,
43+
val resourceType: ResourceType = ResourceType.Task,
4244
) : java.io.Serializable, Parcelable {
4345
constructor(
4446
parcel: Parcel,
4547
) : this(
4648
parcel.readString() ?: "",
4749
Json.decodeFromString(parcel.readString() ?: ""),
50+
ResourceType.fromCode(parcel.readString()),
4851
)
4952

5053
override fun writeToParcel(parcel: Parcel, flags: Int) {
5154
parcel.writeString(jsonPathExpression)
5255
parcel.writeString(value.toString())
56+
parcel.writeString(resourceType.name)
5357
}
5458

5559
override fun describeContents(): Int {

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/register/RegisterFilterConfig.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package org.smartregister.fhircore.engine.configuration.register
1919
import kotlinx.serialization.Serializable
2020
import org.smartregister.fhircore.engine.domain.model.ActionConfig
2121
import org.smartregister.fhircore.engine.domain.model.DataQuery
22+
import org.smartregister.fhircore.engine.domain.model.NestedSearchConfig
2223

2324
@Serializable
2425
data class RegisterFilterConfig(
@@ -28,6 +29,7 @@ data class RegisterFilterConfig(
2829

2930
@Serializable
3031
data class RegisterFilterField(
31-
val dataQueries: List<DataQuery>,
3232
val filterId: String,
33+
val dataQueries: List<DataQuery>? = null,
34+
val nestedSearchResources: List<NestedSearchConfig>? = null,
3335
) : java.io.Serializable

0 commit comments

Comments
 (0)