Skip to content

API access for data in the LocalChangeEntity table #2048

Open
opensrp/android-fhir
#16
@ndegwamartin

Description

@ndegwamartin

Is your feature request related to a problem? Please describe.
Currently there's no API to access data in the LocalChangeEntity table

Describe the solution you'd like
In the client app we'd like a way to obtain Read Only access to the LocalChangeEntity table data, specifically the SquashedLocalChanges.

We can add an interface in FhirEngine.kt and the corresponding implementation in FhirEngineImpl.kt

//FhirEngine.kt
suspend fun getUnsyncedLocalChanges(): List<SquashedLocalChange>
//FhirEngineImpl.kt
override suspend fun getUnsyncedLocalChanges() : List<SquashedLocalChange> = database.getAllLocalChanges()

Describe alternatives you've considered
Might be better to have an API that just returns the counts for the grouped changes per resource because if there's too much data in the LocalChangeEntity table it may lead performance issues since obtaining the counts with the above approach is an in memory operation.

Additional context
This will be useful when one wants have the visibility of the Synced/Unsynced resources on the device.

Here is a sample of what can be achieved by this:

Would you like to work on the issue?
Yes

Metadata

Metadata

Labels

P2Medium priority issueeffort:largeLarge effort - 5 to 10 daystype:enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions