IS Isabel Smith ← Back to projects
Project

Ward CGM simulator

A hospital ward you can actually walk around, built to ask one question: does continuous glucose monitoring with telemetry help a nurse find deteriorating patients sooner than routine monitoring would - and what does it cost the rest of the shift?

Academic model - not clinical decision support. Every threshold and treatment pathway below is a simplified, configurable placeholder. It must not be used to inform patient care. What that means

--:--
-Beds
-Free
-Queue
-Enrolled
-Staff
-Return

Waiting for the simulator to start...

What these mean
Clock and step - the shift runs 08:00 to 20:00 as 144 five-minute steps.
Beds - how many of the 32 are occupied.
Free - beds available for the next admission.
Queue - patients waiting outside for a bed.
Enrolled - patients currently on CGM telemetry.
Staff - how stretched the ward is. You cannot see which individual colleague is free without asking.
Return - the running reward total for the shift. A training signal, not a clinical score.
Alarms - only those you have actually seen on the board. Press M, or stand at the nurse station.

Academic model - not clinical decision support.

Give it a few seconds, then press the green button. Best on a desktop or laptop with a keyboard. Open full screen Source code

Academic model - not clinical decision support

Every treatment pathway, threshold and timing in this simulator is a simplified, configurable, guideline-inspired placeholder chosen to make the model behave plausibly. None of it is prescribing guidance or bedside instruction, and it must not be used to inform real patient care.

What you are looking at

You are the nurse or shift coordinator on a 32-bed mixed medical and surgical ward. One shift is twelve hours; every decision takes five minutes. A telemetry dashboard at the nurse station shows glucose for the patients wearing a sensor - when the sensor is working, which is not always, and it does not announce when it stops.

Meanwhile there are patients to assess for the monitoring programme, notes to read, consent to seek, discharges to chase, and an admissions queue building behind you. The interesting part is not any single decision; it is what you stop doing in order to do it.

Partially observable by design

Insulin regimen, capacity to consent, true glucose, whether a colleague is free - none of it is visible until you spend a step finding out. Even the glucose readings are a snapshot from the last time you checked the board, and they go stale.

The sensor is not the truth

Readings lag, drift and occasionally spike. A capillary test is the reference, and clinically significant alarms are meant to be confirmed before anyone is treated.

Silence is a failure mode

When a sensor drops out it raises no alarm at all. The only cue is data that stopped arriving - which somebody has to notice.

Safety first, then flow

The reward function is deliberately lopsided. Preventing harm is worth an order of magnitude more than tidy paperwork or a short queue.

What happens at the end of a shift

The shift is 144 steps of five minutes - twelve hours. At step 144 it ends, the panel says shift complete, and any key starts a fresh one on a new random seed. A shift can also end early, in one of two ways: the ward becomes unsafely overcrowded, or a patient comes to serious harm. The headline measure the model exists to report is the proportion of shifts that finish without one.

Is it a trained AI?

No - and it is worth being precise about that. What you are watching is a hand-written rule-based nurse: a fixed set of priorities - answer alarms, confirm with a capillary test, treat, escalate, keep beds moving. It reacts to what it can see, but it has not learned anything.

What the project actually provides is the environment: a Gymnasium-compatible partially observable Markov decision process that a reinforcement-learning agent can be trained against. The repository ships a worked PPO training script, but no trained policy - training runs are research work, not part of this demo. The rule-based nurse exists to be a fair, transparent comparator, not to be good at the job.

Nor is the outcome pre-determined. Every shift is a fresh draw: arrivals, physiology, sensor faults and staff availability are all stochastic. Re-running the same seed replays a shift exactly, which is what makes the telemetry-versus-routine comparison a matched one - but you cannot know in advance how a given shift will go.

The experiment

The comparison built into the model is telemetry versus routine monitoring, not telemetry versus nothing. Every patient still receives routine capillary rounds and symptom recognition; monitoring is additive. The question is whether the alarm gets there first, and by how much it changes the shift.

Both arms run on matched random seeds, so they simulate the same ward. The measures are:

  • Primary - how long a patient spends below range before anybody knows.
  • Safety - severe hypoglycaemia events, serious adverse events, and shifts completed without incident.
  • Burden - how many alarms fired, and how many of them were nuisance.
  • Flow - discharge delay, admissions queue, time spent overcrowded.

What it currently shows

Across 60 matched shifts, among the patients actually wearing a sensor, about two thirds of hypoglycaemic episodes were picked up with telemetry against about a third without. That difference holds up. The apparent halving of detection time does not - only ten episodes were ever found in the comparator arm, and the uncertainty around that figure is far too wide to claim anything from it.

Reporting both is the point. It would have been easy, and wrong, to quote the timing on its own.

Measured across the whole ward, that difference nearly disappears - and that is the more interesting result. Only about one patient in seven meets the eligibility criteria, so a large improvement for a small group barely moves a ward-level average. A real study would need to be powered for the monitored cohort, and would have to decide whether a ward-level effect is the right thing to look for at all.

It is a simulation of a workflow model, so it cannot demonstrate clinical benefit. What it can do is show whether a mechanism plausibly produces one, and which assumptions that conclusion rests on - which is the useful thing to know before designing a real study.

Context

Built alongside an MRes in Clinical Research at Imperial College London, on the diabetes and obesity pathway. The full formal specification - the POMDP definition, observation and action spaces, transition dynamics and reward weights - is in the repository under docs/POMDP.md.