The $expunge operation
In some cases, you may need to completely delete data from the HDR-FHIR repository after performing the DELTE operation. In those cases, the $expunge operation will be used and is a powerful operation that can physically delete old versions of resources, deleted resources, or even all data in the database.
Table 11-11 Input Parameters
Name | Type | Usage | Default |
---|---|---|---|
limit | Number | This parameter specifies the maximum number of entries (resource versions and/or resources) that will be deleted in a single batch before exiting. | 1000 |
expungeDeletedResources | Boolean | If set to true, deleted resources will be expunged (including all previous versions of the resource). | false |
expungePreviousVersions | Boolean | If set to true, non-current versions of resources will be expunged. | false |
expungeEverything | Boolean | If set to true, current versions of resources will also be expunged. | false |
Instance level expunge
You can invoke the $expunge operation against a single resource instance, or even an individual version of a resource instance. If invoked at the instance level (shown below), previous versions of the resource may be deleted (if expungePreviousVersions is set to true) and the current version may be deleted (if the resource is deleted and expungeDeletedResources is set to true).
Request: Instance level expunge against a single resource instance
![Request: Instance level expunge against a single resource instance Request: Instance level expunge against a single resource instance](img/delete_instance-levelexpunge_example.png)
Request: Instance level expunge at the instance version level
You can also invoke the $expunge operation at the instance version level (shown below). Use this to expunge an individual version of a resource without affecting other versions.
![Request: Instance level expunge at the instance version level Request: Instance level expunge at the instance version level](img/delete_instance-levelexpunge_example2.png)
Type level expunge
You can invoke the $expunge operation at the type level. In this mode, all resources of a given type are processed with the same rules as at the instance level.
Request: Type level expunge at the type level
![Request—Type level expunge at the type level Request—Type level expunge at the type level](img/delete_typelevelexpunge_typelevel_example.png)
System level expunge
You can invoke the $expunge operation at the system level. In this mode, all resources on the server are processed with the same rules as at the instance level.
Request: System level expunge
![Request: System level expunge Request: System level expunge](img/delete_systemlevelexpunge_example.png)
Delete expunge
If you need to quickly delete all data associated with a set of resources, you can combine the DELETE and $expunge operations into a single step. Oracle HDR FHIR supports this combination.
You can call the usual DELETE with a special parameter
_expunge=true
. This results
in starting a Delete Expunge Batch Job that deletes and expunges the
requested details in the background.
In order to perform a Delete Expunge, three settings need to be enabled on the Oracle HDR FHIR server:
- Expunge Enabled
(
expunge_enabled=true
) - Delete Expunge Enabled
(
delete_expunge_enabled=true
) - Allow multiple Delete Enabled
(
allow_multiple_delete=true
)
When the _expunge parameter is provided to the DELETE operation, the matched resources and all of their history will be both deleted and expunged from the database. This will perform considerably faster than doing the delete and expunge separately.
DELETE with _expunge=true
The following example shows how to perform a delete expunge using the DELETE method:
Request: DELETE with _expunge=true
![Request: DELETE with _expunge=true Request: DELETE with _expunge=true](img/delete_deletewithexpungetrue_example.png)
Parent topic: Deleting data