onaio / fhir-tooling

A command line utility to support FHIR Core content authoring
Other
2 stars 1 forks source link

Add functionality to clean duplicate Practitioners from the HAPI server #61

Closed Wambere closed 11 months ago

Wambere commented 11 months ago

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes https://github.com/onaio/fhir-tooling/issues/58

ageryck commented 11 months ago

it turns out cascade_delete only cascades for Patient resources, we may need to find a way to get linked resources id's and delete them as batch via the transactional delete

Wambere commented 11 months ago

this seems very scary if the practitioner has linked data, whether cascade_delete is true or false.

when would we expect this to be used? Once data collection has started we probably want to clean up links instead of delete data.

@pld I agree, technically this should not have happened in the first place. I think these "extra" resources were created in the very beginning before we started passing in uuids for Practitioners to the csv. So when we ran the script again with new uuids, we created duplicates. Also I think passing cascade_delete as false (at least for the first run) is safe-ish since anything with related resources will not be deleted, and anything that is actually deleted is logged and is only soft deleted and can be recovered

pld commented 11 months ago

this seems very scary if the practitioner has linked data, whether cascade_delete is true or false. when would we expect this to be used? Once data collection has started we probably want to clean up links instead of delete data.

@pld I agree, technically this should not have happened in the first place. I think these "extra" resources were created in the very beginning before we started passing in uuids for Practitioners to the csv. So when we ran the script again with new uuids, we created duplicates. Also I think passing cascade_delete as false (at least for the first run) is safe-ish since anything with related resources will not be deleted, and anything that is actually deleted is logged and is only soft deleted and can be recovered

OK, can you please add these details on when to use it to the readme? And a confirmation prompt when it's called from the cli

ageryck commented 11 months ago

it turns out cascade_delete only cascades for Patient resources, we may need to find a way to get linked resources id's and delete them as batch via the transactional delete

This worked for @Wambere , it could be a permission issue on the target server