A pharmacy inventory management system, scoped to the batch
Retail inventory asks how many you have. Pharmacy inventory asks how many of which batch, expiring when, and in Egypt increasingly which individual pack. That is a different data model, and retrofitting it later is expensive.
Most inventory software is built on a quietly reasonable assumption: a product is a row, and the quantity on that row is the truth. For a clothes shop or a hardware store that holds up. For a pharmacy it fails on the first audit, and it fails in a way that is hard to patch.
The reason is that two packs of the same medicine are not interchangeable. One expires in March, the other in next January. One came from a batch that may be recalled, the other did not. One is a controlled product that has to be accounted for individually. A system whose unit of truth is the product cannot answer any of the questions that actually get asked of a pharmacy.
The unit of truth is the batch, not the product
This is the single design decision that everything else follows from. Stock is not held against a product. It is held against a product and a batch and an expiry date, together, and every movement in or out names which one.
Getting this wrong is not a feature gap, it is a schema problem. A system that stores quantity per product and bolts on an expiry field later ends up with one expiry date for stock that has several, and the number it shows you is simply false. We wrote about the general version of this in an inventory system for a retail chain, where the equivalent trap is per branch rather than per batch. That note owns the multi location problem. This one is narrower and about what sits inside a single location's stock row.
What the storage guidance expects the records to do
The WHO's good storage and distribution practices annex is useful here because it is written as requirements rather than advice, and the requirements map almost directly onto database behaviour. Section 13 covers stock control and rotation (WHO Technical Report Series No. 1025, Annex 7, Good storage and distribution practices for medical products, 2020).
Three of its clauses are really software specifications. Records of stock levels should be kept in paper or electronic form and "updated after each operation", with entries, issues, losses and adjustments named as the operations. Periodic stock reconciliation should be performed at defined intervals "by comparing the actual and recorded stock". And all stock should be checked at regular intervals "to identify those items that are close to their retest or expiry date", with appropriate action such as removal from useable stock.
Read as a build brief, that is: every movement is an append only record rather than an edit to a number; the system has to support a counted stocktake and show you the variance rather than silently overwrite the book figure; and expiry proximity is a query the system runs on a schedule, not something a person remembers. The annex also asks that the root cause of discrepancies be identified and corrective action taken, which means a variance needs somewhere to record why, not just by how much.
FEFO is a rule the software enforces, not a habit staff maintain
The same WHO document defines first expiry first out as a distribution procedure ensuring that "the stock with the earliest expiry date is distributed and/or used before an identical stock item with a later expiry date". Note that it is expiry order, not arrival order. Stock that arrived last week can be the stock that has to go out first, which is exactly the case a human picking from a shelf gets wrong.
In practice this means the dispensing screen should propose the batch rather than ask for it, and should make overriding the proposal possible but recorded. If the software leaves batch selection entirely to the person at the counter during a queue, FEFO is a poster on the wall.
Serialisation has already started, and it changes the model again
Batch level tracking is no longer the end state in Egypt. The Egyptian Drug Authority announced on 4 March 2026 that its chairman had launched the first phase of a national pharmaceutical track and trace system, described as "tracking pharmaceutical products from the manufacturing stage until they reach the patient" and working by "tracking each medicine pack through a unique serial number" (EDA launches the first phase of the pharmaceutical track and trace system, Egyptian Drug Authority).
The announcement is specific about scope, and the specificity matters for planning. It was applied initially to imported Schedule I products, meaning narcotic substances, at ambulance pharmacies, and the announcement states the system "will subsequently be rolled out to other imported pharmaceutical products". So today this affects a narrow slice of a narrow set of pharmacies. The direction of travel is not narrow.
The practical consequence for a build decision now is that the identity column should not be assumed to stop at the batch. A pack level identifier is a third level below product and batch, and a schema that can hold one without being rewritten is cheap to design and expensive to retrofit. That does not mean building serial capture into version one. It means not making it impossible.
| Question the pharmacy gets asked | What a product level system can answer | What a batch level system can answer |
|---|---|---|
| How many packs do we have? | Yes | Yes |
| How many expire within ninety days? | No, it holds one date for mixed stock | Yes, per batch |
| Batch X is recalled, did we receive it and where did it go? | No | Yes, receipts and issues by batch |
| Which pack should be dispensed next? | No basis to choose | The earliest expiry in stock |
| Counted stock differs from the book figure, where? | Only at product level | Per batch, which narrows the cause |
| Where is this individual pack? | No | Only if a pack level identifier is stored |
Recall is a query, and it decides the schema
The WHO annex treats recall as an operational capability with record requirements attached: records should be readily available to the people responsible for recalls and should include the "name, address, contact detail, batch numbers, quantities" involved. That is a specification for what a receipt and an issue have to store.
It is also the clearest test of whether the system works, and one you can run on paper before commissioning anything. Pick a batch number. Ask the software which supplier it came from, how many arrived, how many were dispensed and how many remain. If answering that means reading paper invoices, the system has not been built for the job it exists to do.
What version one should contain, and what it should not
A first version that earns its keep needs: products identified consistently; stock held per product, batch and expiry; receipts, issues, adjustments and losses as separate recorded movement types; a dispensing flow that proposes the earliest expiring batch; a stocktake that records counted against recorded and keeps the variance; a near expiry report with a configurable window; and a batch lookup that answers the recall question above.
What it does not need in version one: forecasting, automated reordering, supplier price comparison, loyalty, or an integration with anything. Those are the features that demo well and are the first to be abandoned when the underlying stock figures turn out to be unreliable. The sequencing argument is the same one in when a stock spreadsheet starts costing more than it saves, and the buy versus build question is in custom software versus off the shelf, which for a single pharmacy usually resolves toward buying.
The record keeping discipline here has a close cousin in a clinic management system, where the patient record is a legal object before it is a feature. Pharmacy stock is the same shape of problem: the data has an external standard to meet, and that standard is the requirements document whether anybody writes it down or not.
Honest limits
- We are reading WHO guidance, not Egyptian pharmacy regulation. The WHO annex is international good practice for storage and distribution. The binding requirements for an Egyptian pharmacy come from Egyptian law and EDA decisions, and we have not read those texts in full for this note. Treat the clauses here as a sound design brief, not as a compliance checklist.
- The WHO annex is from 2020. It is the current published version of that text as far as we can see, and it predates serialisation becoming operational in Egypt. That is part of why the track and trace point is sourced separately.
- The track and trace scope is narrow today. The EDA announcement covers a first phase on imported Schedule I products at ambulance pharmacies. We are not asserting a timeline for the wider rollout, because the announcement does not give one.
- Controlled substances need their own answer. Narcotic and psychotropic products carry register and reporting obligations beyond ordinary stock control. We have not read the current EDA requirement for those registers, so this note does not describe them.
- No numbers here are ours. There is no figure in this note for shrinkage, expiry write off or dispensing error rates, because we have no measured source for them in this market and an invented benchmark is worse than none.
- Most pharmacies should buy. This is a well served category, and a scoping note is for evaluating what you are sold rather than commissioning a build.
The short version: hold stock against product, batch and expiry together, make every movement a record rather than an edit, let the software choose the batch by earliest expiry, and leave room in the schema for a pack level serial you do not need yet.
Describe it. We build it.
Seven or twelve days, pay on delivery, a year of maintenance included. Bring the problem, not a spec.
Book a meetingRead next
An event registration and ticketing system, and when to build one
An event registration and ticketing system is a fee decision before it is a software decision. The published platform fees, and what owning the data means.
ReadA staff shift scheduling tool, and the rules it has to encode
A staff shift scheduling tool is a constraint solver wearing a calendar. The daily rest, weekly rest and night work limits that decide whether a rota is legal.
Read