Skip to content

Shaw1011/supply-chain-analytics

Repository files navigation

Retail Supply Chain Analytics

A free, end-to-end supply chain analytics platform — generate your own synthetic dataset or upload your own data to visually explore it with 15+ auto-generated charts, ML models, and interactive dashboards.


What It Does

  • Generate 50,000 synthetic supply chain records using generate_data.py
  • Or upload your own CSV, Excel, TSV, or JSON file to the web dashboard
  • Auto-generate 15+ chart types: bar, line, pie, scatter, bubble, radar, box plot, histogram, funnel, waterfall, correlation heatmap, and more
  • Filter data with interactive slicers (categorical + numeric)
  • Drill down into any category with one click
  • Bookmark your favorite views
  • Add calculated columns with custom formulas
  • Switch themes — 6 built-in themes to choose from

Tech Stack

Tool Purpose
Python 3.11+ Core language
Pandas / NumPy Data manipulation
Matplotlib / Seaborn Visualization
Scikit-learn Random Forest classifier
Statsmodels SARIMA time-series model
Flask / Chart.js Interactive web dashboard

How to Run

Step 1 — Install Dependencies

pip install -r requirements.txt

Step 2 — Generate or Prepare Data

Option A — Generate synthetic data:

python generate_data.py

Creates retail_supply_chain_data.csv with 50,000 records.

Option B — Use your own dataset: Skip this step and upload your file directly to the web dashboard. It excepts multiple types of dataset. (CSV, TSV, TXT, XLSX, XLS, XLSM, JSON)

Step 3 — Run the Analysis Pipeline

python main_analysis.py
  • Cleans and validates the data
  • Engineers features (lead time, delays, financials, return flags)
  • Generates EDA charts into outputs/
  • Trains SARIMA demand forecasting model
  • Trains Random Forest delay prediction classifier
  • Exports clean_data_for_dashboard.csv

Step 4 — View the Static Dashboard

python dashboard.py

Generates dashboard_board.png — a 2×2 Matplotlib summary dashboard.

Step 5 — Launch the Web Dashboard

python web_dashboard.py

Open http://127.0.0.1:5050 in your browser and upload any dataset to get started.


Web Dashboard Features

Feature How to Use
File Upload Drag & drop or click the upload button
Filter Panel Click "Filters" → check categories or set numeric ranges → "Apply Filters"
Data Table Click "Data Table" → search, sort, paginate through raw data
Chart Switcher Hover any chart card → click the swap icon (↺) → pick a new chart type
Chart Download Hover any chart card → click the download icon (⇩)
Expand Chart Hover any chart card → click the expand icon (⛶) for full-screen view
Drill Down Click any bar/slice on a categorical chart → opens a detailed breakdown panel
Bookmarks Set up filters/theme → click "Bookmarks" → name and save → restore anytime
Calculated Columns Click "Calc Column" → enter name + formula → auto-reanalyse
Theme Switcher Click the "Themes" dropdown in the header → pick a theme
Export CSV Click "Export CSV" in the toolbar

Key Results

Model Metric Value
SARIMA Demand Forecast MAPE ~2.97%
Random Forest Delay Classifier Accuracy ~86%
Dataset Size Records 50,000
EDA Visualizations Count 10
Web Dashboard Chart Types Count 15+

Troubleshooting

Issue Solution
ModuleNotFoundError Run pip install -r requirements.txt
DLL load failed on Windows Use Python 3.12 or 3.13
Web dashboard port in use PORT=8080 python web_dashboard.py
Flask server won't start pip install flask

Author: Edge Shaw

About

End-to-end retail supply chain analytics platform with ML models, 15+ chart types, and an interactive Flask web dashboard

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages