opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
54 stars 41 forks source link

Implement use of KnowledgeManager Library in FHIR Core #2320

Closed allan-on closed 1 year ago

allan-on commented 1 year ago

Context

With the introduction of the KnowledgeManager library in the Google Android FHIR SDK in https://github.com/google/android-fhir/issues/1729 Knowledge Resources essentially packaged up in an Implementation Guide such as ValueSets, Plan/Activity Definitions and Library Resources containing CQL should be provided using the KnowledgeManager.

Based on the Deploying Knowledge Resources via Android FHIR SDK doc,

This library enables developers to deploy a configurable application that knows where to pull knowledge resources and how to load those into the application ‘on-the-fly’. It also handles communication with other Android FHIR SDK libraries to make it easier for developers to integrate with them.

It is a unified library that should be able to handle the loading, storage, caching, and versioning of knowledge resources and provide these resources to individual Android FHIR SDK libraries where needed

sdk_fig_1

sdk_fig_2

sdk_fig_3

How the introduction of the lib affects FHIR Core

  1. Refactors are required to make use of the KnowledgeManager and related Workflow module changes in the FHIR Core MeasureReports implementations. The changes on the SDK introduce loading of Resources, for instance, a Library that is used for evaluation of Immunizations/Measures, from the KnowledgeManager. The KnowledgeManager persists them in a separate database and when we do evaluate any Measure there's a call to the knowledgeManager.loadResources().

  2. These changes break FHIR Core FhirEngine.loadLibraryAtPath(fhirOperator: FhirOperator, path: String) The loadLib() was removed from the now internal FhirOperator class and instead there's install(implementationGuide: ImplementationGuide, rootDirectory: File) or install(file: File)

  3. Future updates to the workflow dependency in FHIR Core will have to either include the new KnowledgeManager changes or have be on a separate branch/fork that doesn't include the KnowledgeManager implementations

Additional context See https://github.com/opensrp/fhircore/pull/2289#discussion_r1179590438 and https://github.com/opensrp/fhircore/pull/2289#discussion_r1180337649

allan-on commented 1 year ago

Following further conversations with the implementers:

Basically, any loading of the Resources from the server will be provided later in the Support downloading IGs from the remote Package Manager issue

Maintaining a similar workflow to the current one on FHIR Core would be ideal. That, we're able to sync them from the server and import them to the KnowledgeManager instead of working with Files.