Team Dream4 | University of Moratuwa | AITHON 2026
Target SBU: Atlas Axilia | Hemas Consumer Brands
HemasSCRG models the entire Hemas supply chain as a dynamic heterogeneous knowledge graph and applies a Relational Graph Convolutional Network (R-GCN) to predict cascade failures 7–28 days before they occur.
| Feature | Description |
|---|---|
| F1 | Interactive Supply Chain Risk Graph Dashboard — live colour-coded nodes (green → amber → red) |
| F2 | Cascade Disruption Simulator (What-If Engine) — select any node, trigger a disruption, visualise downstream cascade |
| F3 | 28-Day Risk Forecast Panel — temporal risk trajectory with seasonal adjustments and alert thresholds |
- Python 3.10+ (3.11 recommended)
- pip and ideally a virtual environment
- 4 GB RAM minimum (CPU training is fine — takes ~2 min)
- GPU optional (CUDA supported automatically)
# If from zip:
unzip hemas_scrg.zip && cd hemas_scrg
# Or if you already have the folder:
cd hemas_scrgpython -m venv venv
# Activate on macOS/Linux:
source venv/bin/activate
# Activate on Windows:
venv\Scripts\activate# CPU-only (recommended for demo)
pip install torch==2.1.0 --index-url https://download.pytorch.org/whl/cpuIf you have CUDA 11.8:
pip install torch==2.1.0 --index-url https://download.pytorch.org/whl/cu118pip install torch-scatter torch-sparse torch-cluster torch-spline-conv \
-f https://data.pyg.org/whl/torch-2.1.0+cpu.html
pip install torch-geometric==2.4.0Note: If the above fails, use the simplified fallback (see Troubleshooting section).
pip install -r requirements.txtpython train.pyThis will:
- Generate 10,000+ synthetic supply chain records across 6 node types
- Build the heterogeneous PyG graph (40 suppliers, 120 SKUs, 8 warehouses, 25 distributors, 200 retailers, 15 external events)
- Train the R-GCN for 150 epochs (~2 minutes on CPU)
- Save the model to
models/ - Print a validation summary
streamlit run frontend/app.pyOpen your browser at http://localhost:8501
uvicorn backend.api:app --reload --host 0.0.0.0 --port 8000API docs at http://localhost:8000/docs
hemas_scrg/
├── data/
│ ├── generate_data.py ← Synthetic dataset generator (10k transactions)
│ ├── suppliers.csv ← Generated: 40 suppliers
│ ├── skus.csv ← Generated: 120 SKUs
│ ├── warehouses.csv ← Generated: 8 warehouses/DCs
│ ├── distributors.csv ← Generated: 25 distributors
│ ├── retailers.csv ← Generated: 200 retailers
│ ├── external_events.csv ← Generated: 15 external risk events
│ ├── transactions.csv ← Generated: 10,000 transactions
│ └── edges.json ← Generated: graph edge definitions
│
├── models/
│ ├── rgcn_model.py ← R-GCN model + Graph builder + Inference engine
│ ├── rgcn_model.pt ← Saved model weights (after training)
│ └── graph.pt ← Saved PyG graph (after training)
│
├── frontend/
│ └── app.py ← Streamlit dashboard (F1, F2, F3)
│
├── backend/
│ └── api.py ← FastAPI REST API
│
├── train.py ← Training entrypoint
├── requirements.txt ← Python dependencies
└── README.md
| Node Type | Count | Key Features |
|---|---|---|
| Supplier | 40 | lead_time, reliability_score, capacity, late_delivery_rate |
| SKU/Product | 120 | demand_velocity, unit_price, margin, shelf_life |
| Warehouse/DC | 8 | stock_level, utilisation, throughput, capacity |
| Distributor | 25 | delivery_sla, order_frequency, coverage_area |
| Retailer | 200 | sales_velocity, channel_type, region |
| External Risk | 15 | severity, risk_impact, event_type |
Supplier ──[produces]──► SKU
SKU ──[stored_at]──► Warehouse
Warehouse ──[dispatches_to]──► Distributor
Distributor ──[delivers_to]──► Retailer
External ──[impacts]──► Supplier
Input Node Features (per type)
│
Linear Projection → hidden_dim=64
│
HeteroConv Layer 1 (SAGEConv + LayerNorm + Residual)
│
HeteroConv Layer 2 (SAGEConv + LayerNorm + Residual)
│
HeteroConv Layer 3 (SAGEConv + LayerNorm + Residual)
│
Risk Head: Linear(64→32) → ReLU → Dropout(0.2) → Linear(32→1) → Sigmoid
│
Risk Score ∈ [0, 1]
| Method | Endpoint | Description |
|---|---|---|
| GET | /nodes |
All nodes with risk scores (filterable) |
| GET | /nodes/{node_id} |
Single node detail |
| GET | /graph/summary |
Risk summary by node type |
| GET | /graph/edges |
Graph edge list |
| POST | /simulate/cascade |
Run What-If cascade simulation |
| POST | /forecast |
28-day risk forecast |
| GET | /alerts |
Nodes above risk threshold |
| GET | /network/health |
Overall network health |
Use the fallback lightweight mode — replace the imports in models/rgcn_model.py:
pip install torch-geometric --no-deps
pip install torch-scatter torch-sparse --no-build-isolationOr use the simpler pip install:
pip install pyg-lib -f https://data.pyg.org/whl/torch-2.1.0+cpu.htmlpip install torch_geometric
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv \
-f https://data.pyg.org/whl/torch-2.1.0+cpu.htmlpip install --upgrade streamlit
streamlit run frontend/app.py --server.port 8502Reduce the dataset size in data/generate_data.py:
N_RETAILERS = 100 # from 200
N_TRANSACTIONS = 5000 # from 10000python train.py --retrain --epochs 200| Layer | Technology |
|---|---|
| GNN Framework | PyTorch Geometric (PyG) — R-GCN/HeteroConv |
| Graph Construction | NetworkX, PyG HeteroData |
| Data Processing | Python, Pandas, NumPy, scikit-learn |
| Backend API | FastAPI + Uvicorn |
| Dashboard | Streamlit + Plotly |
| Version Control | Git / GitHub |
HemasSCRG — Team Dream4 · AITHON 2026 · University of Moratuwa