Skip to content

Ali-datasmith/SupplyChain-Risk-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Global Supply Chain Risk Engine

Python Streamlit Polars DuckDB Plotly License

A real-time, enterprise-grade supply chain risk monitoring platform β€” built entirely with open-source Python tools, deployed on the cloud, and protected with secure authentication.

πŸš€ Live Demo Β β€’Β  πŸ“‚ Repository


πŸ“Έ Application Preview

πŸ–ΌοΈ [Screenshot 2026-05-18 11 15 54 PM ]


🎬 Full Demo

πŸŽ₯ [https://youtu.be/rYTDYH3ZAt4]


πŸ’‘ What Is This?

The Global Supply Chain Risk Engine is a full-stack data intelligence platform that helps procurement teams, logistics managers, and risk analysts identify, monitor, and simulate supply chain disruptions β€” before they happen.

Unlike generic BI dashboards, this engine combines:

  • Real-time news intelligence from 8 industry-specific RSS feeds
  • Live weather risk scoring along shipping routes via Open-Meteo
  • Dynamic risk modeling using financial, geopolitical, and delay factors
  • What-if scenario simulation for disruption planning
  • One-click PDF audit reports for executive stakeholders
  • Secure SHA-256 login system β€” no plain-text passwords, ever

All of this runs on Streamlit Community Cloud β€” completely free to host.


✨ Feature Breakdown

πŸ” Secure Access Terminal

A professional neon-themed login screen protects the entire application. Credentials are SHA-256 hashed with a cryptographic salt. No plain-text passwords stored anywhere in the codebase. Built for single-tenant or multi-client deployment.

πŸ“Š Executive Risk Dashboard

The command center of the application. Upload any supplier CSV and instantly see:

  • Average risk score across your entire supplier network
  • Count of high-risk suppliers (score > 75)
  • Statistical anomaly detection via Z-score analysis
  • Risk score distribution histogram
  • Top 10 highest-risk suppliers via live DuckDB SQL query

🌍 Global Risk Heatmap

An interactive Plotly scatter-geo world map that plots every supplier by geographic coordinates, sized and colored by risk score. Instantly visualize where your supply chain is most exposed β€” from APAC manufacturing hubs to Middle East trade corridors.

πŸ“‘ Supply Chain Intelligence Feed

Live news pulled from 8 industry-specific RSS sources β€” zero API keys required:

Source Coverage
Supply Chain Dive Industry operations & disruptions
Logistics Management Warehousing, freight, 3PL
FreightWaves Freight markets & trucking
DC Velocity Distribution & materials handling
JOC Port & container shipping
Hellenic Shipping News Global maritime intelligence
Reuters Trade Global trade & commerce
Bloomberg Supply Chain Financial & market risk

Filter by source, search by keyword (tariff, port strike, logistics), and read full articles directly from the dashboard in expandable cards.

βš—οΈ Risk Scenario Simulator

A three-part what-if analysis engine for proactive risk planning:

Region Disruption Simulator β€” Select any region and apply a disruption intensity multiplier (1x–5x). See a live bar chart comparing baseline vs simulated risk scores across your entire supplier network.

Inventory Impact Calculator β€” Input current stock, daily demand, and lead time to compute days-of-cover and shortfall probability with a color-coded risk banner.

Lead Time Projector β€” Model the combined effect of port congestion index and active labor strikes on expected delivery timelines.

🌦️ Shipping Route Weather Monitor

Powered by Open-Meteo β€” completely free, no API key, no credit card. Select any supplier from your dataset and get:

  • Current temperature, wind speed, and precipitation probability
  • Shipping risk classification: 🟒 LOW β†’ 🟑 MODERATE β†’ 🟠 HIGH β†’ πŸ”΄ SEVERE
  • 24-hour wind speed forecast (line chart)
  • 24-hour precipitation probability (color-coded bar chart)

πŸ“„ Automated PDF Risk Report

One-click generation of a professional audit-ready PDF containing:

  • Customizable executive summary
  • Risk statistics (average, min, max scores across all suppliers)
  • Critical supplier table (auto-filtered at risk score > 50)
  • Auto-detects column names from any CSV schema β€” no manual mapping

🧠 Risk Scoring Model

Each supplier receives a composite risk score (0–100) from three weighted components:

Total Risk = (Geo Risk Γ— 0.40) + (Delay Risk Γ— 0.30) + (Financial Risk Γ— 0.30)
Component Methodology Weight
Geo Risk Logistic growth curve over event density Γ— regional sensitivity coefficient 40%
Delay Risk Lead time volatility model: avg delay days + historical variance 30%
Financial Risk Log-scaled revenue exposure + supplier health penalty (1 βˆ’ rating) 30%

Scores normalize to 0–100 via Min-Max scaling and classify into tiers: LOW (0–25) β†’ MEDIUM (26–50) β†’ HIGH (51–75) β†’ CRITICAL (76–100)


πŸ—οΈ Project Architecture

ROOT/
β”œβ”€β”€ app.py                    ← Main entry point + SHA-256 login gate
β”œβ”€β”€ theme.py                  ← Neon/terminal CSS theme + Plotly dark layout
β”œβ”€β”€ requirements.txt
β”‚
β”œβ”€β”€ engine/
β”‚   β”œβ”€β”€ ingest.py             ← CSV loader, schema auto-detection, GDELT
β”‚   β”œβ”€β”€ news_stream.py        ← RSS intelligence feed + Open-Meteo weather
β”‚   β”œβ”€β”€ risk_model.py         ← Geo, delay & financial risk scoring engine
β”‚   └── scenario_sim.py       ← Disruption simulator, inventory & lead time calc
β”‚
β”œβ”€β”€ database/
β”‚   └── risk_queries.py       ← DuckDB in-memory SQL analytics layer
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ alerts.py             ← Z-score anomaly detection & alert banners
β”‚   β”œβ”€β”€ map_viz.py            ← Scatter-geo & choropleth map builders
β”‚   └── views.py              ← Page-level UI components
β”‚
β”œβ”€β”€ utils/
β”‚   └── pdf_gen.py            ← FPDF2 professional report generator
β”‚
└── data/
    └── suppliers.csv         ← Sample dataset (50 global suppliers)

πŸ› οΈ Tech Stack

Layer Technology Reason
UI & Hosting Streamlit 1.31 Rapid deployment, free cloud tier
Data Engine Polars 0.20 10–100x faster than Pandas on large CSVs
Analytics DuckDB 0.10 In-memory SQL on DataFrames, zero setup
Visualization Plotly 5.18 Interactive geo maps, charts, hover tooltips
News Feed RSS feeds (8 sources) Free, reliable, no API key required
Weather Open-Meteo API 100% free, no registration needed
PDF Export FPDF2 2.7 Lightweight professional PDF generation
Security SHA-256 + Salt Industry-standard password hashing

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/Ali-datasmith/SupplyChain-Risk-Engine.git
cd SupplyChain-Risk-Engine

2. Install dependencies

pip install -r requirements.txt

3. Run locally

streamlit run app.py

4. Login

Username : Ali-datasmith
Password : Contact the developer

πŸ“„ CSV Format

The engine accepts any CSV format β€” column names are auto-detected and normalized at upload time:

Column Required Accepted Aliases
supplier βœ… Yes supplier_name, vendor, name, company
risk_score βœ… Yes Risk_Score, risk, score, rating
region ⭐ Recommended Supplier_Region, country, area, zone
lat πŸ—ΊοΈ Map only latitude, y
lon πŸ—ΊοΈ Map only longitude, lng, x

Extra columns (industry, lead_time_days, financial_score, reliability_score, inventory_value) are automatically used where applicable.


πŸ’Ό Real-World Use Cases

Procurement Teams β€” Identify which suppliers pose the highest risk before contract renewal. Prioritize audits based on data, not gut feeling.

Logistics Managers β€” Monitor live weather risk along shipping routes. Get early warnings before a typhoon or port strike disrupts your network.

Risk & Compliance Officers β€” Generate audit-ready PDF reports with one click. Present executive summaries to leadership without manual data preparation.

Investment Analysts β€” Model supply chain exposure for portfolio companies. Run what-if scenarios on geopolitical disruptions β€” Red Sea conflict, China tariffs, labor strikes.

Consulting Firms β€” White-label this platform for clients. Deploy a branded version within hours with custom supplier datasets.


πŸ“ˆ Growth Roadmap

The modular architecture makes the following extensions straightforward:

  • Multi-tenant SaaS β€” Per-client login with isolated data views
  • ERP Integration β€” Connect to SAP, Oracle, or NetSuite via REST API
  • ML Risk Prediction β€” Train a gradient boosting model on historical disruptions
  • Real-time Alerts β€” Email/Slack notifications when risk scores cross thresholds
  • Supplier Benchmarking β€” Peer comparison within same region or industry
  • Mobile Responsive UI β€” Progressive Web App for field use

☁️ Deployment

Optimized for Streamlit Community Cloud (Free Tier):

  • βœ… In-memory only β€” no persistent database or file system needed
  • βœ… All modules have graceful fallbacks if imports fail on cold start
  • βœ… RAM usage stays under 1 GB for datasets up to 100,000 rows
  • βœ… No API keys required for any core feature
1. Push repository to GitHub
2. Go to share.streamlit.io
3. Connect repository β†’ set app.py as entry point
4. Click Deploy β€” live in 60 seconds

πŸ“¦ Dependencies

streamlit==1.31.1
polars==0.20.10
duckdb==0.10.0
plotly==5.18.0
fpdf2==2.7.8
requests==2.31.0
numpy==1.26.4
pillow==10.2.0

πŸ‘¨β€πŸ’» About the Developer

Built by Ali-datasmith β€” a data engineer specializing in supply chain analytics, real-time intelligence dashboards, and Python-based risk platforms.

Open to:

  • Freelance projects β€” Upwork / Direct contract
  • Consulting engagements for logistics & procurement firms
  • Full-time Data Engineering / Analytics Engineering roles

πŸ“§ rjptmhmmd@gmail.com πŸ”— GitHub Profile


πŸ“œ License

MIT License β€” free to use, modify, and distribute with attribution.


⚑ Built by Ali-datasmith

Polars Β· DuckDB Β· Streamlit Β· Plotly Β· Open-Meteo Β· FPDF2

"From raw supplier data to executive risk intelligence β€” in seconds."

About

Real-time supply chain risk dashboard built with Streamlit, Polars, DuckDB & Plotly. Features live risk scoring, world map heatmap, RSS news feed, Open Metro weather conditions, what-if scenario simulation and full pdf report.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages