How khp-informatics/patient-flow-simulator works
Patient Flow Simulator is a standalone teaching web application for configuring and running a simulated hospital, then examining patient waits, ward occupancy, resource use and transfer-network bottlenecks. The principal workflow is management configuration and run controls → patient generation and ward-based simulation → performance history and analysis. The README also documents repeatable preset-patient experiments and saving/loading configurations. The sampled source shows the simulation controller and core model; some UI wiring and analysis implementations are represented by the documented capabilities and their source paths.
Main entry points: interactive_simulation.js Simulation loop · index.html Results dashboard · Simulation.js Ward and queues · plot.js Performance charts
Components 17
Hospital setup
- Ward definitions
src/config - Pool and Exit
src/config/virtual_wards.js - Patient scenarios
src/config - Run settings
src/config
Simulation engine
- Simulation loop
src/interactive_simulation.js - Patient model
src/Simulation.js - Ward and queues
src/Simulation.js - Patient generation
src/Simulation.js - Priority queue
src/lib/FastPriorityQueue.js
Performance analysis
- Simulation history
src/interactive_simulation.js - Wait and score metrics
src/Simulation.js - Performance charts
src/plot.js - Transfer network analysis
src/graph.js
User controls
- Run and configure
src/interactive_simulation.js - Saved configurations
src/interactive_simulation.js - Results dashboard
index.html
Other components
- Hospital manager
Connections 21
- Hospital manager → Run and configure: sets options
- Run and configure → Ward definitions: edits wards
- Run and configure → Patient scenarios: selects patients
- Run and configure → Run settings: sets run mode
- Run and configure → Simulation loop: starts or pauses
- Simulation loop → Patient generation: requests arrivals
- Patient generation → Patient model: creates patients
- Simulation loop → Ward and queues: admits and transfers
- Simulation loop → Pool and Exit: initializes wards
- Simulation loop → Ward definitions: initializes wards
- Ward and queues → Priority queue: orders queues
- Simulation loop → Simulation history: records runs
- Simulation loop → Wait and score metrics: summarizes patients
- Simulation loop → Performance charts: plots results
- Simulation loop → Transfer network analysis: builds transfer graph
- Simulation history → Results dashboard: shows history
- Performance charts → Results dashboard: renders charts
- Transfer network analysis → Results dashboard: shows network analysis
- Wait and score metrics → Results dashboard: shows performance
- Run and configure → Saved configurations: imports or exports
- Hospital manager → Results dashboard: reviews results