samply / blaze

A FHIR® Server with internal, fast CQL Evaluation Engine
https://samply.github.io/blaze
Apache License 2.0
141 stars 19 forks source link

deleting resources cascade #1792

Open SamShekhovtsov opened 3 weeks ago

SamShekhovtsov commented 3 weeks ago

it should be possible to cascade delete resources. For example, at our test environment we have a need to cascade delete a device, including all related/linked observations. I'm aware about the ENFORCE_REFERENTIAL_INTEGRITY environment variable, however it should do more than that - remove all linked resources whenever needed.

In order to support the cascade devete, the FHIR server should be configured accordingly, user have to have sufficient permissions and _delete=cascade query parameter should be set or, alternativelly, the HTTP header: 'X-Cascade': 'delete' should be set.

  1. First, the Cascading Deletes Enabled setting must be enabled on the FHIR Storage module.
  2. Then, the user performing the operation must have the FHIR_DELETE_CASCADE_ALLOWED permission, as well as a specific permission allowing the child resource to be deleted. For example, you might grant the user the FHIR_DELETE_CASCADE_ALLOWED and FHIR_ALL_DELETE permissions.
  3. DELETE /Patient/123?_cascade=delete or HTTP header set: DELETE /Patient/123 X-Cascade: delete
alexanderkiel commented 2 weeks ago

Hi Sem, thanks for your issue. We decently will do more work regarding deletion and also #399. Did you especially refer to the way SmileCDR does Cascading Deletes?

SamShekhovtsov commented 2 weeks ago

yep, I was talling specifically about cascading delete, for exampe, remove a patient or a device and all the related observations https://smilecdr.com/docs/fhir_repository/deleting_data.html#cascading-deletes