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

DNM | Knowledge Manager and Workflow Library Upgrades #3521

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
*/
try {
if (resource is MetadataResource && resource.name != null) {
knowledgeManager.install(
knowledgeManager.index(

Check warning on line 606 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L606 was not covered by tests
writeToFile(resource.overwriteCanonicalURL()),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import org.hl7.fhir.r4.model.Resource
import org.hl7.fhir.r4.model.Task
import org.hl7.fhir.r4.utils.FHIRPathEngine
import org.opencds.cqf.fhir.cql.LibraryEngine
import org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor
import org.opencds.cqf.fhir.cr.plandefinition.PlanDefinitionProcessor
import org.opencds.cqf.fhir.utility.monad.Eithers
import org.opencds.cqf.fhir.utility.r4.Parameters.part
import org.smartregister.fhircore.engine.data.local.DefaultRepository
import timber.log.Timber
Expand Down Expand Up @@ -128,9 +129,7 @@ constructor(
params.addParameter(part("%subject", subject))

return planDefProcessor.apply(
null,
null,
planDefinition,
Eithers.forRight3(planDefinition),
"Patient/${subject.id}",
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ class FhirCarePlanGeneratorTest : RobolectricTest() {
}

private suspend fun installToIgManager(resource: Resource) {
knowledgeManager.install(writeToFile(resource))
knowledgeManager.index(writeToFile(resource))
}

private suspend fun loadResource(
Expand Down
6 changes: 3 additions & 3 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ converter-gson = "2.9.0"
core-ktx = "1.13.1"
core-testing = "2.2.0"
coverallsGradlePlugin = "2.12.2"
cqfFhirCr = "3.0.0-PRE9"
cqfFhirCr = "3.8.0"
dagger-hilt = "2.51"
datastore = "1.1.1"
desugar-jdk-libs = "2.1.2"
Expand All @@ -28,8 +28,8 @@ fhir-sdk-contrib-barcode = "0.1.0-beta3-preview7-rc1-SNAPSHOT"
fhir-sdk-contrib-locationwidget = "0.1.0-alpha01-preview2-rc1-SNAPSHOT"
fhir-sdk-data-capture = "1.1.0-preview14-rc1-SNAPSHOT"
fhir-sdk-engine = "1.0.0-preview14-rc3-SNAPSHOT"
fhir-sdk-knowledge = "0.1.0-alpha03-preview5-rc1-SNAPSHOT"
fhir-sdk-workflow = "0.1.0-alpha04-preview10-rc1-SNAPSHOT"
fhir-sdk-knowledge = "0.1.0-beta01-preview-rc1-SNAPSHOT"
fhir-sdk-workflow = "0.1.0-alpha04-preview13-rc1-SNAPSHOT"
fragment-ktx = "1.8.2"
glide = "4.16.0"
gradle = "8.3.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import java.util.NoSuchElementException
import javax.inject.Inject
import kotlinx.coroutines.withContext
import org.hl7.fhir.exceptions.FHIRException
import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.model.Group
import org.hl7.fhir.r4.model.Measure
import org.hl7.fhir.r4.model.MeasureReport
import org.hl7.fhir.r4.model.ResourceType
import org.smartregister.fhircore.engine.configuration.ConfigurationRegistry
import org.smartregister.fhircore.engine.configuration.app.ConfigService
import org.smartregister.fhircore.engine.configuration.report.measure.ReportConfiguration
Expand Down Expand Up @@ -155,11 +155,11 @@ constructor(
): MeasureReport {
return withContext(dispatcherProvider.io()) {
try {
val measureUrlResources: Iterable<IBaseResource> =
knowledgeManager.loadResources(url = measureUrl)

fhirOperator.evaluateMeasure(
measure =
knowledgeManager
.loadResources(ResourceType.Measure.name, measureUrl, null, null, null)
.firstOrNull() as Measure,
measure = measureUrlResources.first() as Measure,
start = startDateFormatted,
end = endDateFormatted,
reportType = reportType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import kotlinx.coroutines.withContext
import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.model.Measure
import org.hl7.fhir.r4.model.MeasureReport
import org.hl7.fhir.r4.model.ResourceType
import org.smartregister.fhircore.engine.configuration.ConfigurationRegistry
import org.smartregister.fhircore.engine.data.local.DefaultRepository
import org.smartregister.fhircore.engine.util.DefaultDispatcherProvider
Expand Down Expand Up @@ -133,10 +132,7 @@ constructor(
withContext(dispatcherProvider.io()) {
try {
val measureUrlResources: Iterable<IBaseResource> =
knowledgeManager.loadResources(
resourceType = ResourceType.Measure.name,
url = measureUrl,
)
knowledgeManager.loadResources(url = measureUrl)

fhirOperator.evaluateMeasure(
measure = measureUrlResources.first() as Measure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class CqlContentTest : RobolectricTest() {
private suspend fun createTestData(dataBundle: Bundle, cqlLibrary: Library) {
dataBundle.entry.forEach { fhirEngine.create(it.resource) }

knowledgeManager.install(
knowledgeManager.index(
File.createTempFile(cqlLibrary.name, ".json").apply {
this.writeText(cqlLibrary.encodeResourceToString())
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ class QuestionnaireViewModelTest : RobolectricTest() {
)
}

knowledgeManager.install(
knowledgeManager.index(
File.createTempFile(cqlLibrary.name, ".json").apply {
this.writeText(cqlLibrary.encodeResourceToString())
},
Expand Down
Loading