How piyush314159/demandcast-retail_demand_forcasting-inventory_optimization works
DemandCast is a retail-sales forecasting system with a Python pipeline and a Next.js dashboard. Its main workflow loads sales into MySQL, builds calendar-aware features, trains and evaluates multiple forecasting approaches, and exports saved results for dashboard exploration. The README also documents reconciliation, data-quality checks, export formats, and an assumption-based inventory calculator. Some dashboard and model connections are based on README statements or source-index references; unsampled implementation details are not inferred.
Main entry points: run_pipeline.py Stage runner · database.py MySQL sales and forecasts · train_lightgbm.py LightGBM · export_dashboard.py Dashboard snapshot exporter
Components 19
Pipeline orchestration
- Stage runner
run_pipeline.py
Sales data
- Sales ingestion
src/data/load_data.py - MySQL sales and forecasts
src/data/database.py - Calendar and lag features
src/features/build_features.py
Forecasting
- Seasonal naive
src/models/baseline_naive.py - SARIMA
src/models/baseline_sarima.py - Prophet
src/models/baseline_prophet.py - LightGBM
src/models/train_lightgbm.py - Attention GRU
src/models/train_gru.py - Bottom-up reconciliation
src/models/reconcile.py
Evaluation and export
- Forecast metrics
src/evaluation/metrics.py - Dashboard snapshot exporter
src/evaluation/export_dashboard.py
Dashboard
- Exported workspace snapshot
dashboard/data - Workspace API
dashboard/app/api/workspace/route.ts - Snapshot reader
dashboard/lib/server-workspace.ts - Workspace data types
dashboard/lib/workspace.ts - Forecast workspace
dashboard/components/ForecastWorkspace.tsx - Evidence guide API
dashboard/app/api/chat/route.ts
Other components
- Pipeline operator
Connections 21
- Pipeline operator → Stage runner: runs stages
README.md - Stage runner → Sales ingestion: invokes
run_pipeline.py - Stage runner → Calendar and lag features: invokes
run_pipeline.py - Stage runner → Seasonal naive: invokes
run_pipeline.py - Stage runner → SARIMA: invokes
run_pipeline.py - Stage runner → Prophet: invokes
run_pipeline.py - Stage runner → LightGBM: invokes
run_pipeline.py - Stage runner → Attention GRU: invokes
run_pipeline.py - Stage runner → Bottom-up reconciliation: invokes
run_pipeline.py - Stage runner → Dashboard snapshot exporter: invokes
run_pipeline.py - Sales ingestion → MySQL sales and forecasts: writes sales
src/data/load_data.py - Calendar and lag features → MySQL sales and forecasts: reads sales
src/features/build_features.py - LightGBM → Forecast metrics: evaluates with
src/models/train_lightgbm.py - LightGBM → MySQL sales and forecasts: writes forecasts
src/models/train_lightgbm.py - Dashboard snapshot exporter → MySQL sales and forecasts: reads saved data
src/evaluation/export_dashboard.py - Dashboard snapshot exporter → Exported workspace snapshot: writes snapshot
src/evaluation/export_dashboard.py - Workspace API → Snapshot reader: serves snapshot
- Snapshot reader → Exported workspace snapshot: reads
dashboard/lib/server-workspace.ts - Snapshot reader → Workspace data types: validates as
dashboard/lib/server-workspace.ts - Forecast workspace → Workspace API: loads workspace
- Forecast workspace → Evidence guide API: requests guide