google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
465 stars 246 forks source link

Query deleted resources for p2p sync #1178

Open ekigamba opened 2 years ago

ekigamba commented 2 years ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like There are several proposed solutions:

  1. Default to soft-deletes and have an API for hard deletes
  2. Soft-deletes only. Never purge data unless the database is deleted
  3. Keep a separate table for tracking deleted resources on the implementing application (FHIR Core/P2P)
  4. We can partially open up the local changes API
  5. We can have a log table on FHIR Engine to keep track of all resource changes

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.

ekigamba commented 2 years ago

Solution 1

Solution 2

Solution 3

Solution 4

Solution 5 (Log table on FHIR Engine tracking resource changes)

Based on the discussion

Use cases

  1. Erroneously created tasks and care plans that need to be hard deleted
  2. Erroneously created data needs to be purged
  3. Devices that never connect to the server after initial login. These devices uses p2p sync to share data to the supervisors device which then connects to the internet
  4. Devices that are offline at times and use p2p sync but are connected to the internet once in a while
ekigamba commented 2 years ago

Feb 24, 2022

We have two options for p2p currently:

  1. Mark resources as soft-deleted and provide a flag in the Search API that provides either soft-deleted records
  2. Provide an API that returns a list of Resource IDs for deleted resources filtered by date

Generally, we agreed that:

Other notes