Omniscope Custom Blocks › Analytics/Safety-Stock

Safety Stock and Reorder Point

Calculates safety stock, reorder points, order-up-to levels and EOQ per item from demand history and lead times for a target service level, with a reorder list.

Analytics › Supply Chain Python visokio-agents

Open the demo in Omniscope Download demo.ioz Sample data: part-demand.csv Sample data: part-parameters.csv Source on GitHub

Items tagged visokio-agents are community examples built by Visokio's agents, to extend Omniscope's core blocks and views with popular, specialist and more unusual use cases, and to show what anyone, people or agents, can build on Omniscope. They are tested by automated tests and were run on a real Omniscope server. They were not reviewed by Omniscope's core team, so they are not on a par with the core blocks and views, which have years of manual, functional and unit tests behind them. About

Omniscope custom block · Analytics

Safety stock, reorder points, order-up-to levels and EOQ for every item, from demand history and lead times, for the service level you choose, with today's reorder list.

Python · pandas, numpy · nothing extra to install

The problem it solves

Too much stock ties up cash and space; too little loses sales and stops production lines. Rules of thumb such as "two weeks' cover" ignore how variable each item's demand and lead time are, so steady items get too much buffer and erratic ones too little.

This block applies the standard inventory formulas per item: demand variability (with zero-demand periods counted), lead-time variability, the service level target, and produces the levels and a reorder list from current stock.

How it works

What goes in

Input 1: part demand

A year of synthetic daily orders for 25 parts, some steady, some lumpy.

Order Date Part Number Quantity
2024-11-04 P-1001 3
2024-11-05 P-1001 3
2024-11-06 P-1001 1
2024-11-07 P-1001 1
2024-11-09 P-1001 2
2024-11-10 P-1001 1

5,674 rows in the sample file.

Input 2: part parameters

Part Number Lead Time (weeks) Lead Time Std Dev (weeks) Unit Cost Stock On Hand Target Service Level
P-1001 3.0 0.58 216.08 27
P-1002 2.0 0.16 23.63 67
P-1003 2.0 0.08 81.36 7
P-1004 2.0 0.53 12.24 42
P-1005 3.0 0.21 35.44 201 0.98
P-1006 1.0 0.04 85.78 16

25 rows in the sample file.

The options

Option Demo setting What it does
Item field Part Number Identifies the item, such as a part number.
Date field Order Date Date of each demand record; demand is summed per period.
Quantity field Quantity Quantity demanded or shipped.
Cost per order 40 For EOQ. 0 = no EOQ.
Demand period Week Lead times and review periods are in this unit.
Target service level 0.95 0.95 = 95% chance of no stock-out per replenishment cycle.
Review period (periods) 1.0 Time between stock reviews, for the order-up-to level.

What comes out

Stock levels (first ten parts)

Part Number Average Demand Demand Std Dev Lead Time Service Level Safety Stock Reorder Point Order-Up-To Level EOQ Stock On Hand Status Suggested Order
P-1001 13.19 3.95 3 0.95 16.88 56.45 70.85 31.87 27 Below reorder point 43.85
P-1002 13.19 3.56 2 0.95 8.99 35.37 50.31 96.38 67 OK 0
P-1003 2.37 1.86 2 0.95 4.33 9.06 12.4 21.99 7 Below reorder point 5.4
P-1004 23.69 4.64 2 0.95 23.31 70.69 95.6 179.47 42 Below reorder point 53.6
P-1005 28.42 4.93 3 0.98 21.4 106.67 137.37 115.52 201 OK 0
P-1006 15.98 4.1 1 0.95 6.82 22.8 41.55 55.68 16 Below reorder point 25.55
P-1007 4.81 2.47 6 0.95 12.87 41.72 47.15 23.05 11 Below reorder point 36.15
P-1008 6.27 2.71 3 0.95 10.09 28.9 36.1 21.03 6 Below reorder point 30.1
P-1009 29.19 5.68 2 0.95 21.76 80.15 111.26 53.36 109 OK 0
P-1010 14.02 3.7 2 0.98 17.27 45.31 60.93 47.88 37 Below reorder point 23.93

Reorder list

Part Number Stock On Hand Reorder Point Cover (periods) Suggested Order
P-1020 3 915.30 0 1,067.46
P-1017 1 50.2 0 71.1
P-1013 5 17.5 0.9 19.4
P-1025 57 384.24 1 415.45
P-1008 6 28.9 1 30.1
P-1019 135 550.51 1 607.54
P-1006 16 22.8 1 25.6
P-1012 36 127.48 1 139.54
P-1004 42 70.7 1.8 53.6
P-1022 52 77.8 1.9 54.2
The cost of service: each extra point of service level costs more safety stock than the last (synthetic data).
The cost of service: each extra point of service level costs more safety stock than the last (synthetic data).

The cost of service: each extra point of service level costs more safety stock than the last (synthetic data).

A few erratic, long-lead-time parts hold most of the safety-stock value.
A few erratic, long-lead-time parts hold most of the safety-stock value.

A few erratic, long-lead-time parts hold most of the safety-stock value.

Where it pays off

Manufacturing and MRO: Spare parts and components

Set reorder points for thousands of parts from consumption history and supplier lead times, and review the most expensive buffers first.

Retail and wholesale: Store and DC replenishment

Order-up-to levels per SKU and location for weekly review cycles, with higher service levels for key lines.

Healthcare: Medical supplies

High service levels for critical consumables, with lead-time variability from suppliers included.

E-commerce: Purchase planning

EOQ and reorder points per product to plan purchase orders and quantify the cash tied up in safety stock.

Use cases describe typical scenarios and are illustrative.

Why do this in Omniscope

How it fits into an Omniscope workflow

Orders / consumption → Item master (lead times, costs, stock) → Safety Stock and Reorder Point → Email output (reorder list)

Connect demand history and the item master; schedule daily or weekly. ABC Classification upstream can set service levels by class (for example 98% for A items).

Email the reorder list to buyers, and show safety-stock value by class in a Report.

In one step

The standard formulas, applied per item with zero-demand periods and lead-time variability handled.

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder): a year of orders for 25 parts plus a parameters table with lead times, costs and stock.
  2. The question: what should each reorder point be, and what needs ordering today?
  3. Open the block: map demand and parameter fields, weekly periods, 95% service level. Run it.
  4. Look at the levels, then the reorder list (18 parts below their reorder point with order quantities).
  5. Look at the service-level curve: the cost of going from 95% to 99.5%, which sets how much safety stock is worth holding.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the sample data, the block, and a Validate data check on its output.

Language and libraries

Python. It uses pandas and numpy, plus the Python standard library (math).

pandas and numpy are part of Omniscope's Docker Python image, and the block was run in both host mode and Docker mode on an Omniscope server, with the same results. It needs nothing else installed.

Tested

The demo workflow runs without errors on an Omniscope server and produces 25 records in Stock levels and 18 in Reorder list. Its automated tests cover normal data, empty input, wrong types and large input.

Reference

Fields it reads

NameTypeWhat it does
Item fieldFieldIdentifies the item, such as a part number.
Date fieldFieldDate of each demand record; demand is summed per period.
Quantity fieldFieldQuantity demanded or shipped.
Item fieldField
Lead timeField
Lead time std devField
Unit costField
Stock on handField
Service level overrideField

Options

NameTypeWhat it does
Demand periodChoiceLead times and review periods are in this unit.
Target service levelNumber0.95 = 95% chance of no stock-out per replenishment cycle.
Lead time (periods)NumberUsed when input 2 gives none.
Review period (periods)NumberTime between stock reviews, for the order-up-to level.
Cost per orderNumberFor EOQ. 0 = no EOQ.
Annual holding cost rateNumberShare of unit cost per year, such as 0.25.

Outputs

OutputWhat it holds
Stock levelsPer item: demand statistics, lead time, service level, z, safety stock, reorder point, order-up-to level, EOQ, cover, status, suggested order.
Reorder listItems at or below their reorder point, least cover first, with the suggested order quantity.