6 min read
Expiry is the hardest part of running a pharmacy
Stock that expires on the shelf is money that was already spent. Here is why it is so hard to see coming, and what a system has to know to warn you in time.
Read moreEngineering7 min read
A counter cannot stop selling because the internet did. What it takes to build software that keeps working through an outage and reconciles cleanly afterwards.
By Stock Sewa Team
A pharmacy counter in Dhangadhi does not stop having customers because a fibre line was cut in transit. Neither does a church office on a Saturday morning. Software that assumes a working connection is not doing its job here.
“Offline support” is easy to say and hard to mean. The honest version is a set of specific decisions, most of which have to be made early because they are difficult to retrofit.
Not everything should. Trying to make an entire application work without a server produces something slow, complicated and full of conflicts. The useful question is which operations cannot wait.
Drawing that line explicitly is most of the work. It converts “make it work offline” into a bounded problem.
The classic mistake is letting the database issue the identifier. If a sale’s ID comes from a server sequence, a sale cannot be recorded without the server, and the whole design collapses at the first outage.
Identifiers must be generated on the device, in a form that cannot collide with another device’s. Human-facing document numbers are a separate concern: they usually need to be sequential and gapless, so let them be assigned on sync and shown as pending until they are.
Two devices selling the last unit of the same item is not a merge problem. It is an oversell, and the right resolution depends on the business — not on which write arrived at the server first.
We treat the sale as the immutable fact. Both sales happened; both are recorded. The stock figure goes negative and is surfaced as an exception for a human to settle, rather than being silently corrected. A quietly discarded transaction is far worse than a visible discrepancy: one is an accounting problem, the other is a trust problem.
Staff need to know, without asking, whether what they are looking at is current. A quiet indicator showing connection state and the count of unsynced documents does more for confidence than any amount of background cleverness. When people can see that seven sales are waiting to sync, they stop worrying about whether the sales were recorded.
None of this is exotic. It is mostly the discipline to decide early, to keep the offline surface small, and to refuse to hide a conflict that a person should see.
Running a pharmacy or a church office and recognise any of this? Tell us how you work today — stocksewa01@gmail.com.
6 min read
Stock that expires on the shelf is money that was already spent. Here is why it is so hard to see coming, and what a system has to know to warn you in time.
Read more5 min read
Most inventory systems count boxes. A pharmacy needs to count batches — and the difference decides whether a recall takes ten minutes or a weekend.
Read more5 min read
Treasurers do not want a dashboard. They want to close the month, answer a question from the committee, and be trusted with the answer.
Read more