Skip to content

Commit af02113

Browse files
Merge pull request #312082 from evachen96/20260219_evachbulkupdatemeta
20260219 evachbulkupdatemeta
2 parents f41067c + 3a4efec commit af02113

3 files changed

Lines changed: 40 additions & 10 deletions

File tree

articles/healthcare-apis/fhir/fhir-bulk-update.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To execute a bulk update, the application or user must be assigned one of the fo
4242

4343
## Request
4444

45-
You can use FHIR search parameters in the request. The bulk update operation supports standard search filters, for example: address:contains=Meadow, or Patient.birthdate=1987-02-20. You can also use _include, _revinclude, and _not-referenced to extend search criteria.
45+
You can use FHIR search parameters in the request. The bulk update operation supports standard search filters, for example: address:contains=Meadow, or Patient.birthdate=1987-02-20. You can also use _include, _revinclude, and _not-referenced to extend search criteria, and _meta-history to configure versioning behavior for metadata-only updates.
4646

4747
### Request examples
4848

@@ -61,6 +61,10 @@ You can use FHIR search parameters in the request. The bulk update operation sup
6161

6262
`PATCH {FHIR-SERVICE-HOST}/DiagnosticReport/$bulk-update?_lastUpdated=lt2021-12-12&_include=DiagnosticReport:based-on:ServiceRequest&_include:iterate=ServiceRequest:encounter`
6363

64+
4. Metadata-only updates with `_meta-history` query parameter: When the FHIR server versioning policy is set to either `versioned` or `version-update`, the `_meta-history` parameter allows you to control whether metadata-only changes to a resource create a new historical version of the resource or not. By default, any change to a resource, including metadata-only changes, creates a new version and saves the previous version as a historical record. When you set the `_meta-history` parameter to false, metadata-only changes do not create a new version, and the previous version is not saved as a historical record. This feature is useful for scenarios where frequent metadata updates are made, and you want to avoid cluttering the resource history with numerous versions that only differ in metadata. For more information and examples, see [FHIR versioning policy and history management](fhir-versioning-policy-and-history-management.md#metadata-only-updates-and-versioning).
65+
66+
`PATCH https://{FHIR-SERVICE-HOST}/$bulk-update?_meta-history=false`
67+
6468
When using bulk update with FHIR search parameters, consider using the same query in a FHIR search first, so that you can verify the data that you plan to update.
6569

6670
The following is an example request body.

articles/healthcare-apis/fhir/fhir-versioning-policy-and-history-management.md

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.custom: sfi-image-nochange
1212

1313
# Versioning policy and history management
1414

15-
The versioning policy in the Azure Health Data Services FHIR® service is a configuration which determines how history is stored for every resource type, with the option for resource specific configuration. This policy is directly related to the concept of managing history for FHIR resources.
15+
The versioning policy in the Azure Health Data Services FHIR® service is a configuration that determines how history is stored for every resource type, with the option for resource specific configuration. This policy is directly related to the concept of managing history for FHIR resources.
1616

1717
## History in FHIR
1818

@@ -71,9 +71,9 @@ Changing the versioning policy, either at a system level or resource level, won'
7171
> The query parameter _summary=count and _count=0 can be added to _history endpoint to get a count of all versioned resources. This count includes soft deleted resources.
7272
7373
## Metadata-only updates and versioning
74-
If the versioning policy is set to either `versioned` or `version-update`, metadata-only updates (changes to FHIR resources that only affect the metadata) increment the resource version, create a new version, and save the old version as a historical record. If you are making metadata-only changes using PUT or PATCH updates, you can use the query parameter _meta-history for PUT and PATCH updates to configure whether or not the old version is saved as a historical record.
74+
If the versioning policy is set to either `versioned` or `version-update`, metadata-only updates (changes to FHIR resources that only affect the metadata) increment the resource version, create a new version, and save the old version as a historical record. If you're making metadata-only changes using PUT, PATCH, or `$bulk-update`, you can use the query parameter `_meta-history` to configure whether or not the old version is saved as a historical record.
7575
- `_meta-history=true` is set by default. By default, the resource version is incremented, a new version is created, and the old version is saved as a historical record. The lastUpdated timestamp is updated to reflect the change.
76-
- `_meta-history=false` The `_meta-history` parameter can be configured to `false`. This means that the resource version is incremented, a new version is created, but the old version is not saved as a historical record. The lastUpdated timestamp is also still updated to reflect the change. This configuration can be used to help reduce data storage when making metadata-only updates.
76+
- `_meta-history=false` The `_meta-history` parameter can be configured to `false`. This means that the resource version is incremented, a new version is created, but the old version isn't saved as a historical record. The lastUpdated timestamp is also still updated to reflect the change. This configuration can be used to help reduce data storage when making metadata-only updates.
7777

7878

7979
### Example of `_meta-history=false` with PUT
@@ -92,7 +92,7 @@ To demonstrate the use of the `_meta-history` parameter with PUT, follow this ex
9292
]
9393
}
9494
```
95-
2. Create a new version of the resource with `PUT <fhir server>/Patient/test-patient`. This will have version 2.
95+
2. Create a new version of the resource with `PUT <fhir server>/Patient/test-patient`. This has version 2.
9696
```
9797
{
9898
"id": "test-patient",
@@ -127,11 +127,11 @@ To demonstrate the use of the `_meta-history` parameter with PUT, follow this ex
127127
]
128128
}
129129
```
130-
5. This will increment resource version and create a new version 3, but the old version 2 will not be saved as a historical record. To see this, run: `GET <fhir server>/Patient/test-patient/_history`. Two versions should be returned, versions 1 and 3. Please note that `_meta-history=false` query parameter only affects metadata-only changes made using PUT or PATCH. Using the query parameter to make metadata updates along with other non-metadata field value changes will increment the resource version and save the old version as a historical record.
130+
5. This increments resource version and create a new version 3, but the old version 2 won't be saved as a historical record. To see this, run: `GET <fhir server>/Patient/test-patient/_history`. Two versions should be returned, versions 1 and 3. Please note that `_meta-history=false` query parameter only affects metadata-only changes made using PUT or PATCH. Using the query parameter to make metadata updates along with other non-metadata field value changes will increment the resource version and save the old version as a historical record.
131131

132132

133-
### Example of `_meta-history=false` with PATCH
134-
To demonstrate the use of the `_meta-history` parameter with PATCH, follow this example:
133+
### Example of `_meta-history=false` with PATCH or `$bulk-update`
134+
To demonstrate the use of the `_meta-history` parameter with PATCH or `$bulk-update`, follow this example:
135135

136136
1. Create a resource:
137137
`PUT <fhir server>/Patient/test-patient`
@@ -169,7 +169,7 @@ To demonstrate the use of the `_meta-history` parameter with PATCH, follow this
169169
}
170170
```
171171
3. Run: `GET <fhir server>/Patient/test-patient/_history`. Two versions should be returned, versions 1 and 2.
172-
4. Use PATCH to make a metadata-only update with `_meta-history=false` query parameter. The example uses PATCH to update only the Patient.meta.tag.system value. More information about PATCH [here](rest-api-capabilities.md#patch-and-conditional-patch).
172+
4. Use PATCH or `$bulk-update`to make a metadata-only update with `_meta-history=false` query parameter. The example demonstrates using PATCH or `$bulk-update` to update only the Patient.meta.tag.system value. More information about PATCH [here](rest-api-capabilities.md#patch-and-conditional-patch) and `$bulk-update` [here](fhir-bulk-update.md).
173173

174174
Using PATCH with FHIRPath patch:
175175
`PATCH <fhir server>/Patient/test-patient?_meta-history=false`
@@ -192,6 +192,30 @@ Using PATCH with FHIRPath patch:
192192
]
193193
}
194194
```
195+
If you wanted to bulk update multiple resources, you could use `$bulk-update`. The following example shows how to use `$bulk-update` to update the same metadata field for all Patient resources with `_meta-history=false`:
196+
197+
`PATCH <fhir server>/Patient/$bulk-update?_meta-history=false`
198+
`Accept: application/fhir+json`
199+
`Content-type: application/fhir+json`
200+
`Prefer: respond-async`
201+
202+
```
203+
204+
{
205+
"resourceType": "Parameters",
206+
"parameter": [
207+
{
208+
"name": "operation",
209+
"part": [
210+
{ "name": "type", "valueCode": "upsert" },
211+
{ "name": "path", "valueString": "Patient.meta.tag[0].system" },
212+
{ "name": "value", "valueUri": "test2" }
213+
]
214+
}
215+
]
216+
}
217+
```
218+
195219

196220
Using PATCH with JSON Patch:
197221
`PATCH <fhir server>/Patient/test-patient?_meta-history=false`
@@ -207,6 +231,8 @@ Using PATCH with JSON Patch:
207231
```
208232
5. This will increment resource version and create a new version 3, but the old version 2 will not be saved as a historical record. To see this, run: `GET <fhir server>/Patient/test-patient/_history`. Two versions should be returned, versions 1 and 3. Please note that `_meta-history=false` query parameter only affects metadata-only changes made using PUT or PATCH. Using the query parameter to make metadata updates along with other non-metadata field value changes will increment the resource version and save the old version as a historical record.
209233

234+
235+
210236
## Next steps
211237

212238
In this article, you learned how to purge the history for resources in the FHIR service. For more information about how to disable history and some concepts about history management, see

articles/healthcare-apis/fhir/rest-api-capabilities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Content-Type: `application/json`
182182
```
183183

184184
#### Patch with `_meta-history` parameter
185-
The FHIR service supports the `_meta-history` query parameter with both `PUT` and `PATCH` operations. This parameter allows you to control whether metadata-only changes to a resource create a new historical version of the resource or not. By default, any change to a resource, including metadata-only changes, creates a new version and saves the previous version as a historical record. When you set the `_meta-history` parameter to `false`, metadata-only changes do not create a new version, and the previous version is not saved as a historical record. This feature is useful for scenarios where frequent metadata updates are made, and you want to avoid cluttering the resource history with numerous versions that only differ in metadata. For more information and examples, see [FHIR versioning policy and history management](fhir-versioning-policy-and-history-management.md#metadata-only-updates-and-versioning).
185+
The FHIR service supports the `_meta-history` query parameter with both `PUT` and `PATCH` operations. When the FHIR server versioning policy is set to either `versioned` or `version-update`, the `_meta-history` parameter allows you to control whether metadata-only changes to a resource create a new historical version of the resource or not. By default, any change to a resource, including metadata-only changes, creates a new version and saves the previous version as a historical record. When you set the `_meta-history` parameter to `false`, metadata-only changes do not create a new version, and the previous version is not saved as a historical record. This feature is useful for scenarios where frequent metadata updates are made, and you want to avoid cluttering the resource history with numerous versions that only differ in metadata. For more information and examples, see [FHIR versioning policy and history management](fhir-versioning-policy-and-history-management.md#metadata-only-updates-and-versioning).
186186

187187
`PATCH <fhir server>/Patient/test-patient?_meta-history=false`
188188

0 commit comments

Comments
 (0)