This page is part of the FHIR Specification (v5.0.0-draft-final: Final QA Preview for R5 - see ballot notes). 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 Infrastructure Work Group | Maturity Level: N/A | Standards Status: Informative |
FHIR (Fast Healthcare Interoperability Resources) is designed to enable information exchange to support the provision of healthcare in a wide variety of settings. The specification builds on and adapts modern, widely used RESTful practices to enable the provision of integrated healthcare across a wide range of teams and organizations.
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 and in a wide variety of architectures and scenarios.
FHIR is based on "Resources" which are the common building blocks for all exchanges. Resources are an instance-level representation of some kind of healthcare entity. All resources have the following features in common:
Resource instances are represented as either XML, JSON or RDF and there are currently 157 different resource types defined in the FHIR specification.
This specification describes a set of resources - that is, a set of resource types that describe the set of resource instances that can actually be exchanged. The term 'Resource' is sometimes used without clarifying whether it specifically refers to types or instances - the context of use makes this clear.
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-18T15: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 instance of a resource consists of:
Note that although this specification always shows the JSON properties in the order that they are defined, many JSON libraries order properties by other criteria.
All resources may have a URL
that identifies the resource and specifies where it was/can be accessed from.
This URL is not represented inside the resource; the value arises in a context use, and changes as copies of the
resource are made, or following other deployment/security related changes. If the resource is accessed via
the FHIR RESTful API (see immediately below) then the URL for the resource is [base]/[resourceType]/[id]
where the resourceType
and id
come from the resource (see above).
Some resources - those typically associated with formal publication cycles, rather than operational healthcare - have an explicit URL in them, which is normally the URL of master copy of the resource. This URL remains constant as the resource is copied across systems. See Canonical URLs for further information.
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, as Messages, and by using various types of Services.
There is a wide variation between different geo-political jurisdictions and segments of the healthcare industry, and no central authority to impose common business practices. Because of this, the FHIR specification defines an extension framework and defines a framework for managing variability.
Another key aspect of the variability encountered in healthcare is that the same information may be represented differently and with different levels of detail, granularity and nesting by various parties across the system. For example, in some cases a blood pressure measurement may be just a simple observation, a vital sign measure, while in other cases can be a rich set of highly defined data that includes things like controlled vocabularies for posture, exercise, etc. The resource types defined in this specification focus on the general, common use cases. Richer and more specific content can be supported and standardized by defining "profiles" on the base resource types.
Versions, in the context of FHIR, means one of three different things:
FHIR Version
Usually, the FHIR version is fixed by the context - the CapabilityStatement that a client can use to find out about the server, but there are other ways of managing multiple FHIR versions.
Record Version
FHIR Servers do not have to support versioning, though they are strongly encouraged to do so. There are three different levels of versioning support for FHIR servers:
In addition, servers may require that version aware updates are used, to prevent over-writing changes, but this is not described on this page.
Business Version
Some resources - typically those that represent content that goes through a formal publishing cycle - carry
a version
element that explicitly states what version of the content the resource represents.
This is changed explicitly by a human, or by some automated process in accordance with applicable business
rules.
To create a resource, send an HTTP POST request to the resource type's respective end point.
POST https://example.com/base/{resourceType}
In the example below we see the creation of a Patient.
POST /base/Patient HTTP/1.1
Authorization: Bearer 37CC0B0E-C15B-4578-9AC1-D83DCED2B2F9
Accept: application/fhir+json
Content-Type: application/fhir+json
Content-Length: 1198
{
"resourceType": "Patient",
...(properties)
}
Submit a new patient to the server, and ask it to store the patient with an id of its own choice.
Notes:
A response will contain 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/fhir+json
Date: Mon, 18 Aug 2014 01:43:30 GMT
ETag: W/"1"
Location: http://example.com/base/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/fhir+json
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 Type end-point.
GET https://example.com/base/{resourceType}/{id}
Here's an example.
GET /base/Patient/347?_format=xml HTTP/1.1
Host: example.com
Accept: application/fhir+xml
Cache-Control: no-cache
Notes:
The response to a GET contains the Resource.
HTTP/1.1 200 OK
Content-Length: 729
Content-Type: application/fhir+xml
Last-Modified: Sun, 17 Aug 2014 15:43:30 GMT
ETag: W/"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-17T15:43:30Z"/>
</meta>
<!-- content as shown above for patient -->
</Patient>
Notes:
In addition to getting single known resources it's possible to find a collection of resources by searching the resource type 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/base/{resourceType}?criteria
The criteria is a set of HTTP parameters that specify which resources to return. The search operation
https://example.com/base/MedicationRequest?patient=347
returns all the prescriptions for the patient created above.
The response to a search request is a Bundle: a list of matching resources with some metadata:
HTTP/1.1 200 OK
Content-Length: 14523
Content-Type: application/fhir+xml
Last-Modified: Sun, 17 Aug 2014 15:49:30 GMT
{
"resourceType": "Bundle",
"type": "searchset",
"id" : "eceb4882-5c7e-4ca4-af62-995dfb8cef01"
"timestamp": "2014-08-19T15:49:30Z",
"total": "3",
"link": [
{
"relation" : "next",
"url" : "https://example.com/base/MedicationRequest?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2"
}, {
"relation" : "self",
"url" : "https://example.com/base/MedicationRequest?patient=347"
}
],
"entry": [
{
"resource" : {
"resourceType": "MedicationRequest",
"id" : "3123",
"meta" : {
"versionId" : "1",
"lastUpdated" : "2014-08-16T05:31:17Z"
},
... content of resource ...
},
},
... 2 additional resources ....
]
}
Notes:
entry.resource.id
must be unique in the bundleThe client sends the server a new version of the resource to replace the existing version - it PUTs it to the location of the existing resource:
PUT https://example.com/base/{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 /base/Patient/347 HTTP/1.1
Host: example.com
Content-Type: application/fhir+json
Content-Length: 1435
Accept: application/fhir+json
If-Match: 1
{
"resourceType": "Patient",
"id" : "347",
"meta" : {
"versionId" : "1",
"lastUpdated" : "2014-08-18T15: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/fhir+json
Date: Mon, 18 Aug 2014 01:43:30 GMT
ETag: W/"2"
Location: https://example.com/base/Patient/347/_history/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-18T15:43:30Z",
"profile" : ["http://example-consortium.org/fhir/profile/patient"],
"security" : [{
"system" : "http://terminology.hl7.org/CodeSystem/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:
profile
, security
and tag
)The base properties of all resources are defined on the resource types Resource and DomainResource.
Want more information?