Skip to content

Commit d4c4345

Browse files
authored
Update fhir-bulk-delete-operation.md
Add examples for bulk delete with _include and _revinclude
1 parent 7246603 commit d4c4345

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

articles/healthcare-apis/includes/fhir-bulk-delete-operation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ Query parameters allow you to filter the raw resources you plan to delete. To su
5757
5858
All the query parameters are optional.
5959
60+
#### Examples for using `$bulk-delete` with `_include` and `_revinclude`
61+
Note: When using FHIR service-supported search parameters with `$bulk-delete`, the `$bulk-delete` operation now supports using `_include` and `_revinclude` in the search criteria for conditional and bulk delete. Please note that this does not affect current behavior of singular deletes, which does not support extra parameters. Additionally, when using bulk delete with FHIR search parameters, consider using the same query in a FHIR search first, so that you can verify the data that you want to delete.
62+
63+
Some examples of using `$bulk-delete` with `_include` and `_revinclude`:
64+
65+
The following example using `_revinclude` will bulk delete all Patient resources that were last updated before 12/18/2021, as well as all resources that reference to those patients:
66+
67+
`DELETE [base]/Patient/$bulk-delete?_lastUpdated=lt2021-12-18&_revinclude=*:*`
68+
69+
The following example using `_include` will bulk delete all DiagnosticReport resources that were last updated before 12/18/2021, as well as all ServiceRequest resources that are referenced by those DiagnosticReport resources (via DiagnosticReport.basedOn relationship), and all Encounter resources that are referenced by those ServiceRequest resources (via ServiceRequest.encounters relationship):
70+
71+
`DELETE [base]/DiagnosticReport/$bulk-delete?_lastUpdated=lt2021-12-12&_include=DiagnosticReport:based-on:ServiceRequest&_include:iterate=ServiceRequest:encounter`
72+
73+
74+
75+
6076
### `$bulk-delete-soft-deleted` operation
6177
To delete soft deleted resources within a FHIR service -$bulk-delete-soft-deleted operation can be used. This operation can be executed at the system level or for individual resource types.
6278

0 commit comments

Comments
 (0)