Inventory that is consumed first-expiry-first, forecast from real fills
Lots with expiry and status enforced in the database, a batch planner that draws the earliest-expiring stock, a forecast that turns demand into material requirements and draft purchase orders, and a scan that tells you what is about to go wrong.
Inventory is where a compounding pharmacy's margin quietly leaves: an API lot that expired on the shelf, a batch that could not start because one excipient ran out, a cycle count that took a Saturday. Pharmacy Flow treats inventory as a ledger with rules. Lots have a state machine, consumption is first-expiry-first-out by construction, the forecast reads what you actually filled, and the purchase orders it drafts are grouped by the supplier you prefer for each material.
Lots, expiry and status
Lots with computed expiry bands, controlled and hazardous flags, storage condition and location. Paged in SQL, filterable, exportable.
A raw-material lot records the internal lot id, supplier and supplier lot number, quantity received and remaining, unit cost and value, expiry date with a computed days-to-expiry and band, certificate-of-analysis reference, temperature-check result, facility and bin. Its status moves through Quarantine, Available, Consumed, Rejected (a scrap, with the quantity written off) and Expired under a database trigger that rejects any other transition; a lot can also return from Available to Quarantine on a hold or an expiry sweep. Finished-good lots carry the variant, BUD, source batch and QC hold reason and follow the same discipline. The list is paged and filtered in SQL and exports to a file, so ten thousand lots behave like ten.
FEFO by construction
First-expiry-first-out is not a picking suggestion in Pharmacy Flow; it is how consumption is written. When a batch is planned, the planner walks the bill of materials and, for each material, reads Available lots ordered by expiry date and takes from the earliest until the requirement is met, then records the take per lot inside the batch transaction. When a unit is commissioned for an order, the fill station reads available finished lots of the order's exact variant ordered by BUD and claims the earliest. There is no path that picks a later lot while an earlier one is available, unless someone quarantines the earlier one first, which is itself a recorded action with a reason.
See the draw before you commit
The batch planner shows, for a chosen variant and quantity, each material's requirement, the lots that will be drawn and how much from each, and the projected per-unit cost. If a material is short the planner tells you before the batch exists. The same functions drive the batch action, so the plan and the record agree. Detail is on the compounding software page.
Demand forecast and material requirements
The Demand & Planning module answers one question: what will we fill over the horizon, and what do we need to buy to do it? Demand per variant is each variant's actual fills over the trailing thirty days, scaled to the chosen horizon. A brand-new tenant with no history falls back to the contracted run-rate in the brand's master data, and the page labels which source it used. Weekly buckets are projected with Holt-Winters exponential smoothing (weekly seasonality) once there are at least two weeks of daily history; before that, a flat split is shown and labelled as a model.
1
Demand per variant
Trailing-30-day actual fills, scaled to the horizon (30, 60 or 90 days). Committed subscription fills due in the window are shown alongside.
2
Explode through the BOM
Each variant's demand is multiplied by its draw per unit for every component, summed per material.
3
Compare to on-hand
Available quantity per material gives the shortfall and the weeks of cover at the forecast rate.
4
Suggest an order
Shortfall plus about two weeks of safety at the forecast rate, rounded up to the next five units, costed at the material's unit cost and attributed to its preferred supplier.
Inventory trend, product and growth analytics read the same fills and lots the forecast uses.
Draft POs, receiving, supplier invoices
One action turns the forecast's shortfalls into draft purchase orders, one per preferred supplier, with the suggested quantities and costs on the lines. A PO is then issued, and later closed or cancelled, each a recorded action. Receiving a line creates a quarantined lot with supplier lot number, expiry, temperature-check result and CoA reference, assigns an LPN, records the GS1 DataMatrix label print and moves the PO to Partial or Received. Supplier invoices are created against the supplier, approved, disputed or paid, and flow into payables on the finance dashboard. Suppliers carry a status and an on-time delivery percentage that the anomaly scan watches.
Run the forecast on your own catalogue
Give us five variants and their bills of materials. We will show the demand, the material requirements, the shortfalls and the draft POs, then receive one and put it away.
✓Cycle count: enter the counted quantity; the variance is booked as a count transaction with the user and the lot
✓Adjustment: a signed delta with a reason, written to the ledger
✓Quarantine a lot: a manual hold with a reason; the lot leaves Available and cannot be drawn
✓Quarantine expired: one action moves every Available lot past its expiry date to Quarantine; the anomaly scan offers it inline when it finds expired stock still Available
✓Scrap: writes off the remaining quantity with a reason and a ledger row
Every one of these is a permission-gated server action. The ledger (Transactions in the sidebar) is the audit trail: receipt, putaway, issue, pick, adjustment, count and scrap with lot, delta, unit, locations, reference and user.
The anomaly scan
AI Insights runs a deterministic rules engine over SQL aggregates for the whole tenant. Each finding names the records involved and links to them, and two findings carry an inline remediation.
The ten rules in lib/anomalies.ts. Counts and values come from tenant-wide SQL views.
When an Anthropic key is configured, a short written briefing is generated from a numeric snapshot of these findings plus operations, finance and growth figures, cached per tenant for an hour; without a key, a deterministic narrative is shown. Neither writes to the database.
Multi-site and transfers
Lots belong to a facility. A transfer between facilities is drafted with quantity and reason, approved and shipped by the sending site (which issues the quantity from the origin lot), and received and counted by the destination, with any discrepancy recorded. Routing decides which facility an order goes to by capability, brand pin, ship-to state and load, so demand and stock are visible per site. The multi-site model is described on the WMS & Control Tower and local manufacturing pages.
Inventory in the wider platform
Because lots, batches, units and parcels are rows in one database, a recall traces from a finished lot to every unit and parcel (see recall by lot), the cost of a fill uses the lot cost that was actually drawn (see 503B software for batch economics), and the partner API only accepts variants that exist in the catalogue (see the telehealth API). For GLP-1 programmes, where API supply is the constraint, the forecast and draft POs are the difference between a surge you serve and one you miss; see GLP-1 fulfilment and the operations playbook. Growth advice is in how to scale a compounding pharmacy.
Frequently asked questions
Is FEFO enforced or just recommended?+
Enforced by how consumption is written. Batch planning draws Available lots in expiry order and records the take per lot inside the batch transaction; unit commissioning claims the earliest-BUD available lot of the order's variant. There is no later-lot-first path.
Where does the demand number come from?+
Each variant's actual fills over the trailing thirty days, scaled to the horizon. A tenant with no history falls back to the contracted run-rate in brand master data, and the page labels the source it used.
How are weekly buckets projected?+
With Holt-Winters exponential smoothing using weekly seasonality once there are at least fourteen days of daily history. Before that, a flat split is shown and labelled as a model.
How is the suggested order quantity computed?+
Shortfall against the horizon plus roughly two weeks of safety at the forecast rate, rounded up to the next five units, costed at the material's unit cost and grouped under its preferred supplier when drafting POs.
Can a lot's status be edited by hand?+
No. Status changes go through permission-checked procedures under a trigger that only allows the defined transitions. Manual quarantine, scrap and adjustment are recorded actions with reasons.
Does the AI change my inventory?+
No. The rules engine and the optional written briefing only read aggregates. The two inline remediations (quarantine expired lots, generate draft POs) are ordinary permission-gated actions you trigger.
Can I run inventory across several facilities?+
Yes. Lots are facility-scoped; transfers move them with approval, shipment and receipt, and discrepancies are recorded on the transfer.
A working platform, not a slide deck. Book a walkthrough and we'll run a real order from intake to carrier lane — or explore the public directory first, no account needed.