Dispensing
Process Overview
Dispensing systems download prescriptions from the EPS using the Task/$release endpoint. This returns up to 25 prescriptions per request, each as a prescription-order FHIR Message within the response. The prescription-order message can contain between 1 to 4 medication item requests, each as a FHIR MedicationRequest resource.
Each time medication is provided to a patient (or a patient’s representative) a dispense-notification FHIR Message is submitted.
When the dispensing process has been completed for all medication items on a prescription, a Claim FHIR Resource is submitted. EPS manages the onward submission of prescription and reimbursement data to the relevant reimbursement agency. If the need arises, a claim can be amended by re-submission.
If the need arises, a dispense notification can be amended by re-submission. Also an incorrect dispense notification can be withdrawn (deleted) using the Task#withdraw endpoint.
If the need arises, a prescription can be returned to the EPS using the Task#return endpoint. This makes the prescription available to download again by another dispenser.
Prescription Release (Download)
| FHIR Exchange | API endpoint | FHIR Definition |
|---|---|---|
| FHIR Operation | POST /Task/$release | release |
Prescriptions submitted are held within the EPS until processed by a dispensing system. There are two methods the dispensing system will use to request the release (download) of prescriptions. Both methods use a common release operation that uses a Parameters resource and returns a FHIR Bundle consisting of 0..* prescription-order messages.
Release Method 1: Nominated Pharmacy Release Request
Download prescriptions nominated to a dispensing site, identified by the site's ODS code.
Here is an incomplete Parameters resource to download nominated prescriptions for the pharmacy with ODS Code of VNE51.
{
"resourceType": "Parameters",
"parameter": [
{
"name": "owner",
"valueIdentifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "VNE51"
}
},
{
"name": "status",
"valueCode": "accepted"
}
]
}
Release Method 2: Patient Release Request
Download an individual prescriptions using the unique prescription identifier that the patient will present as a barcode on a printed prescription token or displayed within the phone app such as the NHS App.
Here is an incomplete Parameters resource to download a patient's prescription with prescription identifier "82D996-C81010-11DB12" by the pharmacy with ODS Code of VNE51.
{
"resourceType": "Parameters",
"parameter": [
{
"name": "owner",
"valueIdentifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "VNE51"
}
},
{
"name": "group-identifier",
"valueIdentifier": {
"system": "https://fhir.nhs.uk/Id/prescription-order-number",
"value": "82D996-C81010-11DB12"
}
},
{
"name": "status",
"valueCode": "accepted"
}
]
}
Release Response
An HTTP 200 response will be a Parameters resource. Successfully downloaded prescriptions will be in a Parameter named "passedPrescriptions". This contains a Bundle containing one or more prescription-order messages carried in the entry[] array. The total number of prescription-order messages returned will be in the total element. EPS is currently configured to download up to 25 prescriptions per request. The request can be repeated until all available prescriptions have been downloaded.
A successful response may also contain a Parameter named "failedPrescriptions". For each failed prescription there will be two entries in the entry[] array. One entry will contain an OperationOutcome resource with the reason for failure, using codes from the DM-Prescription-Release-Rejection-Reason valueset. The other entry will contain the failed prescription-order message. This is made available so the prescribed medication and patient details are known, allowing the user to speak to the patient and/or the prescriber.
An HTTP 4XX response will be an OperationOutcome resource for technical failures.
Here is an incomplete example of a release response containing comments to aid readability.
{
"resourceType": "Parameters",
"id": "a5d77265-8ba5-4c74-b8ce-ea0dbaafbdb8",
"parameter": [
{
"name": "passedPrescriptions",
"resource": {
"resourceType": "Bundle",
"id": "155e1102-9e71-4f19-9453-b905c0bbc494",
"meta": {
"lastUpdated": "2022-11-21T14:00:00+00:00"
},
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "155e1102-9e71-4f19-9453-b905c0bbc494"
},
"type": "searchset",
"link": [
{
"relation": "self",
"url": "https://sandbox.api.service.nhs.uk/electronic-prescriptions/Task/$release"
}
],
"total": 18, ... 18 prescriptions in this response
"entry": [ ... array of 18 prescription-order messages ]
}
},
{
"name": "failedPrescriptions",
"resource": {
"resourceType": "Bundle",
"id": "914298fd-bc64-4c00-8d8d-bf88709db470",
"meta": {
"lastUpdated": "2023-02-15T15:14:47+00:00"
},
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "57674b6e-c6c9-42de-943d-f2ed90f36862"
},
"type": "searchset",
"total": 2, ... a single prescription as failed
"entry": [
{
... an OperationOutcome resource
},
{
... failed prescription-order message
}
]
}
}
]
}
Dispense Notification
| FHIR Exchange | API endpoint | FHIR Definition |
|---|---|---|
| FHIR Messaging | POST /$process-message#dispense-notification | dispense-notification |
Each time medication is provided to a patient (or a patient’s representative) a dispense-notification message must be posted to the process-message endpoint.
The response will be a FHIR Bundle containing an OperationOutcome resource which indicate success or failure.
In the event of human error, a Dispense Notification can be amended by re-posting the dispense-notification message. The MessageHeader Extension-replacementOf
must contain the Bundle.identifier for the dispense-notification message to be updated.
The response will be an OperationOutcome resource which indicate success or failure.
Dispense Notification Withdraw
| FHIR Exchange | API endpoint | FHIR Definition |
|---|---|---|
| FHIR RESTful | POST /Task#withdraw | NHSDigital-Task |
A submitted Dispense Notification can be withdrawn (deleted) using a Task resource if it was sent in error and cannot be corrected by a Dispense Notification Update.
The identifier of the dispense-notification message being withdrawn must be provided within the focus.identifier.value of the Task resource. The groupIdentifier.value (prescription id) for the prescription must also be provided.
When withdrawing a repeat dispensing prescription the Extension-EPS-RepeatInformation extension identifies which issue is being withdrawn, and the Extension-EPS-Prescription extension identifies the prescription as repeat dispensing (i.e. continuous-repeat-dispensing).
The Task resource requires references to a PractitionerRole and Organization resources and as this is a RESTful endpoint, these must be included within the Task resource as contained resources.
The response will be an OperationOutcome resource which indicate success or failure.
Here is an incomplete example containing comments to aid readability.
{
"resourceType": "Task",
"id": "6a2624a2-321b-470e-91a6-8ae7a065e2f0",
"contained": [
{
"resourceType": "PractitionerRole",
"id": "requester",
... a PractitionerRole resource
},
{
"resourceType": "Organization",
... an Organization resource
}
],
"extension": [
{
"url": "https://fhir.nhs.uk/StructureDefinition/Extension-Provenance-agent",
"valueReference": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/sds-user-id",
"value": "7654321"
}
}
}
],
"identifier": [
{
"system": "https://tools.ietf.org/html/rfc4122",
"value": "5AC84C11-DB8B-44DA-8FCF-8980B3D13596"
}
],
"groupIdentifier": {
"system": "https://fhir.nhs.uk/Id/prescription-order-number",
"value": "24F5DA-A83008-7EFE6Z" ... groupIdentifier from the prescription-order
},
"status": "in-progress",
"statusReason": {
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/EPS-task-dispense-withdraw-reason",
"code": "MU",
"display": "Medication Update"
}
]
},
"intent": "order",
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/CodeSystem/task-code",
"code": "abort",
"display": "Mark the focal resource as no longer active"
}
]
},
"focus": {
"type": "Bundle",
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "a14d4fc1-82a2-4a82-aae2-50e212e7b907" ... identifier from the dispense-notification message being withdrawn
}
},
"for": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/nhs-number",
"value": "9449304130"
}
},
"authoredOn": "2022-11-29T11:45:00+00:00",
"requester": {
"reference": "#requester"
},
"owner": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "VNE51"
}
},
"reasonCode": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "373784005",
"display": "Dispensing medication"
}
]
}
}
Prescription Return
| FHIR Exchange | API endpoint | FHIR Definition |
|---|---|---|
| FHIR RESTful | POST /Task#return | NHSDigital-Task |
A prescription-order may be downloaded, but never dispensed by the pharmacy, for example if the pharmacy cannot supply the prescribed medication items. To allow the patient to visit a different dispenser the prescription must be returned to the EPS using a Task resource. Once returned, the prescription record should be removed from the local system.
The identifier from the release response message which released the prescription must be provided within the focus.identifier.value of the Task resource. The groupIdentifier.value (prescription id) for the prescription must also be provided.
The Task resource requires references to a PractitionerRole and Organization resources and as this is a RESTful endpoint, these must be included within the Task resource as contained resources.
Only a complete prescription-order can be returned. It is not possible to return just one of the prescribed medication items on a multi-item prescription.
When returning a repeat dispensing prescription the Extension-EPS-RepeatInformation extension identifies which issue is being returned, and the Extension-EPS-Prescription extension identifies the prescription as repeat dispensing (i.e. continuous-repeat-dispensing).
The response will be an OperationOutcome resource which indicate success or failure.
Here is an incomplete example containing comments to aid readability:
{
"resourceType": "Task",
"id": "ee1b55f8-113c-4725-99a3-25fbad366dd6",
"contained": [
{
"resourceType": "PractitionerRole",
"id": "requester",
... a PractitionerRole resource
},
{
"resourceType": "Organization",
... an Organization resource
}
],
"identifier": [
{
"system": "https://tools.ietf.org/html/rfc4122",
"value": "ee1b55f8-113c-4725-99a3-25fbad366dd6"
}
],
"status": "rejected",
"statusReason": {
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/EPS-task-dispense-return-status-reason",
"code": "0003",
"display": "Patient requested release"
}
]
},
"intent": "order",
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/CodeSystem/task-code",
"code": "fulfill",
"display": "Fulfill the focal request"
}
]
},
"groupIdentifier": {
"system": "https://fhir.nhs.uk/Id/prescription-order-number",
"value": "24F5DA-A83008-7EFE6Z" ... groupIdentifier from the prescription-order
},
"focus": {
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "a5d77265-8ba5-4c74-b8ce-ea0dbaafbdb8" ... identifier from the $release response which released the prescription that is being returned
}
},
"for": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/nhs-number",
"value": "9449304130"
}
},
"authoredOn": "2022-11-21T14:30:00+00:00",
"requester": {
"reference": "#requester"
},
"reasonCode": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "33633005",
"display": "Prescription of drug"
}
]
}
}
Prescription Dispensing Claim
| FHIR Exchange | API endpoint | FHIR Resource |
|---|---|---|
| FHIR RESTful | POST /Claim | NHSDigital-Claim |
This interaction is used to submit a prescription claim to NHS BSA and submit an amended Claim.
The Claim resource requires references to a PractitionerRole and Organization resources and as this is a RESTful endpoint, these must be included within the Claim resource as contained resources.
In the event of human error, a Claim can be updated / corrected by re-posting the Claim resource. The extension:Extension-replacementOf must contain the Claim.identifier for the Claim being replaced.
The response will be an OperationOutcome resource which indicate success or failure.
The Claim.insurance data element is used by EPS to route the claim to the appropriate reimbursement agency using ODS organisational codes.
| Country | ODS Organisation Name and Code |
|---|---|
| England | NHS BUSINESS SERVICES AUTHORITY (T1450) |
| Wales | NWSSP AUDIT & ASSURANCE SERVICES (RQFZ1) |