Skip to content

New API to support saving local only resources #2123

@ndegwamartin

Description

@ndegwamartin

Is your feature request related to a problem? Please describe.
Sometimes we need to persist resources on the device's database without creating local changes to be synced to the server. Such resources may be downloaded from the server or perhaps generated by the client itself.

Currently the only way to persist a resource is to use the FhirEngine.create API method which flags the resources for sync.

Describe the solution you'd like
This could be solved by exposing the Database.insertRemote API via the FhirEngine API by adding the following interface and implementation.

//FhirEngine.kt
suspend fun createRemote(vararg resource: Resource)
//FhirEngineImpl.kt
  override suspend fun createRemote(vararg resource: Resource){
    return database.insertRemote(*resource)
  }

Describe alternatives you've considered
An alternative approach could be to enhance the current FhirEngine.create API and pass a flag to determine whether it should be marked for sync or is a local only resource.

//FhirEngine.kt
suspend fun create(val isLocalOnlyChange:Boolean = false, vararg resource: Resource): List<String>

Might be better to name the flag something like isSyncable or syncUp and set its default to true to avoid any confusion with the existing concept of local changes.

Additional context
N/A

Would you like to work on the issue?
Yes

Metadata

Metadata

Assignees

Labels

P2Medium priority issuetype:enhancementNew feature or request

Type

No type

Projects

Status

PR under Review

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions