Skip to main content

Blog Consulting

Case study · Pharma

Stock alerts in pharma logistics: the customer asked for a web shop. We thought it through.

Published on
Updated on
Reading time
10 min

A pharma company wanted early warning of low stock. Rather than build a web shop just for a stock alert, we wrote a small application that reads the warehouse's existing stock list, and then, on our own initiative, a multi-client prototype.

A pharma company wanted to know before an item ran low. The request came to us through its logistics provider. The first idea was a web shop that would do nothing but send stock alerts. We built something simpler: an application that automatically emails the people responsible whenever it finds an item's stock below its reorder level.

A note on terms. Our customer is that pharma logistics provider. Its clients are the pharma companies that own the goods it stores, hence the single-client and multi-client versions below. The ordering portals are the existing systems we run for the logistics provider and its clients, each with a stock alert module built in.

Why a web shop looked like the answer

Ordering portals come with a stock alert as standard, so a web shop was the natural first thought. The alert in the portals is focused and modular: it does one job and has done it reliably for years.

The brief asked for each item's quantity and reorder level, counting free stock only. It also asked for an email whenever that stock falls below the reorder level. Without monitoring, a stock-out often comes to light only when orders can no longer be met, and routine manual stock checks eat into staff time. The only question was whether a whole web shop was worth building to host the alert.

A small application instead

We advised against the web shop, because setting it up and keeping its data current would have been more effort than the job justified. We proposed a small bespoke application instead, kept deliberately lean. It is self-contained, easy to replicate and has fewer dependencies than a shop.

There is a structural reason, too. A stock alert built into a single ordering portal sees only that portal's stock and recipients. If several systems draw on the same warehouse stock, reorder levels and distribution lists have to be maintained in each of them and drift apart. Our application starts from the warehouse instead.

Using a report that already exists

The first plan was a direct interface to the warehouse management system (WMS). Instead, the application uses one of its existing standard reports: a CSV stock list that the WMS delivers over SFTP. The WMS writes that list anyway; the application simply reads it too. It recognises an unchanged list by the file's checksum and skips it, which makes checking at short intervals practical.

One file covers every client at a site, so the application first picks out the rows for its own client. It finds each column by its heading, not its position.

What counts as free stock?

In the WMS stock list, a quantity says only that the goods are not reserved for an order. That does not make them free: the stock type decides, so the application counts only quantities marked 'free'. Negative quantities from stock adjustments are ignored, so they cannot trigger false alarms.

Now picture an item whose free stock has slipped just below its reorder level while a large consignment, newly arrived, waits in quarantine for release. An alert that showed only the free figure would tell half the story. So the application compares only free stock with the reorder level. It also records quarantine and blocked stock and shows both in the alert email for context.

One alert per shortfall, not a flood

Each shortfall triggers one alert, and only one: as long as stock stays below the reorder level, nothing further is sent. If an item runs out completely, one alert goes out, followed by silence until stock rises again.

When stock climbs back above the reorder level, the alert re-arms. That happens when the next stock list is imported, not between imports. Alerts go out one item per email, not as lines in a digest. Each alert also leaves a record: the item, its reorder level, the three stock figures and the addresses it went to.

Almost nothing to maintain

Because the stock list includes item descriptions, importing it automatically creates new items and keeps the item master data in step with the WMS. A new item arrives without a reorder level, so it stays silent until someone gives it one.

That leaves two things to look after: reorder levels and recipients. Each item can alert several people, and each person can cover several items. For this one client, both are maintained by the logistics provider; the client has no access of its own.

Tested on live stock

We used live stock levels rather than dummy data and set reorder levels close to current stock so that genuine alerts were triggered. At first, they went to our own addresses. Before go-live, we ran the whole process against the live SFTP server, with real emails going out.

Testing also settled one finer point. Anyone who lowers an item's reorder level expects to be alerted again if stock is still below the new figure. So any change to the reorder level re-arms the alert. Otherwise the one-alert rule holds.

Why build a second version unprompted?

The original, single-client version still runs, unchanged, as a separate installation. Alongside it, we built a multi-client prototype on our own initiative, because we see the need and expect demand to follow. It began as a copy of the single-client version, kept its automated tests and needed no new data source.

The prototype reads the stock lists of all the logistics provider's sites. Clients organise items into product groups, each with its own recipients. Every alert is saved as a snapshot in a history that clients can view. If an item below its reorder level has no active recipient, the alert stays armed and the incident is logged. Each client sees only its own data. That separation is secured by queries restricted to the client, per-record access checks and a dedicated set of tests.

Why one interface instead of three places?

In the portal module, the same settings live in three places: the reorder level on the item, the product group on the category, the recipients in a separate module. It is all documented, but you need to know your way around the documentation. The multi-client version brings these settings together in one interface that can be used without prior knowledge.

There, client staff set their own reorder levels and recipients, one at a time or in bulk from a spreadsheet. The plan is for clients to sign up through the logistics provider: its key account manager sets up access, and there is nothing to install at the client's end. For clients switching from the portal module, we intend to carry reorder levels and recipients across.

What the stock alert does not do

It only reads the WMS stock lists; it never writes anything back. Both versions display an item's earliest expiry date, but neither monitors expiry dates or batches. Technically we could add that, but it was not wanted.

On regulation: we build non-GxP systems and do not offer computer system validation or GxP certification. The logistics provider commissioned and runs the single-client version; it decides whether that version is GxP-relevant. Our article on non-GxP systems explains how we classify such applications; our page on pharma logistics gives the wider picture.

How do you make a small application dependable?

By treating it like a large one, because an application whose job is to raise the alarm should not fail quietly. Both versions are built test-first: the single-client version has more than 100 automated tests, the multi-client version more than 600, all passing.

Static code analysis checks both versions at a strict level (level 7) and blocks functions that are banned as risky. Login attempts are throttled to counter password guessing. Before the single-client version went live, we ran a security scan as a logged-in user and checked its dependencies for known vulnerabilities. Our own tool also checks both versions from the outside, automatically, and updates are rolled out by script.

What we took from it

The obvious answer was a web shop. We looked at the problem we were given and built a better answer without overturning what was already there: a small application that reads what the WMS already writes and adds the one check that was missing between the warehouse and the client. The multi-client version is meant to let clients see low free stock coming before an order goes unfilled. We work the same way for other companies and on other problems, and our case studies show it in practice.

Frequently asked questions

Can the stock alert work with our own warehouse management system?
The version we built does without a direct interface to the WMS. It fetches a standard CSV report from an SFTP server and matches the columns by their headings, whatever order they come in. It only ever reads the file, so nothing flows back into your WMS.
Can we carry over the reorder levels from our ordering portal?
That is the plan. If you move over from an ordering portal's built-in alert, we intend to bring across item numbers, reorder levels, recipients and product groups, so that nothing has to be typed in twice. We would provide this as a service rather than an automated tool: we export every item with a reorder level and recipients from the portal and match it against the warehouse's stock list. Items the warehouse does not hold yet are left out. They appear in the stock alert automatically once they are received into stock, and their reorder levels are added in a later import.
Who maintains reorder levels and recipients?
That depends on the version. In the single-client version the logistics provider does, and the client cannot log in. In the multi-client prototype, the relevant client staff maintain both themselves, including bulk changes by spreadsheet upload. User accounts are the exception: the logistics provider or we create them, never the client.
Does the stock alert monitor expiry dates?
No. You can see the earliest expiry date for each item in either version, but no alert is tied to it and batches are not monitored. Leaving expiry monitoring out was a choice, not a technical limit: it could be built, it simply was not wanted.
Is the stock alert a GxP system?
No, it is built as a non-GxP system. Computer system validation and GxP certification are not part of what we offer. For the single-client version, the logistics provider that commissioned and operates it assesses GxP relevance, not the pharmaceutical company that owns the goods.
What does a stock alert like this cost?
Talk to us about your situation and we will give you a quote.

A stock alert, or something else entirely?

Tell us where things are stuck. We will look at it with you and build something that fits the systems you already have, without starting from scratch. You will hear back from us quickly.

Share on LinkedIn

Related articles

Case study · E-commerce

One QR code on every appliance: from EU obligation to service portal

Since 2021, every EU energy label has had to point via QR code to the European product database, EPREL. For an international household-appliance manufacturer, we turned that into more than a compliance box-tick: a QR platform that routes every scan to the right destination depending on context, and a multilingual service portal covering over 600 products, both living off the same data foundation.

Guide · Pharma

Non-GxP in pharma: what we build, what we leave out and where our systems stop

We build specialist applications for the pharma sector that their operators classify as non-GxP. Instead of promising validation, we give you technology you can check: automated tests, a protected login and security testing in the applications we develop. Below we explain who classifies a system, where our software stops and what your QA team can inspect and receive.

Case study · E-commerce

The self-driving content machine

An established mid-market online shop with several thousand specialist products that need real explanation, multiple country shops and a large trade magazine faced a scaling problem: high-quality, search-strong content, complete with imagery, internal linking and multiple languages, can't be produced by hand at the volume required. We built a fully automated content machine for it that generates, illustrates, translates and even voices articles, running autonomously round the clock.

Search the website

Popular topics

All results