Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade sdk libraries to latest versions #2825

Merged
merged 138 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
cf94e7f
Uprade gradle dependencies
ellykits Oct 16, 2023
83a5f79
WIP
owais-vd Oct 17, 2023
a004aed
Refactor failing tests
ellykits Oct 18, 2023
f1232a1
Merge branch 'main' into upgrade-sdk-libraries
ellykits Oct 18, 2023
ee98977
Merge branch 'apply-testing' into upgrade-sdk-libraries
ellykits Oct 18, 2023
a517d48
Refactor failing tests quest module
ellykits Oct 18, 2023
566dd1c
Merge branch 'main' into upgrade-sdk-libraries
ellykits Oct 24, 2023
d822140
Merge branch 'main' into upgrade-sdk-libraries
ellykits Oct 24, 2023
757ef9b
Fix failing build
ellykits Oct 24, 2023
3a0640a
Update Kotlin version to 1.8.20
ellykits Oct 25, 2023
0dc0169
Remove extra libraries | upgrade sdk workflow libs (#2837)
maimoonak Oct 27, 2023
316d851
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
ellykits Oct 30, 2023
69bf5a6
Merge branch 'main' into upgrade-sdk-libraries
ellykits Oct 30, 2023
7ec1fc6
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
ellykits Oct 30, 2023
f374de4
Delete unused dependencies
ellykits Oct 30, 2023
1935bc6
Update sdk library versions
ellykits Nov 1, 2023
ebbcca7
Disable code coverage
ellykits Nov 1, 2023
c897765
Resolve blocker causing build failures
ellykits Nov 1, 2023
0f6e4f2
Merge branch 'main' into upgrade-sdk-libraries
ellykits Nov 1, 2023
e122456
Change CI JDK version to 17
ellykits Nov 1, 2023
6b22858
Refactor tests in quest module
ellykits Nov 2, 2023
85de386
Merge branch 'main' into upgrade-sdk-libraries
dubdabasoduba Nov 3, 2023
eaf8ddb
Update compose version to v1.4.6
ellykits Nov 3, 2023
28045bb
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
ellykits Nov 3, 2023
a811009
Update unit test
Rkareko Nov 8, 2023
296a946
Fix loading of json resources from file on generateMeaslesCarePlan test
Rkareko Nov 8, 2023
d7a922a
Update generateMeaslesCarePlan test
DebbieArita Nov 8, 2023
830545f
Add org.opencds.cqf.fhir:cqf-fhir-cr:3.0.0-PRE9 dependency
qiarie Nov 8, 2023
df96c15
Merge branch 'main' into upgrade-sdk-libraries
pld Nov 8, 2023
c43699c
Merge branch 'main' into upgrade-sdk-libraries
Rkareko Nov 9, 2023
9bafbde
Fix duplicate class error in geowidget module
Rkareko Nov 9, 2023
85e9983
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 9, 2023
a1d5bac
Run spotless Apply
Rkareko Nov 9, 2023
ad8439b
Fix duplicate class error in engine module
Rkareko Nov 10, 2023
8873049
Update creation of task for references to include resource type
Rkareko Nov 10, 2023
42cdbf0
updated the testing thread and move the engine initialization on setup
owais-vd Nov 10, 2023
34d3860
Fix tests assertions testing thrown exceptions
Rkareko Nov 12, 2023
88f08c0
Add gson type handler for timezone
Rkareko Nov 14, 2023
128413b
Update file location of generated code coverage data
Rkareko Nov 14, 2023
95fc382
Add build config for enabling test coverage in quest module
Rkareko Nov 14, 2023
32ebce6
Update generateMeaslesCarePlan test resources to generate medicalRequest
DebbieArita Nov 14, 2023
8b214ea
Revert additional of enable test covergae confis in quest build config
Rkareko Nov 14, 2023
8ecae07
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 14, 2023
3d7db34
Run spotlessApply
DebbieArita Nov 14, 2023
3a622e3
Enable running of evaluatePerformanceBenchmarkResults
Rkareko Nov 15, 2023
6a7873a
Run spotlessApply
Rkareko Nov 15, 2023
c08b361
Add debug flag on commands for running quest tests
Rkareko Nov 15, 2023
e2ea7e8
Add github action for downloading workflow artifacts
Rkareko Nov 15, 2023
82b8b84
Temporarily disable running of jacoco report generation command
Rkareko Nov 15, 2023
0da2e9b
Remove debug logging command
Rkareko Nov 15, 2023
80a5915
Only run tests without generating coverage report
Rkareko Nov 16, 2023
e03d395
Temporarily disable action for uploading test coverage
Rkareko Nov 16, 2023
4c77801
enable action for uploading test coverage
Rkareko Nov 16, 2023
81964bb
Revert changes made to quest CI workflow
Rkareko Nov 16, 2023
366e96f
Add manifest permission for writing to external storage
Rkareko Nov 16, 2023
1e2428a
Revert manifest permission for writing to external storage
Rkareko Nov 16, 2023
cc8ea67
Comment out command for generating coverage report for instrumented …
Rkareko Nov 16, 2023
e7d1bd7
Only generate report for unit tests
Rkareko Nov 16, 2023
73efcd9
Comment out exclusion of commons-logging dependency from quest build …
Rkareko Nov 16, 2023
edc4354
Fix failing testHandleQuestionnaireSubmission test
Rkareko Nov 16, 2023
d950aa3
moved measles test from structureMapUtilitiesTest to FhirCarePlanGene…
owais-vd Nov 16, 2023
edcde6a
Run spotless apply
Rkareko Nov 16, 2023
0b97404
spotlessApply
owais-vd Nov 16, 2023
b1b5e89
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 16, 2023
539d971
Update workflow command for running quest tests
Rkareko Nov 16, 2023
cbb99ad
Correct file path for generated code coverage
Rkareko Nov 16, 2023
236ec90
Add manifest permission for writing to external storage
Rkareko Nov 16, 2023
7217899
Temporarily disable running of engine and geo-widget tests
Rkareko Nov 16, 2023
2754420
Temporarily disable running of performance tests
Rkareko Nov 16, 2023
1c0b841
only run quest test in the UI profile package
Rkareko Nov 16, 2023
d1ff1ca
Merge branch 'main' into upgrade-sdk-libraries
ndegwamartin Nov 17, 2023
f10402a
Update quest module test run command to use gradlew tasks
Rkareko Nov 20, 2023
dc38df3
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 20, 2023
d2da4b3
Enable running of engine, geowidget and performance tests
Rkareko Nov 21, 2023
b2bad33
Merge branch 'main' into upgrade-sdk-libraries
Rkareko Nov 21, 2023
3601636
Revert perfmission for writing to external storage
Rkareko Nov 21, 2023
1474afa
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 21, 2023
2553388
Merge branch 'main' into upgrade-sdk-libraries
Rkareko Nov 21, 2023
3db27f9
Merge branch 'main' into upgrade-sdk-libraries
Rkareko Nov 23, 2023
28589a0
Update engine version
Rkareko Nov 24, 2023
990c21c
Merge branch 'upgrade-sdk-libraries' of github.com:opensrp/fhircore i…
Rkareko Nov 24, 2023
ac72c54
Trying to recreate the StructureMap running environment in the $apply…
vitorpamplona Dec 18, 2023
fcac929
remove now incorrect comment
pld Dec 18, 2023
7765ea8
Fix duplicate classes
ellykits Dec 20, 2023
e250377
Merge branch 'main' into upgrade-sdk-libraries
owais-vd Dec 26, 2023
5166609
added datastore-preferences version in libs.versions.toml
owais-vd Dec 26, 2023
6a84dab
updated test case and workflow
owais-vd Dec 28, 2023
c84f13d
Remove hardcoded resource type declaration
Rkareko Jan 19, 2024
c58bc6d
Upgrade to the latest SDK artifacts
ndegwamartin Jan 22, 2024
219c77b
fhirOperator library | Fix cql content tests
Jan 12, 2024
b8eade5
spotless fix
Jan 12, 2024
ef7722f
load knowledge manager resources
Jan 12, 2024
2b0a657
Fix failing test
Jan 12, 2024
af047b0
[Workaround] Migrate to latest SDK Artifacts 💚 -
ndegwamartin Jan 24, 2024
4c84739
Migrate to latest SDK Artifacts - Code changes ✅
ndegwamartin Jan 24, 2024
5ba6194
Contraint depdendencies to Gradle API configuration
ndegwamartin Jan 24, 2024
25fcf16
Merge remote-tracking branch 'origin/main' into upgrade-sdk-libraries
ndegwamartin Jan 24, 2024
8ce6254
Spotless Apply
ndegwamartin Jan 24, 2024
c519e94
Merge branch 'main' into upgrade-sdk-libraries
pld Jan 24, 2024
e323ad9
remove commented code
pld Jan 24, 2024
2cb4ea9
add note on $this.id
pld Jan 24, 2024
ce204ce
remove comments
pld Jan 24, 2024
38786e6
use var, make private
pld Jan 24, 2024
14e98bf
add ntoe on measures
pld Jan 24, 2024
d7bfd18
Add missing slash when evaluating task.for reference
Rkareko Jan 25, 2024
7d171b9
upgrade gradle to version 8.2.2
ndegwamartin Jan 25, 2024
3e9807f
Merge branch 'upgrade-sdk-libraries' of https://github.com/opensrp/fh…
ndegwamartin Jan 25, 2024
195fc0e
Merge remote-tracking branch 'origin/main' into upgrade-sdk-libraries
ndegwamartin Jan 25, 2024
7d2745a
Update depdendency configuration
ndegwamartin Jan 25, 2024
281f712
Trigger CI
ndegwamartin Jan 25, 2024
704a91d
Code cleanup - remove comment
Rkareko Jan 25, 2024
b50b6bd
Merge remote-tracking branch 'origin/main' into upgrade-sdk-libraries
ndegwamartin Jan 25, 2024
220d173
Code clean up
ndegwamartin Jan 25, 2024
53e242c
Update android/macrobenchmark/build.gradle.kts
pld Jan 25, 2024
7eaadf1
Merge branch 'main' into upgrade-sdk-libraries
pld Jan 26, 2024
ba3ad77
Merge branch 'main' into upgrade-sdk-libraries
pld Jan 26, 2024
32f61ce
add to content change notes
pld Jan 26, 2024
c92a700
Merge branch 'main' into upgrade-sdk-libraries
ndegwamartin Jan 29, 2024
d505c7e
Fixes CQL evaluation post Questionnaire submission
ndegwamartin Jan 31, 2024
2a68650
Merge branch 'main' into upgrade-sdk-libraries
owais-vd Feb 1, 2024
822b6af
fixed method name
owais-vd Feb 1, 2024
bf607c8
Merge branch 'upgrade-sdk-libraries' of https://github.com/opensrp/fh…
ndegwamartin Feb 2, 2024
cb4d76f
Careplan generation, Engine Build, Tests
ndegwamartin Feb 2, 2024
0cd50ac
Spotless clean
ndegwamartin Feb 2, 2024
89ac5a4
Fix Tests ✅
ndegwamartin Feb 3, 2024
f75f06b
Clean up 🗑
ndegwamartin Feb 3, 2024
8da3c4e
remove duplicate note
pld Feb 5, 2024
ce5d08c
Merge branch 'main' into upgrade-sdk-libraries
ndegwamartin Feb 6, 2024
5822652
Move Configs to Constants object - update documentation
ndegwamartin Feb 6, 2024
c0d878f
Remove guava cache config from build: Enforced by SDK
ndegwamartin Feb 6, 2024
16229dc
Merge branch 'main' into upgrade-sdk-libraries
ndegwamartin Feb 6, 2024
676c881
Update CHANGELOG.md
pld Feb 6, 2024
85cd72c
remove comments
pld Feb 6, 2024
1417f48
Refactor Dollar Lite to function
ndegwamartin Feb 7, 2024
26c551b
Upgrade Engine and SDC artifacts
ndegwamartin Feb 7, 2024
ff6f2dd
Fix Build ✅
ndegwamartin Feb 7, 2024
7893f28
Upgrade Engine + SDC artifacts
ndegwamartin Feb 7, 2024
26fae69
Merge branch 'main' into upgrade-sdk-libraries
ndegwamartin Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.19.0")
classpath("gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
classpath("com.android.tools.build:gradle:7.1.3")
classpath("com.android.tools.build:gradle:8.0.2")
classpath("org.jetbrains.dokka:dokka-base:1.8.20")
classpath("org.owasp:dependency-check-gradle:8.2.1")
}
Expand Down
22 changes: 13 additions & 9 deletions android/engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ plugins {
android {
compileSdk = 34

namespace = "org.smartregister.fhircore.engine"

defaultConfig {
minSdk = 26
targetSdk = 34
Expand Down Expand Up @@ -50,11 +52,11 @@ android {
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}
buildFeatures {
Expand Down Expand Up @@ -135,11 +137,11 @@ dependencies {
implementation(libs.compressor)
implementation(libs.xercesImpl)
implementation(libs.msg.simple)
implementation(libs.cqf.cql.engine)
implementation(libs.cql.engine.jackson)
implementation(libs.dagger.hilt.android)
implementation(libs.hilt.work)
implementation(libs.slf4j.nop)
implementation(libs.cqf.cql.engine)
implementation(libs.cql.to.elm)
implementation(libs.cqf.cql.evaluator) {
exclude(group = "com.github.ben-manes.caffeine")
exclude(group = "ca.uhn.hapi.fhir")
Expand All @@ -152,10 +154,10 @@ dependencies {
exclude(group = "com.github.ben-manes.caffeine")
exclude(group = "ca.uhn.hapi.fhir")
}
implementation(libs.cql.evaluator.dagger) {
exclude(group = "com.github.ben-manes.caffeine")
exclude(group = "ca.uhn.hapi.fhir")
}

api(libs.cqf.fhir.cr)
api(libs.cqf.fhir.jackson)
api(libs.cqf.fhir.utility)

// Shared dependencies
api(libs.glide)
Expand Down Expand Up @@ -229,6 +231,8 @@ dependencies {
isTransitive = true
exclude(group = "com.google.android.fhir", module = "common")
exclude(group = "com.github.ben-manes.caffeine")
exclude(group = "org.opencds.cqf.cql:engine.fhir")
exclude(group = "info.cqframework:engine")
}

// Annotation processors
Expand Down
3 changes: 1 addition & 2 deletions android/engine/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.smartregister.fhircore.engine">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ constructor(
suspend fun create(vararg resources: Resource) {
return withContext(dispatcherProvider.io()) {
resources.onEach { it.generateMissingId() }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to add updateLastUpdated here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is updated by the calling method here

fhirEngine.createRemote(*resources)
fhirEngine.create(*resources, isLocalOnly = true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,25 @@ import ca.uhn.fhir.context.api.BundleInclusionRule
import ca.uhn.fhir.model.valueset.BundleTypeEnum
import ca.uhn.fhir.rest.api.BundleLinks
import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory
import com.google.android.fhir.logicalId
import com.google.common.collect.Lists
import javax.inject.Inject
import javax.inject.Singleton
import org.apache.commons.lang3.tuple.Pair
import org.cqframework.cql.cql2elm.CqlTranslatorOptions
import org.cqframework.cql.cql2elm.LibrarySourceProvider
import org.cqframework.cql.cql2elm.ModelManager
import org.cqframework.cql.elm.execution.Library
import org.cqframework.cql.elm.execution.VersionedIdentifier
import org.hl7.fhir.instance.model.api.IBaseBundle
import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.model.Base
import org.hl7.fhir.r4.model.Bundle
import org.hl7.fhir.r4.model.Library as LibraryResource
import org.hl7.fhir.r4.model.Parameters
import org.hl7.fhir.r4.model.Patient
import org.hl7.fhir.r4.model.Resource
import org.json.JSONArray
import org.json.JSONObject
import org.opencds.cqf.cql.engine.data.CompositeDataProvider
import org.opencds.cqf.cql.engine.data.DataProvider
import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverter
import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverterFactory
import org.opencds.cqf.cql.evaluator.CqlEvaluator
import org.opencds.cqf.cql.evaluator.cql2elm.content.fhir.BundleFhirLibrarySourceProvider
import org.opencds.cqf.cql.evaluator.cql2elm.util.LibraryVersionSelector
import org.opencds.cqf.cql.evaluator.engine.CqlEngineOptions
import org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader
import org.opencds.cqf.cql.evaluator.engine.retrieve.BundleRetrieveProvider
import org.opencds.cqf.cql.evaluator.engine.terminology.BundleTerminologyProvider
import org.opencds.cqf.cql.evaluator.fhir.adapter.r4.AdapterFactory
Expand Down Expand Up @@ -131,7 +121,7 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
isExpandValueSets = true
}

cqlEvaluator =
/* cqlEvaluator =
CqlEvaluator(
object :
TranslatingLibraryLoader(
Expand Down Expand Up @@ -162,7 +152,7 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
terminologyProvider,
CqlEngineOptions.defaultOptions().options,
)
libEvaluator = LibraryEvaluator(cqlFhirParametersConverter, cqlEvaluator)
libEvaluator = LibraryEvaluator(cqlFhirParametersConverter, cqlEvaluator)*/
}

/**
Expand All @@ -185,14 +175,15 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
contextLabel: String,
): String {
loadConfigs(resources, valueSetData, testData, fhirContext)
val result =
/* val result =
libEvaluator!!.evaluate(
VersionedIdentifier().withId(evaluatorId),
Pair.of(context, contextLabel),
null,
null,
)
return parser.encodeResourceToString(result)
return parser.encodeResourceToString(result)*/
return ""
}

/**
Expand Down Expand Up @@ -254,7 +245,7 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
)
}

val result =
/* val result =
libEvaluator!!.evaluate(
VersionedIdentifier().withId(library?.name).withVersion(library?.version),
patient?.let { Pair.of("Patient", it.logicalId) },
Expand All @@ -280,7 +271,8 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
else -> null
}
}
}
}*/
return emptyList()
}

fun getStringRepresentation(base: Base): String =
Expand Down Expand Up @@ -328,18 +320,18 @@ class LibraryEvaluator @Inject constructor(val defaultRepository: DefaultReposit
this.isExpandValueSets = true
}

cqlEvaluator =
CqlEvaluator(
TranslatingLibraryLoader(
modelManager,
listOf(libraryProvider),
CqlTranslatorOptions.defaultOptions(),
null,
),
mapOf("http://hl7.org/fhir" to CompositeDataProvider(fhirModelResolver, retrieveProvider)),
terminologyProvider,
CqlEngineOptions.defaultOptions().options,
)
/* cqlEvaluator =
CqlEvaluator(
TranslatingLibraryLoader(
modelManager,
listOf(libraryProvider),
CqlTranslatorOptions.defaultOptions(),
null,
),
mapOf("http://hl7.org/fhir" to CompositeDataProvider(fhirModelResolver, retrieveProvider)),
terminologyProvider,
CqlEngineOptions.defaultOptions().options,
)*/

libEvaluator = LibraryEvaluator(cqlFhirParametersConverter, cqlEvaluator)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ constructor(
suspend fun createRemote(addResourceTags: Boolean = true, vararg resource: Resource) {
return withContext(dispatcherProvider.io()) {
preProcessResources(addResourceTags, *resource)
fhirEngine.createRemote(*resource)
fhirEngine.create(*resource, isLocalOnly = true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ class CoreModule {

@Singleton
@Provides
fun provideFhirOperator(fhirEngine: FhirEngine): FhirOperator =
FhirOperator(fhirContext = FhirContext.forCached(FhirVersionEnum.R4), fhirEngine = fhirEngine)
fun provideFhirOperator(
@ApplicationContext context: Context,
fhirContext: FhirContext,
fhirEngine: FhirEngine,
knowledgeManager: KnowledgeManager,
): FhirOperator =
FhirOperator.Builder(context)
.fhirEngine(fhirEngine)
.fhirContext(fhirContext)
.knowledgeManager(knowledgeManager)
.build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ constructor(
// PeriodSync doesn't return state. It's enqueued instead. Finish the sync as workaround.
if (workInfo.state == WorkInfo.State.ENQUEUED) {
syncListenerManager.onSyncListeners.forEach { onSyncListener ->
onSyncListener.onSync(SyncJobStatus.Finished())
onSyncListener.onSync(SyncJobStatus.Finished)
}
} else {
val data =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ constructor(
val availablePlanDefinitions =
defaultRepository.search<PlanDefinition>(Search(ResourceType.PlanDefinition))
for (cqlLibrary in availableCqlLibraries) {
fhirOperator.loadLib(cqlLibrary)
// fhirOperator.loadLib(cqlLibrary)
pld marked this conversation as resolved.
Show resolved Hide resolved
knowledgeManager.install(writeToFile(cqlLibrary))
cqlLibraryIdList.add(IdType(cqlLibrary.id).idPart)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ suspend fun FhirEngine.loadLibraryAtPath(fhirOperator: FhirOperator, path: Strin
runCatching { get<Library>(IdType(path).idPart) }.getOrNull()
?: search<Library> { filter(Library.URL, { value = path }) }.map { it.resource }.firstOrNull()

library?.let {
// TODO Fix refactored implementation on fhirOperator.loadLib()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come from the knowledge manager now. Have we added libs there already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We included the knowledger dependency do we need any others? Feel free to add any other that's relevant for the knowledge manager to work.

/*library?.let {
fhirOperator.loadLib(it)

it.relatedArtifact.forEach { loadLibraryAtPath(fhirOperator, it) }
}
}*/
}

suspend fun FhirEngine.loadLibraryAtPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ import ca.uhn.fhir.rest.param.ParamPrefixEnum
import com.google.android.fhir.FhirEngine
import com.google.android.fhir.search.Operation
import com.google.android.fhir.search.Search
import com.google.android.fhir.search.search
import org.apache.commons.lang3.StringUtils
import org.hl7.fhir.r4.model.DateTimeType
import org.hl7.fhir.r4.model.MeasureReport
import org.hl7.fhir.r4.model.ResourceType
import org.opencds.cqf.cql.evaluator.measure.common.MeasurePopulationType
import org.opencds.cqf.fhir.cr.measure.common.MeasurePopulationType
import org.smartregister.fhircore.engine.configuration.report.measure.ReportConfiguration
import org.smartregister.fhircore.engine.configuration.report.measure.ReportConfiguration.Companion.DEFAULT_ROUNDING_PRECISION
import org.smartregister.fhircore.engine.configuration.report.measure.ReportConfiguration.Companion.DEFAULT_ROUNDING_STRATEGY
Expand Down
2 changes: 2 additions & 0 deletions android/engine/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,6 @@
<string name="all_data_synced">All data synced</string>
<string name="invalid_offline_login_state">User set up required. Enable your internet connection </string>
<string name="select_month">Select Month</string>
<string name="ok">OK</string>
<string name="add">ADD</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.just
import io.mockk.mockk
import io.mockk.runs
import io.mockk.spyk
import javax.inject.Inject
import kotlinx.coroutines.test.runTest
Expand Down Expand Up @@ -368,7 +366,7 @@ class ConfigurationRegistryTest : RobolectricTest() {
val patient = Faker.buildPatient()
coEvery { fhirEngine.get(patient.resourceType, patient.logicalId) } throws
ResourceNotFoundException("", "")
coEvery { fhirEngine.createRemote(any()) } just runs
coEvery { fhirEngine.create(any(), isLocalOnly = true) } returns listOf(patient.id)

runTest {
val previousLastUpdate = patient.meta.lastUpdated
Expand All @@ -377,18 +375,18 @@ class ConfigurationRegistryTest : RobolectricTest() {
}

coVerify(inverse = true) { fhirEngine.update(any()) }
coVerify { fhirEngine.createRemote(patient) }
coVerify { fhirEngine.create(patient, isLocalOnly = true) }
}

@Test
@kotlinx.coroutines.ExperimentalCoroutinesApi
fun testCreate() {
val patient = Faker.buildPatient()
coEvery { fhirEngine.createRemote(patient) } just runs
coEvery { fhirEngine.create(patient, isLocalOnly = true) } returns listOf(patient.id)

runTest {
configRegistry.create(patient)
coVerify { fhirEngine.createRemote(patient) }
coVerify { fhirEngine.create(patient, isLocalOnly = true) }
}
}

Expand Down Expand Up @@ -677,13 +675,15 @@ class ConfigurationRegistryTest : RobolectricTest() {
coEvery { fhirEngine.get(any(), any()) } throws
ResourceNotFoundException(ResourceType.Group.name, "some-id")

coEvery { fhirEngine.createRemote(any()) } just runs
coEvery { fhirEngine.create(any(), isLocalOnly = true) } returns listOf()

configRegistry.fetchNonWorkflowConfigResources()

val requestPathArgumentSlot = mutableListOf<Group>()

coVerify(exactly = 2) { fhirEngine.createRemote(capture(requestPathArgumentSlot)) }
coVerify(exactly = 2) {
fhirEngine.create(capture(requestPathArgumentSlot), isLocalOnly = true)
}

Assert.assertEquals(2, requestPathArgumentSlot.size)

Expand Down Expand Up @@ -737,13 +737,15 @@ class ConfigurationRegistryTest : RobolectricTest() {
coEvery { fhirEngine.get(any(), any()) } throws
ResourceNotFoundException(ResourceType.Group.name, "some-id-not-found")

coEvery { fhirEngine.createRemote(any()) } just runs
coEvery { fhirEngine.create(any(), isLocalOnly = true) } returns listOf()

configRegistry.fetchNonWorkflowConfigResources()

val requestPathArgumentSlot = mutableListOf<Resource>()

coVerify(exactly = 3) { fhirEngine.createRemote(capture(requestPathArgumentSlot)) }
coVerify(exactly = 3) {
fhirEngine.create(capture(requestPathArgumentSlot), isLocalOnly = true)
}

Assert.assertEquals(3, requestPathArgumentSlot.size)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,10 @@ class DefaultRepositoryTest : RobolectricTest() {
@Test
fun `createRemote() should correctly invoke FhirEngine#createRemote`() {
val resource = spyk(Patient())
coEvery { fhirEngine.createRemote(resource) } just runs
coEvery { fhirEngine.create(resource, isLocalOnly = true) } returns listOf(resource.id)

runBlocking { defaultRepository.createRemote(false, resource) }

coVerify { fhirEngine.createRemote(resource) }
coVerify { fhirEngine.create(resource, isLocalOnly = true) }
}
}
Loading