android-fhir
android-fhir copied to clipboard
Allow remote FHIR search through FHIR engine
Is your feature request related to a problem? Please describe. Currently FHIR engine provides sync APIs to periodically fetch data. This is useful for offline systems and data that maybe required after a long period of time (eg: 24 hours). The FhirSyncWorker also has a one time work request to fetch data just in time. The developer has to pass the search URL to the work manager which will run a job to fetch data based on the search URL and save it in the DB. For an application to fetch a Patient resource that is not synced yet we need to do the following:
- Search in local DB using fhirEngine
- If not found, create a one time work request
- After the completion of the task, wait for indexing to complete
- Search again in the local DB using fhirEngine.
Describe the solution you'd like There be value in automatically searching for the resource in the Remote server if not found and internet is available. That way we avoid the multiple step process mentioned above.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Would you like to work on the issue? Please state if this issue should be assigned to you or who you think could help to solve this issue.
cc: @f-odhiambo @omarismail94
thanks for raising this @joiskash. qq: would it help to increase the periodic sync frequency?
the idea of the offline sync api + search api is really that the app shouldn't be trying to handle online/offline all the time. the app should treat on-device data as if it's online all the time.
The expectation of users is that if the device is online, then it should fetch the latest data. We use online server queries to fetch list of patients that have visited the clinic on a given day. some eg:
Encounter?service-provider=faciliityid&
class=IMP&
date=2023-05-12&
_sort:desc=_lastUpdated&
_include=Encounter:patient
On clicking the Patient, we use a normal sync job. The Online FHIR search is mainly to fetch some resources for display. The actual downloading and inserting in DB is all done by the SDK.
@joiskash Is this still an open issue or have you implemented this into your client application? Can you provide any updates. Thanks
We can close this. We have implemented it on the client side.