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
region
anddatastoreId
values. For more information, see Getting data store properties. -
Determine the type of FHIR
Resource
to read and collect the associatedid
value. For more information, see Resource types. -
Construct a URL for the request using the collected values for HealthLake
region
anddatastoreId
. Also include the FHIRResource
type, 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 history
interactionParameter Description _count : integer
The 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 : instant
Only 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 date
in the HL7 FHIR RESTful API documentation. -
Send the request. The FHIR
history
interaction uses aGET
request with either AWS Signature Version 4 or SMART on FHIR authorization. The followingcurl
example uses the_count
search parameter to return 100 historical search results per page for a FHIRPatient
resource in HealthLake. To view the entire example, scroll over the Copy button.The return content of a
history
interaction 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 Bundle
in 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.versioning
Resource.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 location
vid
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
region
anddatastoreId
values. For more information, see Getting data store properties. -
Determine the FHIR
Resource
type to read and collect associatedid
andvid
values. 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
history
interaction uses aGET
request with either AWS Signature Version 4 or SMART on FHIR authorization. The followingvread
interaction returns a single instance with the content specified for the FHIRPatient
resource 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.