FHIR DocumentReference

Base Path: /fhir/4.0/DocumentReference

Version: 1.1.0

The FHIR DocumentReference API allows you to look up and retrieve stored documents for a patient. The endpoint provides the ability to:

  • Retrieve all DocumentReference resources that match a search criteria for a given patient.
  • Retrieve a specific DocumentReference resource based on its resource ID.

The data returned in this API is subject to privacy and permissions settings, refer to the Working with Privacy guide to learn how this might affect your application.

This API is based on the R4 release of the FHIR standard, for more information on this API refer to the official FHIR documentation.


Methods

Get Documents for a Patient

GET /fhir/4.0/DocumentReference/

This method returns all documents for the patient identified either by patient.identifier or by patient. Optionally filtering by the document's category, type, contenttype and date.


Parameters

Name

Type

Data Type

Description


Name:

patient.identifier

required

Type:

query

Data Type:

string

Description:

The patient identifier consists of patient identifier namespace, also known as the system, and patient identifier ID, separated using a URL encoded | character i.e. %7c.

Note: You must either define the patient.identifier or patient, not both.


Sample Value: ORION%7cAAA-00001-8



Name:

patient

required

Type:

query

Data Type:

string

Description:

The patient resource id.

Note: You must either define the patient.identifier or patient, not both.


Sample Value: IFAUCQJNGAYTENBNHBAE6USJJ5HA



Name:

category

optional

Type:

query

Data Type:

string

Description:

Filters the documents to those that are of the specified category. Multiple values can be provided as a comma separated string. Both a system and a code must be included for every provided category, separated using a URL encoded | character i.e. %7c.


Sample Value: 2.16.840.1.113883.6.1%7c34133-9



Name:

type

optional

Type:

query

Data Type:

string

Description:

Filters the documents to those that are of the specified type. Multiple values can be provided as a comma separated string. Both a system and a code must be included for every provided type, separated using a URL encoded | character i.e. %7c.


Sample Value: 2.16.840.1.113883.6.1%7c34133-9



Name:

contenttype

optional

Type:

query

Data Type:

string

Description:

Filters the documents to those that are of the specified content types. Multiple values can be provided as a comma-separated string.


Sample Value: application/pdf



Name:

date

optional

Type:

query

Data Type:

array

Description:

Filters the Document References to those with a date on, before, or after a specific date, date-time, or date range. The supported prefixes are gt, ge, lt, le and eq. If no prefix is used, exact date or date-time matching is implied. Dates must be formatted according to ISO 8601 either as a date only (e.g. 1997-07-16) or as a date-time including the timezone (e.g. 1997-07-16T19:20:30+13:00). Ensure that special characters such as + are URL encoded i.e. %2B. The date filtering behaviour of this API for the 'eq' prefix is slightly more lenient than the FHIR specification which defines 'eq' to require that the range of the search value fully contains the range of the target value. This API defines 'eq' to only require that the the range of the search value overlap with the range of the target value.


Sample Value: eq2021-01-23



Name:

-include-sources

optional

Type:

query

Data Type:

array

Description:

The -include-sources parameter defines which sources should be queried for the results.

Note: Either -include-sources or -exclude-sources parameter can be specified, not both. If -include-sources is specified, ONLY the specified sources will be searched. Note that the sources specified should be enabled.


Sample Value: Orion%20Health%E2%84%A2%20R4%20HL7V2%20Generic%20Problems



Name:

-exclude-sources

optional

Type:

Data Type:

array

Description:

The -exclude-sources parameter defines which sources should NOT be queried for the results.

Note: Either -include-sources or -exclude-sources parameter can be specified, not both. If -exclude-sources is specified, the specified sources will NOT be searched. Note that the sources specified should be enabled..




Name:

_format

optional

Type:

query

Data Type:

string

Description:

Media type of the response. It takes precedence over the Accept header.

Possible values are json and xml. The default value is xml.


Sample Value: json



Name:

Accept

optional

Type:

header

Data Type:

string

Description:

Media type of the response.

Possible values are application/json and application/xml. The default value is application/xml.


Sample Value: application/xml


Responses


application/json+fhir

200

Returns a FHIR Bundle containing 0.. OperationOutcome resources and 0.. DocumentReference resources


application/json+fhir

400

This response code is returned when the query is invalid e.g. an invalid parameter or a partial token in the search.

Sample Requests

Retrieve specific Documents References for a Patient identified by a patient identifier
curl -X GET "https://developer-solution/fhir/4.0/DocumentReference/?patient.identifier=ORION%7cAAA-00001-8&category=2.16.840.1.113883.6.1%7c34133-9&type=2.16.840.1.113883.6.1%7c34133-9&date=eq2021-01-23" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8='

Get Documents for a Patient

POST /fhir/4.0/DocumentReference/_search

This method returns all documents for the patient identified by patient.identifier. Optionally filtering by the document's category, type, contenttype and date. This is the secure alternative to the GET search.


Parameters

Name

Type

Data Type

Description


Name:

patient.identifier

required

Type:

formData

Data Type:

string

Description:

The patient identifier consists of patient identifier namespace, also known as the system, and patient identifier ID, separated using a URL encoded | character i.e. %7c.

Note: You must either define the patient.identifier or patient, not both.


Sample Value: ORION%7cAAAA-0124-8



Name:

patient

required

Type:

formData

Data Type:

string

Description:

The patient resource id.

Note: You must either define the patient.identifier or patient, not both.


Sample Value: IFAUCLJQGAYDAMJNHBAE6USJJ5HA



Name:

Content-Type

required

Type:

header

Data Type:

string

Description:

Specifies how to encode the form data. The Content-Type value must be application/x-www-form-urlencoded


Sample Value: application/x-www-form-urlencoded



Name:

category

optional

Type:

formData

Data Type:

string

Description:

Filters the documents to those that are of the specified category. Multiple values can be provided as a comma separated string. Both a system and a code must be included for every provided category, separated using a URL encoded | character i.e. %7c.


Sample Value: 2.16.840.1.113883.3.88.12.80.46%7c18842-5



Name:

type

optional

Type:

formData

Data Type:

string

Description:

Filters the documents to those that are of the specified type. Multiple values can be provided as a comma separated string. Both a system and a code must be included for every provided type, separated using a URL encoded | character i.e. %7c.


Sample Value: http://loinc.org%7c34133-9



Name:

contenttype

optional

Type:

formData

Data Type:

string

Description:

Filters the documents to those that are of the specified content types. Multiple values can be provided as a comma-separated string.


Sample Value: application/pdf, text/xml



Name:

date

optional

Type:

formData

Data Type:

array

Description:

Filters the Document References to those with a date on, before, or after a specific date, date-time, or date range. The supported prefixes are gt, ge, lt, le and eq. If no prefix is used, exact date or date-time matching is implied. Dates must be formatted according to ISO 8601 either as a date only (e.g. 1997-07-16) or as a date-time including the timezone (e.g. 1997-07-16T19:20:30+13:00). Ensure that special characters such as + are URL encoded i.e. %2B. The date filtering behaviour of this API for the 'eq' prefix is slightly more lenient than the FHIR specification which defines 'eq' to require that the range of the search value fully contains the range of the target value. This API defines 'eq' to only require that the the range of the search value overlap with the range of the target value.


Sample Value: gt2013-01-01T01:00:00%2B13:00



Name:

-include-sources

optional

Type:

query

Data Type:

array

Description:

The -include-sources parameter defines which sources should be queried for the results.

Note: Either -include-sources or -exclude-sources parameter can be specified, not both. If -include-sources is specified, ONLY the specified sources will be searched. Note that the sources specified should be enabled.


Sample Value: Orion%20Health%E2%84%A2%20R4%20HL7V2%20Generic%20Problems



Name:

-exclude-sources

optional

Type:

Data Type:

array

Description:

The -exclude-sources parameter defines which sources should NOT be queried for the results.

Note: Either -include-sources or -exclude-sources parameter can be specified, not both. If -exclude-sources is specified, the specified sources will NOT be searched. Note that the sources specified should be enabled.




Name:

_format

optional

Type:

query

Data Type:

string

Description:

Media type of the response. It takes precedence over the Accept header.

Possible values are json and xml. The default value is xml.


Sample Value: json



Name:

Accept

optional

Type:

header

Data Type:

string

Description:

Media type of the response.

Possible values are application/json and application/xml. The default value is application/xml.


Sample Value: application/xml


Responses


application/json+fhir

200

Returns a FHIR Bundle containing 0.. OperationOutcome resources and 0.. DocumentReference resources


application/json+fhir

400

This response code is returned when the query is invalid e.g. an invalid parameter or a partial token in the search.

Sample Requests

Retrieve specific Documents References for a Patient identified by a patient resource id
curl -X POST "https://developer-solution/fhir/4.0/DocumentReference/_search" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8=' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'patient=IFAUCLJQGAYDAMJNHBAE6USJJ5HA' \
-d 'contenttype=application/pdf, text/xml'

Retrieve a single DocumentReference

GET /fhir/4.0/DocumentReference/{id}

This method returns the DocumentReference resource matching the requested resource ID.


Parameters

Name

Type

Data Type

Description


Name:

id

required

Type:

path

Data Type:

string

Description:

The id of the DocumentReference resource


Sample Value: shaTFTZOZCSJ7LQAYWFZDYSOEUE7X6PCP4IILNUCO4Q6PSSXVPTOQCA



Name:

_format

optional

Type:

query

Data Type:

string

Description:

Media type of the response. It takes precedence over the Accept header.

Possible values are json and xml. The default value is xml.


Sample Value: json



Name:

Accept

optional

Type:

header

Data Type:

string

Description:

Media type of the response.

Possible values are application/json and application/xml. The default value is application/xml.


Sample Value: application/xml


Responses


application/json+fhir

200

Returns a DocumentReference resource matching the the requested resource ID.


application/json+fhir

400

This response code is returned when the resource ID is empty.


application/json+fhir

404

No resource found with the requested resource ID or the resource ID is invalid.

Sample Requests

Retrieve Document References identified by a resource id
curl -X GET "https://developer-solution/fhir/4.0/DocumentReference/shaTFTZOZCSJ7LQAYWFZDYSOEUE7X6PCP4IILNUCO4Q6PSSXVPTOQCA" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8='