Skip to content

Commit 75108c5

Browse files
Merge pull request #303327 from evachen96/bulkdeletedocs
bulk delete with references documentation
2 parents 6fd3171 + 3cf96af commit 75108c5

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

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

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The bulk delete capability allows you to delete resources from FHIR® service
1212
FHIR service requires specific headers and roles enabled to use bulk delete capability
1313

1414
## Headers
15-
To perform bulk delete capability header parameters needed are:
15+
Bulk delete capability header parameters are:
1616

1717
- **Accept**: application/fhir+json
1818

@@ -120,7 +120,7 @@ Here's a list of error messages that might occur if the bulk delete operation fa
120120
121121
- What are the steps for resolution if my bulk delete job seems to be stuck?<br/><br/> To check if a bulk delete job is stuck, run a FHIR search with the same parameters as the bulk delete job and _summary=count. If the count of resources is going down, the job is working. You can also cancel the bulk delete job and try again.
122122
123-
- Will API interactions see any latency when a bulk delete operation job is executed concurrently?<br/><br/>When you run a bulk delete operation, you might see increased latency on concurrent calls to the service. To avoid a latency increase, we recommend that you cancel the bulk delete job, and then rerun it during a period of lower traffic.
123+
- Do API interactions see any latency when a bulk delete operation job is executed concurrently?<br/><br/>When you run a bulk delete operation, you might see increased latency on concurrent calls to the service. To avoid a latency increase, we recommend that you cancel the bulk delete job, and then rerun it during a period of lower traffic.
124124
125125
> [!NOTE]
126126
> If you cancel and then restart a bulk delete job, the deletion process resumes from where it was stopped.
@@ -131,7 +131,7 @@ Note: The `$bulk-delete` operation now supports using `_include` and `_revinclud
131131
132132
Some examples of using `$bulk-delete` with `_include` and `_revinclude`:
133133
134-
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:
134+
The following example using `_revinclude` will bulk delete all Patient resources that were last updated before December 18, 2021, and all resources that reference to those patients:
135135
136136
`DELETE [base]/Patient/$bulk-delete?_lastUpdated=lt2021-12-18&_revinclude=*:*`
137137
@@ -140,9 +140,55 @@ The following example using `_include` will bulk delete all DiagnosticReport res
140140
`DELETE [base]/DiagnosticReport/$bulk-delete?_lastUpdated=lt2021-12-12&_include=DiagnosticReport:based-on:ServiceRequest&_include:iterate=ServiceRequest:encounter`
141141
142142
### `$bulk-delete` with `_not-referenced`
143-
Note: This feature is available in Azure Health Data Services FHIR Server only, and is not available in Azure API for FHIR.
143+
>[!Note]
144+
> The `_not-referenced` feature is available in Azure Health Data Services FHIR Server only, and isn't available in Azure API for FHIR.
144145
145-
As mentioned in the "Query parameters" section above, the `$bulk-delete` operation uses FHIR service supported search parameters. This includes the new `_not-referenced` parameter, which allows you to search for and delete resources that are not referenced by any other resources.
146+
As mentioned in the "Query parameters" section, the `$bulk-delete` operation uses FHIR service supported search parameters. This includes the new `_not-referenced` parameter, which allows you to search for and delete resources that are not referenced by any other resources.
146147
147-
The following example will bulk delete all Patient resources that are not referenced by any other resources:
148-
`DELETE [base]/Patient/$bulk-delete?_not-referenced=*:*`
148+
The following example will bulk delete all Patient resources that are not referenced by any other resources:
149+
`DELETE [base]/Patient/$bulk-delete?_not-referenced=*:*`
150+
151+
152+
153+
154+
### `$bulk-delete` with excluded resource types
155+
156+
The `$bulk-delete` operation supports configuring excluded resource types. When you perform a bulk delete operation, these resource types are excluded from deletion. This means that if you include this parameter and specify a comma separated list of resource types in your bulk delete request, those resource types will not be deleted, and the operation will complete successfully deleting everything else in the request, without deleting the specified excluded resource types.
157+
158+
The following example will delete all resources in your FHIR server, except for the `Patient` resource type:
159+
`DELETE [base]/$bulk-delete?excludedResourceTypes=patient`
160+
161+
The following example will delete all resources in your FHIR server, except for the `Patient` and `Observation` resource types:
162+
`DELETE [base]/$bulk-delete?excludedResourceTypes=patient,observation`
163+
164+
### `$bulk-delete` and removing references
165+
166+
167+
The `$bulk-delete` operation supports removing references to resources that are being deleted. This means that if you delete a resource that is referenced by another resource, the reference will be removed from the referencing resource. The reference that has been removed with be replaced with the following value:
168+
169+
`"display": "Referenced resource deleted"`
170+
171+
>[!Note]
172+
> This feature only works with hard delete, so you must also set the `_hardDelete` query parameter to `true`.
173+
174+
This is useful for maintaining data integrity and ensuring that resources that are no longer needed are properly cleaned up.
175+
176+
The following example will bulk hard delete all Patient resources, and remove references to those patients from other resources.
177+
178+
`DELETE [base]/Patient/$bulk-delete?_remove-references=true&_hardDelete=true`
179+
180+
In the example above, if a Patient resource is referenced by a DiagnosticReport resource and an Observation resource, the reference to that Patient will be removed from the DiagnosticReport and Observation resources.
181+
182+
For an Observation's subject reference:
183+
184+
Before delete:
185+
186+
`"subject": {
187+
"reference": "Patient/example-patient-id",
188+
}`
189+
190+
After delete:
191+
192+
`"subject": {
193+
"display": "Referenced resource deleted"
194+
}`

0 commit comments

Comments
 (0)