StickyMetrics¶
Demand forecasting and Amazon data warehouse for the eComHD store. The system pulls Amazon sales, orders, inventory, and ad spend into Postgres, runs an ML model to predict future demand, generates reorder recommendations, and writes the results to dashboards. It self-corrects over time by scoring each forecast against what actually sold.
Start here¶
- New to the project? Read Getting Started, then the Architecture Overview.
- Want the forecasting design? See Forecasting and Inventory Data Warehouse.
- Running or fixing the pipeline? The Runbooks cover the nightly refresh, backfills, and adding a seller.
How the pieces fit¶
| Layer | What it does | Where it lives |
|---|---|---|
| Data warehouse | Pulls Amazon data into Postgres (orders, sales, inventory, ad spend, settlements) | scripts/pull_*.py, db/migrations/ |
| Forecast engine | ML demand model + self-healing calibration | forecasts/ (forecast_all_lifecycle.py, calibrate.py, score_run.py) |
| Recommendations | Turns forecasts into reorder decisions | scripts/compute_po_recommendations.py, forecasts/po_recommender.py |
| Dashboards | Writes results to Google Sheets | scripts/push_*.py |
Self-healing in one paragraph¶
The forecast is pure demand, but when a product is out of stock it sells zero, which would teach the model that demand dropped. The engine detects out-of-stock days from inventory snapshots and uncensors them, imputing the trailing in-stock run rate so the model learns true demand, not stockouts. Scoring then excludes out-of-stock days so accuracy measures the model rather than purchasing decisions. Full detail is in Forecasting.
Code and data¶
- Code: this repository (
github.com/acehemani/stickymetrics). The deep engineering reference, including the stock-aware demand work, is inFORECASTING.mdat the repo root. - Database: Supabase Postgres (read-only access available for developers).