Pharmacy and Drug Inventory System
A hospital or clinic pharmacy dispensing against handwritten prescriptions, with stock counted periodically and expiry discovered on the shelf.
The problem
Drugs leave the pharmacy against a note, so stock on the system and stock on the shelf diverge continuously. Expiry is found rather than anticipated, and expired stock is money already spent.
In scope
- Formulary
- Stock by batch and expiry
- Dispensing
- Stock movements
- Reorder
- Purchase orders and receiving
- Wastage and write-off
- Dispensing reports
- Controlled items register
Out of scope
- Clinical notes
- Patient billing beyond the dispensing charge
- Laboratory
- Appointments
- This system runs the pharmacy; it does not run the hospital.
- Also out: drug interaction checking against a full clinical database — see the trade-off.
What this would cover
Grouped by module — open the ones you want to read.
Formulary
- Generic and brand names, strength, form, pack size, with the conversion between purchase unit and dispensing unit handled explicitly
Batch stock
- Quantity by batch with expiry date and supplier, because a drug is not one stock item, it is several batches with different deadlines
Dispensing
- Against a prescription, electronic where the Hospital Operations & Patient Flow Platform or another clinical system exists, entered once where it does not; quantity dispensed recorded; first-expiry-first-out picking suggested
Stock movements
- Received, dispensed, returned, transferred, expired, written off, damaged; every movement attributable to a person with a reason
Expiry management
- Alerts at configurable horizons, expiry exposure valued in money, and a quarantine state that removes a batch from picking without deleting it
Reorder
- Levels per item, consumption-based suggestions, low-stock list
Purchasing
- Purchase orders, receipt against them with batch and expiry captured at intake, supplier price history
Controlled items
- A separate register for items requiring one, with tighter access and a full movement audit
Reporting
- Consumption by item and period, stock valuation, expiry write-off, dispensing by staff member
Data model
- Drug → Batch → StockMovement
- Prescription → DispenseRecord
- PurchaseOrder → GoodsReceipt
- Supplier
- WriteOff → Reason
- ControlledRegisterEntry
- User → Role
Invariants
- Nothing leaves the pharmacy without a stock movement recorded against a patient, a department, or a write-off reason.
- A batch past expiry cannot be dispensed without an override that is logged and reviewed.
- Dispensed quantity cannot exceed prescribed quantity without a logged override.
- Stock is held at batch level, never aggregated to product level in the underlying record.
Offline behavior
Dispensing requires connectivity. Stock and controlled items cannot safely reconcile last-write-wins, and a pharmacy is a fixed location where a wired fallback is reasonable.
Hard trade-offs
The difficult decisions, stated plainly — not trimmed for length.
Batch and expiry discipline at intake is the entire system, and it is slower than what the pharmacy does today.
Receiving stock currently means counting boxes; under this system it means recording batch numbers and expiry dates per line. That is real additional work at the receiving door, and every downstream feature — first-expiry-first-out, recall tracing, expiry forecasting — depends on it. A pharmacy unwilling to change receiving should be told that the system will degrade to an expensive stock counter.
Full drug interaction and contraindication checking requires a licensed clinical database, which carries a recurring cost and a liability position.
Afivox can integrate one; Afivox should not build one. [FILL: decide whether Afivox will resell a licensed interaction database or scope it out entirely.]
End state
What would be true about their day once this is running.
- The pharmacy knows what it holds, by batch, with expiry dates it can see coming.
- Nothing leaves without a recorded movement and a name against it.
- Reorder is driven by consumption rather than by noticing an empty shelf.
- Expired stock is a forecast and a decision, not a discovery.
This is a deliberate first step toward Hospital Operations & Patient Flow Platform — its data model is designed as a genuine subset, so growing into it later doesn't mean starting over.
Let's map how your operation actually runs.
One session. We look at what's breaking, and what we'd build around it — whether or not you hire us afterward.
Start the operations review