Skip to main content

Resource History

The Medplum backend stores every version of a resource, allowing you to easily track changes over time. Resource history can be viewed in the Medplum App or by accessing the /_history endpoint.

Accessing History in the Medplum App

To access a resource's history in the Medplum App, follow these steps:

  • Navigate to the resources page at http://app.medplum.com/:resourceType.
  • Select your desired resource. This will bring you to that resource's page.
  • Select the History tab from the array of tabs at the top of the page.

History Tab

Alternatively, you can navigate directly to this page at https://app.medplum.com/:resourceType/:id/history.

The History tab shows every version of the selected resource, representing each time the resoruce was changed. Along with this, it will show when the change was made, as well as the user who made the update.

Selecting a version will bring you to the Diff page, which displays the differences between that version and the version directly previous to it.

Diff Page

You can also view the raw JSON of the selected version by clickin on the Raw tab.

Raw Page

Accessing the /_history Endpoint

The history of a resouce can also be viewed by accessing the /_history endpoint in the FHIR API. This endpoint allows you to retrieve the history of an individual resource, a resource type, or all resources in your system.

To access the /_history endpoint, make a GET request to the url of the desired resource or resource type.

The Mepdlum SDK also provides the readHistory helper function to access the /_history endpoint.

await medplum.readHistory('Patient', 'homer-simpson');

These requests return a Bundle resource with the different versions stored as an array of resources in the entry field.

Resource Creation Time

There is currently no support for directly accessing the time and date that a resource was initially created. To do this use the /_history endpoint to retrieve all versions and view the lastUpdated field of the original version. Note that the GraphQL endpoint does not currently have a spec for the history API.