Supply chain and logistics
Forecast item demand, plan reorder points, and identify slow-moving inventory from stock movements.
Data mapping
- Entity
- item (SKU)
- Group
- warehouse or plant
- Profile
- generic; configure time windows with verticals.register
Supported analyses
- Will this item be issued within 14 days?
predict_event(target="GI", window_days=14)
Movement Type contains goods receipts (GR), goods issues (GI), transfers and returns. - What quantity will the next issue be?
predict_value(target="GI", window_days=30)
Reference implementation
from datetime import datetime, timedelta
from vertiq import plugins, rules
from vertiq.mapping import Mapping, apply, repair
from vertiq.tasks import predict_event, predict_value
# rows: the source export as a list of dicts, e.g. list(csv.DictReader(open("export.csv")))
mapping = Mapping.parse({"entity": "Articulo", "time": "Movement Date", "type": "Movement Type", "value": "Quantity", "group": "Plant", "attrs": ["Batch", "Supplier"], "date_format": "%Y-%m-%d"})
m, notes = repair(mapping, rows) # validates column names, value types and date format against the rows
ds, problems = apply(m, rows) # rows that fail to load are reported, not imputed
@plugins.feature("stock")
def receipts_90(entity, before, cut): # receives only events recorded before the cutoff
return {"gr_90": sum(1 for e in before if e.type == "GR"
and e.at >= cut - timedelta(days=90))}
task = predict_event(ds, target="GI", window_days=14, pack="stock")
print(task.status, task.report()) # "trained" only if the model outperformed the baseline on held-out entities
if task.status == "trained":
print(task.score("SKU-1678")) # probability with contributing factors
size = predict_value(ds, target="GI", window_days=30, pack="stock")
print(size.status, size.report())
flags = rules.run(ds, [
rules.repeat(2, type="return"), # two returns of the same item within two days
])
print(flags["summary"])
This code is executed by the test suite (tests/test_guides.py) against generated records with these column names.
Recommended plugin
receipts_90: Recent goods receipts indicate planned demand.
Validation rules
rules.repeat(2, type="return"): two returns of the same item within two days
Related modules
inventory: reorder points, slow-moving stock, new items, margins and working capital held in stocksequences: items typically ordered a set number of days after otherstasks.predict_uplift: the effect of a carrier or routing change, against shipments left on the old route
Implementation notes
- In this mapping the item is the entity and each stock movement is an event.
- For shipment-level analysis, map the shipper or route as the entity and scan records as events.
Validation
- Reorder and slow-moving stock logic in the unit tests
- Inventory and logistics tables in the Vertiq LM mapping evaluation
- Every deployment: the evaluation gate measures each model on the organisation's own held-out records before promotion.