Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GDPR FHIR Operation Support - $erase #850

Closed
prb112 opened this issue Mar 25, 2020 · 6 comments
Closed

Add GDPR FHIR Operation Support - $erase #850

prb112 opened this issue Mar 25, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request schema-change a schema change showcase Used to Identify End-of-Sprint Demos

Comments

@prb112
Copy link
Contributor

prb112 commented Mar 25, 2020

Background
As part of GDPR support, HL7 FHIR is discussing the $erase. The IBM FHIR Server should implement $erase.

Description

  • Implement the $erase operation

Reference
FHIR R5 Roadmap
$erase

@prb112 prb112 added the enhancement New feature or request label Mar 25, 2020
@lmsurpre
Copy link
Member

HAPI FHIR Server implements a similar operation called $expunge (formerly $purge): https://smilecdr.com/docs/fhir_repository/deleting_data.html#the-expunge-operation

@kmbarton423 kmbarton423 added the schema-change a schema change label Nov 16, 2020
@kmbarton423
Copy link
Contributor

need to consider storing compartment relationships outside of parameter tables

@punktilious
Copy link
Collaborator

Compartment relationships are now computed during ingestion and stored as internal token parameters. This information could be leveraged to drive a hard-delete for a patient. To do this properly we need to consider the volume of data likely to be associated with a patient and whether or not it would be possible to delete all that data in a single transaction (taking into account the constraints of log space and transaction time). An asynchronous batch process may be needed so that the deletes can be spread over multiple transactions.

@lmsurpre
Copy link
Member

lmsurpre commented Jan 29, 2021

The really tricky thing here is that we only store parameters for the latest version of a given resource.

Problem scenarios:

Soft-deleted resources

  1. version 1 of a resource points to Patient/abc
  2. user soft-deletes this resource (which essentially becomes version 2 of this resource)

Now we have a request to delete all resources for Patient/abc ...good luck finding the historical version of this resource

Changing ownership

  1. version 1 of a resource points to Patient/123oops
  2. version 2 of the resource points to Patient/123fixed

Now we have a request to delete all resources for Patient/123oops; should this resource which now belongs to Patinet/123fixed be hard deleted?

Lee's proposal

Its scenarios like this that can be very tricky. Unless we want to start storing compartment membership for each version of each resource, I think it might be better to 'punt' on the "erase everything about patient XYZ" and instead implement a single-resource hard-delete; then let the client decide which resources to purge.

How this might play out in a real solution:
Using our fhir-notification mechanism, there is some other component listening for resource creates and updates and associating ResourceType+ResourceId+Version with a given patient. This is that component's sole responsibility.

Then, when it comes time to delete all resources associated with that patient, this component does a simple lookup in its map to decide which resources should get blown away and drives the erasure of those resources. Note: the "Changing ownership" scenario makes this especially tricky and so it might make sense to either disable that via a PersistenceInterceptor or otherwise have policy in place for either mitigating or managing this scenario.

@prb112 prb112 self-assigned this Feb 5, 2021
@prb112
Copy link
Contributor Author

prb112 commented Feb 5, 2021

I've started working on this at a design level and considered Lee and Robin's comments. I'll have a Dev Team meeting on Wednesday to discuss more on the design and implementation.

@prb112 prb112 added this to the Sprint 2021-04 milestone Mar 15, 2021
prb112 added a commit that referenced this issue Apr 1, 2021
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
prb112 added a commit that referenced this issue May 10, 2021
- Issues resolved are:
	- Add GDPR FHIR Operation Support - $erase #850
	- FHIROperationContext inconsistently available to Batch.java #2297
	- Support $erase (hard delete) for a specific historical version of a
resources #2304

- Remove the timeout and count parameters in lieu of the
version-specific erase
- Update the README with clarity on the parameters
	- logicalId, version, patient, reason
	- clarified the HTTP Method, Api Paths, Response Codes, and Responses
	- Add Acceptance Criteria to explain VERSION delete
- Update the test harnesses for Db2 and Postgres to use the simple Erase
approach
- Clean up the DAO, JdbcEraseTest to move away from Timeout
- Removed patient/reason so we don't reflect illegal content.
- Change function/stored proc to use resource_type, logical_id only
- Refactor erase.json to support only specific values.
- Revert test.properties to logging false
- Improve IT/UT test coverage

Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
@lmsurpre lmsurpre added the showcase Used to Identify End-of-Sprint Demos label May 11, 2021
@JohnTimm
Copy link
Collaborator

Ran through the Postman collection that @prb112 provided to verify the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request schema-change a schema change showcase Used to Identify End-of-Sprint Demos
Projects
None yet
Development

No branches or pull requests

5 participants