We have detected that you are using Internet Explorer to visit this website. Internet Explorer is now being phased out by Microsoft. As a result, NHS Digital no longer supports any version of Internet Explorer for our web-based products, as it involves considerable extra effort and expense, which cannot be justified from public funds. Some features on this site will not work. You should use a modern browser such as Edge, Chrome, Firefox, or Safari. If you have difficulty installing or accessing a different browser, contact your IT support team.
Electronic Prescription Service overview for developers
Find Electronic Prescription Service (EPS) guidance for developers, including information on application architecture, external interfaces, data flow models and component view models.
The EPS is a national system implemented within the Spine infrastructure. It manages the dispensing of electronic prescriptions and the onward transmission to the NHS Business Services Authority (NHSBSA). The NHSBSA provides the prescription reimbursement and cost reporting function for the NHS.
The scope of the EPS includes all prescriptions from general practice and urgent care, including those prescribed by the NHS 111 service. In theory, all prescriptions that are reimbursed by the NHSBSA are in scope for the EPS.
The scope of dispensers includes:
- community pharmacies
- distance dispensers
- dispensing appliance contractors
- dispensing doctors
Medicines listed within the NHS Dictionary of Medicines and Devices (dm+d) can be prescribed via the EPS, apart from those listed within controlled drugs schedule 1. Any patient with an NHS Number can receive an electronic prescription. Patient consent is implied, meaning a patient not wanting an electronic prescription must inform their prescriber.
The EPS is a distributed system. The Spine component primarily acts as a message broker connecting prescribing, dispensing and reimbursement systems. There is also a portal application, the EPS Prescription Tracker, that supports end users and service management teams if there's a need to confirm the existence of an electronic prescription.
Functionality within prescribing and dispensing systems is based on a functional specification. The only client software component provided by NHS Digital is the identity agent, as part of the end-user smartcard authentication process. These systems communicate with the EPS Spine component via an ebXML / HL7v3 external interface.
Interoperability between the EPS Spine component and NHSBSA reimbursement systems is via a WebSphere MQ / HL7v3 interface, with the NHSBSA acting as the MQ server and Spine acting as the MQ client.
The Spine infrastructure sits on the N3 network. NHS organisations either have their own N3 service, or have a networking route through to N3 via a 3rd party network provider, known as an N3 Aggregator.
The NHS.UK service and it’s SOAP / XML web services provide the definitive list of EPS-enabled dispensers in England. Both prescribing and dispensing systems use these web services to help patients choose a nominated dispenser.
The Basho Riak noSQL database is the underlying technology of the EPS Spine component.
The EPS Spine component is a transitory store of prescription data - EPS does not include a residual store of prescription data. The NHSBSA are responsible for long term storage of prescribing and dispensing data. The EPS only holds prescription data for those prescriptions still in the dispensing process. Various data cleaning jobs purge old data from the system. This design ensures data storage requirements are manageable (but still enormous) and cost effective.
The service must handle volumes of over 1 million transactions a day, with peak periods during and directly after GP surgery hours. A clever combination of low-footprint open source technologies means the EPS can handle peak loads, with negligible impact to service response times, on minimal hardware. The EPS Spine component is highly resilient and both vertically and horizontally scaleable.
Electronic prescriptions will be signed with an Advanced Electronic Signature (AES). They are applied to every electronic prescription. The hash contains the data elements required by law for a prescription. The signer’s certificate is taken from their NHS authentication smartcard. Dispensing systems validate the signature contained within the electronic prescription on receipt and before any dispensing processes can occur.
Each prescription will be identified by a bespoke Prescription ID throughout the prescribing, dispensing and reimbursement cycle. An 18-character Prescription ID, based on an algorithm defined within the EPS compliance specifications, uniquely identifies the prescription during it’s life cycle. The ID is not designed to be universally unique, as it does not need to be. It has been designed to be sufficiently unique for the purposes of the EPS and not overly large, so it can be relayed verbally if or when required. The ID is represented as a 1D barcode on a prescription token that may accompany the electronic prescription. Find out more about EPS identifiers and what they mean.
Patients are identified by NHS Number. By law, a prescription must also contain other patient demographics, including the patient’s name and address.
Implementation will be phased. Initially, only patients who have chosen a nominated dispenser will receive electronic prescriptions. A phased approach allows the gradual deployment of compliant EPS systems and end-user training. Only patients who have nominated their preferred dispenser receive electronic prescriptions. Dispensing sites confirmed as live are added to NHS.UK. Only dispensers listed by NHS.UK as EPS-compliant can be nominated.
The final phase of EPS implementation is due soon. Here, all prescriptions, by default, will be electronic. A patient can request a paper prescription from their prescriber. Patients can continue to use a nominated dispenser, but can also receive an electronic token via email or a mobile app. They then present this token to any pharmacy for dispensing.
The prescription container will include one or more prescribed medication items, but initially limited to four items to mirror the physical constraints of paper prescriptions. This (artificial) limit still applies on electronic prescriptions.
A prescription cannot be split and dispensed by multiple dispensers. A prescription must be completed by a single dispenser before being submitted for reimbursement. Items are marked as ‘Dispensed’, ‘Not Dispensed’ or ‘Cancelled’ to put them into a completed state. The NHSBSA can only pay one dispenser for one prescription.
Prescribers and dispensers will be smartcard authenticated and systems will implement Role Based Access Control (RBAC) onto local functionality related to the prescribing or dispensing process. The use of smartcards is integral to the electronic signing process, so mandatory for prescribers. All EPS end users authenticate using the NHS smartcard.
Systems implement RBAC to control access to local functionality. This includes the ability to:
- view medicines data
- request the cancellation of a prescription
- record dispensing information against a prescription
- submit endorsement information required for the prescription reimbursement process managed by the NHSBSA
The primary interface to talk to the EPS, for the creation of electronic prescriptions, downloading for dispensing and the subsequent financial claim process is via an ebXML/HL7v3 messaging interface, implemented via the Spine Transaction Messaging Service (TMS). The messaging specification is available on this website and is currently MIM 4.2.00.
The ebXML/HL7v3 interface is complex and the accompanying functional EPS requirements were written to supplement the HL7v3 specification, but soon grew to include lots of business process rules.
Primary care prescribing and dispensing is very complex. The paper processes evolved over many years and there are various ways to prescribe. The primary rule enforced by the EPS is to prevent two or more dispensers accessing the same electronic prescription. This adds complexity into a system that must also allow patient choice to use any NHS dispenser in the country.
A Prescription Tracker API has been available since July 2016. This provides programmatic access to the same EPS data visible within the portal application. Access the API technical documentation.
There are no current plans to make available a RESTful API to mirror the ebXML/HL7v3 interface.
As of April 2018, the headline EPS statistics are:
- 57.8 million medication items dispensed per month, received by the NHSBSA (up from 54 million in July 2017)
- deployed in 92.7% of GP practices, 99.5% of community pharmacies and 94% of dispensing appliance contractors
- 63.7% of all prescriptions received by the NHSBSA via the EPS (the remainder via paper processes)
- 27 million patients have a nominated dispenser (up from 24 million in July 2017)
Data flow model
Flows that apply to both paper and electronic prescription processes are in orange. These include clinical decision support and the legal reimbursement invoice to the NHSBSA, the FP34C paper invoice form. The FP34C should be replaced by the NHSBSA with a paperless solution.
State transition diagram
The state transition diagram for a prescription record can look daunting. It becomes more manageable if viewed as three separate diagrams.
The medication items within a prescription are also subject to state transition logic. In many ways, the item state transition diagram mirrors that for the prescription.
The path shown in blue is the normal workflow for a prescription. A prescription is created by a prescribing system and uploaded to the EPS [Status = To Be Dispensed]. A dispensing system downloads the prescription [Status = With Dispenser]. The medication items within the prescription are dispensed and recorded within a message going back up to the EPS [Status = Dispensed].
Before the end of the claim month period (timescales defined by the NHSBSA) the dispensing system submits a message to the EPS containing information needed by the NHSBSA to process the reimbursement claim for the prescription [Status = Claimed].
Repeat dispensing transitions
The paths in green are additional workflow steps that apply to repeat dispensing prescriptions. A repeat dispensing prescription is a repeatable prescription, for the same medication items, for a given number of issues over the period of up to one year. The most common would be a repeat dispensing prescription for 6 or 12 issues of a month’s supply of medication.
The EPS creates all the future issues of a repeat dispensing prescription on receipt of the signed master prescription. Each issue is identical, and guaranteed to be so because of the advanced electronic signature. The repeat issue number, an attribute of the prescription record, is excluded from the signature hash which increments for each issue without invalidating the signature. When the previous issue is completed, the next issue is made available to be downloaded.
Alternative dispensing transitions
Prescribed medication items within a prescription may not all be dispensed, or may not all be dispensed at the same time. In some cases, the patient may not want all the medication. In other cases stock issues may require the patient to come back another time after the next re-up by the pharmacy wholesaler.
The path in black supports these processes. “Partial dispensing” is when only part of the required quantity is dispensed, such as 14 tablets out of 28 required, with the remainder to be supplied at another time. 'Owings' are when an entire medication item is not supplied, but will be at another time.
Humans make mistakes so the messages sent back to the EPS from dispensing systems can be corrected via the Amend Dispense and Amend Claim process.
Finally, if a prescription is recorded as “Dispensed” but, after a long period of time, it is not followed by a claim message, the EPS marks the prescription as “No Claim Notified” and notifies the NHSBSA of this fact.
Numerous exception workflows turn the state transition diagram into spaghetti, and these are shown in red.
Prescriptions or individual items within the prescription can be cancelled by the prescribing system.
UK medicines law defines the lifetime of a prescription as:
- 6 months for most prescriptions
- 28 days for Schedule 2 & 3 controlled drug medication items
- 12 months for repeat dispensing prescriptions
One important limitation of the EPS today is that it only enforces the 6 month and 12 month expiry rules. The EPS does not calculate or enforce the 28 day expiry rules. This is the responsibility of EPS-compliant dispensing systems.
Prescriptions can be returned to the EPS so that another dispenser can download them. Only whole prescriptions can be returned so only applies if no dispensing activities have started.
Component view model