Riverbit demand forecasting engine, cover with a sparse-spike demand time series and a forecast band

Demand forecasting engine for intermittent pharmacy demand

At Riverbit I built an in-house demand-forecasting engine for a pharmaceutical franchise platform, replacing a legacy forecasting system that systematically under-ordered on intermittent demand — most of a ~100,000-series catalogue. Each product×warehouse series is classified by demand pattern (Syntetos-Boylan, by ADI/CV²) and routed to the right method: Croston-SBA for intermittent demand, TSB for lumpy/obsolescent, seasonal methods for smooth movers — plus hierarchical middle-out reconciliation, damped asymmetric trend (stockouts cost more than overstock in pharma), and promo-aware uplift.

The engine is pure, stateless .NET with every parameter backed by database rows — live-tunable in production without a redeploy. Output lands in a shadow table and a single feature flag decides whether the order engine reads legacy or new forecasts, so rollback is one statement.

It's tested like a trading algorithm: leakage-free walk-forward backtesting on the full production path, a seasonal-naive benchmark it must beat per ABC tier, and an inventory simulator that scores forecasts by fill-rate and holding cost rather than point error. Validated recovery landed between 0.89 and 1.00 across ABC tiers, and the backtest harness caught two real implementation bugs before they ever reached production. A daily calibration-drift monitor watches it in production.

Project information

  • Technology used: .NET 8, ML.NET, PostgreSQL + TimescaleDB, Hangfire
  • Project goal: Right-size replenishment for ~100k product×warehouse series
  • Date: 2025–2026
  • Role: Engineering Manager / CTO