FHIR Chat · type level expunge everything · hapi

Stream: hapi

Topic: type level expunge everything


view this post on Zulip Martin Zacho Grønhøj (May 13 2020 at 10:56):

Hi - I need to permanently delete all instances of a subset of all resources types (Patient, Appointment, Communication etc., but not the conformance resources StructureDefinition, ValueSet, CodeSystem etc.) on several servers running the hapi fhir jpaserver v4.1.0 DSTU3.

By testing it seems that the hapi-fhir-jpaserver only supports the expunge everything parameter on system level operations (eg. permanently deleting all instances of all resource types on a server), and not on type level operations (permanently deleting all instances of a given resource type). It looks like this is unchanged in v4.2.0 and the soon-to-be-released v5.0.0 (released today?! hooray).

Ok, so I thought, "oh well, I'll just first invoke the type level DELETE operation on all of the resource types I need to permanently delete, before I call the type level expunge operation with the 'expungeDeletedResources' and 'expungeOldVersions' flags set." - however this is not possible, since the DELETE operation is only supported on resource instances, not on resource types.. It seems a bit to use this to mark all instances of a given resource type as deleted.

Can anyone help me figuring out the combination of DELETE/ expunge operations needed in my use case?

view this post on Zulip James Agnew (May 13 2020 at 13:05):

If you enable multi-delete (it's disabled by default) you can use a conditional delete to delete everything by type.

We make it a bit hard because it would be easy to accidentally to a lot of damage. Basically, we require at least one search parameter on the condition, so you can't do:

DELETE Patient?

...but you could get the same effect by doing:

DELETE Patient?_lastUpdated=gt1970

Note that expunge has had a lot of performance optimization in the last 6 months. You'll get much more consistent performance if you upgrade to HAPI FHIR 5.0.0.

view this post on Zulip Martin Zacho Grønhøj (May 13 2020 at 13:48):

Thanks - I can't seem to find any documentation of multi-delete?

view this post on Zulip James Agnew (May 13 2020 at 15:47):

This is the setting: https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java#L1001

Looks like it's literally the only one without documentation! Whoops......


Last updated: Apr 12 2022 at 19:14 UTC