← BACK TO THE BLOG

AI for pharmacies: stock, expiry dates and the health-data limit

Customer examining a bottle in a pharmacy aisle, surrounded by shelves full of products

Search for AI for pharmacies and what comes back is dispensing robots and headlines about diagnosis. Neither describes the daily reality of a neighbourhood chemist or a four-to-ten-person pharmacy on a busy avenue. There, the business is decided in three very unglamorous places: the stock you buy, the product that expires in the drawer, and the minutes the pharmacist spends doing things that aren't serving patients.

This guide is about those three. Which parts of that work can realistically be automated today with the data a pharmacy already generates — sales from the dispensing software, order history, dispensations — what each one costs in effort, and where you should stop dead because the data is health data and it doesn't tolerate experiments.

The usual warning first: if nobody in your pharmacy can say within two minutes which ten lines produced the most margin last month and how many euros went in the bin through expiry, the problem isn't AI yet. It's that the software stores that data and nobody looks at it. Fixing that comes first, costs far less, and everything else depends on it.

What is actually broken in a pharmacy before we talk about AI?

Spend a week behind the counter and the same gaps show up:

None of those six is an artificial intelligence problem. They are information-arrives-too-late problems. AI helps because almost all of that information is already written down — every sale, every order, every shortage — and right now nobody reads it systematically.

Which systems do you have to touch in a pharmacy?

Before promising anything, look at where each piece of data comes from and what it costs to get out. In a mid-sized pharmacy the map looks like this:

| Source | What it gives you | Usual problem | |---|---|---| | Dispensing / pharmacy software | Line-by-line sales, stock, margin, expiry dates | Limited export; API only in some products | | Wholesaler orders | What you ordered, what arrived, what was short | Shortage history isn't kept: the most valuable data, routinely lost | | Electronic prescription | Dispensation and dosage | Health data; restricted and logged access | | POS and payments | Basket, time of day, average ticket | Doesn't always reconcile with the sales line | | Catalogues and labs | Prices, terms, promotions, equivalences | A different spreadsheet per sales rep | | Website / click and collect | OTC and beauty, reservations | Lives apart from the real shop stock |

The practical rule: start with what already produces structured data — sales and orders — and leave anything touching electronic prescription for later. The first block is business management; the second is health data and the bar is completely different.

If your software has no decent API, that isn't fatal: a daily export into a small data warehouse covers 80% of what this article describes. The patterns and the traps are the same as in ERP and CRM integration.

How do you automate stock and wholesaler ordering?

This is the best effort-to-result case, and the one almost no pharmacy exploits.

A pharmacy handles between 4,000 and 10,000 active lines with radically different behaviour: the chronic medication dispensed every month like clockwork, seasonal OTC lines, the antibiotic that moves in spikes, and the reference you sell three times a year. Treating them all with one min-max rule guarantees you overstock some and run out of others.

What you can build with 18 to 24 months of sales:

And one money point that isn't AI but almost nobody checks: compare what you buy from the wholesaler against what you could buy direct from the lab at volume, line by line. It's a well-built spreadsheet, and it often pays for the whole project before the modelling even starts.

In a pharmacy, AI doesn't start by predicting illness. It starts by getting you to stop buying badly.

What can you do about expiry dates and shrinkage?

Expired stock is money you already paid for and are about to throw away. Most of it is caught late because the control is manual and quarterly.

With stock and rotation in the same place, the calculation is close to arithmetic: for each batch, days of cover at the current sales rate versus days until expiry. If cover exceeds the expiry window, that unit will not sell. That produces a short, actionable weekly list:

1. Rotate before it hurts. Return to the wholesaler if the terms allow, promote it at the counter, or move it to another branch if you have one. 2. Fix the buying. The same line expiring every year is telling you the minimum is wrong. The value isn't in the rescue promotion; it's in never buying it that way again. 3. Separate what cannot be promoted. A prescription medicine is not a face cream. The list has to distinguish OTC from everything else, and the system must know that before it proposes anything.

Do you need AI for this? Not for the base calculation: you need the data in one place and somebody who looks at the list on Monday. The model adds value on the layer above — estimating future sales of that specific line in that specific pharmacy — and in spotting shrinkage that isn't expiry: mismatches between what came in, what sold and what's left. That second part is classic anomaly detection, the same logic as fraud detection, and what turns up is almost never theft: it's a goods-in procedure nobody follows the same way twice.

What does AI add at the counter and in patient service?

Here the boundary needs to be stated plainly: pharmaceutical advice is not automated. What gets automated is everything that stops you giving it.

What works today:

What should not be done, however it's sold:

Where is the limit with health data?

This is what separates a pharmacy from any other retail business, and it has to be written down before, not after.

What a pharmacy dispenses reveals the health status of an identified person. That makes it a special category of data under GDPR, with a far stricter regime than a supermarket receipt. The practical consequences:

None of this is exotic, and it doesn't block 80% of the cases in this article, because 80% is business management and never touches the patient. The essentials are in GDPR and AI, and the full clinical criterion is covered in AI for clinics.

Where should a pharmacy start?

A realistic order by effort-to-result:

| Order | Project | Data it needs | Sign it's your turn | |---|---|---|---| | 1 | Rotation and margin dashboard | 12-24 months of sales | Nobody knows which ten lines carry the margin | | 2 | Weekly expiry list by cover | Stock with batch and expiry | Product written off every quarter | | 3 | Ordering assisted by real rotation | Sales + shortage history | Overstock and stockouts at the same time | | 4 | Out-of-hours orders and alerts | Web or WhatsApp | Orders written on paper | | 5 | Seasonal forecasting | 2-3 years of sales | Campaign buying by eye | | 6 | Search assistant over datasheets and protocols | Your documentation, organised | The team looks up the same thing daily | | 7 | Patient service follow-up | Health data with a legal basis | Services that start and fade |

No item on that list begins with buying a tool. They all begin with deciding which decision changes and who makes it. If the owner isn't going to read the expiry list on Monday, the list is pointless — exactly what we explain in change management.

One note on proportion: if you're a two-person pharmacy with 3,000 lines, only items 1, 2 and 4 are worth it — and all three run on data you already have. The sizing criterion is in AI for SMEs.

Frequently asked questions

Is this any use if my pharmacy software is closed and has no API?

Yes, with more work. If it can export sales, stock and orders to CSV, a daily export covers nearly everything in this article. What you won't be able to do is write back: a person still validates the order until the vendor opens up an integration.

How much history do you need to forecast demand for a line?

For stable rotation, 12 months gives a usable forecast; for seasonal campaigns you need two or three years, because the pattern is annual and one cycle can't separate trend from coincidence. More important than volume is that wholesaler shortages are recorded: without them, the model confuses "it didn't sell" with "there wasn't any".

Can I use electronic prescription data to improve purchasing?

For purchasing you don't need to: aggregated dispensation by line and date is enough, with nobody identified. If the use case genuinely needs the patient — adherence, dosette boxes, follow-up — then you're processing health data, and that requires a legal basis, clear information, access control and a proper processor agreement.

Can an assistant give pharmaceutical advice to patients?

No, and it's a line worth not crossing. An assistant can handle opening hours, availability and order status, and it can help the team locate a datasheet while citing the source. Clinical advice comes from a pharmacist, because that's who answers for it.

---

If you run a pharmacy, have two years of sales sitting in your dispensing software and the feeling that there's money in there nobody is looking at, the first step isn't an AI pilot: it's seeing what you can answer today with what you already have, and what's missing for the next step. That's exactly what we look at in the audit, and if you'd rather talk it through in half an hour, let's talk.

Shall we apply it to your case?

The 360° AI Audit turns these ideas into a concrete plan for your company: three weeks, fixed price and the full picture of your AI before spending a euro.

See the 360° Audit→ Let's talk↗