Most FHIR servers won't completely remove a FHIR resource from the database when you do a DELETE.
What I'm wondering is this: if I retreive the latest version of a deleted resource using it _history
for example: GET Patient/1/_history/2
and want to "restore" it. What's the best way to do that?
Is my only option to create a copy of the deleted patient by removing the ID and doing POST
to /Patient
or... is there some way to restore the deleted patient and keep its original ID?
This may depend on the FHIR server you're using
With the HAPI FHIR server a deleted resource is still considered to be an existing record, so simply calling PUT
on that resource will "un-delete" it and create a new version, adding it to the resource's history.
Other FHIR servers might take a different interpretation.
With the Google Cloud Healthcare API, this would require enabling the "update as create" feature, or upsert operation https://hl7.org/fhir/http.html#upsert. This feature allows you to create a resource with an ID you specify by using PUT
instead of POST
. The Cloud Healthcare API does not differentiate between deleted and missing records for updates, so "enableUpdateCreate" is required to "re-create" (vs "un-delete") the resource. However, even though it is "re-created", it will still become part of the resource's history.