How to automate hospital medication ordering, from the ward to the pharmacy
Hospital medication ordering automation: an agent works out ward demand from current prescriptions and flags unusual stock movements to the pharmacy.
This article was generated by AI. Labelled in accordance with Article 50 of the EU AI Act. Responsible for publication: Sophera Consulting.
Most hospitals treat ward medication ordering as solved once there is a par level in the inventory system. If you want to automate hospital medication ordering, that idea gets you about halfway. What a ward needs depends on how many beds are occupied, what has been prescribed for the next few days and when the pharmacy delivers next. A fixed number on a shelf knows none of that. So nurses keep counting, keep guessing, and end up on the phone when the heparin runs low on a Saturday.
An agent can work with exactly that information. The example below walks through it step by step. It is made up and does not describe a client. Automated medication ordering and early detection of unusual pharmacy stock movements are, however, among the projects we build for clients.
Automating hospital medication ordering: a worked example
Say a 400 bed hospital supplies its wards from its own pharmacy. Each ward keeps a stock of medicines with a set par level per product. Twice a week a nurse counts the cupboard, writes the shortfall on the requisition and sends it to the pharmacy. On a 32 bed medical ward that takes the better part of an hour, and the number on the form is still a guess, because nobody knows exactly what will be used before the next delivery.
In our example the ward has been full since Monday. Three new patients are on heparin prophylaxis, the pharmacy does not deliver at weekends, and Thursday's requisition is due.
Six steps from ward to delivery
1. Knowing what is in stock
If the ward scans withdrawals or has a cabinet system that books them, the agent reads stock levels from there. If it doesn't, the count stays but gets shorter. The nurse types quantities into a list on a tablet and the agent matches them to products. Nobody copies item numbers onto a form anymore.
2. Working out demand from prescriptions
A par level can't do this part. The agent reads the ward's current prescriptions in the hospital information system and projects what will be used up to the delivery after next. The heparin par level was set when the ward was half full. The agent raises the quantity for this delivery and notes why: "3 new prescriptions since Monday, no delivery Saturday or Sunday."
That means the agent sees patient data, so in this setup the model runs on the hospital's own hardware and the prescriptions never leave the building. The order itself ends up containing nothing but products and quantities. We describe how we separate hospital data by type of setup in our piece on GDPR compliant AI agents in hospitals.
3. Checking against the formulary
Every hospital has a formulary agreed between doctors and pharmacy. When a prescription names something that isn't on it, say because a patient brought their own medication from home, the agent doesn't just order it. It puts the listed product with the same active ingredient on the requisition as a suggestion and flags the line. The pharmacy and the ward doctor decide whether to switch.
4. The requisition as a draft
The agent creates the requisition in the pharmacy or inventory system with the status "to review". Each line says where its quantity came from: the par level, the prescriptions, the delivery calendar or the count. Controlled drugs stay in their own requisition process. There the agent only reminds the ward that stock is getting low.
5. Sign-off on the ward
The ward manager sees the requisition with flagged lines at the top. The unremarkable ones go through with one click, and each flagged one has its reason next to it. The better part of an hour with a clipboard turns into a few minutes of reading. The decision stays on the ward.
6. The pharmacy sees every ward at once
Approved requisitions from all wards land in the pharmacy. The agent turns them into a picking list and checks it against the pharmacy's own stock and open orders with the wholesaler. When a supplier reports a shortage, the affected wards and the formulary alternatives are already on the list before anyone picks up the phone. The agent prepares the wholesale order the same way, and the pharmacy approves it.
What the pharmacy notices along the way
Once every requisition is checked against occupancy and prescriptions, it also shows where the numbers don't add up. That is the second half of the project: early detection of unusual pharmacy stock movements. In our example three things stand out:
- One ward has asked for noticeably more of a painkiller over the last three deliveries than its prescriptions explain.
- An expensive product keeps going to a ward where nobody has been prescribed it for days. The packs sit there until they expire.
- A patient on a specialist medication has been discharged, but the leftover stock never comes back to the pharmacy.
Usually there is a boring explanation: a miscount, a new group of patients, a par level nobody updated. The agent doesn't accuse anyone. It puts the anomaly on a list for the pharmacy, with numbers, and the pharmacy sorts it out with the ward. Without that check, this kind of thing tends to surface at stocktaking.
What we sort out beforehand
The agent needs read access to prescriptions in the hospital information system, access to the pharmacy or inventory system, the formulary and the delivery calendar. You also need one person from nursing and one from the pharmacy who know the house rules, such as how much buffer to keep over the weekend and which lines the agent must never raise on its own. Whether a data protection impact assessment or the staff council needs to be involved is something we settle together up front. We bring the data processing agreement with us.
Building it is quick. An agent like this is set up in one to two days, and testing with a ward's real requisitions happens the same week.
Our advice: start with one ward
Don't start with the whole hospital. Pick one busy ward whose manager knows the counting chore first hand. After the first few deliveries you will see whether the calculated quantities track actual use more closely than the estimates did. Then add more wards. The pharmacy gains more from the second ward onwards, because requisitions can then be compared.
Sophera Consulting builds ordering agents like this for hospitals at a fixed price with no subscription, with the model running on the hospital's own hardware if you prefer. The maintenance agent that monitors operation is included in the fixed price. In the free automation check we work out which ward is the right place to start and which access we need.
This article was created with the help of AI.