Medicines wholesale · Playbook 66

Medicines shortages and quota allocation

Shortages seen weeks earlier, scarce stock shared fairly under manufacturer quotas, and pharmacies told honestly what they'll get and when. People set the rules and approve every allocation.

  • Predictive ML
  • Agents with tools
  • Human in the loop
  • Event-driven integration
  • MHRA WDA(H) and GDP
  • DHSC supply guidance
  • UK GDPR

At a glance

The problem
Shortages are spotted when the shelf is empty, and scarce stock goes to whoever orders first
Typical volume
Around 20,000 active product lines and 5,000 customer accounts, with 200–300 lines short or on quota at any time
Who's involved
Purchasing and supply, commercial, customer services, the Responsible Person, quality, IT
Pilot
8–10 weeks after a 3-week discovery
Clouds
AWS or Azure, UK regions

An illustrative scenario. Linked to a real, anonymised case study below; the numbers here are still typical examples. The cloud services and UK rules were checked on 9 November 2026.

The business problem

A full-line wholesaler buys from hundreds of manufacturers and delivers to community pharmacies, dispensing doctors and hospitals, often twice a day. When a product starts to run short, the early signs are scattered: a manufacturer's delivery slips, a quota letter arrives by email, a Medicine Supply Notification is published, a price concession is granted, or orders for a different strength suddenly jump. Buyers piece these together by hand, usually after the stock has gone.

Once a manufacturer puts a product on quota, the wholesaler has a fixed monthly allocation to share across thousands of customers. In many businesses that means a spreadsheet of caps per account, set from old history and adjusted by hand. Early orderers get stock and late ones get "out of stock" with no date. Customer services spend hours on calls they can't answer well, and pharmacies order the same line from several wholesalers to be safe, which makes the demand signal noisier still.

The pressure is real. DHSC granted 245 price concessions for October 2026, each one a product pharmacies couldn't buy at the Drug Tariff price. DHSC's best practice guidance, revised in August 2026, asks wholesalers to manage quota allocations fairly, with a clear review process, to avoid gaps between regions, and not to hoard. Any new way of sharing stock has to be explainable to the Responsible Person, to customers and, if asked, to DHSC.

What AI changes

  • Demand is forecast every night for each product, depot and customer group, with each forecast flagged when it isn't reliable.
  • Signals from supplier deliveries, quota letters, Medicine Supply Notifications, Serious Shortage Protocols, price concessions and unusual orders are combined into a ranked watch list of products likely to run short in the next four to eight weeks, each with its reasons.
  • When a product goes on quota, a proposed allocation is calculated from rules agreed in advance, based on each customer's normal need rather than their latest order, with a reserve for hospitals and urgent patient orders. A supply manager approves it.
  • Pharmacies are offered other licensed packs of the same medicine where they exist. A different strength or formulation is never substituted, because that changes what the patient receives and is the pharmacist's or prescriber's decision.
  • Customers see an honest expected date and their remaining allocation in the ordering portal, and customer services get a plain-English summary of every shortage.
  • People stay in control: buyers, supply managers and the Responsible Person own the rules and the exceptions, and every allocation is logged with its reason.

How success is measured

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

Early warning

How many days before a stock-out the product first appeared on the watch list.

ExampleFour weeks or more for most shortages

Forecast accuracy

Forecast error by product and depot, reported separately for lines on quota, where it matters most.

ExampleBetter than today's baseline, every month

Allocation fairness

The share of normal need each customer group received while a product was on quota, by region and customer type.

ExampleNo region or customer type consistently worse off

Unwarned stock-outs

Lines that ran out without any warning.

ExampleDown by a third in the first year

"When will it be back?" contacts

Calls and emails to customer services about availability.

ExampleDown by half

Override rate

How often supply managers change the proposed allocation. Very high means it isn't helping; near zero can mean nobody is checking.

ExampleStable, and reviewed weekly

UK regulation and controls

Cross-sector rules are on the UK regulation map.

  • MHRAWholesale dealer's licence (WDA(H)) and the supply duty

    The Human Medicines Regulations 2012 (regulation 43(2)) require the licence holder to ensure appropriate and continued supplies so patients' needs are met, and DHSC has said hoarding can breach this. Allocation rules share stock across all customers, keep a reserve for urgent need, and never hold stock back for margin.

  • MHRAGood Distribution Practice and the Responsible Person

    Every alternative offered must be a licensed product from a qualified supplier, delivered to a customer qualified to receive it. The Responsible Person signs off the substitution rules, and changes go through change control. Controlled drugs stay within the existing Home Office-licensed processes and records.

  • DHSCBest practice guidance on supply and distribution (revised August 2026)

    Wholesalers should manage quotas fairly with a clear review process, avoid regional gaps, share demand changes with manufacturers within competition rules, and report suspected hoarding. Each of these is a feature of the design, not an afterthought.

  • DHSCHealth Service Products (Provision and Disclosure of Information) Regulations 2018

    Wholesalers must answer DHSC requests for sales and volume data promptly. A clean data platform turns each request into a report, not a project.

  • MHRAWindsor Framework (since 1 January 2025)

    Medicines for Northern Ireland are now licensed UK-wide in 'UK Only' packs, so one stock pool can usually serve the whole UK. Older in-date packs licensed for Great Britain or Northern Ireland only are tagged, so an allocation never sends them to the wrong place.

  • ICOUK GDPR and the Data Protection Act 2018

    This is mostly business data, but customer records name pharmacists and some dispensing doctors trade as individuals. No patient data is needed. A short DPIA, UK regions, and a contract that stops providers training their models on your data.

The solution

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

Medicines shortages and quota allocation: reference architecture
  1. 01Signals

    • Manufacturer quotas and delivery dates
    • Supply notices, SSPs and price concessions
    • Customer orders: portal, EDI, phone
  2. 02Intake

    • Amazon SES + S3Logic Apps email connector + Blob StorageYour mail server + CephSupplier emails and letters
    • Amazon EventBridgeEvent GridApache KafkaOrder and stock events
    • S3 + Amazon RedshiftMicrosoft Fabric (OneLake)PostgreSQL or an open lakehouse on CephData platform
  3. 03Intelligence

    • Amazon SageMaker AIAzure Machine LearningMLflow + KubeflowForecasts and shortage risk
    • Amazon BedrockMicrosoft FoundryDocling + open-weight model (vLLM)Read quota letters and notices
    • Agent
      Bedrock AgentCoreFoundry Agent ServiceLangGraph on KubernetesSupply analyst agent
  4. 04Orchestration

    • Step FunctionsLogic Apps / Durable FunctionsTemporal or n8nAllocation workflow
    • EventBridge + SQSEvent Grid + Service BusKafka or RabbitMQEvents and queues
  5. 05Systems of record

    • ERP: purchasing, stock, quotas
    • Warehouse management system
    • Customer ordering portal
  6. 06People

    • Person
      Buyer: works the watch list
    • Person
      Supply manager: approves allocations
    • Person
      Responsible Person: signs off rules
  • Cloud or platform service (AWSAzuresovereign / on-prem)
  • AI agent
  • A person decides
  • Your existing systems
  • Outside your organisation

Components, side by side

Medicines shortages and quota allocation: components on AWS, Azure and a sovereign or on-prem stack
LayerAWSAzureSovereign / on-prem
Signals in: supplier emails, notices, ordersSupply notices and SSPs are published for people, not machines. Expect to read web pages and PDFs, and keep a person checking the link to your product codes.Amazon SES, S3, API GatewayLogic Apps connectors, Blob Storage, API ManagementYour mail server, Ceph or IONOS S3 Object Storage, Kong or your existing API gateway
Reading quota letters and noticesA buyer confirms every extracted quota before it drives an allocation.Amazon Bedrock, with Textract for scanned lettersMicrosoft Foundry, with Azure Content UnderstandingOpen-source parsing (e.g. Docling) plus an open-weight model served with vLLM, or IONOS AI Model Hub
Data platformMap every pack to its NHS dictionary of medicines and devices (dm+d) code, so alternatives and duplicates can be found.Amazon S3, AWS Glue, Amazon RedshiftMicrosoft Fabric (OneLake, Data Factory)PostgreSQL, or an open lakehouse (e.g. Apache Iceberg with Trino) on Ceph
Forecasting and shortage riskAmazon Forecast closed to new customers in July 2024. Don't start new work on it.Amazon SageMaker AI (Canvas first, custom models later)Azure Machine LearningMLflow and Kubeflow on Kubernetes
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
Allocation engineDeliberately not an AI model: plain, tested rules the business can read and the Responsible Person can sign off.AWS Lambda or Amazon ECSAzure Functions or Container AppsKubernetes on-prem (e.g. OpenShift, Rancher), or IONOS Managed Kubernetes
WorkflowAWS Step FunctionsLogic Apps or Durable FunctionsTemporal, or n8n
Middleware and eventsAmazon EventBridge, SQSEvent Grid, Service BusApache Kafka or RabbitMQ
Link to ERP and warehouseThe ERP keeps enforcing quotas at order entry, as it does today. The AI only proposes the numbers.API Gateway, plus your existing integration platformAPI Management, plus your existing integration platformKong, or your existing API gateway, plus your existing integration platform
Human reviewPeople approve allocations where they already work, not in a new tool.In the buyers' existing ERP screensIn the buyers' existing ERP screensIn the buyers' existing ERP screens
GuardrailsBedrock GuardrailsFoundry guardrails (Azure AI Content Safety)Open-source guardrails (e.g. NeMo Guardrails, Llama Guard)
Identity, keys, data protectionIAM Identity Center, KMSEntra ID, Key Vault, PurviewKeycloak or your existing Active Directory; OpenBao or HashiCorp Vault; an HSM
Monitoring and auditCheck forecast drift with your own scheduled tests. SageMaker Model Monitor closed to new customers on 30 July 2026.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 ERP, warehouse system and customer ordering portal stay where they are, and so does the allocation engine, which sits next to the ERP's quota tables. Named customer accounts and their order history don't need to leave your data centre.

Uses cloud AI

Forecast training, the shortage watch list and the agent that reads quota letters and public notices run in the cloud, where models and compute are easy to scale. They receive demand and stock by product, depot and customer group, not named accounts.

How they connect

A private link, AWS Direct Connect or Azure ExpressRoute, carries nightly extracts and change events out, and allocation proposals back through your API gateway, which is the only way in to the ERP. If you'd rather run the cloud services on your own hardware, AWS Outposts or Azure Local with Azure Arc are options.

If the link drops

Ordering and quota enforcement carry on, because they live in the ERP. The last approved allocations stay in force, forecasts are marked as stale, and buyers work from the weekly review until the link returns and queued events catch up in order.

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.

Supply analyst agent

May do

  • Read supplier emails and quota letters, and draft the quota record for a buyer to confirm
  • Link supply notices, SSPs and price concessions to your product codes
  • Explain why a product is on the watch list, citing its signals
  • Run the agreed allocation rules and present the proposal with its reasons
  • Draft availability messages for the ordering portal and customer services

May not do

  • Change a quota, allocation or price in the ERP
  • Release stock reserved for hospitals or urgent patient orders
  • Offer a different strength or formulation, or anything that changes what a patient receives
  • Contact manufacturers or customers directly
  • Act on controlled drug orders, beyond reporting on them

Where a person signs offA supply manager approves every allocation before it goes live, and the Responsible Person signs off the allocation and substitution rules themselves. Customer messages follow templates a person has approved. The agent's permissions are enforced by the platform's identity and policy controls, not by instructions in a prompt.

Middleware and integration

The ERP stays the system of record for stock, quotas and orders, and keeps enforcing quota caps at order entry. The AI never writes to it directly. Approved allocations go through the API layer and your existing integration platform, like any other change.

Every goods receipt, order, quota change and published notice becomes an event, so forecasts and the watch list update without polling the ERP. If the forecasting service is down, the last approved allocation stays in force and ordering carries on as normal.

Outside signals are fragile: web pages change and supplier emails vary. Each feed has a health check, and a missing feed shows as missing on the dashboard rather than quietly reading as "no shortage".

DHSC encourages sharing demand changes with manufacturers, within competition rules. Agree with your legal team what leaves the business, and at what level of detail, before building any feed to a supplier.

Process and people

  • A written allocation policy that says what "fair" means, how reserves for hospitals and urgent orders work, and how new customers are treated, approved before anything is built.
  • A weekly shortage review that works from the watch list, with a named buyer for every product on it.
  • An urgent route for patient-specific requests, with a duty supply manager who can release reserve stock, including out of hours.
  • Unusual ordering patterns flagged to a person, who decides whether it's hoarding and whether to report it to DHSC. Nothing is blocked automatically.
  • A named owner for every model, prompt, rule and data feed, with change control through the quality system.
  • Customer services trained on what an expected date means, and how sure it is, before it appears in the portal.

Delivery plan

  1. 3 weeks

    Discovery

    Map how shortages and quotas are handled today, measure stock-outs and availability calls, check product data and dm+d mapping, and draft the allocation policy.

  2. Gate · must be true to passBaseline agreed, data access confirmed, allocation policy drafted with the Responsible Person and commercial, and legal's view on data sharing.

  3. 8–10 weeks

    Pilot

    Forecasts and the watch list run in shadow mode across all lines, back-tested on last year's shortages. Allocation proposals run alongside today's spreadsheet for a handful of quota lines.

  4. Gate · must be true to passThe watch list caught most past shortages early, proposals are at least as fair as today's, and buyers and the Responsible Person sign off.

  5. 4–6 weeks

    Production

    Approved allocations go live for quota lines, and expected dates appear in the ordering portal, with monitoring, support and a rollback plan.

  6. Gate · must be true to passMonitoring, support model, rollback plan and customer services training in place.

  7. Ongoing

    Scale

    Add hospital contracts, share agreed forecasts with manufacturers, then reuse the pattern for short-dated and slow-moving stock.

  8. Gate · must be true to passEach extension passes the same pilot gate.

Roles and RACI

Who is responsible, accountable, consulted and informed, by activity
ActivitySupply directorProduct ownerSolutions architectI can fill thisTechnical PMI can fill thisEngineersI can fill thisResponsible PersonSecurityI can fill this
Business case and benefitsAccountableResponsibleConsultedConsultedInformedInformedInformed
Allocation policy: what "fair" meansAccountableResponsibleConsultedInformedInformedConsultedInformed
Target architectureInformedConsultedAccountable and ResponsibleConsultedConsultedConsultedConsulted
Substitution rules and change controlInformedConsultedConsultedInformedInformedAccountable and ResponsibleInformed
Build and integration with ERP and warehouseInformedConsultedAccountableResponsibleResponsibleInformedConsulted
Back-testing on past shortagesInformedAccountableResponsibleConsultedResponsibleConsultedInformed
Go-live decisionAccountableResponsibleConsultedResponsibleInformedConsultedConsulted
Run, monitor and improveInformedAccountableConsultedConsultedResponsibleConsultedConsulted

Business case and benefits

Supply director
A · Accountable
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
I · Informed
Responsible Person
I · Informed
Security
I · Informed

Allocation policy: what "fair" means

Supply director
A · Accountable
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
I · Informed
Responsible Person
C · Consulted
Security
I · Informed

Target architecture

Supply director
I · Informed
Product owner
C · Consulted
Solutions architect
A/R · Accountable and Responsible
Technical PM
C · Consulted
Engineers
C · Consulted
Responsible Person
C · Consulted
Security
C · Consulted

Substitution rules and change control

Supply director
I · Informed
Product owner
C · Consulted
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
I · Informed
Responsible Person
A/R · Accountable and Responsible
Security
I · Informed

Build and integration with ERP and warehouse

Supply director
I · Informed
Product owner
C · Consulted
Solutions architect
A · Accountable
Technical PM
R · Responsible
Engineers
R · Responsible
Responsible Person
I · Informed
Security
C · Consulted

Back-testing on past shortages

Supply director
I · Informed
Product owner
A · Accountable
Solutions architect
R · Responsible
Technical PM
C · Consulted
Engineers
R · Responsible
Responsible Person
C · Consulted
Security
I · Informed

Go-live decision

Supply director
A · Accountable
Product owner
R · Responsible
Solutions architect
C · Consulted
Technical PM
R · Responsible
Engineers
I · Informed
Responsible Person
C · Consulted
Security
C · Consulted

Run, monitor and improve

Supply director
I · Informed
Product owner
A · Accountable
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
R · Responsible
Responsible Person
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 data platform, the forecasting and allocation services, and the integration with your ERP and warehouse system. Having built an ERP for a medical supplier, I'd start where these projects usually stall: product data and the quota rules already in your ERP. I'd report to your programme board.

Option B

Support your architect

If your partner or your own team already has an architect, I'd take on the forecasting models, the agent and the ERP integration under their lead, and give them a second senior opinion on the rest. They stay in charge of the design; I make the hard parts lighter.

Where this goes wrong

  1. Goes wrong

    The model learns from orders, but a shortage changes the orders: pharmacies over-order, switch strengths and order from three wholesalers at once.

    How the design avoids it

    Forecast normal need from steady order history, treat SSPs and quota changes as known events, and never allocate on the latest order alone.

  2. Goes wrong

    Allocation becomes a black box, and customers who lose out can't be told why.

    How the design avoids it

    Allocation is plain, tested rules, not a model. The AI supplies the inputs; the rules are written down, signed off and explainable to any customer.

  3. Goes wrong

    The same medicine sits under five product codes, so alternatives and duplicates are missed.

    How the design avoids it

    Map every pack to dm+d during discovery, with a named owner, before trusting any forecast.

  4. Goes wrong

    Expected dates shown to pharmacies turn out wrong, and trust goes.

    How the design avoids it

    Show a date only with how sure it is, say "not known" when it isn't, and measure how often the dates were right.

  5. Goes wrong

    The watch list cries wolf, so buyers stop reading it.

    How the design avoids it

    Back-test on last year's shortages, keep the list to what buyers can act on, and track which warnings proved right.

On the horizon

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

  1. Late 2026–2027
    DHSC's response on the shortage information regulations

    DHSC consulted from February to May 2026 on wider reporting of supply problems, requests for stock and future delivery data when demand may outstrip supply, penalties without a prior compliance notice, and giving hub-and-spoke dispensing hubs the same reporting duties as wholesalers. Keep stock, delivery and sales history in a form you could hand over within days.

  2. Late 2026–2027
    Pharmacist dispensing flexibilities

    DHSC consulted on letting pharmacists supply a different strength or formulation in some cases. The consultation closed in December 2025, and in October 2026 DHSC said it would set out next steps within weeks. If it goes ahead, demand will move between strengths and forms faster than today. Group products by medicine, not only by pack, so the forecast can follow.

  3. 2026–2027
    Project Revive

    NHS England, the MHRA and Medicines UK launched a 12-month pilot in February 2026 to bring dormant licences for 378 at-risk medicines back to market, with a longer-term programme planned for 2027. New suppliers for old products will appear. Make adding a supplier and its quota a configuration change, not a code change.

  4. No date yet
    Shortage information at the point of prescribing

    DHSC and NHS England plan to show shortage information to prescribers, with an information standard in development. Keep your availability data structured, dated and easy to share, so you're ready if it's asked for.

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 does "fair" mean in your allocation rules, and who signed it off?
  2. How was the watch list tested against our own past shortages, not a demo dataset?
  3. What happens to allocations and ordering if the forecasting service is down?
  4. Which actions can the agent take without a person, and where is that enforced?
  5. How do you stop the forecast learning from panic buying?
  6. What does it cost to run each month at our number of product lines?

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