Model radiation oncology workflows before changing them in the clinic.
Radonc Workflow Sim lets users build a visual process map, assign staffing and capacity assumptions, configure routing and rework, simulate patient flow, and identify queues, delays, utilization problems, and operational bottlenecks using synthetic data.
Demonstration placeholder
Insert a short GIF here showing a workflow graph on the canvas, a simulation run with animated patient tokens, and the bottleneck / utilization summary. Do not commit a fabricated image.
This local React + TypeScript application (radonc-bottleneck-sim) builds and edits the workflow directly on a tldraw canvas as a directed graph of stages and paths. A deterministic simulation engine routes patients through that graph and replays the run as animated patient tokens.
This is a planning and operations simulation tool only. The defaults in this repo are configurable starting assumptions, not universal clinical truths.
- The canvas is the source of truth for the workflow: add, remove, connect, and configure stages as custom node shapes
- Each stage node exposes its capacity (units × FTE × hours/day), service time, due date, complexity scaling, and complexity restrictions
- Paths between stages carry a % open routing weight — patients leaving a stage pick among open paths proportionally (a 50% path gets half the flow of a 100% path) — and optional complexity restrictions
- Splitting a stage across multiple nodes (e.g. two planner teams) and weighting paths models partial FTE staffing
- Rework loops are backward paths with low % open
- A Patient Arrivals circle node sets the arrival rate and is where animated tokens enter; a Treatment node books fraction courses against linac capacity
- Simulated runs replay on the canvas: queues stack above each stage, in-service tokens sit inside nodes, overdue work is ring-highlighted, with play/pause, replay, speed, and scrubbing
- Tracks throughput, cycle times, waits, overdue rates, utilization, WIP, machine occupancy, and a bottleneck ranking per stage
npm installnpm run devnpm run buildnpm testnpm run lint
src/
app/ React shell, scenario panel, playback controls, summary
model/ domain types, default graph scenario
simulation/ seeded RNG, patient generation, graph routing engine, scheduler, metrics
analysis/ Little's Law, capacity math, playback frame computation
nodes/ custom tldraw node shapes (start / stage / treatment)
ports/ port rendering and pointer interactions
connection/ connection shape, bindings, insert-on-connection
components/ toolbar, on-canvas picker, connection edit panel
tldraw/ canvas seed/extract commands, playback projection, token shape
tests/ vitest coverage
- On first load the default referral-to-treatment workflow is seeded onto the canvas.
- Edit the graph: drag from a node's right port to draw a path, click a path to set % open and allowed plan types, edit capacity numbers on nodes, add stages from the toolbar or by dropping them into a connection.
- Run simulation extracts the graph from the canvas, simulates it deterministically with the configured seed, and replays the result as animated tokens.
The repo is intended to validate locally with:
npm run buildnpm testnpm run lint
If dependency installation is required, run npm install first.
This software is provided for research, education, and development. It is not a medical device and has not been validated for clinical decision-making.
Users are responsible for independent code review, testing, commissioning, verification of calculations and outputs, and compliance with applicable institutional policies before using any portion of the software in a clinical environment.
No patient information or protected health information is included in this repository. Examples and test data are synthetic or de-identified unless explicitly documented otherwise.
MIT — see LICENSE.md.
The interactive node/port/connection canvas machinery is adapted from the tldraw workflow starter template (MIT, © tldraw Inc.). This project is a simulation and planning tool only; it is not a medical device and must not be connected to clinical systems.