KnowledgeManager

Manages knowledge artifacts on the Android device. Knowledge artifacts can be installed individually as JSON files or from FHIR NPM packages.

Coordinates the management of knowledge artifacts by using the three following components:

  • knowledgeDatabase: indexing knowledge artifacts stored in the local file system,

  • npmFileManager: managing files containing the knowledge artifacts, and

  • npmPackageDownloader: downloading the knowledge artifacts from an NPM package server .

Knowledge artifacts are scoped by the application. Multiple applications using the knowledge manager will not share the same sets of knowledge artifacts.

See Clinical Reasoning for the formal definition of knowledge artifacts. In this implementation, however, knowledge artifacts are represented as MetadataResources.

Note that the list of resources implementing the MetadataResource class differs from the list of resources implementing the MetadataResource interface in FHIR R5.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun delete(vararg igDependencies: FhirNpmPackage)

Deletes Implementation Guide, cleans up files.

Link copied to clipboard
suspend fun import(fhirNpmPackage: FhirNpmPackage, rootDirectory: File)

Imports the content of the fhirNpmPackage from the provided rootDirectory by indexing the metadata of the FHIR resources for future retrieval.

Link copied to clipboard
suspend fun index(file: File)

Indexes a knowledge artifact as a JSON object in the provided file.

Link copied to clipboard
suspend fun install(vararg fhirNpmPackages: FhirNpmPackage)

Downloads and installs the fhirNpmPackages from the NPM package server with transitive dependencies. The NPM packages will be unzipped to a directory managed by the knowledge manager. The resources will be indexed in the database for future retrieval.

Link copied to clipboard
suspend fun loadResources(url: String, version: String? = null): Iterable<IBaseResource>

Loads knowledge artifact by its canonical URL and an optional version.

suspend fun loadResources(resourceType: String, url: String? = null, id: String? = null, name: String? = null, version: String? = null): Iterable<IBaseResource>

Loads resources from IGs listed in dependencies.

Link copied to clipboard
suspend fun loadWorkerContext(vararg npmPackages: NpmPackage, allowLoadingDuplicates: Boolean = true, loader: SimpleWorkerContext.IContextResourceLoader? = null): IWorkerContext

Loads and initializes a worker context with the specified npm packages.