From 7aa06dfdab378a9438dd639db3249053c1595fbe Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 24 Feb 2023 12:30:50 +0300 Subject: [PATCH 001/126] OpenSRP Sonatype Publishing Set Up - Updated versions of preview releases - Releases.kt - Publishing configurations of individual modules --- buildSrc/src/main/kotlin/Releases.kt | 12 ++++++------ common/build.gradle.kts | 11 +++++++++++ contrib/barcode/build.gradle.kts | 11 +++++++++++ datacapture/build.gradle.kts | 9 +++++++++ engine/build.gradle.kts | 10 ++++++++++ workflow/build.gradle.kts | 10 ++++++++++ 6 files changed, 57 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index c6da3648f2..a7e711aaf7 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -36,38 +36,38 @@ interface LibraryArtifact { } object Releases { - const val groupId = "com.google.android.fhir" + const val groupId = "org.smartregister" // Libraries object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha03" + override val version = "0.1.0-alpha03-preview4-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta02" + override val version = "0.1.0-beta02-preview10-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "0.1.0-beta06" + override val version = "0.1.0-beta06-preview8-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha02" + override val version = "0.1.0-alpha02-preview8-SNAPSHOT" 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 version = "0.1.0-beta3-preview3-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index b184a4294b..5de1bf50cf 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -5,6 +5,17 @@ plugins { jacoco } +publishing{ + repositories { + maven { + + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} + publishArtifact(Releases.Common) createJacocoTestReportTask() diff --git a/contrib/barcode/build.gradle.kts b/contrib/barcode/build.gradle.kts index 7741acc4ce..529275b999 100644 --- a/contrib/barcode/build.gradle.kts +++ b/contrib/barcode/build.gradle.kts @@ -5,6 +5,17 @@ plugins { jacoco } +publishing{ + repositories { + maven { + + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} + publishArtifact(Releases.Contrib.Barcode) createJacocoTestReportTask() diff --git a/datacapture/build.gradle.kts b/datacapture/build.gradle.kts index dbe640a214..70f13c67c8 100644 --- a/datacapture/build.gradle.kts +++ b/datacapture/build.gradle.kts @@ -7,6 +7,15 @@ plugins { jacoco id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } +publishing{ + repositories { + maven { + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} publishArtifact(Releases.DataCapture) diff --git a/engine/build.gradle.kts b/engine/build.gradle.kts index 843be249af..acdc5aab01 100644 --- a/engine/build.gradle.kts +++ b/engine/build.gradle.kts @@ -9,6 +9,16 @@ plugins { jacoco id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } +publishing{ + repositories { + maven { + + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} publishArtifact(Releases.Engine) diff --git a/workflow/build.gradle.kts b/workflow/build.gradle.kts index 8cf440e40e..a370529caf 100644 --- a/workflow/build.gradle.kts +++ b/workflow/build.gradle.kts @@ -10,6 +10,16 @@ plugins { id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } +publishing{ + repositories { + maven { + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} + publishArtifact(Releases.Workflow) createJacocoTestReportTask() From 10e46a0eac5f41b68b5bb1caa87069b83d36c6b1 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 24 Feb 2023 15:37:49 +0300 Subject: [PATCH 002/126] SDK Release: Engine, SDC - With unmerged PR https://github.com/google/android-fhir/pull/1669 branch --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index f570d3ebb2..3a3a1200db 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta02-preview10-SNAPSHOT" + override val version = "0.1.0-beta02-preview11-SNAPSHOT" 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.0.0-preview-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From fb3b13b6c16a6b7e0766fb41ad3cddaf5dddecd5 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 1 Mar 2023 11:38:12 +0300 Subject: [PATCH 003/126] SDK Release: Barcode - With unmerged PR https://github.com/google/android-fhir/pull/1669 branch --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 3a3a1200db..8d8e200215 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -67,7 +67,7 @@ object Releases { object Contrib { object Barcode : LibraryArtifact { override val artifactId = "contrib-barcode" - override val version = "0.1.0-beta3-preview3-SNAPSHOT" + override val version = "0.1.0-beta3-preview4-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" } } From 167e89685694b30f67937bbb15ee00a94f30b259 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 3 Mar 2023 16:52:22 +0300 Subject: [PATCH 004/126] SDK Release: Engine - With unmerged PR https://github.com/google/android-fhir/pull/1669 branch --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 8d8e200215..78bd4f2f28 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta02-preview11-SNAPSHOT" + override val version = "0.1.0-beta02-preview12-SNAPSHOT" override val name = "Android FHIR Engine Library" } From abd41d026ff21980e95c7a4861149708e174e1cc Mon Sep 17 00:00:00 2001 From: Allan Onchuru Date: Fri, 3 Mar 2023 17:42:48 +0300 Subject: [PATCH 005/126] SDK Release: Engine - With unmerged PR https://github.com/google/android-fhir/pull/1669 branch - With unmerged PR https://github.com/google/android-fhir/pull/1893 branch --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 78bd4f2f28..4fa35118ba 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta02-preview12-SNAPSHOT" + override val version = "0.1.0-beta02-preview13-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 32952bb1d9229a19fafef086d881cf090b9d4934 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 21 Mar 2023 14:12:53 +0300 Subject: [PATCH 006/126] Reinstate Sonatype support --- buildSrc/src/main/kotlin/Releases.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 4fa35118ba..d01507a815 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -15,11 +15,13 @@ */ import org.gradle.api.Project +import org.gradle.api.artifacts.repositories.PasswordCredentials import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.bundling.Jar import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.credentials import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.register @@ -132,6 +134,11 @@ fun Project.publishArtifact(artifact: LibraryArtifact) { artifact.version } } + maven { + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } } } } From 8274e4803a07f8d5003a374a20f4932ac5c1ef9b Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 21 Mar 2023 14:00:15 +0300 Subject: [PATCH 007/126] SDK Release: SDC, Engine, Workflow - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/1927 - With unmerged PR https://github.com/google/android-fhir/pull/1917 --- buildSrc/src/main/kotlin/Releases.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index d01507a815..0d1f4c8fd3 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,19 +50,19 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta02-preview13-SNAPSHOT" + override val version = "0.1.0-beta02-preview14-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview-SNAPSHOT" + override val version = "1.0.0-preview2-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha02-preview8-SNAPSHOT" + override val version = "0.1.0-alpha02-preview9-SNAPSHOT" override val name = "Android FHIR Workflow Library" } From d59c54275db03235046208b5c519b0e4cf160387 Mon Sep 17 00:00:00 2001 From: Allan Onchuru Date: Fri, 14 Apr 2023 19:30:09 +0300 Subject: [PATCH 008/126] SDK Release: Engine - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1917 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index dc1bb0a154..bcf7b5443c 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,7 +50,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03" + override val version = "0.1.0-beta03-preview-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 3c2bc65fbfcc43cfa94e87998496f78e5ad20bd0 Mon Sep 17 00:00:00 2001 From: Allan Onchuru Date: Mon, 17 Apr 2023 11:52:34 +0300 Subject: [PATCH 009/126] =?UTF-8?q?SDK=20Release:=20SDC=20=20=20-=20With?= =?UTF-8?q?=20unmerged=20PR=20https://github.com/google/android-fhir/pull/?= =?UTF-8?q?1973=20=C2=A0=20-=20With=20unmerged=20PR=20https://github.com/o?= =?UTF-8?q?pensrp/android-fhir/pull/1=20=C2=A0=20-=20With=20unmerged=20PR?= =?UTF-8?q?=20https://github.com/google/android-fhir/pull/1917?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index bcf7b5443c..d28a315233 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -56,7 +56,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview2-SNAPSHOT" + override val version = "1.0.0-preview3-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 9a5c079e2ab9ce61af70d2bbbe0faeb2fafb8906 Mon Sep 17 00:00:00 2001 From: Allan Onchuru Date: Wed, 26 Apr 2023 12:47:23 +0300 Subject: [PATCH 010/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1917 - With unmerged PR https://github.com/google/android-fhir/pull/1978 - With unmerged PR https://github.com/google/android-fhir/pull/1964 --- buildSrc/src/main/kotlin/Releases.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index c16150dbd7..c76b003d72 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,33 +50,33 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview-SNAPSHOT" + override val version = "0.1.0-beta03-preview1-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview3-SNAPSHOT" + override val version = "1.0.0-preview4-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha02-preview9-SNAPSHOT" + override val version = "0.1.0-alpha02-preview10-SNAPSHOT" override val name = "Android FHIR Workflow Library" } object Contrib { object Barcode : LibraryArtifact { override val artifactId = "contrib-barcode" - override val version = "0.1.0-beta3-preview4-SNAPSHOT" + override val version = "0.1.0-beta3-preview5-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" } } object Knowledge : LibraryArtifact { override val artifactId = "knowledger" - override val version = "0.1.0-alpha001" + override val version = "0.1.0-alpha001-preview-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From de945a5bb004b8f5ebbc838bb0a6f267fdcea14e Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 11 May 2023 18:26:55 +0300 Subject: [PATCH 011/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1917 - With unmerged PR https://github.com/google/android-fhir/pull/1978 - With unmerged PR https://github.com/google/android-fhir/pull/1964 - With unmerged PR https://github.com/google/android-fhir/pull/1963 - With unmerged PR https://github.com/google/android-fhir/pull/1907 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index c76b003d72..c4f1c236e4 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,13 +50,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview1-SNAPSHOT" + override val version = "0.1.0-beta03-preview3-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview4-SNAPSHOT" + override val version = "1.0.0-preview5-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From ffa535a2d9b5c9e995a9a98d36b71e900bfd5da6 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 23 May 2023 16:58:56 +0300 Subject: [PATCH 012/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR opensrp#1 - With unmerged PR #1917 - With unmerged PR #1978 - With unmerged PR #1964 - With unmerged PR #1907 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index d630acfbad..b51c253887 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,13 +50,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview3-SNAPSHOT" + override val version = "0.1.0-beta03-preview4-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview5-SNAPSHOT" + override val version = "1.0.0-preview6-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 6968bf1596e3fb9a528f78cc387d2f610286221b Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 15 Jun 2023 15:41:23 +0300 Subject: [PATCH 013/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR #1 - With unmerged PR google#1917 - With unmerged PR google#1978 - With unmerged PR google#1907 - With unmerged PR https://github.com/google/android-fhir/pull/2016 - With unmerged PR https://github.com/google/android-fhir/pull/2032 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index b51c253887..a7196f686c 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,13 +50,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview4-SNAPSHOT" + override val version = "0.1.0-beta03-preview6-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview6-SNAPSHOT" + override val version = "1.0.0-preview9-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From e87bf59055a6cbb82942d89da4b07cc473b4ec35 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 23 Jun 2023 16:53:07 +0300 Subject: [PATCH 014/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR #1 - With unmerged PR google#1917 - With unmerged PR google#1978 - With unmerged PR google#1907 - With unmerged PR https://github.com/google/android-fhir/pull/2016 - With unmerged PR https://github.com/google/android-fhir/pull/2032 - With unmerged PR https://github.com/google/android-fhir/pull/1669 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index a7196f686c..730f28e241 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,7 +50,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview6-SNAPSHOT" + override val version = "0.1.0-beta03-preview7-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 92b193818a1b8171e83a7f8e9a75e08ef318fea0 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 26 Jun 2023 17:03:10 +0300 Subject: [PATCH 015/126] SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger - With unmerged PR #1 - With unmerged PR google#1917 - With unmerged PR google#1978 - With unmerged PR google#1907 - With unmerged PR https://github.com/google/android-fhir/pull/2032 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/2047 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 730f28e241..ed812e8e26 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -50,7 +50,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview7-SNAPSHOT" + override val version = "0.1.0-beta03-preview8-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 7a45e18cf5280d60b1ebe8dfd08c9745134b4197 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:00:56 +0300 Subject: [PATCH 016/126] New API to support saving local only resources - https://github.com/google/android-fhir/issues/2123 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 ++ .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 4 ++++ .../main/java/com/google/android/fhir/testing/Utilities.kt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index f0cc2f72f9..376ff3b327 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -34,6 +34,8 @@ interface FhirEngine { */ suspend fun create(vararg resource: Resource): List + suspend fun createRemote(vararg resource: Resource) + /** Loads a FHIR resource given the class and the logical ID. */ suspend fun get(type: ResourceType, id: String): Resource diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 3b9911d66f..de35675a0b 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -44,6 +44,10 @@ internal class FhirEngineImpl(private val database: Database, private val contex return database.insert(*resource) } + override suspend fun createRemote(vararg resource: Resource) { + return database.insertRemote(*resource) + } + override suspend fun get(type: ResourceType, id: String): Resource { return database.select(type, id) } diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 59e035d41f..1e680aa479 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -133,6 +133,9 @@ open class TestDownloadManagerImpl( object TestFhirEngineImpl : FhirEngine { override suspend fun create(vararg resource: Resource) = emptyList() + override suspend fun createRemote(vararg resource: Resource) { + TODO("Not yet implemented") + } override suspend fun update(vararg resource: Resource) {} From 0cae3508363a28241912575623e7afb3e58f486f Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:02:19 +0300 Subject: [PATCH 017/126] API access for data in the LocalChangeEntity table - https://github.com/google/android-fhir/issues/2048 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 +- .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 3 +++ .../main/java/com/google/android/fhir/testing/Utilities.kt | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 376ff3b327..59ab1f3991 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -97,7 +97,7 @@ interface FhirEngine { * an empty list. */ suspend fun getLocalChanges(type: ResourceType, id: String): List - + suspend fun getUnsyncedLocalChanges(): List /** * Purges a resource from the database based on resource type and id without any deletion of data * from the server. diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index de35675a0b..e3a913990d 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -79,6 +79,9 @@ internal class FhirEngineImpl(private val database: Database, private val contex override suspend fun getLocalChanges(type: ResourceType, id: String): List { return database.getLocalChanges(type, id) } + // FhirEngineImpl.kt + override suspend fun getUnsyncedLocalChanges(): List = + database.getAllLocalChanges() override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) { database.purge(type, id, forcePurge) diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 1e680aa479..8e6666edfc 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -184,6 +184,10 @@ object TestFhirEngineImpl : FhirEngine { ) } + override suspend fun getUnsyncedLocalChanges(): List { + TODO("Not yet implemented") + } + override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) {} } From bb1f2eb06aede3f47ef8271d26870af6103e7da1 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:09:16 +0300 Subject: [PATCH 018/126] Add a SyncJobStatus result callback amid Sync retries - https://github.com/google/android-fhir/issues/2049 --- .../android/fhir/sync/FhirSyncWorker.kt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt b/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt index 148e3f01a7..772fad8348 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt @@ -21,6 +21,7 @@ import androidx.work.CoroutineWorker import androidx.work.Data import androidx.work.WorkerParameters import androidx.work.workDataOf +import ca.uhn.fhir.context.FhirContext import com.google.android.fhir.FhirEngine import com.google.android.fhir.FhirEngineProvider import com.google.android.fhir.OffsetDateTimeTypeAdapter @@ -29,6 +30,7 @@ import com.google.android.fhir.sync.upload.UploaderImpl import com.google.gson.ExclusionStrategy import com.google.gson.FieldAttributes import com.google.gson.GsonBuilder +import java.nio.charset.StandardCharsets import java.time.OffsetDateTime import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -36,6 +38,9 @@ import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch +import org.apache.commons.io.IOUtils +import org.hl7.fhir.r4.model.OperationOutcome +import retrofit2.HttpException import timber.log.Timber /** A WorkManager Worker that handles periodic sync. */ @@ -91,6 +96,9 @@ abstract class FhirSyncWorker(appContext: Context, workerParams: WorkerParameter ) .apply { subscribe(flow) } .synchronize() + + if (result is SyncJobStatus.Failed) onFailedSyncJobResult(result) + val output = buildWorkData(result) // await/join is needed to collect states completely @@ -118,6 +126,33 @@ abstract class FhirSyncWorker(appContext: Context, workerParams: WorkerParameter } } + open fun onFailedSyncJobResult(failedSyncJobStatus: SyncJobStatus.Failed) { + try { + CoroutineScope(Dispatchers.IO).launch { + val jsonParser = FhirContext.forR4().newJsonParser() + + (failedSyncJobStatus).exceptions.filterIsInstance().forEach { + resourceSyncHTTPException -> + val operationOutcome = + jsonParser.parseResource( + IOUtils.toString( + resourceSyncHTTPException.response()?.errorBody()?.byteStream(), + StandardCharsets.UTF_8 + ) + ) as OperationOutcome + + operationOutcome.issue.forEach { operationOutcome -> + Timber.e( + "SERVER ${operationOutcome.severity} - HTTP ${resourceSyncHTTPException.code()} | Code - ${operationOutcome.code} | Diagnostics - ${operationOutcome.diagnostics}" + ) + } + } + } + } catch (e: Exception) { + Timber.e(e) + } + } + private fun buildWorkData(state: SyncJobStatus): Data { return workDataOf( // send serialized state and type so that consumer can convert it back From a6b0ec272d1241e4fc45e4be22b764f1b19a9080 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 22 Aug 2023 18:26:32 +0300 Subject: [PATCH 019/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/google/android-fhir/pull/2032 - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/2132 - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 --- buildSrc/src/main/kotlin/Releases.kt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 1d49065c4e..2c0de7c5ce 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -15,7 +15,6 @@ */ import org.gradle.api.Project -import org.gradle.api.artifacts.repositories.PasswordCredentials import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.kotlin.dsl.configure @@ -43,25 +42,25 @@ object Releases { object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha04" + override val version = "0.1.0-alpha04-preview1-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta03-preview8-SNAPSHOT" + override val version = "0.1.0-beta03-preview10-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview9-SNAPSHOT" + override val version = "1.0.0-preview15-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha03" + override val version = "0.1.0-alpha03-preview1-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -75,7 +74,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha01-preview-SNAPSHOT" + override val version = "0.1.0-alpha01-preview2-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } @@ -127,11 +126,13 @@ fun Project.publishArtifact(artifact: LibraryArtifact) { artifact.version } } - maven { - credentials(PasswordCredentials::class) - url = uri("https://oss.sonatype.org/content/repositories/snapshots") - name = "sonatype" - } + // Weird quirk, build fails with this entry. Reverting to individual configuration per + // module + // maven { + // credentials(PasswordCredentials::class) + // url = uri("https://oss.sonatype.org/content/repositories/snapshots") + // name = "sonatype" + // } } } } From bf060ad192519749ad33758fd11d9b6f2cf5ec4d Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 18:18:34 +0300 Subject: [PATCH 020/126] Spotless formatting --- common/build.gradle.kts | 3 +-- contrib/barcode/build.gradle.kts | 3 +-- datacapture/build.gradle.kts | 3 ++- engine/build.gradle.kts | 4 ++-- knowledge/build.gradle.kts | 10 ++++++++++ workflow/build.gradle.kts | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 17ac60024a..0df63e6f0d 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -5,10 +5,9 @@ plugins { jacoco } -publishing{ +publishing { repositories { maven { - credentials(PasswordCredentials::class) url = uri("https://oss.sonatype.org/content/repositories/snapshots") name = "sonatype" diff --git a/contrib/barcode/build.gradle.kts b/contrib/barcode/build.gradle.kts index 2e4bf64560..861d85af1a 100644 --- a/contrib/barcode/build.gradle.kts +++ b/contrib/barcode/build.gradle.kts @@ -5,10 +5,9 @@ plugins { jacoco } -publishing{ +publishing { repositories { maven { - credentials(PasswordCredentials::class) url = uri("https://oss.sonatype.org/content/repositories/snapshots") name = "sonatype" diff --git a/datacapture/build.gradle.kts b/datacapture/build.gradle.kts index 27825d8f3a..aea69ae388 100644 --- a/datacapture/build.gradle.kts +++ b/datacapture/build.gradle.kts @@ -7,7 +7,8 @@ plugins { jacoco id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } -publishing{ + +publishing { repositories { maven { credentials(PasswordCredentials::class) diff --git a/engine/build.gradle.kts b/engine/build.gradle.kts index 0761f17293..19885d02c3 100644 --- a/engine/build.gradle.kts +++ b/engine/build.gradle.kts @@ -9,10 +9,10 @@ plugins { jacoco id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } -publishing{ + +publishing { repositories { maven { - credentials(PasswordCredentials::class) url = uri("https://oss.sonatype.org/content/repositories/snapshots") name = "sonatype" diff --git a/knowledge/build.gradle.kts b/knowledge/build.gradle.kts index 4cdbb8212c..721186b709 100644 --- a/knowledge/build.gradle.kts +++ b/knowledge/build.gradle.kts @@ -9,6 +9,16 @@ plugins { id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } +publishing { + repositories { + maven { + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} + publishArtifact(Releases.Knowledge) createJacocoTestReportTask() diff --git a/workflow/build.gradle.kts b/workflow/build.gradle.kts index 605adccdfb..d2ef9805d1 100644 --- a/workflow/build.gradle.kts +++ b/workflow/build.gradle.kts @@ -11,7 +11,7 @@ plugins { id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka) } -publishing{ +publishing { repositories { maven { credentials(PasswordCredentials::class) From 75f243da2ec22cc9b7605b25d2ad0383de39422c Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 28 Aug 2023 10:28:03 +0300 Subject: [PATCH 021/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/google/android-fhir/pull/2032 - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/2132 - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - With unmerged PR https://github.com/google/android-fhir/pull/2076 - With unmerged PR https://github.com/opensrp/android-fhir/pull/10 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 2c0de7c5ce..07a6c07fbb 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,7 +54,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview15-SNAPSHOT" + override val version = "1.0.0-preview16-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From d7036a96d129eda4139658c1c588341d6025d92c Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 7 Sep 2023 15:52:49 +0300 Subject: [PATCH 022/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/google/android-fhir/pull/2032 - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/2132 - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - With unmerged PR https://github.com/google/android-fhir/pull/2076 - With unmerged PR https://github.com/opensrp/android-fhir/pull/10 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index cbe31d828f..08fd99bed9 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta04" + override val version = "0.1.0-beta04-preview-SNAPSHOT" override val name = "Android FHIR Engine Library" } From edb284259a3ae1e8db4f36f3afafe7dbabdacc95 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 13 Sep 2023 11:19:11 +0300 Subject: [PATCH 023/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - With unmerged PR https://github.com/opensrp/android-fhir/pull/10 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 08fd99bed9..892218c76a 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta04-preview-SNAPSHOT" + override val version = "0.1.0-beta04-preview2-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview16-SNAPSHOT" + override val version = "1.0.0-preview17-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 95633d25a2fd29028ed0f17b4b3462d70c7f6530 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 14 Sep 2023 12:41:53 +0300 Subject: [PATCH 024/126] Refactor SquashedLocalChanges to LocalChanges --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 +- .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index a44c2c56c7..1046c3aa50 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -96,7 +96,7 @@ interface FhirEngine { * an empty list. */ suspend fun getLocalChanges(type: ResourceType, id: String): List - suspend fun getUnsyncedLocalChanges(): List + suspend fun getUnsyncedLocalChanges(): List /** * Purges a resource from the database based on resource type and id without any deletion of data * from the server. diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 3b08ac8c9c..5567e3f5d8 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -79,8 +79,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex return database.getLocalChanges(type, id) } // FhirEngineImpl.kt - override suspend fun getUnsyncedLocalChanges(): List = - database.getAllLocalChanges() + override suspend fun getUnsyncedLocalChanges(): List = database.getAllLocalChanges() override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) { database.purge(type, id, forcePurge) From e31fc6fcdb7562efeb44558564c30bc6be14b0a5 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:00:56 +0300 Subject: [PATCH 025/126] New API to support saving local only resources - https://github.com/google/android-fhir/issues/2123 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 ++ .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 4 ++++ .../main/java/com/google/android/fhir/testing/Utilities.kt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 59a2a1322e..fe06d2dd3b 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -33,6 +33,8 @@ interface FhirEngine { */ suspend fun create(vararg resource: Resource): List + suspend fun createRemote(vararg resource: Resource) + /** Loads a FHIR resource given the class and the logical ID. */ suspend fun get(type: ResourceType, id: String): Resource diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 3d90ed3114..d3d8849ac5 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -43,6 +43,10 @@ internal class FhirEngineImpl(private val database: Database, private val contex return database.insert(*resource) } + override suspend fun createRemote(vararg resource: Resource) { + return database.insertRemote(*resource) + } + override suspend fun get(type: ResourceType, id: String): Resource { return database.select(type, id) } diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 6b7a27ae57..3cfdaf01b7 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -133,6 +133,9 @@ open class TestDownloadManagerImpl( object TestFhirEngineImpl : FhirEngine { override suspend fun create(vararg resource: Resource) = emptyList() + override suspend fun createRemote(vararg resource: Resource) { + TODO("Not yet implemented") + } override suspend fun update(vararg resource: Resource) {} From efd34445937d79e2bacc8b84489360ced7fefdc7 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Sat, 16 Sep 2023 16:16:00 +0300 Subject: [PATCH 026/126] Add API to support saving local only resources --- .../com/google/android/fhir/FhirEngine.kt | 28 ++++--- .../android/fhir/impl/FhirEngineImpl.kt | 14 ++-- .../google/android/fhir/testing/Utilities.kt | 12 +-- .../android/fhir/impl/FhirEngineImplTest.kt | 78 ++++++++++++------- 4 files changed, 83 insertions(+), 49 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index fe06d2dd3b..b1e41239f7 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -33,6 +33,10 @@ interface FhirEngine { */ suspend fun create(vararg resource: Resource): List + /** + * Creates one or more remote FHIR [resource]s in the local storage without flagging as local + * changes. + */ suspend fun createRemote(vararg resource: Resource) /** Loads a FHIR resource given the class and the logical ID. */ @@ -55,7 +59,7 @@ interface FhirEngine { * api caller should [Flow.collect] it. */ suspend fun syncUpload( - upload: (suspend (List) -> Flow>) + upload: (suspend (List) -> Flow>), ) /** @@ -64,7 +68,7 @@ interface FhirEngine { */ suspend fun syncDownload( conflictResolver: ConflictResolver, - download: suspend () -> Flow> + download: suspend () -> Flow>, ) /** @@ -89,29 +93,32 @@ interface FhirEngine { * Retrieves a list of [LocalChange]s for [Resource] with given type and id, which can be used to * purge resource from database. If there is no local change for given [resourceType] and * [Resource.id], return an empty list. + * * @param type The [ResourceType] * @param id The resource id [Resource.id] * @return [List]<[LocalChange]> A list of local changes for given [resourceType] and - * [Resource.id] . If there is no local change for given [resourceType] and [Resource.id], return - * an empty list. + * [Resource.id] . If there is no local change for given [resourceType] and [Resource.id], + * return an empty list. */ suspend fun getLocalChanges(type: ResourceType, id: String): List /** * Purges a resource from the database based on resource type and id without any deletion of data * from the server. + * * @param type The [ResourceType] * @param id The resource id [Resource.id] * @param isLocalPurge default value is false here resource will not be deleted from - * LocalChangeEntity table but it will throw IllegalStateException("Resource has local changes - * either sync with server or FORCE_PURGE required") if local change exists. If true this API will - * delete resource entry from LocalChangeEntity table. + * LocalChangeEntity table but it will throw IllegalStateException("Resource has local changes + * either sync with server or FORCE_PURGE required") if local change exists. If true this API + * will delete resource entry from LocalChangeEntity table. */ suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean = false) } /** * Returns a FHIR resource of type [R] with [id] from the local storage. + * * @param The resource type which should be a subtype of [Resource]. * @throws ResourceNotFoundException if the resource is not found */ @@ -122,6 +129,7 @@ suspend inline fun FhirEngine.get(id: String): R { /** * Deletes a FHIR resource of type [R] with [id] from the local storage. + * * @param The resource type which should be a subtype of [Resource]. */ suspend inline fun FhirEngine.delete(id: String) { @@ -140,7 +148,7 @@ data class SearchResult( /** Matching referenced resources as per the [Search.include] criteria in the query. */ val included: Map>?, /** Matching referenced resources as per the [Search.revInclude] criteria in the query. */ - val revIncluded: Map, List>? + val revIncluded: Map, List>?, ) { override fun equals(other: Any?) = other is SearchResult<*> && @@ -157,7 +165,7 @@ data class SearchResult( private fun equalsShallow( first: Map>?, - second: Map>? + second: Map>?, ) = if (first != null && second != null && first.size == second.size) { first.entries.asSequence().zip(second.entries.asSequence()).all { (x, y) -> @@ -170,7 +178,7 @@ data class SearchResult( @JvmName("equalsShallowRevInclude") private fun equalsShallow( first: Map, List>?, - second: Map, List>? + second: Map, List>?, ) = if (first != null && second != null && first.size == second.size) { first.entries.asSequence().zip(second.entries.asSequence()).all { (x, y) -> diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index d3d8849ac5..158be8eff4 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -85,7 +85,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex override suspend fun syncDownload( conflictResolver: ConflictResolver, - download: suspend () -> Flow> + download: suspend () -> Flow>, ) { download().collect { resources -> database.withTransaction { @@ -93,7 +93,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex resolveConflictingResources( resources, getConflictingResourceIds(resources), - conflictResolver + conflictResolver, ) database.insertSyncedResources(resources) saveResolvedResourcesToDatabase(resolved) @@ -111,7 +111,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex private suspend fun resolveConflictingResources( resources: List, conflictingResourceIds: Set, - conflictResolver: ConflictResolver + conflictResolver: ConflictResolver, ) = resources .filter { conflictingResourceIds.contains(it.logicalId) } @@ -127,7 +127,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex .intersect(database.getAllLocalChanges().map { it.resourceId }.toSet()) override suspend fun syncUpload( - upload: suspend (List) -> Flow> + upload: suspend (List) -> Flow>, ) { val localChanges = database.getAllLocalChanges() if (localChanges.isNotEmpty()) { @@ -165,7 +165,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex id, type, getVersionFromETag(response.etag), - response.lastModified.toInstant() + response.lastModified.toInstant(), ) } } @@ -177,7 +177,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex resource.id, resource.resourceType, resource.meta.versionId, - resource.meta.lastUpdated.toInstant() + resource.meta.lastUpdated.toInstant(), ) } } @@ -201,9 +201,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex * [Bundle.BundleEntryResponseComponent.location]. * * [Bundle.BundleEntryResponseComponent.location] may be: - * * 1. absolute path: `///_history/` - * * 2. relative path: `//_history/` */ private val Bundle.BundleEntryResponseComponent.resourceIdAndType: Pair? diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 3cfdaf01b7..a0c23f7963 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -111,7 +111,7 @@ object TestDataSourceImpl : DataSource { } open class TestDownloadManagerImpl( - private val queries: List = listOf("Patient?address-city=NAIROBI") + private val queries: List = listOf("Patient?address-city=NAIROBI"), ) : DownloadWorkManager { private val urls = LinkedList(queries) @@ -133,6 +133,7 @@ open class TestDownloadManagerImpl( object TestFhirEngineImpl : FhirEngine { override suspend fun create(vararg resource: Resource) = emptyList() + override suspend fun createRemote(vararg resource: Resource) { TODO("Not yet implemented") } @@ -150,17 +151,18 @@ object TestFhirEngineImpl : FhirEngine { } override suspend fun syncUpload( - upload: suspend (List) -> Flow> + upload: suspend (List) -> Flow>, ) { upload(getLocalChanges(ResourceType.Patient, "123")).collect() } override suspend fun syncDownload( conflictResolver: ConflictResolver, - download: suspend () -> Flow> + download: suspend () -> Flow>, ) { download().collect() } + override suspend fun count(search: Search): Long { return 0 } @@ -179,8 +181,8 @@ object TestFhirEngineImpl : FhirEngine { payload = "{ 'resourceType' : 'Patient', 'id' : '123' }", token = LocalChangeToken(listOf()), type = LocalChange.Type.INSERT, - timestamp = Instant.now() - ) + timestamp = Instant.now(), + ), ) } diff --git a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt index d19d1b8dfc..59421d6095 100644 --- a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt +++ b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt @@ -77,6 +77,31 @@ class FhirEngineImplTest { assertResourceEquals(TEST_PATIENT_2, fhirEngine.get(TEST_PATIENT_2_ID)) } + @Test + fun createRemote_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { + val totalLocalChangesPatient2 = + fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size + fhirEngine.createRemote(TEST_PATIENT_2) + assertResourceEquals(TEST_PATIENT_2, fhirEngine.get(TEST_PATIENT_2_ID)) + assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size) + .isEqualTo(totalLocalChangesPatient2) + } + + @Test + fun createRemoteAll_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { + val totalLocalChangesPatient1 = + fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size + val totalLocalChangesPatient2 = + fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size + fhirEngine.createRemote(TEST_PATIENT_1, TEST_PATIENT_2) + assertResourceEquals(TEST_PATIENT_1, fhirEngine.get(TEST_PATIENT_1_ID)) + assertResourceEquals(TEST_PATIENT_2, fhirEngine.get(TEST_PATIENT_2_ID)) + assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size) + .isEqualTo(totalLocalChangesPatient1) + assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size) + .isEqualTo(totalLocalChangesPatient2) + } + @Test fun create_resourceWithoutId_shouldCreateResourceWithAssignedId() = runBlocking { val patient = @@ -85,7 +110,7 @@ class FhirEngineImplTest { HumanName().apply { family = "FamilyName" addGiven("GivenName") - } + }, ) } val ids = fhirEngine.create(patient.copy()) @@ -101,7 +126,7 @@ class FhirEngineImplTest { } assertThat(exception.message) .isEqualTo( - "Resource not found with type ${TEST_PATIENT_2.resourceType.name} and id $TEST_PATIENT_2_ID!" + "Resource not found with type ${TEST_PATIENT_2.resourceType.name} and id $TEST_PATIENT_2_ID!", ) } @@ -160,7 +185,7 @@ class FhirEngineImplTest { } assertThat(resourceNotFoundException.message) .isEqualTo( - "Resource not found with type ${ResourceType.Patient.name} and id nonexistent_patient!" + "Resource not found with type ${ResourceType.Patient.name} and id nonexistent_patient!", ) } @@ -175,7 +200,7 @@ class FhirEngineImplTest { listOf( buildPatient("3", "C", Enumerations.AdministrativeGender.FEMALE), buildPatient("2", "B", Enumerations.AdministrativeGender.FEMALE), - buildPatient("1", "A", Enumerations.AdministrativeGender.MALE) + buildPatient("1", "A", Enumerations.AdministrativeGender.MALE), ) fhirEngine.create(*patients.toTypedArray()) @@ -184,7 +209,7 @@ class FhirEngineImplTest { assertThat(result.size).isEqualTo(2) assertThat( - result.all { (it.resource as Patient).gender == Enumerations.AdministrativeGender.FEMALE } + result.all { (it.resource as Patient).gender == Enumerations.AdministrativeGender.FEMALE }, ) .isTrue() } @@ -195,7 +220,7 @@ class FhirEngineImplTest { listOf( buildPatient("3", "C", Enumerations.AdministrativeGender.FEMALE), buildPatient("2", "B", Enumerations.AdministrativeGender.FEMALE), - buildPatient("1", "A", Enumerations.AdministrativeGender.MALE) + buildPatient("1", "A", Enumerations.AdministrativeGender.MALE), ) fhirEngine.create(*patients.toTypedArray()) @@ -212,7 +237,7 @@ class FhirEngineImplTest { listOf( buildPatient("3", "C", Enumerations.AdministrativeGender.FEMALE), buildPatient("2", "B", Enumerations.AdministrativeGender.FEMALE), - buildPatient("1", "A", Enumerations.AdministrativeGender.MALE) + buildPatient("1", "A", Enumerations.AdministrativeGender.MALE), ) fhirEngine.create(*patients.toTypedArray()) @@ -258,7 +283,7 @@ class FhirEngineImplTest { }, buildPatient("2", "Patient2", Enumerations.AdministrativeGender.FEMALE).apply { meta = Meta().setTag(mutableListOf(Coding("http://d-tree.org/", "Tag2", "Tag 2"))) - } + }, ) fhirEngine.create(*patients.toTypedArray()) @@ -279,15 +304,15 @@ class FhirEngineImplTest { .setProfile( mutableListOf( CanonicalType( - "http://fhir.org/STU3/StructureDefinition/Example-Patient-Profile-1" - ) - ) + "http://fhir.org/STU3/StructureDefinition/Example-Patient-Profile-1", + ), + ), ) }, buildPatient("4", "C", Enumerations.AdministrativeGender.FEMALE).apply { meta = Meta().setProfile(mutableListOf(CanonicalType("http://d-tree.org/Diabetes-Patient"))) - } + }, ) fhirEngine.create(*patients.toTypedArray()) @@ -295,7 +320,7 @@ class FhirEngineImplTest { val result = fhirEngine .search( - "Patient?_profile=http://fhir.org/STU3/StructureDefinition/Example-Patient-Profile-1" + "Patient?_profile=http://fhir.org/STU3/StructureDefinition/Example-Patient-Profile-1", ) .map { it.resource as Patient } @@ -305,7 +330,7 @@ class FhirEngineImplTest { patient.meta.profile.all { it.value.equals("http://fhir.org/STU3/StructureDefinition/Example-Patient-Profile-1") } - } + }, ) .isTrue() } @@ -340,7 +365,7 @@ class FhirEngineImplTest { private fun buildPatient( patientId: String, name: String, - patientGender: Enumerations.AdministrativeGender + patientGender: Enumerations.AdministrativeGender, ) = Patient().apply { id = patientId @@ -436,7 +461,7 @@ class FhirEngineImplTest { } assertThat(resourceNotFoundException.message) .isEqualTo( - "Resource not found with type ${TEST_PATIENT_1.resourceType.name} and id $TEST_PATIENT_1_ID!" + "Resource not found with type ${TEST_PATIENT_1.resourceType.name} and id $TEST_PATIENT_1_ID!", ) assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID)).isEmpty() } @@ -450,7 +475,7 @@ class FhirEngineImplTest { } assertThat(resourceIllegalStateException.message) .isEqualTo( - "Resource with type ${TEST_PATIENT_1.resourceType.name} and id $TEST_PATIENT_1_ID has local changes, either sync with server or FORCE_PURGE required" + "Resource with type ${TEST_PATIENT_1.resourceType.name} and id $TEST_PATIENT_1_ID has local changes, either sync with server or FORCE_PURGE required", ) } @@ -462,9 +487,10 @@ class FhirEngineImplTest { } assertThat(resourceNotFoundException.message) .isEqualTo( - "Resource not found with type ${TEST_PATIENT_1.resourceType.name} and id nonexistent_patient!" + "Resource not found with type ${TEST_PATIENT_1.resourceType.name} and id nonexistent_patient!", ) } + fun syncDownload_conflictResolution_acceptRemote_shouldHaveNoLocalChangeAnymore() = runBlocking { val originalPatient = Patient().apply { @@ -478,7 +504,7 @@ class FhirEngineImplTest { HumanName().apply { family = "Stark" addGiven("Tony") - } + }, ) } fhirEngine.syncDownload(AcceptRemoteConflictResolver) { flowOf((listOf((originalPatient)))) } @@ -500,7 +526,7 @@ class FhirEngineImplTest { fhirEngine.syncDownload(AcceptRemoteConflictResolver) { flowOf((listOf(remoteChange))) } assertThat( - services.database.getAllLocalChanges().filter { it.resourceId == "Patient/original-001" } + services.database.getAllLocalChanges().filter { it.resourceId == "Patient/original-001" }, ) .isEmpty() assertResourceEquals(fhirEngine.get("original-001"), remoteChange) @@ -521,7 +547,7 @@ class FhirEngineImplTest { HumanName().apply { family = "Stark" addGiven("Tony") - } + }, ) } fhirEngine.syncDownload(AcceptLocalConflictResolver) { flowOf((listOf((originalPatient)))) } @@ -535,7 +561,7 @@ class FhirEngineImplTest { Address().apply { city = "Malibu" state = "California" - } + }, ) } fhirEngine.update(localChange) @@ -555,7 +581,7 @@ class FhirEngineImplTest { val localChangeDiff = """[{"op":"remove","path":"\/address\/0\/country"},{"op":"add","path":"\/address\/0\/city","value":"Malibu"},{"op":"add","path":"\/address\/-","value":{"city":"Malibu","state":"California"}}]""" assertThat( - services.database.getAllLocalChanges().first { it.resourceId == "original-002" }.payload + services.database.getAllLocalChanges().first { it.resourceId == "original-002" }.payload, ) .isEqualTo(localChangeDiff) assertResourceEquals(fhirEngine.get("original-002"), localChange) @@ -575,7 +601,7 @@ class FhirEngineImplTest { { value = of(DateTimeType(Date.from(localChangeTimestamp))) prefix = ParamPrefixEnum.EQUAL - } + }, ) } @@ -597,7 +623,7 @@ class FhirEngineImplTest { HumanName().apply { addGiven("John") family = "Doe" - } + }, ) } fhirEngine.update(patientUpdate) @@ -611,7 +637,7 @@ class FhirEngineImplTest { { value = of(DateTimeType(Date.from(localChangeTimestampWhenUpdated))) prefix = ParamPrefixEnum.EQUAL - } + }, ) } From 283ad6e9811e7a2eebdda406b8c06e0a3e9e637a Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 18 Sep 2023 10:55:05 +0300 Subject: [PATCH 027/126] Engine, SDC, Workflow, Knowledge - With unmerged PR https://github.com/opensrp/android-fhir/pull/1 - With unmerged PR https://github.com/google/android-fhir/pull/1669 - With unmerged PR https://github.com/google/android-fhir/pull/2178 - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - With unmerged PR https://github.com/opensrp/android-fhir/pull/10 --- buildSrc/src/main/kotlin/Releases.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 892218c76a..991dde9d45 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,19 +48,19 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta04-preview2-SNAPSHOT" + override val version = "0.1.0-beta04-preview3-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview17-SNAPSHOT" + override val version = "1.0.0-preview18-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha03-preview1-SNAPSHOT" + override val version = "0.1.0-alpha03-preview2-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -74,7 +74,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha01-preview2-SNAPSHOT" + override val version = "0.1.0-alpha01-preview3-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 1721a4a6c835e2d0fbc730c6886a72d36cf05d71 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 20 Sep 2023 10:51:34 +0300 Subject: [PATCH 028/126] Revert "New API to support saving local only resources" This reverts commit 7a45e18cf5280d60b1ebe8dfd08c9745134b4197. The changes will be introduced by the PR https://github.com/google/android-fhir/pull/2178 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 -- .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 4 ---- .../main/java/com/google/android/fhir/testing/Utilities.kt | 3 --- 3 files changed, 9 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 1769bb1b93..38f8d469ce 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -34,8 +34,6 @@ interface FhirEngine { */ suspend fun create(vararg resource: Resource): List - suspend fun createRemote(vararg resource: Resource) - /** Loads a FHIR resource given the class and the logical ID. */ suspend fun get(type: ResourceType, id: String): Resource diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 56cbfe2405..d7b4c8d0e8 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -44,10 +44,6 @@ internal class FhirEngineImpl(private val database: Database, private val contex return database.insert(*resource) } - override suspend fun createRemote(vararg resource: Resource) { - return database.insertRemote(*resource) - } - override suspend fun get(type: ResourceType, id: String): Resource { return database.select(type, id) } diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index cd3505cd5e..2169a75543 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -134,9 +134,6 @@ open class TestDownloadManagerImpl( object TestFhirEngineImpl : FhirEngine { override suspend fun create(vararg resource: Resource) = emptyList() - override suspend fun createRemote(vararg resource: Resource) { - TODO("Not yet implemented") - } override suspend fun update(vararg resource: Resource) {} From 658f9c498ff4ab7d261b54d0efaadc3518b5d3a4 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 21 Sep 2023 09:13:34 +0300 Subject: [PATCH 029/126] Engine, SDC - With unmerged PR https://github.com/opensrp/android-fhir/pull/11 - Wup https://github.com/google/android-fhir/pull/1669 - Wup https://github.com/google/android-fhir/pull/2076 - Wup https://github.com/opensrp/android-fhir/pull/9 - Wup https://github.com/google/android-fhir/pull/2178 - Wup https://github.com/opensrp/android-fhir/pull/10 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 991dde9d45..3da9f67280 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta04-preview3-SNAPSHOT" + override val version = "0.1.0-beta04-preview4-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview18-SNAPSHOT" + override val version = "1.0.0-preview19-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 78d5bb536f791d80f2310584b2f1acf5ca59b44a Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 21 Sep 2023 12:59:02 +0300 Subject: [PATCH 030/126] Refactor create local only changes API --- .../main/java/com/google/android/fhir/FhirEngine.kt | 10 +++------- .../main/java/com/google/android/fhir/db/Database.kt | 9 +++++++++ .../com/google/android/fhir/db/impl/DatabaseImpl.kt | 4 ++++ .../com/google/android/fhir/impl/FhirEngineImpl.kt | 8 ++------ .../java/com/google/android/fhir/testing/Utilities.kt | 7 ++----- .../com/google/android/fhir/impl/FhirEngineImplTest.kt | 4 ++-- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 0333fd54f6..4882a78775 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -30,15 +30,11 @@ interface FhirEngine { /** * Creates one or more FHIR [resource]s in the local storage. * + * @param isLocalOnly - Setting the value to [true] instructs engine that the resource and its + * subsequent updates should never be synced to the server. * @return the logical IDs of the newly created resources. */ - suspend fun create(vararg resource: Resource): List - - /** - * Creates one or more remote FHIR [resource]s in the local storage without flagging as local - * changes. - */ - suspend fun createRemote(vararg resource: Resource) + suspend fun create(vararg resource: Resource, isLocalOnly: Boolean = false): List /** Loads a FHIR resource given the class and the logical ID. */ suspend fun get(type: ResourceType, id: String): Resource diff --git a/engine/src/main/java/com/google/android/fhir/db/Database.kt b/engine/src/main/java/com/google/android/fhir/db/Database.kt index cbbc840b64..c8ea52b4fd 100644 --- a/engine/src/main/java/com/google/android/fhir/db/Database.kt +++ b/engine/src/main/java/com/google/android/fhir/db/Database.kt @@ -37,6 +37,15 @@ internal interface Database { */ suspend fun insert(vararg resource: R): List + /** + * Inserts a list of local `resources` into the FHIR resource database. If any of the resources + * already exists, it will be overwritten. + * + * @param The resource type + * @return the logical IDs of the newly created resources. + */ + suspend fun insertLocalOnly(vararg resource: R): List + /** * Inserts a list of remote `resources` into the FHIR resource database. If any of the resources * already exists, it will be overwritten. diff --git a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt index 8ca9fff23c..b2f7de8647 100644 --- a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt @@ -123,6 +123,10 @@ internal class DatabaseImpl( return logicalIds } + override suspend fun insertLocalOnly(vararg resource: R): List { + return db.withTransaction { resourceDao.insertAllRemote(resource.toList()) } + } + override suspend fun insertRemote(vararg resource: R) { db.withTransaction { resourceDao.insertAllRemote(resource.toList()) } } diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 8f82a10815..3c61d80f5b 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -40,12 +40,8 @@ import org.hl7.fhir.r4.model.ResourceType /** Implementation of [FhirEngine]. */ internal class FhirEngineImpl(private val database: Database, private val context: Context) : FhirEngine { - override suspend fun create(vararg resource: Resource): List { - return database.insert(*resource) - } - - override suspend fun createRemote(vararg resource: Resource) { - return database.insertRemote(*resource) + override suspend fun create(vararg resource: Resource, isLocalOnly: Boolean): List { + return if (isLocalOnly) database.insertLocalOnly(*resource) else database.insert(*resource) } override suspend fun get(type: ResourceType, id: String): Resource { diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 18b3f66596..94598c401d 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -133,11 +133,8 @@ open class TestDownloadManagerImpl( } object TestFhirEngineImpl : FhirEngine { - override suspend fun create(vararg resource: Resource) = emptyList() - - override suspend fun createRemote(vararg resource: Resource) { - TODO("Not yet implemented") - } + override suspend fun create(vararg resource: Resource, isLocalOnly: Boolean): List = + emptyList() override suspend fun update(vararg resource: Resource) {} diff --git a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt index f9d626941c..fa7a0e08de 100644 --- a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt +++ b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt @@ -82,7 +82,7 @@ class FhirEngineImplTest { fun createRemote_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { val totalLocalChangesPatient2 = fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size - fhirEngine.createRemote(TEST_PATIENT_2) + fhirEngine.create(TEST_PATIENT_2, isLocalOnly = true) assertResourceEquals(TEST_PATIENT_2, fhirEngine.get(TEST_PATIENT_2_ID)) assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size) .isEqualTo(totalLocalChangesPatient2) @@ -94,7 +94,7 @@ class FhirEngineImplTest { fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size val totalLocalChangesPatient2 = fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size - fhirEngine.createRemote(TEST_PATIENT_1, TEST_PATIENT_2) + fhirEngine.create(TEST_PATIENT_1, TEST_PATIENT_2, isLocalOnly = true) assertResourceEquals(TEST_PATIENT_1, fhirEngine.get(TEST_PATIENT_1_ID)) assertResourceEquals(TEST_PATIENT_2, fhirEngine.get(TEST_PATIENT_2_ID)) assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size) From 563c233a2340b9aae1113f7e5fd01ac4f66b0d15 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 21 Sep 2023 13:05:47 +0300 Subject: [PATCH 031/126] Rename test cases --- .../java/com/google/android/fhir/impl/FhirEngineImplTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt index fa7a0e08de..06490cd545 100644 --- a/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt +++ b/engine/src/test/java/com/google/android/fhir/impl/FhirEngineImplTest.kt @@ -79,7 +79,7 @@ class FhirEngineImplTest { } @Test - fun createRemote_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { + fun create_isLocalOnlyTrue_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { val totalLocalChangesPatient2 = fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size fhirEngine.create(TEST_PATIENT_2, isLocalOnly = true) @@ -89,7 +89,7 @@ class FhirEngineImplTest { } @Test - fun createRemoteAll_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { + fun createAll_isLocalOnlyTrue_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking { val totalLocalChangesPatient1 = fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size val totalLocalChangesPatient2 = From 7d7d440852678ebd734e48837ebdb8ac9ba441d2 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 21 Sep 2023 13:08:49 +0300 Subject: [PATCH 032/126] Revert return type for Test Utilites create method signature --- .../src/main/java/com/google/android/fhir/testing/Utilities.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index 94598c401d..4e519c90d5 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -133,8 +133,7 @@ open class TestDownloadManagerImpl( } object TestFhirEngineImpl : FhirEngine { - override suspend fun create(vararg resource: Resource, isLocalOnly: Boolean): List = - emptyList() + override suspend fun create(vararg resource: Resource, isLocalOnly: Boolean) = emptyList() override suspend fun update(vararg resource: Resource) {} From c9ca366fd87c533d940b089baf10deea4118106c Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 13 Oct 2023 12:31:57 +0300 Subject: [PATCH 033/126] Disable eTAGs for Uploads Disable using eTAGs - Fixes HTTP 400 exception during transaction bundle sync *Resources:* - https://github.com/hapifhir/hapi-fhir/issues/3575 - https://github.com/opensrp/fhircore/pull/2481 --- .../main/java/com/google/android/fhir/sync/upload/Uploader.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/main/java/com/google/android/fhir/sync/upload/Uploader.kt b/engine/src/main/java/com/google/android/fhir/sync/upload/Uploader.kt index b5a8ee66d8..6b479a42d3 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/upload/Uploader.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/upload/Uploader.kt @@ -40,7 +40,7 @@ import timber.log.Timber */ internal class Uploader(private val dataSource: DataSource) { private val patchGenerator = PerResourcePatchGenerator - private val requestGenerator = TransactionBundleGenerator.getDefault() + private val requestGenerator = TransactionBundleGenerator.getDefault(useETagForUpload = false) suspend fun upload(localChanges: List): UploadSyncResult { val patches = patchGenerator.generate(localChanges) From ac92d70af41dcad9439c2b8298104f90c19507ce Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 13 Oct 2023 12:59:34 +0300 Subject: [PATCH 034/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/opensrp/android-fhir/pull/11 - Wup https://github.com/google/android-fhir/pull/1669 - Wup https://github.com/opensrp/android-fhir/pull/9 - Wup https://github.com/google/android-fhir/pull/2178 - Wup https://github.com/opensrp/android-fhir/pull/10 - Wup https://github.com/google/android-fhir/pull/2230 - Wup https://github.com/google/android-fhir/pull/2262 --- buildSrc/src/main/kotlin/Releases.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 99bbccaa72..164ac9f9bc 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -42,25 +42,25 @@ object Releases { object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha05" + override val version = "0.1.0-alpha05-preview-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta04-preview4-SNAPSHOT" + override val version = "0.1.0-beta04-preview5-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview19-SNAPSHOT" + override val version = "1.0.0-preview20-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha03-preview2-SNAPSHOT" + override val version = "0.1.0-alpha03-preview3-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -74,7 +74,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha02" + override val version = "0.1.0-alpha02-preview-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 136833ad3271adc7023a76d862c6bf04c4719210 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 13 Oct 2023 14:51:13 +0300 Subject: [PATCH 035/126] Apply Spotless --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 ++ .../java/com/google/android/fhir/impl/FhirEngineImpl.kt | 1 + .../java/com/google/android/fhir/sync/FhirSyncWorker.kt | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 8c38aa94fa..da6437394c 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -105,7 +105,9 @@ interface FhirEngine { * return an empty list. */ suspend fun getLocalChanges(type: ResourceType, id: String): List + suspend fun getUnsyncedLocalChanges(): List + /** * Purges a resource from the database based on resource type and id without any deletion of data * from the server. diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index d70233efbe..36fe8c984b 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -77,6 +77,7 @@ internal class FhirEngineImpl(private val database: Database, private val contex override suspend fun getLocalChanges(type: ResourceType, id: String): List { return database.getLocalChanges(type, id) } + // FhirEngineImpl.kt override suspend fun getUnsyncedLocalChanges(): List = database.getAllLocalChanges() diff --git a/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt b/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt index 6a51fc7715..5ac262d89f 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt @@ -127,13 +127,13 @@ abstract class FhirSyncWorker(appContext: Context, workerParams: WorkerParameter jsonParser.parseResource( IOUtils.toString( resourceSyncHTTPException.response()?.errorBody()?.byteStream(), - StandardCharsets.UTF_8 - ) + StandardCharsets.UTF_8, + ), ) as OperationOutcome operationOutcome.issue.forEach { operationOutcome -> Timber.e( - "SERVER ${operationOutcome.severity} - HTTP ${resourceSyncHTTPException.code()} | Code - ${operationOutcome.code} | Diagnostics - ${operationOutcome.diagnostics}" + "SERVER ${operationOutcome.severity} - HTTP ${resourceSyncHTTPException.code()} | Code - ${operationOutcome.code} | Diagnostics - ${operationOutcome.diagnostics}", ) } } From 111c6629d91b2c503ffa83b76b50d8f4c42ac7f9 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 30 Oct 2023 12:40:07 +0300 Subject: [PATCH 036/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/opensrp/android-fhir/pull/11 - Wup https://github.com/google/android-fhir/pull/1669 - Wup https://github.com/opensrp/android-fhir/pull/9 - Wup https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Dependencies.kt | 8 ++++---- buildSrc/src/main/kotlin/Releases.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 34711c988f..a844ffa424 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -133,7 +133,7 @@ object Dependencies { "com.google.mlkit:object-detection-custom:${Versions.Mlkit.objectDetectionCustom}" } - const val androidFhirGroup = "com.google.android.fhir" + const val androidFhirGroup = "org.smartregister" const val androidFhirEngineModule = "engine" const val androidFhirKnowledgeModule = "knowledge" const val androidFhirCommon = "$androidFhirGroup:common:${Versions.androidFhirCommon}" @@ -219,9 +219,9 @@ object Dependencies { const val stdlib = "1.8.20" } - const val androidFhirCommon = "0.1.0-alpha05" - const val androidFhirEngine = "0.1.0-beta05" - const val androidFhirKnowledge = "0.1.0-alpha03" + const val androidFhirCommon = "0.1.0-alpha05-preview-SNAPSHOT" + const val androidFhirEngine = "0.1.0-beta05-preview1-SNAPSHOT" + const val androidFhirKnowledge = "0.1.0-alpha03-preview-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" const val caffeine = "2.9.1" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 1280d22110..a6f8476d9c 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,19 +48,19 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05" + override val version = "0.1.0-beta05-preview1-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview20-SNAPSHOT" + override val version = "1.0.0-preview22-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04" + override val version = "0.1.0-alpha04-preview-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -74,7 +74,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03" + override val version = "0.1.0-alpha03-preview-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From afbfd9a07e7e6cd6777c93131ae88c1a29a54372 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 30 Oct 2023 13:45:59 +0300 Subject: [PATCH 037/126] Fix build for Insert Local Only --- .../main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt index 34ab857068..de6584cefb 100644 --- a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt @@ -38,6 +38,7 @@ import java.time.Instant import java.util.UUID import org.hl7.fhir.r4.model.Resource import org.hl7.fhir.r4.model.ResourceType +import java.util.Collections /** * The implementation for the persistence layer using Room. See docs for @@ -140,7 +141,7 @@ internal class DatabaseImpl( } override suspend fun insertLocalOnly(vararg resource: R): List { - return db.withTransaction { resourceDao.insertAllRemote(resource.toList()) } + return db.withTransaction { resourceDao.insertAllRemote(resource.toList()).map { it.toString() }.toList() } } override suspend fun insertRemote(vararg resource: R) { From 5276c82480313773aeb6df76e832e4c6a62fe3d2 Mon Sep 17 00:00:00 2001 From: Rkareko Date: Fri, 24 Nov 2023 18:27:33 +0300 Subject: [PATCH 038/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR https://github.com/opensrp/android-fhir/pull/11 - Wup https://github.com/google/android-fhir/pull/1669 - Wup https://github.com/opensrp/android-fhir/pull/9 - Wup https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index a6f8476d9c..c72b399388 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05-preview1-SNAPSHOT" + override val version = "0.1.0-beta05-preview3-SNAPSHOT" override val name = "Android FHIR Engine Library" } From d03017af2b709136d3de860cd5673558d9d00056 Mon Sep 17 00:00:00 2001 From: Rkareko Date: Tue, 19 Dec 2023 13:57:20 +0300 Subject: [PATCH 039/126] Engine, SDC, Workflow, Common, Knowledge - With unmerged PR #11 - Wup google#1669 - Wup #9 - Wup google#2178 --- buildSrc/src/main/kotlin/Releases.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index c72b399388..194282305e 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -42,25 +42,25 @@ object Releases { object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha05-preview-SNAPSHOT" + override val version = "0.1.0-alpha05-preview1-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05-preview3-SNAPSHOT" + override val version = "0.1.0-beta05-preview4-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview22-SNAPSHOT" + override val version = "1.0.0-preview23-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview-SNAPSHOT" + override val version = "0.1.0-alpha04-preview1-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -74,7 +74,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview-SNAPSHOT" + override val version = "0.1.0-alpha03-preview1-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 6ebc36debbee309fc0ed099cb804b246863927d4 Mon Sep 17 00:00:00 2001 From: Rkareko Date: Wed, 20 Dec 2023 04:47:43 +0300 Subject: [PATCH 040/126] Disable eTAGs for Uploads --- .../android/fhir/sync/upload/request/UploadRequestGenerator.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/src/main/java/com/google/android/fhir/sync/upload/request/UploadRequestGenerator.kt b/engine/src/main/java/com/google/android/fhir/sync/upload/request/UploadRequestGenerator.kt index 62a4612d97..ebdb63a490 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/upload/request/UploadRequestGenerator.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/upload/request/UploadRequestGenerator.kt @@ -59,6 +59,7 @@ internal object UploadRequestGeneratorFactory { TransactionBundleGenerator.getGenerator( mode.httpVerbToUseForCreate, mode.httpVerbToUseForUpdate, + useETagForUpload = false ) } } From dfe6232bbeb9b093855035a1550187db851a507f Mon Sep 17 00:00:00 2001 From: Rkareko Date: Tue, 9 Jan 2024 14:53:13 +0300 Subject: [PATCH 041/126] Engine, SDC, Workflow, Common, Knowledge, Datacapture, Contrib, Catalog - With unmerged PR #11 - Wup google#1669 - Wup #9 - Wup google#2178 --- buildSrc/src/main/kotlin/Releases.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 194282305e..74bd028c4d 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -42,39 +42,39 @@ object Releases { object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha05-preview1-SNAPSHOT" + override val version = "0.1.0-alpha05-preview2-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05-preview4-SNAPSHOT" + override val version = "0.1.0-beta05-preview5-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.0.0-preview23-SNAPSHOT" + override val version = "1.0.0-preview24-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview1-SNAPSHOT" + override val version = "0.1.0-alpha04-preview2-SNAPSHOT" override val name = "Android FHIR Workflow Library" } object Contrib { object Barcode : LibraryArtifact { override val artifactId = "contrib-barcode" - override val version = "0.1.0-beta3-preview5-SNAPSHOT" + override val version = "0.1.0-beta3-preview6-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" } } object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview1-SNAPSHOT" + override val version = "0.1.0-alpha03-preview2-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 219cd36a9990a44740dce31e196c3a0876b96398 Mon Sep 17 00:00:00 2001 From: Rkareko Date: Wed, 10 Jan 2024 12:44:04 +0300 Subject: [PATCH 042/126] Engine, Workflow - With unmerged PR #11 - Wup google#1669 - Wup #9 - Wup google#2178 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 74bd028c4d..d341713ea4 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05-preview5-SNAPSHOT" + override val version = "0.1.0-beta05-preview6-SNAPSHOT" override val name = "Android FHIR Engine Library" } @@ -60,7 +60,7 @@ object Releases { object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview2-SNAPSHOT" + override val version = "0.1.0-alpha04-preview3-SNAPSHOT" override val name = "Android FHIR Workflow Library" } From 64ffbae29834227dbbc5a1f59f95a5571531ef5b Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 22 Jan 2024 14:00:10 +0300 Subject: [PATCH 043/126] SDC, Engine, Workflow - With unmerged PR https://github.com/google/android-fhir/pull/11 - Wup https://github.com/google/android-fhir/pull/1669 - Wup https://github.com/google/android-fhir/pull/9 - Wup https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Dependencies.kt | 6 +++--- buildSrc/src/main/kotlin/Releases.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 4188123d79..4d64f753d5 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -247,9 +247,9 @@ object Dependencies { const val stdlib = "1.8.20" } - const val androidFhirCommon = "0.1.0-alpha05-preview-SNAPSHOT" - const val androidFhirEngine = "0.1.0-beta05-preview1-SNAPSHOT" - const val androidFhirKnowledge = "0.1.0-alpha03-preview-SNAPSHOT" + const val androidFhirCommon = "0.1.0-alpha05-preview2-SNAPSHOT" + const val androidFhirEngine = "0.1.0-beta05-preview7-SNAPSHOT" + const val androidFhirKnowledge = "0.1.0-alpha03-preview2-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" const val caffeine = "2.9.1" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index dc4dbea6cc..7ae69ab45f 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,19 +48,19 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "0.1.0-beta05-preview6-SNAPSHOT" + override val version = "0.1.0-beta05-preview7-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0" + override val version = "1.1.0-preview-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview3-SNAPSHOT" + override val version = "0.1.0-alpha04-preview4-SNAPSHOT" override val name = "Android FHIR Workflow Library" } From e049913eb9905f711f1ff5de5fc3752702d01833 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 24 Jan 2024 14:00:27 +0300 Subject: [PATCH 044/126] SDC : Minor Data capture version update --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 7ae69ab45f..9d3e4d59e4 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,7 +54,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview-SNAPSHOT" + override val version = "1.1.0-preview1-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 4f0fea0b0c453f7bb0316304af78f20b0ddae84f Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 7 Feb 2024 15:45:15 +0300 Subject: [PATCH 045/126] Release Engine, SDC * With unmerged PRS - https://github.com/opensrp/android-fhir/pull/9 - https://github.com/google/android-fhir/pull/2420 - https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 4d64f753d5..b2e5c1e964 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -248,7 +248,7 @@ object Dependencies { } const val androidFhirCommon = "0.1.0-alpha05-preview2-SNAPSHOT" - const val androidFhirEngine = "0.1.0-beta05-preview7-SNAPSHOT" + const val androidFhirEngine = "1.0.0-preview1-SNAPSHOT" const val androidFhirKnowledge = "0.1.0-alpha03-preview2-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 3b6afdb180..c639d7f95c 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0" + override val version = "1.0.0-preview2-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview1-SNAPSHOT" + override val version = "1.1.0-preview4-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 3e4ccf83ac70ae78e5b4c612f2d149207a78c5f9 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 9 Feb 2024 21:42:04 +0300 Subject: [PATCH 046/126] Release SDC, Workflow * With unmerged PRS - https://github.com/opensrp/android-fhir/pull/9 - https://github.com/google/android-fhir/pull/2420 - https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 75946211c2..b10f5e8612 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -252,7 +252,7 @@ object Dependencies { } const val androidFhirCommon = "0.1.0-alpha05-preview2-SNAPSHOT" - const val androidFhirEngine = "1.0.0-preview1-SNAPSHOT" + const val androidFhirEngine = "1.0.0-preview2-SNAPSHOT" const val androidFhirKnowledge = "0.1.0-alpha03-preview2-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index f6c5837a59..526e2a3658 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,13 +54,13 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview4-SNAPSHOT" + override val version = "1.1.0-preview5-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview4-SNAPSHOT" + override val version = "0.1.0-alpha04-preview5-SNAPSHOT" override val name = "Android FHIR Workflow Library" } From e6439e33efba21a254bccf956f411e34d8208952 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 9 Feb 2024 21:35:15 +0300 Subject: [PATCH 047/126] Update Clinical Reasoning version to PRE9 --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 5469d71f81..7fb6a4b1dd 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -244,7 +244,7 @@ object Dependencies { } object Cql { - const val clinicalReasoning = "3.0.0-PRE9-SNAPSHOT" + const val clinicalReasoning = "3.0.0-PRE9" } object Kotlin { From 7097dfbbd144151fff231d69cee686f2caaecb07 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 9 Feb 2024 21:33:04 +0300 Subject: [PATCH 048/126] Expose overloaded API for evaluateMeasure - Implement evaluateMeasure API method in the FHIR Operator with Measure as parameter --- .../FhirEngineR4MeasureProcessor.java | 62 +++++++++++++++++++ .../android/fhir/workflow/FhirOperator.kt | 55 +++++++++++++++- 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 workflow/src/main/java/com/google/android/fhir/workflow/FhirEngineR4MeasureProcessor.java diff --git a/workflow/src/main/java/com/google/android/fhir/workflow/FhirEngineR4MeasureProcessor.java b/workflow/src/main/java/com/google/android/fhir/workflow/FhirEngineR4MeasureProcessor.java new file mode 100644 index 0000000000..a13540e501 --- /dev/null +++ b/workflow/src/main/java/com/google/android/fhir/workflow/FhirEngineR4MeasureProcessor.java @@ -0,0 +1,62 @@ +package com.google.android.fhir.workflow; + +import org.hl7.fhir.instance.model.api.IBaseBundle; +import org.hl7.fhir.r4.model.Measure; +import org.hl7.fhir.r4.model.MeasureReport; +import org.opencds.cqf.fhir.api.Repository; +import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions; +import org.opencds.cqf.fhir.cr.measure.common.MeasureEvalType; +import org.opencds.cqf.fhir.cr.measure.common.SubjectProvider; +import org.opencds.cqf.fhir.cr.measure.r4.R4MeasureProcessor; +import org.opencds.cqf.fhir.cr.measure.r4.R4RepositorySubjectProvider; +import org.opencds.cqf.fhir.utility.repository.FederatedRepository; +import org.opencds.cqf.fhir.utility.repository.InMemoryFhirRepository; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.stream.Collectors; + +public class FhirEngineR4MeasureProcessor extends R4MeasureProcessor { + private static String FIELD_SUBJECT_PROVIDER="subjectProvider"; + private Repository repository; + + public FhirEngineR4MeasureProcessor(Repository repository, MeasureEvaluationOptions measureEvaluationOptions) { + super(repository, measureEvaluationOptions); + this.repository = repository; + } + + public FhirEngineR4MeasureProcessor(Repository repository, MeasureEvaluationOptions measureEvaluationOptions, SubjectProvider subjectProvider) { + super(repository, measureEvaluationOptions, subjectProvider); + this.repository = repository; + } + + @Override + public MeasureReport evaluateMeasure(Measure measure, String periodStart, String periodEnd, String reportType, List subjectIds, IBaseBundle additionalData, MeasureEvalType evalType) { + var actualRepo = this.repository; + if (additionalData != null) { + actualRepo = new FederatedRepository( + this.repository, new InMemoryFhirRepository(this.repository.fhirContext(), additionalData)); + } + + SubjectProvider subjectProvider = getSubjectProvider(); + var subjects = subjectProvider.getSubjects(actualRepo, evalType, subjectIds).collect(Collectors.toList()); + return super.evaluateMeasure( measure, periodStart, periodEnd, reportType, subjects, additionalData, evalType) ; + } + + + /*** + * We have two constructors that could result in different subject providers. So for this field we will use reflection + * @return [SubjectProvider] the SubjectProvider + */ + public SubjectProvider getSubjectProvider(){ + SubjectProvider subjectProvider; + try { + Field field = this.getClass().getSuperclass().getDeclaredField(FIELD_SUBJECT_PROVIDER); + field.setAccessible(true); + subjectProvider = (SubjectProvider) field.get(this); + }catch (Exception e){ + subjectProvider = null; + } + return subjectProvider; + } +} diff --git a/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt b/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt index 81ca998e40..abd727b026 100644 --- a/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt +++ b/workflow/src/main/java/com/google/android/fhir/workflow/FhirOperator.kt @@ -31,6 +31,7 @@ import org.hl7.fhir.instance.model.api.IBaseParameters import org.hl7.fhir.instance.model.api.IBaseResource import org.hl7.fhir.r4.model.CanonicalType import org.hl7.fhir.r4.model.IdType +import org.hl7.fhir.r4.model.Measure import org.hl7.fhir.r4.model.MeasureReport import org.hl7.fhir.r4.model.Parameters import org.hl7.fhir.r4.model.PlanDefinition @@ -38,8 +39,8 @@ import org.hl7.fhir.r4.model.Reference import org.opencds.cqf.fhir.cql.EvaluationSettings import org.opencds.cqf.fhir.cql.LibraryEngine import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions +import org.opencds.cqf.fhir.cr.measure.common.MeasureEvalType import org.opencds.cqf.fhir.cr.measure.common.MeasureReportType -import org.opencds.cqf.fhir.cr.measure.r4.R4MeasureProcessor import org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor import org.opencds.cqf.fhir.utility.monad.Eithers import org.opencds.cqf.fhir.utility.repository.ProxyRepository @@ -68,7 +69,8 @@ internal constructor( private val libraryProcessor = LibraryEngine(repository, evaluationSettings) - private val measureProcessor = R4MeasureProcessor(repository, measureEvaluationOptions) + private val measureProcessor: FhirEngineR4MeasureProcessor = + FhirEngineR4MeasureProcessor(repository, measureEvaluationOptions) private val planDefinitionProcessor = PlanDefinitionProcessor(repository, evaluationSettings) /** @@ -209,6 +211,55 @@ internal constructor( return report } + /** + * Generates a [MeasureReport] based on the provided inputs. + * + * NOTE: The API may internally result in a blocking IO operation. The user should call the API + * from a worker thread or it may throw [BlockingMainThreadException] exception. + */ + @WorkerThread + fun evaluateMeasure( + measure: Measure, + start: String, + end: String, + reportType: String, + subjectId: String? = null, + practitioner: String? = null, + additionalData: IBaseBundle? = null, + ): MeasureReport { + val subject = + if (!practitioner.isNullOrBlank()) { + checkAndAddType(practitioner, "Practitioner") + } else if (!subjectId.isNullOrBlank()) { + checkAndAddType(subjectId, "Patient") + } else { + // List of null is required to run population-level measures + null + } + val evalType = + MeasureEvalType.fromCode(reportType) + .orElse( + if (!subjectId.isNullOrEmpty()) MeasureEvalType.SUBJECT else MeasureEvalType.POPULATION, + ) as MeasureEvalType + + val report = + measureProcessor.evaluateMeasure( + /* measure = */ measure, + /* periodStart = */ start, + /* periodEnd = */ end, + /* reportType = */ reportType, + /* subjectIds = */ if (subject.isNullOrEmpty()) listOf() else listOf(subject), + /* additionalData = */ additionalData, + /* evalType = */ evalType, + ) + + // add subject reference for non-individual reportTypes + if (report.type.name == MeasureReportType.SUMMARY.name && !subject.isNullOrBlank()) { + report.setSubject(Reference(subject)) + } + return report + } + /** * Generates a [CarePlan] based on the provided inputs. * From c5cb3c73ff525f4422540284c0a35fdc0bef38a0 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 12 Feb 2024 10:47:08 +0300 Subject: [PATCH 049/126] Release SDC, Workflow, Location Widget * With unmerged PRS - https://github.com/opensrp/android-fhir/pull/9 - https://github.com/google/android-fhir/pull/2420 - https://github.com/google/android-fhir/pull/2178 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- contrib/locationwidget/build.gradle.kts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 526e2a3658..bfc7e89c1d 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -60,7 +60,7 @@ object Releases { object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview5-SNAPSHOT" + override val version = "0.1.0-alpha04-preview6-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -73,7 +73,7 @@ object Releases { object LocationWidget : LibraryArtifact { override val artifactId = "contrib-locationwidget" - override val version = "0.1.0-alpha01" + override val version = "0.1.0-alpha01-preview-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Location Widget Extensions (contrib)" } diff --git a/contrib/locationwidget/build.gradle.kts b/contrib/locationwidget/build.gradle.kts index 324638d7d0..08df914de7 100644 --- a/contrib/locationwidget/build.gradle.kts +++ b/contrib/locationwidget/build.gradle.kts @@ -7,6 +7,16 @@ plugins { jacoco } +publishing { + repositories { + maven { + credentials(PasswordCredentials::class) + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + name = "sonatype" + } + } +} + publishArtifact(Releases.Contrib.LocationWidget) createJacocoTestReportTask() From 207190c294a32dbc4bd2719115870968435662c3 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 19 Mar 2024 12:04:43 +0300 Subject: [PATCH 050/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - With unmerged PR https://github.com/google/android-fhir/pull/2420 - WUP PR https://github.com/google/android-fhir/pull/2178/ --- buildSrc/src/main/kotlin/Dependencies.kt | 6 +++--- buildSrc/src/main/kotlin/Releases.kt | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index b10f5e8612..e4e35401fa 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -251,9 +251,9 @@ object Dependencies { const val stdlib = "1.8.20" } - const val androidFhirCommon = "0.1.0-alpha05-preview2-SNAPSHOT" - const val androidFhirEngine = "1.0.0-preview2-SNAPSHOT" - const val androidFhirKnowledge = "0.1.0-alpha03-preview2-SNAPSHOT" + const val androidFhirCommon = "0.1.0-alpha05-preview3-SNAPSHOT" + const val androidFhirEngine = "1.0.0-preview3-SNAPSHOT" + const val androidFhirKnowledge = "0.1.0-alpha03-preview3-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" const val caffeine = "2.9.1" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index bfc7e89c1d..681fdd2b77 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -42,38 +42,38 @@ object Releases { object Common : LibraryArtifact { override val artifactId = "common" - override val version = "0.1.0-alpha05-preview2-SNAPSHOT" + override val version = "0.1.0-alpha05-preview3-SNAPSHOT" override val name = "Android FHIR Common Library" } object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview2-SNAPSHOT" + override val version = "1.0.0-preview4-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview5-SNAPSHOT" + override val version = "1.1.0-preview6-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview6-SNAPSHOT" + override val version = "0.1.0-alpha04-preview8-SNAPSHOT" override val name = "Android FHIR Workflow Library" } object Contrib { object Barcode : LibraryArtifact { override val artifactId = "contrib-barcode" - override val version = "0.1.0-beta3-preview6-SNAPSHOT" + override val version = "0.1.0-beta3-preview7-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)" } object LocationWidget : LibraryArtifact { override val artifactId = "contrib-locationwidget" - override val version = "0.1.0-alpha01-preview-SNAPSHOT" + override val version = "0.1.0-alpha01-preview2-SNAPSHOT" override val name = "Android FHIR Structured Data Capture - Location Widget Extensions (contrib)" } @@ -81,7 +81,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview2-SNAPSHOT" + override val version = "0.1.0-alpha03-preview3-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 91795e8666cc21327e632dbb5fe4da610a1287f0 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 22 Mar 2024 18:44:42 +0300 Subject: [PATCH 051/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 681fdd2b77..00fe162a98 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview4-SNAPSHOT" + override val version = "1.0.0-preview5-SNAPSHOT" override val name = "Android FHIR Engine Library" } From f7a23c9a518e0f9626a92496a510a0ca1eb70433 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 27 Mar 2024 14:19:48 +0300 Subject: [PATCH 052/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 00fe162a98..18efa67068 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,7 +54,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview6-SNAPSHOT" + override val version = "1.1.0-preview7-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } @@ -81,7 +81,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview3-SNAPSHOT" + override val version = "0.1.0-alpha03-preview3.1-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 5643dd0e55094f5b66d9f86f6efefb46688a5614 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 19 Apr 2024 18:21:23 +0300 Subject: [PATCH 053/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ --- buildSrc/src/main/kotlin/Releases.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 18efa67068..7a60691ad8 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview5-SNAPSHOT" + override val version = "1.0.0-preview6-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview7-SNAPSHOT" + override val version = "1.1.0-preview8-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } @@ -81,7 +81,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview3.1-SNAPSHOT" + override val version = "0.1.0-alpha03-preview4-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From eb73046af4a5afa0a74c5029f6ed12b649356a32 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 23 Apr 2024 11:16:13 +0300 Subject: [PATCH 054/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 7a60691ad8..aa717a8a27 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview6-SNAPSHOT" + override val version = "1.0.0-preview7-SNAPSHOT" override val name = "Android FHIR Engine Library" } From e4ce8208cfaec0a3dbab3c09e7707d0bd4e5f547 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 29 Apr 2024 11:33:29 +0300 Subject: [PATCH 055/126] SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common, Knowledger - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511/ --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index aa717a8a27..4fd7dcc490 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview7-SNAPSHOT" + override val version = "1.0.0-preview7.1-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 6c072101044183f9d65b81423228312547721f14 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 8 May 2024 13:38:47 +0300 Subject: [PATCH 056/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511/ --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 4fd7dcc490..5f242c11bb 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,7 +54,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview8-SNAPSHOT" + override val version = "1.1.0-preview8.1-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 51dc8ecea0801bbf07c4d0762e1c3aa3b13b9ea3 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 14 May 2024 18:53:09 +0300 Subject: [PATCH 057/126] Update Workflow Knowledge dependency --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 131a09030b..bbe671af48 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -253,7 +253,7 @@ object Dependencies { const val androidFhirCommon = "0.1.0-alpha05-preview3-SNAPSHOT" const val androidFhirEngine = "1.0.0-preview3-SNAPSHOT" - const val androidFhirKnowledge = "0.1.0-alpha03-preview3-SNAPSHOT" + const val androidFhirKnowledge = "0.1.0-alpha03-preview5-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" const val caffeine = "2.9.1" From ee02125a86a3f275e17b2fd76476a8986b620d67 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 14 May 2024 18:53:21 +0300 Subject: [PATCH 058/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511/ --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 5f242c11bb..d74194de9c 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -60,7 +60,7 @@ object Releases { object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview8-SNAPSHOT" + override val version = "0.1.0-alpha04-preview9-SNAPSHOT" override val name = "Android FHIR Workflow Library" } @@ -81,7 +81,7 @@ object Releases { object Knowledge : LibraryArtifact { override val artifactId = "knowledge" - override val version = "0.1.0-alpha03-preview4-SNAPSHOT" + override val version = "0.1.0-alpha03-preview5-SNAPSHOT" override val name = "Android FHIR Knowledge Manager Library" } From 1531f9be6bce6ad06277a25b3b5225e54464c1b7 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 4 Jun 2024 12:50:49 +0300 Subject: [PATCH 059/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511/ - WUP PR https://github.com/google/android-fhir/pull/2464 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index d74194de9c..03e1c4eae3 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,7 +48,7 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview7.1-SNAPSHOT" + override val version = "1.0.0-preview8-SNAPSHOT" override val name = "Android FHIR Engine Library" } From 748664ea9e635b7634e21bd03c6aa8491ac5b769 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 10 Jun 2024 19:20:10 +0300 Subject: [PATCH 060/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511 --- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 03e1c4eae3..89aa44ecc6 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview8-SNAPSHOT" + override val version = "1.0.0-preview9-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview8.1-SNAPSHOT" + override val version = "1.1.0-preview9-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 865fdae6e216455c5227a67ff10ec2c36c3b9975 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 11 Jun 2024 18:08:01 +0300 Subject: [PATCH 061/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511 - WUP PR https://github.com/google/android-fhir/pull/2537 - WUP PR https://github.com/google/android-fhir/pull/2511 --- buildSrc/src/main/kotlin/Releases.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 89aa44ecc6..096bb89477 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -54,7 +54,7 @@ object Releases { object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview9-SNAPSHOT" + override val version = "1.1.0-preview10-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From c78f967979b9f65244265aca4ca30ca8e5e37a17 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 21 Jun 2024 13:12:39 +0300 Subject: [PATCH 062/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2511 - WUP PR https://github.com/google/android-fhir/pull/2511 - WUP PR https://github.com/google/android-fhir/pull/2544 --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- buildSrc/src/main/kotlin/Releases.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 56fea1d216..cceedaf847 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -236,7 +236,7 @@ object Dependencies { } const val androidFhirCommon = "0.1.0-alpha05-preview3-SNAPSHOT" - const val androidFhirEngine = "1.0.0-preview3-SNAPSHOT" + const val androidFhirEngine = "1.0.0-preview10-SNAPSHOT" const val androidFhirKnowledge = "0.1.0-alpha03-preview5-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index ba69cad7f8..7532b62db4 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,13 +48,13 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview9-SNAPSHOT" + override val version = "1.0.0-preview10-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview10-SNAPSHOT" + override val version = "1.1.0-preview11-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } From 3ef1357124dbd7bc9a3a319b80ce9a1aa1d882fb Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 9 Jul 2024 11:03:07 +0300 Subject: [PATCH 063/126] SDK Release - With unmerged PR https://github.com/opensrp/android-fhir/pull/9 - WUP PR https://github.com/google/android-fhir/pull/2178/ - WUP PR https://github.com/google/android-fhir/pull/2544 - WUP PR https://github.com/google/android-fhir/pull/2607 --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- buildSrc/src/main/kotlin/Releases.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 5d0114f78f..8f35539ffb 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -144,7 +144,7 @@ object Dependencies { } const val androidFhirCommon = "0.1.0-alpha05-preview3-SNAPSHOT" - const val androidFhirEngine = "1.0.0-preview10-SNAPSHOT" + const val androidFhirEngine = "1.0.0-preview11-SNAPSHOT" const val androidFhirKnowledge = "0.1.0-alpha03-preview5-SNAPSHOT" const val apacheCommonsCompress = "1.21" const val desugarJdkLibs = "2.0.3" diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 7532b62db4..d304c779ff 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -48,19 +48,19 @@ object Releases { object Engine : LibraryArtifact { override val artifactId = "engine" - override val version = "1.0.0-preview10-SNAPSHOT" + override val version = "1.0.0-preview11-SNAPSHOT" override val name = "Android FHIR Engine Library" } object DataCapture : LibraryArtifact { override val artifactId = "data-capture" - override val version = "1.1.0-preview11-SNAPSHOT" + override val version = "1.1.0-preview12-SNAPSHOT" override val name = "Android FHIR Structured Data Capture Library" } object Workflow : LibraryArtifact { override val artifactId = "workflow" - override val version = "0.1.0-alpha04-preview9-SNAPSHOT" + override val version = "0.1.0-alpha04-preview10-SNAPSHOT" override val name = "Android FHIR Workflow Library" } From 5ac832348ff3087c08cc938129199a39b906befa Mon Sep 17 00:00:00 2001 From: fikrimilano Date: Sat, 27 Jul 2024 15:40:26 +0700 Subject: [PATCH 064/126] Refactor QuestionnaireNavigationViewUIState --- .../QuestionnaireNavigationViewUIState.kt | 3 +- .../datacapture/QuestionnaireViewModel.kt | 43 +++++++++++++++---- .../datacapture/views/NavigationViewHolder.kt | 19 ++++++-- datacapture/src/main/res/values/strings.xml | 2 +- 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireNavigationViewUIState.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireNavigationViewUIState.kt index c33a25785d..1d566086b2 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireNavigationViewUIState.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireNavigationViewUIState.kt @@ -19,7 +19,7 @@ package com.google.android.fhir.datacapture sealed class QuestionnaireNavigationViewUIState(val isShown: Boolean, val isEnabled: Boolean) { data object Hidden : QuestionnaireNavigationViewUIState(isShown = false, isEnabled = false) - data class Enabled(val labelText: String? = null, val onClickAction: () -> Unit) : + data class Enabled(val labelText: String? = null, val onClickAction: () -> Unit = {}) : QuestionnaireNavigationViewUIState(isShown = true, isEnabled = true) } @@ -29,4 +29,5 @@ data class QuestionnaireNavigationUIState( val navSubmit: QuestionnaireNavigationViewUIState = QuestionnaireNavigationViewUIState.Hidden, val navCancel: QuestionnaireNavigationViewUIState = QuestionnaireNavigationViewUIState.Hidden, val navReview: QuestionnaireNavigationViewUIState = QuestionnaireNavigationViewUIState.Hidden, + val navNextProgressBar: QuestionnaireNavigationViewUIState = QuestionnaireNavigationViewUIState.Hidden, ) diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt index 4343257704..2951fa36f3 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt @@ -731,8 +731,8 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat navSubmit = if (showSubmitButton) { QuestionnaireNavigationViewUIState.Enabled( - submitButtonText, - onSubmitButtonClickListener, + labelText = submitButtonText, + onClickAction = onSubmitButtonClickListener, ) } else { QuestionnaireNavigationViewUIState.Hidden @@ -740,6 +740,7 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat navCancel = if (!isReadOnly && shouldShowCancelButton) { QuestionnaireNavigationViewUIState.Enabled( + labelText = (getApplication() as Context).getString(R.string.cancel_questionnaire), onClickAction = onCancelButtonClickListener, ) } else { @@ -799,7 +800,10 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat navPrevious = when { questionnairePagination.isPaginated && questionnairePagination.hasPreviousPage -> { - QuestionnaireNavigationViewUIState.Enabled { goToPreviousPage() } + QuestionnaireNavigationViewUIState.Enabled( + labelText = (getApplication() as Context).getString(R.string.button_pagination_previous), + onClickAction = { goToPreviousPage() } + ) } else -> { QuestionnaireNavigationViewUIState.Hidden @@ -807,8 +811,16 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat }, navNext = when { + questionnairePagination.isPaginated && questionnairePagination.hasNextPage && isLoadingNextPage.value -> { + QuestionnaireNavigationViewUIState.Enabled( + labelText = null, + ) + } questionnairePagination.isPaginated && questionnairePagination.hasNextPage -> { - QuestionnaireNavigationViewUIState.Enabled { goToNextPage() } + QuestionnaireNavigationViewUIState.Enabled( + labelText = (getApplication() as Context).getString(R.string.button_pagination_next), + onClickAction = { goToNextPage() } + ) } else -> { QuestionnaireNavigationViewUIState.Hidden @@ -817,24 +829,39 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat navSubmit = if (showSubmitButton) { QuestionnaireNavigationViewUIState.Enabled( - submitButtonText, - onSubmitButtonClickListener, + labelText = submitButtonText, + onClickAction = onSubmitButtonClickListener ) } else { QuestionnaireNavigationViewUIState.Hidden }, navReview = if (showReviewButton) { - QuestionnaireNavigationViewUIState.Enabled { setReviewMode(true) } + QuestionnaireNavigationViewUIState.Enabled( + labelText = (getApplication() as Context).getString(R.string.button_review), + onClickAction = { setReviewMode(true) } + ) } else { QuestionnaireNavigationViewUIState.Hidden }, navCancel = if (showCancelButton) { - QuestionnaireNavigationViewUIState.Enabled(onClickAction = onCancelButtonClickListener) + QuestionnaireNavigationViewUIState.Enabled( + labelText = (getApplication() as Context).getString(R.string.cancel_questionnaire), + onClickAction = onCancelButtonClickListener + ) } else { QuestionnaireNavigationViewUIState.Hidden }, + navNextProgressBar = + when { + questionnairePagination.isPaginated && isLoadingNextPage.value -> { + QuestionnaireNavigationViewUIState.Enabled() + } + else -> { + QuestionnaireNavigationViewUIState.Hidden + } + }, ) val bottomNavigationItems = listOf(QuestionnaireAdapterItem.Navigation(bottomNavigationUiViewState)) diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/NavigationViewHolder.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/NavigationViewHolder.kt index 171990ba05..bb43e00253 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/NavigationViewHolder.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/NavigationViewHolder.kt @@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView import com.google.android.fhir.datacapture.QuestionnaireNavigationUIState import com.google.android.fhir.datacapture.QuestionnaireNavigationViewUIState import com.google.android.fhir.datacapture.R +import com.google.android.material.progressindicator.CircularProgressIndicator class NavigationViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { @@ -41,6 +42,9 @@ class NavigationViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { itemView .findViewById