FHIR MedicationStatement

Base Path: /fhir/4.0/MedicationStatement

Version: 1.2.0

The FHIR MedicationStatement API allows you to look up and retrieve a list of the medications that were recorded to have been consumed, or are being consumed by a patient. The endpoint provides the ability to:

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

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

Retrieve Medication Statements for a Patient

GET /fhir/4.0/MedicationStatement/

This method returns all medication statements for the patient identified either by patient.identifier or by patient. Optionally filtering by the date the medication was consumed, and the status. Additionally, the _list parameter can be provided to request the current list of medications.


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 identifier, separated using a URL encoded | character i.e. %7c.

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


Sample Value: ORION|AAAA-0124-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: GU2TAMJWIBJVSU27IE



Name:

effective

optional

Type:

query

Data Type:

array

Description:

Filters the medications 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.


Sample Value: lt2015-08-11&,gt2012-06-05



Name:

-date-asserted

optional

Type:

query

Data Type:

date

Description:

Returns all MedicationStatement resources for that patient for the specified date parameters. This applies to the dateAsserted field of the MedicationStatement resources. The supported operations are: =>, =>=, =<, =<=, = . The {dateTimeValue} value should be in the following format: 2013-01-01T23:00:00-05:00. However, the time portion can be excluded. If a time portion is provided, the time zone must be provided as well.
It is highly recommended to provide the time portion in any query. Ensure that special characters such as '+' are encoded so that it can be interpreted correctly.


Sample Value: 2013-01-01T01:00:00+13:00



Name:

status

optional

Type:

query

Data Type:

string

Description:

Filters the medications to those having the specified status. Possible values are

  • active
  • completed
  • entered-in-error
  • intended
  • stopped
  • on-hold
  • unknown
  • not-taken


Sample Value: completed



Name:

_list

optional

Type:

query

Data Type:

string

Description:

Filters the medications to the list of medications that a clinician has confirmed the patient is currently on. This is only supported in deployments where medication lists are actively managed by clinicians and the value currently supported is $current-medications.


Sample Value: $current-medications



Name:

-include-sources

optional

Type:

formData

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.




Name:

-exclude-sources

optional

Type:

formData

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:

formData

Data Type:

string

Description:

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


Default Value: json

Sample Value: json



Name:

Accept

optional

Type:

header

Data Type:

string

Description:

Media type of the response


Default Value: application/xml

Sample Value: application/json


Responses


application/json+fhir

200

Returns a FHIR Bundle containing 0..* OperationOutcome resources and 0..* MedicationStatement 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 Medication Statements for a Patient identified by patient resource id
curl -X GET "https://developer-solution/fhir/4.0/MedicationStatement/?patient=GU2TAMJWIBJVSU27IE&effective=lt2015-08-11&,gt2012-06-05&status=completed" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8='

Retrieve Medication Statements for a Patient

POST /fhir/4.0/MedicationStatement/_search

This method returns all medication statements for the patient identified either by patient.identifier or by patient. Optionally filtering by the date-time the medication was consumed, and the status. Additionally, the _list parameter can be provided to request the current list of medications. This is the secure alternative to the GET search.


Parameters

Name

Type

Data Type

Description


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:

patient.identifier

required

Type:

formData

Data Type:

string

Description:

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

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


Sample Value: ORION|AAAA-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: IFAUCQJNGAYTENBNHBAE6USJJ5HA



Name:

effective

optional

Type:

formData

Data Type:

array

Description:

Filters the medications 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.


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



Name:

-date-asserted

optional

Type:

formData

Data Type:

date

Description:

Returns all MedicationStatement resources for that patient for the specified date parameters. This applies to the dateAsserted field of the MedicationStatement resources. The supported operations are: =>, =>=, =<, =<=, = . The {dateTimeValue} value should be in the following format: 2013-01-01T23:00:00-05:00. However, the time portion can be excluded. If a time portion is provided, the time zone must be provided as well.
It is highly recommended to provide the time portion in any query. Ensure that special characters such as '+' are encoded so that it can be interpreted correctly.


Sample Value: 2013-01-01T01:00:00+13:00



Name:

status

optional

Type:

formData

Data Type:

string

Description:

Filters the medications to those having the specified status. Possible values are

  • active
  • completed
  • entered-in-error
  • intended
  • stopped
  • on-hold
  • unknown
  • not-taken


Sample Value: active



Name:

_list

optional

Type:

formData

Data Type:

string

Description:

Filters the medications to the list of medications that a clinician has confirmed the patient is currently on. This is only supported in deployments where medication lists are actively managed by clinicians and the value currently supported is $current-medications.


Sample Value: $current-medications



Name:

-include-sources

optional

Type:

formData

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.




Name:

-exclude-sources

optional

Type:

formData

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:

formData

Data Type:

string

Description:

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


Default Value: json

Sample Value: json



Name:

Accept

optional

Type:

header

Data Type:

string

Description:

Media type of the response


Default Value: application/xml

Sample Value: application/json


Responses


application/json+fhir

200

Returns a FHIR Bundle containing 0..* OperationOutcome resources and 0..* MedicationStatement 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 Medication Statements for a Patient identified by patient identifier
curl -X POST "https://developer-solution/fhir/4.0/MedicationStatement/_search" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8=' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'patient.identifier=ORION%7CAAAA-0124-8' \
-d 'effective=gt2013-01-01T01:00:00%2B13:00' \
-d 'status=active'

Retrieve a single MedicationStatement

GET /fhir/4.0/MedicationStatement/{id}

This method returns the MedicationStatement 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 MedicationStatement resource


Sample Value: shaDHEYB4DQOPLUSYGJLOYIQMHZSW54MAJJSJW4FOZLGILDMAPNS4BQ



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 MedicationStatement resource matching the the requested resource ID.


application/json+fhir

400

This code is returned when the resource ID is empty or not valid.


application/json+fhir

404

No MedicationStatement resource found with the requested resource ID.

Sample Requests

Retrieve specific Medication Statements identified by resource ID.
curl -X GET "https://developer-solution/fhir/4.0/MedicationStatement/shaDHEYB4DQOPLUSYGJLOYIQMHZSW54MAJJSJW4FOZLGILDMAPNS4BQ" \
-H 'Accept: application/json' \
-H 'Authorization: Basic bGV2ZWwxLnN5c19hOk9yaW9uc3k1IT8='