Back to Features

Production Notes

Unchained

Medical supply chain disruption forecasting

2026

Synopsis

Unchained is a full-stack prototype that explores how disruptions ripple through a medical supply chain. The project combines an interactive map-based React frontend using deck.gl with a PyTorch Geometric modeling pipeline that trains LifelineGNN, a spatiotemporal graph neural network to forecast hospital supply.

The Problem

Understanding how isolated supply shocks (e.g., at a manufacturer or port) cascade down to hospital inventory levels is incredibly complex. A tool was needed to not only predict these downstream shortages but also visually communicate the network health and critical threshold alerts to stakeholders.

Starring

Next.js 16React 19deck.glMapboxPyTorchPyTorch GeometricNetworkXPython

Production Challenges

Spatiotemporal Graph Modeling

Building LifelineGNN to process both the static 500-node graph topology and dynamic 14-day sliding window sequences containing shock indicators and inventory levels.

Physics-Informed Loss Functions

Implementing a custom physics loss component that enforces conservation of inventory across transit days, preventing the model from predicting physically impossible inventory changes.

Interactive 3D Visualization

Animating the 365-day disruption scenario across the entire network in real-time on a map using deck.gl, synchronizing node states, severed edges, and hospital line charts.

Production Design

The repository is split into two halves. The Next.js frontend runs the interactive deck.gl / Mapbox visualization, importing graph topology and pre-computed forecast JSONs to animate disruption scenarios and hospital impacts. The Python backend (MODEL_CODE) handles the machine learning pipeline, where synthetic scenario data is transformed into node feature tensors (shock indicators & inventory levels) across 14-day sliding windows. The LifelineGNN model—built with PyTorch Geometric—is trained to predict inventory residuals (deltas) simultaneously across all 500 nodes. During training, a physics loss penalty dynamically scales via cosine annealing to ensure the predictions obey real-world transit delays and conservation rules.