This page is part of the FHIR Specification (v0.5.0: DSTU 2 Ballot 2). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2
FHIR (Fast Health Interoperability Resources) is designed to enable the information exchange that supports the provision of healthcare in a wide variety of processes. The specification builds on and adapts standard industry RESTful practices to enable the provision of integrated healthcare across a wide range of teams.
The intended scope of FHIR is broad, covering human and veterinary, clinical care, public health, clinical trials, administration and financial aspects. The standard is intended for global use in a wide variety of architectures and scenarios.
FHIR is based on "Resources" which are the common building block for all exchanges. Each resource has the following common features:
Resources are represented as either XML or JSON. There are currently 89 different resource types defined in the FHIR specification.
This is an example of how a patient is represented as a FHIR object in JSON. An XML encoding is also defined in the specification.
{
"resourceType": "Patient",
"id" : "23434",
"meta" : {
"versionId" : "12",
"lastUpdated" : "2014-08-18T01:43:30Z"
}
"text": {
"status": "generated",
"div": "<!-- Snipped for Brevity -->"
},
"extension": [
{
"url": "http://example.org/consent#trials",
"valueCode": "renal"
}
],
"identifier": [
{
"use": "usual",
"label": "MRN",
"system": "http://www.goodhealth.org/identifiers/mrn",
"value": "123456"
}
],
"name": [
{
"family": [
"Levin"
],
"given": [
"Henry"
],
"suffix": [
"The 7th"
]
}
],
"gender": {
"text": "Male"
},
"birthDate": "1932-09-24",
"active": true
}
Each resource consists of:
Note that though this specification always shows the JSON properties in the order they are defined, many JSON libraries order properties by other criteria.
For manipulation of resources, FHIR provides a REST API with a rich but simple set of interactions:
The FHIR specification describes other kinds of exchanges beyond this simple RESTful API, including exchange of groups of resources as Documents, Messages, and by using other kinds of services.
One feature of the healthcare industry is that there is a wide variation between different jurisdictions and sections of the industry, and no central authority to impose common business practices. Because of this, the FHIR specification defines a common extension framework, and defines a framework for managing variability.
To create a resource, send an HTTP POST request to the resource's respective end point.
POST https://example.com/path/{resourceType}
In the example below we see the creation of a Patient.
POST {some base path}/Patient HTTP/1.1
Authorization: Bearer 37CC0B0E-C15B-4578-9AC1-D83DCED2B2F9
Accept: application/json+fhir
Content-Type: application/json+fhir
Content-Length: 1198
{
"resourceType": "Patient",
...
}
Submit a new patient to the server, and ask it to store the patient with an id of its own choice. Notes:
A response contains an HTTP code 201 to indicate that the Resource has been created successfully. A location header indicates where the resource can be fetched in subsequent requests. The server may choose to return an OperationOutcome resource, but is not required to do so.
HTTP/1.1 201 Created
Content-Length: 161
Content-Type: application/json+fhir
Date: Mon, 18 Aug 2014 01:43:30 GMT
ETag: "1"
Location: http://example.com/Patient/347
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">The operation was successful</div>"
}
}
Notes:
For a variety of reasons, servers may need to return an error. Clients should be alert to authentication related responses, but FHIR content related errors should be returned using an appropriate HTTP status code, with an OperationOutcome resource to provide additional information. Here is an example of a server rejecting a resource because of server defined business rules:
HTTP/1.1 422 Unprocessable Entity
Content-Length: 161
Content-Type: application/json+fhir
Date: Mon, 18 Aug 2014 01:43:30 GMT
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">MRN conflict
- the MRN 123456 is already assigned to a different patient</div>"
},
}
Notes:
Reading a resource is done by sending HTTP GET requests to the desired Resource end point.
GET https://example.com/path/{resourceType}/{id}
Here's an example.
GET /Patient/347?_format=xml HTTP/1.1
Host: example.com
Accept: application/xml+fhir
Cache-Control: no-cache
Notes:
The response to a GET contains the Resource.
HTTP/1.1 200 OK
Content-Length: 729
Content-Type: application/xml+fhir
Last-Modified: Sun, 17 Aug 2014 15:43:30 GMT
ETag: "1"
<?xml version="1.0" encoding="UTF-8"?>
<Patient xmlns="http://hl7.org/fhir">
<id value="347"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2014-08-18T01:43:30Z"/>
</meta>
<!-- content as shown above for patient -->
</Patient>
Notes:
In addition to getting single known resources it is possible to find resources by searching the resource end point with a set of criteria describing the set of resources that should be retrieved and their order. The general pattern is:
GET https://example.com/path/{resourceType}?criteria
The criteria is a set of http parameters that specify which resources to return. The search operation
https://example.com/base/MedicationPrescription?patient=347
returns all the prescriptions for the patient created above.
The response to a search request is a bundle: list of matching resources with some metadata:
{
"resourceType": "Bundle",
"id" : "eceb4882-5c7e-4ca4-af62-995dfb8cef01"
"meta" : {
"lastUpdated" : "2014-08-19T15:43:30Z"
},
"base": "http://example.com/base",
"total": "3",
"link": [
{
"relation" : "next",
"url" : "https://example.com/base/MedicationPrescription?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2"
}, {
"relation" : "self",
"url" : "https://example.com/base/MedicationPrescription?patient=347"
}
],
"entry": [
{
"resource" : {
"resourceType": "MedicationPrescription",
"id" : "3123",
"meta" : {
"versionId" : "1",
"lastUpdated" : "2014-08-16T05:31:17Z"
},
... content of resource ...
},
},
... 2 additional resources ....
]
}
Notes:
The client sends the server a new version of the resource to replace the exist version - it PUTs it to the location of the existing resource:
PUT https://example.com/path/{resourceType}/{id}
Note that there does not need to be a resource already existing at {id} - the server may elect to automatically create the resource at the specified address. Here is an example of updating a patient:
PUT /Patient/347 HTTP/1.1
Host: example.com
Content-Type: application/json+fhir
Content-Length: 1435
Accept: application/json+fhir
If-Match: 1
{
"resourceType": "Patient",
"id" : "347",
"meta" : {
"versionId" : "1",
"lastUpdated" : "2014-08-18T01:43:30Z"
},
...
}
Notes:
The response to an update request has metadata / status, and optionally an OperationOutcome:
HTTP/1.1 200 OK
Content-Length: 161
Content-Type: application/json+fhir
Date: Mon, 18 Aug 2014 01:43:30 GMT
ETag: "2"
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">The operation was successful</div>"
}
}
Notes:
Here is an example that shows all the information found in all resources, fully populated:
{
"resourceType" : "X",
"id" : "12",
"meta" : {
"versionId" : "12",
"lastUpdated" : "2014-08-18T01:43:30Z",
"profile" : ["http://example-consortium.org/fhir/profile/patient"],
"security" : [{
"system" : "http://hl7.org/fhir/v3/ActCode",
"code" : "EMP"
}],
"tag" : [{
"system" : "http://example.com/codes/workflow",
"code" : "needs-review"
}]
},
"implicitRules" : "http://example-consortium.org/fhir/ehr-plugins",
"language" : "X"
}
Implementers notes: