How bs-prime/retail-demand-forecasting-and-inventory-optimization-system works
This is a retail demand forecasting and inventory-planning application. Its principal workflow accepts product/store inputs, predicts demand, converts forecasts into replenishment metrics, and presents plans through a dashboard or API. A separate training workflow prepares historical data, fits and evaluates forecasting models, and saves model and preprocessing artifacts. The README documents time-aware validation, SHAP explainability, single and batch inference, and configurable inventory planning; the sampled source confirms the orchestration and serving paths, but not every training component’s internals.
Main entry points: train_pipeline.py Training orchestrator · predict_pipeline.py Prediction pipeline · app.py FastAPI service · inventory_service.py Inventory service
Components 20
Model training
- Training orchestrator
src/pipeline/train_pipeline.py - Data ingestion
src/components/data_ingestion.py - Data cleaning
src/components/data_cleaning.py - Feature engineering
src/components/feature_engineering.py - Preprocessing
src/components/data_preprocessing.py - Model training
src/components/model_training.py - Model evaluation
src/components/model_evaluation.py - SHAP explainability
src/components/model_explainability.py
Forecast inference
- Prediction pipeline
src/pipeline/predict_pipeline.py
Inventory planning
- Inventory service
src/services/inventory_service.py - EOQ and reorder logic
src/optimization_strategy/optimization.py
User interfaces
- FastAPI service
src/api/app.py - Request schemas
src/api/schemas.py - Streamlit dashboard
src/ui/main.py
Data and artifacts
- Retail history
data/demand_forecasting.csv - Feature datasets
artifacts/features/train.csv - Preprocessor artifact
artifacts/preprocessor/preprocessor.pkl - Best model
models/best_model.pkl
Other components
- Retail planner
- API client
Connections 23
- Training orchestrator → Data ingestion: calls
- Data ingestion → Retail history: reads
- Training orchestrator → Data cleaning: calls
- Training orchestrator → Feature engineering: calls
- Training orchestrator → Preprocessing: calls
- Preprocessing → Feature datasets: writes
- Training orchestrator → Model training: calls
- Training orchestrator → Model evaluation: calls
- Training orchestrator → Best model: writes
- Training orchestrator → Preprocessor artifact: writes
- Training orchestrator → SHAP explainability: calls
- Prediction pipeline → Data cleaning: calls
- Prediction pipeline → Feature engineering: calls
- Prediction pipeline → Best model: loads
- Prediction pipeline → Inventory service: returns forecasts to caller
- Inventory service → EOQ and reorder logic: calls
- API client → FastAPI service: requests
- FastAPI service → Request schemas: validates with
- FastAPI service → Prediction pipeline: calls
- FastAPI service → Inventory service: calls
- Retail planner → Streamlit dashboard: uses
- Streamlit dashboard → Prediction pipeline: calls
- Streamlit dashboard → Inventory service: calls