Skip to content

Money

An AI Forecast Trapped $18,642 in a Rural Pharmacy’s Stock

The ordering system learned demand from larger stores. It bought costly medicine local patients rarely used and missed the pharmacy’s spring rush.

Mara QuinnNarrator, Work and Money

October 26, 2026 · 8 min read

A pharmacy counter with an inventory report, a notebook and several medicine boxes awaiting review.
A pharmacy counter with an inventory report, a notebook and several medicine boxes awaiting review.

The pharmacist found the problem on an inventory valuation report at the end of May. One line showed $18,642 in medicine that had gone more than 90 days without a sale.

The figure was high enough to change the month. Her pharmacy served a town and the farms around it, filling prescriptions for about 1,700 regular patients. A normal month’s wholesale purchases ran near $96,000, much of it paid before insurers reimbursed the pharmacy. Cash moved in a narrow channel between the wholesaler’s bill, payroll and payments that might take weeks to arrive.

The slow stock included boxes of a weekly diabetes injection, migraine medicine kept in a refrigerator and a prescription skin treatment that the pharmacy’s patients seldom requested. The diabetes medicine alone represented $11,392 at wholesale cost.

At the same time, the pharmacy was short of albuterol solution, allergy eye drops and two common inhalers. Local demand for those products rose each spring as fields dried and planting began. Patients who had driven 20 or 30 miles sometimes left with part of a prescription or agreed to return after the next delivery.

That spring, the next delivery did not always solve it. The automated ordering system kept placing expensive medicine near the top of the purchase list, using cash the pharmacist needed for products moving off the shelves that week.

The forecast replaced a local habit

For years, the pharmacist ordered from a handwritten notebook and the previous month’s sales report. She marked the start of planting, the first hard freeze and the weeks when respiratory illness usually reached the local school. The method took part of each evening and depended on her memory.

The automated system promised to do more. It produced a demand forecast for every medicine each night, then converted that forecast into a target quantity. If stock fell below the target, the program added units to the next wholesale order unless a worker removed them.

This was not a fixed spreadsheet copying last year’s sales. The machine-learning model adjusted its estimate from recent purchases across a wider network, using each item’s sales history, regional demand and the time required to replace it. It also looked for relationships among stores that appeared similar by transaction volume and product mix.

When a pharmacy had little local history for an expensive medicine, the system did not leave the estimate blank. It borrowed patterns from other stores and gave more weight to those broader patterns than the pharmacist understood when she turned on automated ordering.

That ability was useful at first. The system caught routine changes in blood pressure prescriptions and reduced the number of common maintenance drugs that expired. It noticed gradual shifts that were easy to miss in a notebook, and the pharmacist spent less time building orders after the doors were locked.

The trouble sat inside the same feature. Sparse local sales caused the model to rely on stores it had grouped as peers, although many of those pharmacies served larger towns where newer diabetes treatments and migraine injections moved faster. The grouping reflected what people bought and how much the stores sold. It did not give enough weight to distance, farm work or the town’s later spring.

A spreadsheet using the pharmacy’s own history would have repeated local mistakes. This system created a different one: it inferred that demand from elsewhere belonged here, revised that inference each night and sent the result into a purchase order before the pharmacist saw the accumulating cost.

A season disappeared into the average

The pharmacist opened the dashboard’s item history after the third patient in a week needed albuterol solution that was not available in the quantity prescribed. The local sales line showed a sharp rise during the previous two springs. The forecast line rose more slowly.

Across the wider network, respiratory demand had already peaked and begun to fall. The model treated that larger decline as useful evidence, which pulled down its estimate for the rural store even as dust and pollen were beginning to push local demand up.

The system was designed to smooth irregular data so that one unusual week would not produce a large order. In a small pharmacy, however, a real seasonal change can resemble noise. A jump from two boxes to eight is a strong local signal, but it remains a small number beside the sales flowing through the network.

The expensive medicines had the opposite problem. A few sales at the pharmacy, combined with sustained demand among its assigned peers, made the model expect more. The target quantity increased. Boxes arrived, remained in stock and continued to count as available inventory, while the cash used to buy them could not be spent again.

On the $18,642 report, the pharmacist wrote the date of the last local sale beside each item. Several dates reached back into winter. She had approved the orders in batches, usually checking the total rather than every machine-set target, because reviewing each line would have restored much of the work the system was meant to remove.

Returns offered only part of the money back. Some refrigerated products could not be returned through the ordinary process, and other items carried restocking charges or had to remain unsold for a set period. During the next quarter, the pharmacy drew $15,000 from its credit line and paid $286 in interest and fees. The pharmacist delayed replacing a counting machine that had begun stopping between batches.

The shortage cost money in a less visible way. A patient who took an inhaler prescription to another pharmacy might move the rest of the household’s prescriptions there. The pharmacist could count the missing box. She could not put an exact figure on the relationship that left with it.

She kept the machine and narrowed its reach

The pharmacist did not remove automated ordering. By then, the system handled enough routine stock well that returning to the notebook for every product would have added hours to the week.

Instead, she separated medicines by how much a wrong forecast could cost. The system continued placing orders for lower-cost maintenance drugs with steady local use. Expensive products required a person to approve the quantity, while seasonal respiratory and allergy medicines went back onto a local review list tied to the pharmacy’s own history.

She also changed the peer data setting after learning that the model’s idea of a similar store came from sales behavior rather than a map. The support team could explain the inputs and adjust how strongly network demand influenced the forecast, though it could not show why a particular outside store had affected a particular order.

That limit mattered. The dashboard displayed a recommended quantity as one clean number, even though the underlying estimate blended local sales with patterns borrowed from pharmacies the pharmacist could not inspect. The number looked like a decision. It was an estimate with hidden neighbors.

Over the next four months, the value of stock older than 90 days fell from $18,642 to $7,910. Some boxes sold. Some were returned at a loss. The weekly diabetes injections remained in the refrigerator longer than she expected, and she checked their expiration dates each month while the system handled hundreds of ordinary refills without incident.

The notebook came back, though it carried less. One page held the month when planting usually began and a short list of products whose demand changed with field conditions. Beside it sat the inventory valuation report, with $18,642 circled once.

Questions people ask

How did the AI forecast get local demand wrong?

The model filled gaps in the pharmacy’s limited sales history with patterns from stores it considered similar. Those stores matched on transaction volume and product mix, but their patients bought more costly diabetes and migraine medicine, while their spring respiratory season arrived earlier.

Why did the pharmacy have empty shelves if it still had inventory?

Inventory is tied to specific products. The pharmacy had spent $18,642 on slow-moving medicine, and that cash was unavailable for inhalers, allergy products and other prescriptions moving faster. Insurance payment delays and limits on returns made the mismatch last beyond a single order.

Did the pharmacist stop using automated ordering?

No. The system continued ordering lower-cost medicines with steady local demand, where it had reduced expired stock and saved time. The pharmacist required human approval for expensive products and reviewed seasonal items against local history rather than accepting the network forecast alone.

Could the pharmacist see why the system chose each quantity?

She could see local sales, the forecast and the resulting target quantity. She could also learn which broad inputs shaped the estimate. She could not inspect the outside stores behind a particular recommendation, so the $18,642 inventory report stayed beside the keyboard.

ShareFacebook
seasonal allergiesrespiratory illnessdiabetesmigraineai forecastingpharmacy workcash flowinventoryrural business

One story a day

The story of the day, in your inbox

One real story about AI each morning — no hype, no alarm, just company for the road.

Read next