FhirEngine

interface FhirEngine

The FHIR Engine interface that handles the local storage of FHIR resources.

Functions

clearDatabase
Link copied to clipboard
abstract suspend fun clearDatabase()
Clears all database tables without resetting the auto-increment value generated by PrimaryKey.autoGenerate.
count
Link copied to clipboard
abstract suspend fun count(search: Search): Long
Returns the total count of entities available for given search.
create
Link copied to clipboard
abstract suspend fun create(vararg resource: Resource): List<String>
Creates one or more FHIR resources in the local storage.
delete
Link copied to clipboard
abstract suspend fun delete(type: ResourceType, id: String)
Removes a FHIR resource given the class and the logical ID.
get
Link copied to clipboard
abstract suspend fun get(type: ResourceType, id: String): Resource
Loads a FHIR resource given the class and the logical ID.
getLastSyncTimeStamp
Link copied to clipboard
abstract suspend fun getLastSyncTimeStamp(): OffsetDateTime?
Returns the timestamp when data was last synchronized.
getLocalChange
Link copied to clipboard
abstract suspend fun getLocalChange(type: ResourceType, id: String): LocalChange?
Retrieve LocalChange for Resource with given type and id, which can be used to purge resource from database.
purge
Link copied to clipboard
abstract suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean = false)
Purges a resource from the database based on resource type and id without any deletion of data from the server.
search
Link copied to clipboard
abstract suspend fun <R : Resource> search(search: Search): List<R>
Searches the database and returns a list resources according to the search specifications.
syncDownload
Link copied to clipboard
abstract suspend fun syncDownload(conflictResolver: ConflictResolver, download: suspend (SyncDownloadContext) -> Flow<List<Resource>>)
Synchronizes the download result in the database.
syncUpload
Link copied to clipboard
abstract suspend fun syncUpload(upload: suspend (List<LocalChange>) -> Flow<Pair<LocalChangeToken, Resource>>)
Synchronizes the upload result in the database.
update
Link copied to clipboard
abstract suspend fun update(vararg resource: Resource)
Updates a FHIR resource in the local storage.

Extensions

count
Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.count(init: Search.() -> Unit): Long
delete
Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.delete(id: String)
Deletes a FHIR resource of type R with id from the local storage.
get
Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.get(id: String): R
Returns a FHIR resource of type R with id from the local storage.
search
Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.search(init: Search.() -> Unit): List<R>
suspend fun FhirEngine.search(xFhirQuery: String): List<Resource>

Sources

androidJvm source
Link copied to clipboard