Closed f-odhiambo closed 6 months ago
I've conducted some research regarding the functionality:
Conditional Deletes:
It seems that conditional deletes with a match URL like /Patient?_id=1,2
result in an error due to matching multiple resources. To overcome this, it might be necessary to delete resources one by one.
ref: https://hl7.org/fhir/http.html#cdelete
Transactional Deletes: Transactional deletes, such as using a Bundle with DELETE methods, also encounter issues when a resource has references. Deleting references one by one might be necessary to successfully delete the target resource. ref: https://smilecdr.com/docs/fhir_repository/deleting_data.html#transactional-delete
Expunge Operation: The expunge operation is not supported as of now, and attempting to use it results in a parsing error. It might be worth checking if future updates of the tooling will include support for this operation. ref: https://smilecdr.com/docs/fhir_repository/deleting_data.html#instance-level-expunge
Cascading Deletes:
Enabling allow_cascading_deletes
and allow_multiple_delete
at the JPA server settings seems to work for deleting multiple resources and all references at once. This means if a Patient of id 1 is referenced by another resource i.r Observation. When the patient is deleted, the referenced observation is deleted aswell.
[DELETE] http://localhost:8888/fhir/Patient?_id=1,2&_cascade=delete
ref: https://docs.oracle.com/en/industries/health-sciences/healthcare-data-repository/8.1.4/fhir-guide/deletes-and-referential-integrity.html#GUID-78537C7B-B9CC-466D-BFF4-8D75E785947C
I'll be implementing 4 as a solution to this
@f-odhiambo @lincmba I'm probably missing some context here, but is there a reason we could not use this already existing cleaner ?
Option 4 does not exist on the cleaner , so should we add this ad an enhancement there ?
since this already done in the PR, let's make sure the PR matches the cleaner functionality and remove the cleaner, I think we need to add expunge to the efsity version to match.
@lincmba you can update the PR to delete the cleaner, after adding the expunge functionality
@pld after some discussions with @ndegwamartin and @lincmba we think that it makes more sense to update the current cleaner and keep using it instead of deleting it, since it has the following functionality that does not exist here yet
We would need to add the cascade delete
functionality to the cleaner though, creating a separate issue for that
Ah ok, so then we're remove the cleaning functionality from esfity? Or maybe better, merge that PR, so it's there and working, but at a doc string pointing to the cleaner tool?
Nevermind, just saw this comment, https://github.com/onaio/fhir-tooling/issues/101#issuecomment-1893980465
To be completed in https://github.com/onaio/fhir-tooling/issues/106
Need to delete dummy data from HAPI which includes dirty/dummy data while testing
DELETE
/Patient/123?_cascade=delete
$expunge
operation{ "resourceType": "Parameters", "parameter": [ { "name": "expungeEverything", "valueBoolean": true } ] }