Community pharmacy · Playbook 71

Prescription flow and hub-and-spoke dispensing

Each branch knows tomorrow's workload today. Repeat items go to the hub when it makes sense, owings are chased before patients ask, and pharmacists get time back for clinical services.

  • Predictive ML
  • Agents with tools
  • Human in the loop
  • Event-driven integration
  • GPhC standards
  • Human Medicines Regulations
  • NHS Terms of Service
  • UK GDPR

At a glance

The problem
Every branch assembles almost everything itself, owings are chased by hand, and pharmacists lose clinic time to dispensing
Typical volume
Around 4 million items a month across 450 branches, most of them repeat prescriptions
Who's involved
Superintendent's office, retail operations, hub operations, buying, IT, information governance
Pilot
10–12 weeks after a 3–4 week discovery
Clouds
AWS or Azure, UK regions

An illustrative scenario. The numbers are typical examples, not a client case study. The cloud services and UK rules were checked on 9 November 2026.

The business problem

Prescriptions arrive at each branch through the Electronic Prescription Service. Repeat items come in steady waves, but nobody can say with confidence how many will land at a given branch next Tuesday, so rotas are set by habit and the dispensary is either idle or overrun. When it's overrun, the pharmacist ends up assembling and checking instead of running the consultations the branch is now paid for.

Most groups already run a central hub, or are building one. The hard part isn't the robot. It's deciding, item by item, what can go to the hub and come back in time: the prescription has to arrive early enough, the item has to suit the hub, and the patient must not be left waiting. Today that decision is often a blunt rule, such as every repeat for certain branches, so the hub runs below capacity while branches stay busy.

Shortages make everything harder. Owings are tracked on paper or in the dispensing system, and staff spend hours a day ringing wholesalers. Industry surveys in 2026 reported most pharmacies spending more time sourcing medicines than a year before. Meanwhile, independent prescribing is being added to Pharmacy First, which asks for even more pharmacist time.

What AI changes

  • Each branch gets a daily forecast of incoming items, by hour, from its own EPS history, so rotas and hub slots are planned a week ahead.
  • Each eligible item gets a routing recommendation, hub or branch, based on the superintendent's rules and a prediction of when the patient will collect.
  • Owings are checked against wholesaler stock and supply notices every morning. The branch sees what's arriving, what isn't, and which need a pharmacist's decision.
  • Pharmacists see their queue ordered so new medicines, changed doses and anything flagged by the hub reach them first. The clinical check itself doesn't change.
  • Hub and spoke records are kept item by item, so every label, every hub assembly date and every error can be traced and shared between sites.
  • The pharmacist's clinical check and the accuracy check stay with people. The AI plans the work. It never checks it.

How success is measured

Agree these, and measure the baseline, before anything is built. Example targets are typical, not promises.

Forecast accuracy

How close the daily item forecast is for each branch. Measured per branch, not averaged across the group, where errors cancel out.

ExampleWithin 10% on most branch days

Hub share of eligible items

The share of suitable items that actually go through the hub and come back on time.

ExampleUp from a blunt rule to what the hub can really handle

Ready when the patient arrives

Prescriptions waiting when the patient comes in, including hub items.

ExampleNo worse than today, then better

Owings age

How long patients wait for items owed, and how many owings pass seven days.

ExampleDown by a third

Pharmacist time on clinical services

Consultation hours per pharmacist, from the rota and the clinical system.

ExampleMeasured against last year

Dispensing incidents

Near misses and errors, at branch and hub, shared both ways. This must not rise.

ExampleFlat or falling, reviewed weekly

UK regulation and controls

Cross-sector rules are on the UK regulation map.

  • DHSC / MHRAHuman Medicines Regulations 2012, as amended for hub and spoke (SI 2025/758)

    Since 1 October 2025, hub and spoke can work between different legal entities, using the patient, spoke, hub, spoke, patient model only. The label carries the spoke's name and address and the date the hub assembled the item. Schedule 1 to 3 controlled drugs can't go through a hub run by a different legal entity. These exclusions are hard rules in the routing engine, not something a model learns.

  • NHS EnglandNHS Terms of Service: hub and spoke notifications

    A spoke must tell its ICB about each cross-entity arrangement, normally 28 days before it starts, now through the NHSBSA Manage Your Service portal. It must also tell patients the arrangement exists. The design keeps a live register of which branch uses which hub, and which items went where.

  • GPhCStandards for registered pharmacies

    Both hub and spoke are registered pharmacies and each needs a responsible pharmacist. The GPhC's October 2025 review of hub and spoke found errors weren't always shared between sites, and many spokes weren't telling people about the arrangement. A shared incident log and patient notices are part of the build, not an afterthought.

  • DHSC / GPhCResponsible pharmacist rules and the 2025 supervision changes

    Since 7 January 2026, a pharmacist can authorise team members to hand out checked and bagged prescriptions. From 10 December 2026, pharmacists can authorise pharmacy technicians to supervise assembly and dispensing. The AI takes no part in any check, and task permissions follow who is authorised, not job titles.

  • DHSCOriginal pack dispensing (±10%)

    For NHS prescriptions in England, the supervising pharmacist may adjust quantity by up to 10% to supply whole packs, since 1 January 2025. It's a professional judgement, not a default. The system can show where it would apply, but any change made at the hub is flagged for the spoke pharmacist, who makes the final supply decision.

  • ICO / NHS EnglandUK GDPR, the Data Protection Act 2018 and the DSPT

    Prescriptions are health data. That means a DPIA, forecasting on pseudonymised data, processing in UK regions, and a contract that stops providers training models on your data. Every branch completes the Data Security and Protection Toolkit each year, and the new platform has to fit inside that assurance.

The solution

Showing AWSAzuresovereign / on-prem services. Switch with the toggle; every diagram and table on this page follows it.

Prescription flow and hub-and-spoke dispensing: reference architecture
  1. 01Channels

    • EPS prescriptions from GPs
    • Patient repeat requests
    • Wholesaler stock and supply notices
  2. 02Intake

    • API GatewayAPI ManagementKong, or your existing API gatewayEvents from the dispensing system
    • AWS Transfer FamilyLogic Apps connectorsAn SFTP server, or your existing EDI gatewayWholesaler feeds and files
    • Amazon S3Data Lake StorageCeph, or IONOS S3 Object StoragePseudonymised history
  3. 03Intelligence

    • SageMaker AIAzure Machine LearningMLflow and Kubeflow on KubernetesVolume and collection forecasts
    • Bedrock Knowledge BasesFoundry IQ (Azure AI Search)OpenSearch, or PostgreSQL with pgvectorSOPs and supply notices
    • Agent
      Bedrock AgentCoreFoundry Agent ServiceLangGraph on KubernetesOwings agent
  4. 04Orchestration

    • Step FunctionsLogic Apps / Durable FunctionsTemporal, or n8nHub routing and cut-offs
    • EventBridge + SQSEvent Grid + Service BusApache Kafka or RabbitMQEvents and queues
  5. 05Systems of record

    • Dispensing system (PMR)
    • Hub automation system
    • Ordering and rota systems
  6. 06People

    • Person
      Pharmacist: clinical check
    • Person
      Accuracy checker
    • Person
      Branch team: owings and patients
  • Cloud or platform service (AWSAzuresovereign / on-prem)
  • AI agent
  • A person decides
  • Your existing systems
  • Outside your organisation

Components, side by side

Prescription flow and hub-and-spoke dispensing: components on AWS, Azure and a sovereign or on-prem stack
LayerAWSAzureSovereign / on-prem
Intake: dispensing events, wholesaler feedsThe cloud never connects to the NHS Spine. It receives events from your dispensing system, through whatever interface your supplier provides.API Gateway, AWS Transfer Family, S3API Management, Logic Apps connectors, Data Lake StorageKong or your API gateway, an SFTP or EDI gateway, Ceph
Analytics storeHolds pseudonymised item history, branch calendars, hub capacity and van schedules.Amazon RedshiftMicrosoft FabricPostgreSQL, or your existing data warehouse
ForecastingAmazon Forecast is closed to new customers, so new builds use SageMaker AI. Start with a simple seasonal model per branch, and only add complexity that beats it.Amazon SageMaker AIAzure Machine LearningMLflow and Kubeflow on Kubernetes
Reasoning and summariesBoth offer a choice of models, including Claude and others.Amazon BedrockMicrosoft FoundryOpen-weight models served with vLLM on your own GPUs, or IONOS AI Model Hub
SOPs and supply knowledge (retrieval)Your SOPs, hub eligibility rules, Medicine Supply Notifications and serious shortage protocols, so answers cite the source.Bedrock Knowledge BasesFoundry IQ, built on Azure AI SearchOpenSearch, or PostgreSQL with pgvector
Agent runtimeThe original Bedrock Agents closed to new customers on 30 July 2026; new builds use AgentCore.Amazon Bedrock AgentCoreFoundry Agent ServiceAn open-source agent framework (e.g. LangGraph) on Kubernetes
Routing workflowEligibility rules run first and can't be overridden by a model. The forecast only chooses between options the rules allow.AWS Step FunctionsLogic Apps or Durable FunctionsTemporal, or n8n
Middleware and eventsAmazon EventBridge, SQSEvent Grid, Service BusApache Kafka or RabbitMQ
Human reviewIf the supplier can't take tasks, one simple branch screen, not a new app per job.In the dispensing system's task list where the supplier allows itIn the dispensing system's task list where the supplier allows itIn the dispensing system's task list where the supplier allows it
GuardrailsBedrock GuardrailsAzure AI Content SafetyOpen-source guardrails (e.g. NeMo Guardrails, Llama Guard)
Identity, keys, data protectionIAM Identity Center, KMS, MacieEntra ID, Key Vault, PurviewKeycloak or your existing Active Directory; OpenBao or HashiCorp Vault; an HSM
Monitoring and auditLog every routing decision and every owing action, with the reason, against the item.CloudWatch, CloudTrailAzure Monitor, Log AnalyticsPrometheus, Grafana, OpenTelemetry
UK data residencyeu-west-2 (London)UK South / UK WestYour own UK data centre, or a UK/EU provider (IONOS AI Model Hub runs in Germany)

On a phone, the table shows the platform you pick. Sovereign / on-prem means open, portable components you can run in your own data centre or with a UK or European provider; IONOS is shown as one example, and others exist. What sovereign cloud means →

Hybrid and on-prem

Many organisations keep core systems and sensitive data on their own servers. This is how the same design works across both.

Stays on-prem

The dispensing system (PMR), the hub automation system and every patient-identifiable prescription stay where they run today, in your data centre or your supplier's hosting. Item history is pseudonymised before anything leaves.

Uses cloud AI

Forecasting on pseudonymised item history, retrieval over SOPs and supply notices, and the owings agent's reasoning. None of it needs a patient's name to work.

How they connect

A private link from your data centre to the cloud, such as AWS Direct Connect or Azure ExpressRoute, or a site-to-site VPN for the pilot. Events flow out through the queue and tasks flow back. On the sovereign option, the same parts run on Kubernetes in your own data centre or with a UK or European provider.

If the link drops

Dispensing carries on, because nothing clinical depends on the link. Routing falls back to the fixed hub rules held on-prem, owings go back to the branch list, and queued events catch up when the link returns, each with an ID so nothing is processed twice.

The agents

What each agent may do through its tools, what it may not, and where a person signs off. The limits are enforced by the platform, not the prompt.

Owings and shortages agent

May do

  • Read the branch's owings list from the dispensing system
  • Check wholesaler stock and expected delivery dates
  • Look up Medicine Supply Notifications and serious shortage protocols
  • Re-order the same product from an approved wholesaler, within an agreed price limit
  • Draft a task for the branch, with the options and their sources

May not do

  • Change a prescription, or pick a different medicine, strength or form
  • Apply a serious shortage protocol
  • Contact a patient or a prescriber
  • Order above the price limit, or from an unapproved supplier
  • Take or record any clinical or accuracy check

Where a person signs offA pharmacist decides every alternative, every use of a shortage protocol and every conversation with a prescriber. The branch team decides what to tell the patient. The agent's limits are enforced by the platform's identity and policy controls, not by instructions in a prompt.

Middleware and integration

The dispensing system (PMR) is the system of record for every prescription, and the integration with it decides the whole project. Some suppliers offer APIs or event feeds; others offer a nightly extract. Find out which in discovery, because the forecast can run on a nightly extract, but owings work needs data within the hour.

Events decouple the AI from the dispensary. Each new prescription, hub dispatch and owing becomes a message on a queue. If the hub's system is slow or a link drops, messages wait safely, and every message carries an ID so nothing is routed twice. The NHS's move from the HL7 v3 interface to FHIR APIs for EPS will change what suppliers send, so the design reads your supplier's interface, not the raw NHS message format.

The AI can be switched off without stopping dispensing. If it's paused, routing falls back to today's fixed rules and owings go back to the branch list. Prescriptions keep flowing because nothing clinical depends on it.

Process and people

  • Hub eligibility rules owned by the superintendent's office: what never goes to the hub, such as controlled drugs, fridge lines and urgent items, with change control.
  • A daily cut-off and exception queue at the hub, with a clear owner, for items that miss the van.
  • A shared incident log between hub and branches, reviewed weekly, so errors found at either end reach both.
  • Owings rules agreed with buying: price limits, approved wholesalers, and when to escalate to a pharmacist.
  • Branch managers trained to read the forecast and adjust it with local knowledge, such as a GP practice closing for a week.
  • A named owner for every model, SOP document and agent prompt, reviewed when the regulations change.

Delivery plan

  1. 3–4 weeks

    Discovery

    Map prescription flow at a sample of branches and the hub, measure the baseline, and confirm what data the dispensing system supplier can provide, and how fast.

  2. Gate · must be true to passData access confirmed in writing, baseline agreed, DPIA started, and the superintendent's office involved.

  3. 8–10 weeks

    Pilot

    Forecasts and routing recommendations for 20–30 branches in shadow mode, and the owings agent live in ten branches with a pharmacist reviewing every action.

  4. Gate · must be true to passForecast accuracy within agreed limits, no rise in incidents, branch teams find owings tasks useful, and superintendent sign-off.

  5. 4–6 weeks

    Production

    Routing goes live for the pilot branches, with monitoring, support, the fallback to fixed rules, and a rollback plan.

  6. Gate · must be true to passMonitoring, support model, fallback tested, and training in place at branch and hub.

  7. Ongoing

    Scale

    Add branches in waves, by hub and region, then reuse the forecasts for rotas and for planning consultation capacity.

  8. Gate · must be true to passEach wave passes the same accuracy and incident checks.

Roles and RACI

Who is responsible, accountable, consulted and informed, by activity
ActivitySuperintendent pharmacistOperations directorProduct ownerSolutions architectI can fill thisTechnical PMI can fill thisEngineersI can fill thisIG & DPOSecurityI can fill this
Business case and benefitsConsultedAccountableResponsibleConsultedConsultedInformedInformedInformed
Hub eligibility rules and SOPsAccountableConsultedResponsibleConsultedInformedConsultedInformedInformed
Target architectureConsultedInformedConsultedAccountable and ResponsibleConsultedConsultedConsultedConsulted
DPIA, DSPT and hub data sharingConsultedInformedConsultedConsultedInformedInformedAccountable and ResponsibleConsulted
Build and dispensing system integrationInformedInformedConsultedAccountableResponsibleResponsibleInformedConsulted
Forecast and routing accuracy testingConsultedConsultedAccountableResponsibleConsultedResponsibleInformedInformed
Go-live decisionAccountableResponsibleResponsibleConsultedResponsibleInformedConsultedConsulted
Run, monitor and improveConsultedConsultedAccountableConsultedConsultedResponsibleConsultedConsulted

Business case and benefits

Superintendent pharmacist
C · Consulted
Operations director
A · Accountable
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
I · Informed
IG & DPO
I · Informed
Security
I · Informed

Hub eligibility rules and SOPs

Superintendent pharmacist
A · Accountable
Operations director
C · Consulted
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
C · Consulted
IG & DPO
I · Informed
Security
I · Informed

Target architecture

Superintendent pharmacist
C · Consulted
Operations director
I · Informed
Product owner
C · Consulted
Solutions architect
A/R · Accountable and Responsible
Technical PM
C · Consulted
Engineers
C · Consulted
IG & DPO
C · Consulted
Security
C · Consulted

DPIA, DSPT and hub data sharing

Superintendent pharmacist
C · Consulted
Operations director
I · Informed
Product owner
C · Consulted
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
I · Informed
IG & DPO
A/R · Accountable and Responsible
Security
C · Consulted

Build and dispensing system integration

Superintendent pharmacist
I · Informed
Operations director
I · Informed
Product owner
C · Consulted
Solutions architect
A · Accountable
Technical PM
R · Responsible
Engineers
R · Responsible
IG & DPO
I · Informed
Security
C · Consulted

Forecast and routing accuracy testing

Superintendent pharmacist
C · Consulted
Operations director
C · Consulted
Product owner
A · Accountable
Solutions architect
R · Responsible
Technical PM
C · Consulted
Engineers
R · Responsible
IG & DPO
I · Informed
Security
I · Informed

Go-live decision

Superintendent pharmacist
A · Accountable
Operations director
R · Responsible
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
R · Responsible
Engineers
I · Informed
IG & DPO
C · Consulted
Security
C · Consulted

Run, monitor and improve

Superintendent pharmacist
C · Consulted
Operations director
C · Consulted
Product owner
A · Accountable
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
R · Responsible
IG & DPO
C · Consulted
Security
C · Consulted

R ResponsibleA AccountableC ConsultedI Informed· not involved

Where I'd fit

Option A

Lead the architecture

If there's no architect on the programme, I'd own the design end to end: the forecasts, the routing rules, the integration with your dispensing and hub systems, and the gates. I'd report to your programme board and work closely with the superintendent's office.

Option B

Support your architect

If your partner or your own team already has an architect, I'd take on the forecasting, the owings agent and the dispensing system integration under their lead, and give them a second senior opinion on the rest.

Where this goes wrong

  1. Goes wrong

    The forecast looks good across the group, but individual branches are badly wrong.

    How the design avoids it

    Measure accuracy branch by branch and day by day, and let branch managers add local knowledge.

  2. Goes wrong

    A model learns to send items to the hub that should never go there.

    How the design avoids it

    Eligibility is a set of hard rules owned by the superintendent. The model only chooses among items the rules allow.

  3. Goes wrong

    The dispensing system supplier can only give a nightly extract, found out in week six.

    How the design avoids it

    Confirm data access, latency and cost with the supplier in writing during discovery.

  4. Goes wrong

    Errors found at the hub never reach the branch, or the other way round.

    How the design avoids it

    One shared incident log, item-level traceability, and a weekly joint review.

  5. Goes wrong

    Pharmacist time is freed, but goes to more dispensing instead of consultations.

    How the design avoids it

    Plan the freed hours into the rota as clinical time, and measure consultations, not just items.

On the horizon

Changes already announced or under way that affect this design. More in the UK horizon scan.

  1. 10 December 2026
    Pharmacy technicians can supervise assembly and dispensing

    Once authorised by a pharmacist, technicians can carry out or supervise preparation, assembly and supply. Base task permissions on who is authorised, not on job titles, so the workflow can follow the new rules without rework.

  2. Branch by branch, from 29 October 2026
    Independent prescribing in Pharmacy First

    Legally available from 29 October 2026, with each branch starting once its ICB approves it. Pharmacist prescribers can then prescribe within Pharmacy First and the contraception service. Use the forecasts to plan prescriber hours for consultations, not only dispensing.

  3. March 2027
    EPS moves from HL7 v3 to FHIR APIs

    NHS England's working date to retire the old EPS interface. Ask your dispensing system supplier when its feed changes, and test the integration against it before it does.

  4. By 2028
    The 10 Year Health Plan: NHS App and the Single Patient Record

    More patients will order and track prescriptions in the NHS App, and pharmacies are to be connected to the Single Patient Record. Ordering patterns will shift, so record the ordering channel in the data and retrain the forecasts when it moves.

Questions to ask your partner or vendor

Good answers are specific. Vague answers to any of these are worth following up.

Copy them into your next supplier meeting

  1. What data can our dispensing system supplier give us, how quickly, and at what cost?
  2. Which items are never eligible for the hub, who owns that list, and where is it enforced?
  3. How will we measure forecast accuracy for each branch, not just the group average?
  4. What happens to routing and owings if the platform or the hub system is down?
  5. Can the agent ever change what's supplied to a patient, and how do we know it can't?
  6. Where is patient data processed and stored, and is it used to train anyone's model?

Planning something like this?

Whether you need someone to lead the design or to support the architect you already have, let's talk it through.

Sam Naseem
Sam NaseemBirmingham, UK · UK & Europe
Available now