Reading FHIR resource history
The FHIR history interaction retrieves the history of a particular FHIR
resource in a HealthLake data store. Using this interaction, you can determine how the contents
of a FHIR resource have changed over time. It is also useful in coordination with audit
logs to see the state of a resource before and after modification. The FHIR interactions
create, update, and delete result in a historical
version of the resource to be saved. For additional information, see history
Note
You can opt out of history for specific FHIR resource types. To opt
out, create a case using AWS Support Center Console
To read FHIR resource history
-
Collect HealthLake
regionanddatastoreIdvalues. For more information, see Getting data store properties. -
Determine the type of FHIR
Resourceto read and collect the associatedidvalue. For more information, see Resource types. -
Construct a URL for the request using the collected values for HealthLake
regionanddatastoreId. Also include the FHIRResourcetype, its associatedid, and optional search parameters. To view the entire URL path in the following example, scroll over the Copy button.GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history{?[parameters]}HealthLake supported search parameters for FHIR historyinteractionParameter Description _count : integerThe maximum number of search results on a page. The server will return the number requested or the maximum number of search results allowed by default for the data store, whichever is lower. _since : instantOnly include resource versions that were created at or after the given instant in time. _at : date(Time)Only include resource versions that were current at some point during the time period specified in the date time value. For more information, see datein the HL7 FHIR RESTful API documentation. -
Send the request. The FHIR
historyinteraction uses aGETrequest with either AWS Signature Version 4 or SMART on FHIR authorization. The followingcurlexample uses the_countsearch parameter to return 100 historical search results per page for a FHIRPatientresource in HealthLake. To view the entire example, scroll over the Copy button.The return content of a
historyinteraction is contained in a FHIR resourceBundle, with type set tohistory. It contains the specified version history, sorted with oldest versions last, and includes deleted resources. For more information, seeResource Bundlein the FHIR R4 documentation.
Reading version-specific FHIR resource history
The FHIR vread interaction performs a version-specific read of a resource
in a HealthLake data store. Using this interaction, you can view the contents of a FHIR
resource as it was at a particular time in the past.
Note
If you use FHIR history interaction without
vread, HealthLake always returns the latest version of the resource's
metadata.
HealthLake declares it support for versioning in CapabilityStatement.rest.resource.versioningResource.meta.versionId
(vid) on all resources.
When FHIR history interaction is enabled (by default for data stores
created after 10/25/2024 or by request for older data stores), the Bundle
response includes the vid as part of the locationvid displays as the number 1. To view the full example,
see Example
Bundle/bundle-response (JSON)
"response" : { "status" : "201 Created", "location" : "Patient/12423/_history/1", ...}
To read version-specific FHIR resource history
-
Collect HealthLake
regionanddatastoreIdvalues. For more information, see Getting data store properties. -
Determine the FHIR
Resourcetype to read and collect associatedidandvidvalues. For more information, see Resource types. -
Construct a URL for the request using the values collected for HealthLake and FHIR. To view the entire URL path in the following example, scroll over the Copy button.
GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history/vid -
Send the request. The FHIR
historyinteraction uses aGETrequest with either AWS Signature Version 4 or SMART on FHIR authorization. The followingvreadinteraction returns a single instance with the content specified for the FHIRPatientresource for the version of the resource metadata specified by thevid. To view the entire URL path in the following example, scroll over the Copy button.