2026-11-12 20:07:35 +01:00
# Patient Monitor Simulation (PaMSim) — v0.6.4
2026-11-12 09:36:13 +01:00
2026-11-12 16:10:57 +01:00
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
2026-11-12 09:36:13 +01:00
> **Synthetic training signals only — not for clinical use.** ECG, arterial pressure,
> plethysmography and capnography are schematic mathematical approximations. The
> simulation has no clinical validation and is not a medical device.
2026-11-12 16:02:08 +01:00
## Monitor layout (v0.5.7)
The monitor uses a fixed **3:1 column ratio ** over the drawable area:
**75% waveform column / 25% numeric column**, regardless of window size.
The last row is reserved for four equal-width numerical measurement groups:
| Group 1 (25%) | Group 2 (25%) | Group 3 (25%) | Group 4 (25%) |
| --- | --- | --- | --- |
| CO / CI | SVRI · GEDI · ELWI | * (empty) * | NIBP |
The first two groups currently display only their headings, with no numerical
values or simulation logic. The third group is completely empty. The fourth
retains the existing red NIBP readings, cuff gauge, progress bar and alarms.
The NIBP visibility toggle hides **only the fourth group's content ** ; the
bottom measurement row and other three groups remain present. Disabling one
of the four waveform channels still reflows the remaining rows above it.
2026-11-12 20:07:35 +01:00
## Monitor touchscreen: alarm limits and NIBP controls (v0.6.4)
2026-11-12 19:08:11 +01:00
Tap or click the **waveform or numerical readout ** of ECG, SpO₂, ART or CO₂
to open that channel's alarm-limit panel. For NIBP, tap the **rightmost
quarter of the bottom measurement row**. The other three bottom-row groups
are reserved for future measurements and remain non-interactive. The panels
are available in fullscreen and retain a **black background, very light-grey
text, and 0.8-pixel borders and dividers**, in the style of the main monitor.
2026-11-12 20:07:35 +01:00
**Alarm thresholds can be modified from every monitor-side menu.**
2026-11-12 19:08:11 +01:00
No keyboard is required: every lower/upper limit has large * * − / +** controls
with a parameter-specific increment and an independent **ON/OFF ** control.
Unset limits remain disabled. The lower limit cannot exceed the upper limit.
| Touch area | Available alarm limits | Increment |
2026-11-12 16:40:51 +01:00
| --- | --- | --- |
2026-11-12 19:08:11 +01:00
| ECG | HR | 5 bpm |
| SpO₂ | SpO₂; pulse rate (PR) | 1% SpO₂; 5 bpm PR |
| ART | SYS; MAP; DIA; PPV | 5 mmHg pressure; 1% PPV |
| CO₂ | EtCO₂; respiratory rate (RR) | 1 mmHg EtCO₂; 1 breath/min RR |
| NIBP | SYS; MAP; DIA | 5 mmHg |
**Apply** commits the threshold changes and synchronizes the Admin window.
Changing a threshold sets the alarm preset to **Custom ** . **Cancel ** or
**Esc** discards the draft changes.
2026-11-12 20:07:35 +01:00
**NIBP is the exception:** its monitor-side menu additionally provides **Measure now ** ,
**Automatic measurement ON/OFF**, and the **1/3/5/10/20/30/60-minute interval ** .
Interval and Auto changes take effect with **Apply ** (or are discarded with
Cancel/Esc); **Measure now starts immediately ** , even with Auto OFF and before
Apply. The touch controls synchronize with Admin. A measurement already in
progress is not restarted. The simulated failure option and cuff placement
remain Admin-only, as do ECG lead, SpO₂ sensor/quality and waveform choices.
2026-11-12 16:40:51 +01:00
### NIBP startup and automatic measurements
2026-11-12 19:08:11 +01:00
**Auto measurement is OFF by default.** On startup the monitor shows
`---/---` (MAP `---` ) and no measurement is initiated. To obtain a reading,
2026-11-12 20:07:35 +01:00
select **Measure now ** in the NIBP monitor menu (or in Admin), or enable
**Automatic NIBP measurement** via the menu (or Admin). The first automatic cycle begins immediately after enabling Auto;
2026-11-12 19:08:11 +01:00
subsequent measurement intervals count from completion of the prior cycle.
Disabling Auto stops further scheduled measurements without interrupting a
cycle already in progress. Manual measurement remains possible while Auto
is off. The interval bar is empty and the monitor displays `AUTO OFF`
whenever automatic measurements are disabled.
2026-11-12 16:10:57 +01:00
2026-11-12 19:31:05 +01:00
### Horizontal touchscreen alarm matrix (v0.6.3)
All five monitor touch menus now share a compact horizontal alarm-limit matrix.
Each parameter occupies its own row (for ART: **SYS ** , **MAP ** , **DIA ** ,
**PPV**), with * * ↓ Lower** and * * ↑ Upper** displayed in adjacent columns.
Within each limit cell, the touch controls are ordered * * + · value · − ·
OFF/ON** (the OFF/ON button is immediately right of minus). The original
large button styling, per-parameter increments, last-value restoration,
optional bounds and Apply/Cancel semantics are unchanged. The matrix scrolls
if necessary while Apply and Cancel remain accessible below it. Other
2026-11-12 20:07:35 +01:00
physiological controls remain Admin-only, except for the three explicitly
requested NIBP measurement controls.
2026-11-12 19:31:05 +01:00
2026-11-12 15:11:04 +01:00
## Chest compressions (v0.5.4)
The **Chest compressions ** Admin group provides a large **Start Chest Compressions **
button (green background). While active it changes to **Stop Chest Compressions **
(red background). **Compression quality ** can be changed at any time:
**Good**, **Adequate ** (default), **Poor ** , or **Bad ** .
- Compressions are generated independently of the ECG at **90– 110/min ** , with
a new reproducible pseudo-random compression rate and pressure each stroke.
**The ECG rhythm and electrical HR setting are not changed. **
- Every compression adds movement artifact to the ECG. In a patient with
**existing intrinsic arterial perfusion ** , the native arterial waveform is
preserved but distorted by compression-synchronous pressure artifact.
- With **no intrinsic arterial pulse ** (e.g., VF, PVT, asystole or PEA),
each effective compression generates a broad, blunt arterial pressure wave:
| Compression quality | Compression-generated ART systolic peak |
| --- | --- |
| Good | 90 mmHg ±10% (81– 99 mmHg) |
| Adequate (default) | 70 mmHg ±10% (63– 77 mmHg) |
| Poor | 50 mmHg, +10% / − 50% (25– 55 mmHg) |
| Bad | No compression-generated arterial pressure; 0– 5 mmHg baseline drift |
During pulseless CPR, **ART SYS ** shows the current compression peak,
while **DIA/MAP ** remain `--` (not estimable from this synthetic pressure).
- SpO₂ numeric saturation and the pleth waveform remain visible **only when
compression quality is Good**, provided the sensor is connected and not
occluded by an NIBP cuff. Their effective signal quality is forced to
**Poor (★) ** , irrespective of the normal Admin quality setting. The displayed
pleth-derived **PR follows the compression rate (90– 110/min) ** , not the ECG.
Adequate, Poor and Bad CPR display **NO READING ** ; detached sensors display
**NO SENSOR ** . Compression-induced Poor quality does not schedule the usual
intermittent dropout; that resumes when ordinary Poor signal mode returns.
- Existing numerical alarms and rhythm alarms remain active. ART SYS limits
apply to compression-generated systolic peaks; NIBP scheduling remains unchanged; its cycle duration still depends on
effective SpO₂ quality at the start of a measurement.
These pressure targets are **didactic assumptions ** , not validated CPR
hemodynamic criteria. The exercise must not be used to judge real compression
quality or clinical perfusion.
2026-11-12 09:36:13 +01:00
## Build and run on Fedora
```bash
2026-11-12 14:34:31 +01:00
sudo dnf install rust cargo gcc pkgconf-pkg-config gtk4-devel pipewire-utils
2026-11-12 09:36:13 +01:00
cargo test
cargo run --release
```
Run these commands from the extracted `patient-monitor-simulation` folder.
Window titles show the application version. GTK4 requires a functional graphical
session (e.g., Fedora KDE/Wayland).
## Windows
2026-11-12 12:47:47 +01:00
**Admin sections** have a narrow colored stripe on their left edge to match the
monitor: ECG **green ** , SpO₂ **yellow ** , invasive arterial pressure **red ** ,
2026-11-12 14:07:59 +01:00
capnography **light grey ** , NIBP **red ** . The Patient section remains
2026-11-12 12:47:47 +01:00
neutral. These accents are drawn by GTK and remain visible independently of
light/dark themes. This is a visual-only change; control behavior is unchanged.
2026-11-12 10:43:11 +01:00
**Admin:** Controls patient name; ECG rhythm and rate; mechanical capture;
SpO₂, signal quality and sensor connection; invasive arterial pressure,
waveform shape and pulse-pressure variation; NIBP; and capnography. Numeric inputs have bidirectionally linked sliders and text fields.
2026-11-12 09:36:13 +01:00
Each of the five monitor parameters (ECG, SpO₂/pleth, ART, CO₂, NIBP) has its
own **Show on monitor ** checkbox.
**Monitor:** Black background; ECG green, pleth yellow, ART red and capnogram
2026-11-12 10:43:11 +01:00
light grey. The patient name entered in Admin replaces **PATIENT MONITOR ** in
the header immediately; leaving the name blank restores the generic title.
Long names are automatically resized or clipped to fit the header.
Waveforms and vital signs disappear together when their respective
2026-11-12 09:36:13 +01:00
visibility checkbox is cleared. Remaining waveform rows expand to use the space.
Hiding a display channel does **not ** stop signal generation or physiological
2026-11-12 16:02:08 +01:00
coupling: for example, hiding ECG does not stop ART or pleth pulses.
The final row is split into four equal-width measurement groups, with **NIBP in
the fourth group**, aligned beneath the regular numeric column. The first
three groups are reserved for future measurements. Hiding NIBP only clears
its own fourth group, without removing the final row.
2026-11-12 09:36:13 +01:00
The monitor can be resized and toggled fullscreen with **F11 ** ; **Esc ** exits
fullscreen. On Wayland, move the monitor to the presentation screen before
activating fullscreen. Fullscreen does not lock down the computer.
2026-11-12 14:34:31 +01:00
## Audible alarms (v0.5.3)
Sound is **enabled by default ** . The Admin window has an **Audible alarms **
checkbox for muting and a **Test tone ** button (works even while muted).
Visual alarms keep blinking normally when sound is off.
- **Critical rhythm alarm:** VT, PVT, VF and asystole produce a double beep
(two short 880 Hz tones), repeated approximately every 1.5 seconds.
- **Numerical and SpO₂ technical alarms:** out-of-range values, **NO SENSOR **
and **NO READING ** produce a single 700 Hz beep, repeated approximately
every 2.5 seconds.
- Critical alarms have priority: only one tone pattern is played even if
multiple alarms are active. The sound stops when all alarms clear or when
the checkbox is unchecked. Alarms on hidden monitor channels are excluded.
- Values not yet available (e.g. NIBP before a completed measurement) do not
trigger numerical limit alarms. The cuff measurement cycle by itself is not
an alarm. Audio playback is separate from waveform rendering and simulation.
On Fedora, sound is played through * * `pw-play` ** from `pipewire-utils` , with
**`paplay` ** as a fallback. No additional Rust crates or sound files are needed:
the application creates its own short WAV tones at runtime. If neither player
is installed, Admin reports that audio is unavailable; the monitor continues
to work normally. `Test tone` helps verify the desktop audio output. The
application uses the system output device and mixer volume.
**Important:** These simple teaching tones do not comply with medical-device
alarm standards (including IEC 60601-1-8) and must never be relied on for
clinical monitoring.
2026-11-12 11:47:38 +01:00
## Numerical alarm limits (v0.4.0; layout and presets updated in v0.4.1)
2026-11-12 11:30:50 +01:00
Each displayed numeric measurement has an **independent optional lower (↓) and
2026-11-12 11:47:38 +01:00
upper (↑) alarm threshold** in the corresponding Admin section. The lower
and upper entries are placed **in the same row as the corresponding slider ** .
Derived values with no separate slider (PR, ART MAP, NIBP MAP) have their own
compact alarm rows. The Admin window opens wider to accommodate these controls.
Alarm fields are text inputs; leave a field **blank ** (displayed as `off` ) to disable just
2026-11-12 11:30:50 +01:00
that threshold. With both fields blank, the whole numeric alarm is disabled.
The value may equal either limit without triggering an alarm; only readings
strictly below/above the respective threshold are out of range. If both limits
are present, the lower limit must not exceed the upper limit. Invalid input is
highlighted and the last valid configuration stays active.
| Monitor section | Independently configurable alarms |
| --- | --- |
| ECG | HR |
| SpO₂ | Oxygen saturation (SpO₂), derived pulse rate (PR) |
| Invasive arterial pressure (ART) | Systolic (SYS), mean (MAP), diastolic (DIA), PPV |
| NIBP | Systolic (SYS), mean (MAP), diastolic (DIA) |
| Capnography | End-tidal CO₂ (EtCO₂), respiratory rate (RR) |
The current limits are displayed in small type at the **upper-right corner ** of
each channel, with an arrow for the corresponding direction. A disabled
boundary is displayed as `---` . For instance:
```text
2026-11-12 11:47:38 +01:00
⚠ SYS ↓80 ↑180
MAP ↓60 ↑---
DIA ↓--- ↑---
2026-11-12 11:30:50 +01:00
```
2026-11-12 11:47:38 +01:00
### Alert presets
The **Alert presets ** dropdown at the top of Admin offers **Custom ** (manual)
and **Adult ** . Choosing **Adult ** immediately sets all alarm limits and updates
the lower/upper text fields alongside the sliders. It changes * only * alarm limits:
it does not change heart rate, blood pressure, channel visibility or any other
simulated physiological setting. Editing any alarm field after applying Adult
switches the selector to **Custom ** without changing other alarm limits. Select
**Adult** again to reapply the complete preset.
| Parameter | Lower | Upper |
| --- | ---: | ---: |
| HR (bpm) | 60 | 100 |
| SpO₂ (%) | 90 | --- |
| PR (bpm) | --- | --- |
| ART SYS (mmHg) | 80 | 180 |
| ART MAP (mmHg) | 60 | 100 |
| ART DIA (mmHg) | --- | --- |
| PPV (%) | --- | 10 |
| NIBP SYS (mmHg) | 80 | 180 |
| NIBP MAP (mmHg) | 60 | 100 |
| NIBP DIA (mmHg) | --- | --- |
| EtCO₂ (mmHg) | 30 | 50 |
| RR (/min) | 10 | 20 |
`---` denotes a disabled threshold. Adult is a **teaching convenience preset ** ,
not a clinically validated set of alarm limits. Initially the selector is
**Custom**, with all limits disabled (as in v0.4.0).
2026-11-12 11:30:50 +01:00
When a number violates a configured limit, **that number flashes by inverting
its foreground and background colors** (500 ms inverted / 500 ms normal).
Each pressure component (SYS, DIA, MAP) and the PPV reading flash independently. The waveform
itself remains unchanged. All alarms are **disabled by default ** so old
scenarios do not unexpectedly flash.
Numerical threshold alarms only evaluate actual displayed measurements:
`--` , `NO SENSOR` , and other unavailable readings do not trigger low-value
alarms. ECG-derived PR and signal visibility continue to work as in v0.3.2.
Alarms are presentation-only: there is **no audible alarm, alarm latching,
priority classification or clinical alarm validation**. Instructor settings
are held in memory and reset on restart.
2026-11-12 10:43:11 +01:00
## Patient name and pulse oximeter signal state (new in v0.3.2)
The new **Patient name ** text field at the top of Admin immediately replaces the
monitor headline. It is optional; an empty or whitespace-only name displays
**PATIENT MONITOR**. This is a local teaching label, not a patient record.
Admin → **Pulse oximetry ** has two additional controls:
- **Sensor not attached** (checkbox): immediately removes the pleth waveform,
suppresses SpO₂ and pulse-rate readings, and displays **NO SENSOR ** instead
of the numeric saturation. This takes precedence over signal quality.
- **Signal quality** (dropdown), which changes the visible pleth waveform and
quality indicator, independently of the instructor-set SpO₂ percentage:
| Setting | Pleth waveform | Monitor display |
| --- | --- | --- |
2026-11-12 12:08:46 +01:00
| **0 — None ** | No waveform | Flashing **NO READING ** , PR `--` ; no stars |
2026-11-12 12:30:54 +01:00
| **1 — Poor ** | Small, irregularly distorted pulse, with temporary losses of signal | 1 star (★) when available; blinking **NO READING ** during loss |
2026-11-12 10:43:11 +01:00
| **2 — Adequate ** | Medium, smoothly damped pulse | 2 stars (★★) |
| **3 — Good ** | Full nominal, smoothly damped pulse | 3 stars (★★★) |
Default: sensor attached; signal quality **3 — Good ** . At levels 1– 3, the
instructor-set SpO₂ number is shown only when mechanical pulses are detected.
2026-11-12 12:30:54 +01:00
In **Poor ** quality, the signal also has intermittent complete dropouts:
**30– 180 seconds of signal** between interruptions, with each interruption
lasting **5– 20 seconds ** . During an interruption the pleth trace disappears,
SpO₂ and PR are unavailable, and **NO READING ** flashes. Following recovery,
the Poor waveform and numerical readings return automatically. These intervals
are pseudo-random and driven by simulation time, independent of frame rate;
they reset when Poor quality is selected again. The dropout does not affect
the actual saturation setting, ECG, derived mechanical pulse generation, or ART.
The simulated pulse rate remains derived from captured QRS complexes.
2026-11-12 10:43:11 +01:00
The degraded waveform uses deterministic, smoothly interpolated pseudo-noise
that scales only existing pleth pulses: it cannot manufacture pulses during
2026-11-12 12:08:46 +01:00
PEA, PVT, ventricular fibrillation or asystole. Unplugging a sensor or selecting
2026-11-12 10:43:11 +01:00
quality 0 hides even previously buffered pleth samples immediately. ECG and
ART continue unaffected. The **Show on monitor ** checkbox still hides the
entire SpO₂ row; sensor/quality controls leave the row visible so the status
can be taught.
2026-11-12 14:07:59 +01:00
## NIBP measurement cycle (v0.5.0)
NIBP is **red ** , with a dedicated value box in the **right-hand numeric column ** .
2026-11-12 16:02:08 +01:00
The bottom measurement row has three placeholder groups to its left, keeping
NIBP aligned with the standard right-hand numeric column. The previous static
2026-11-12 14:10:46 +01:00
NIBP footer has been removed. In Admin, choose an interval
2026-11-12 16:40:51 +01:00
of **1, 3, 5, 10, 20, 30, or 60 minutes ** (default 5).
**Auto measurement is disabled at startup**, so no reading is shown and no
measurement starts until the instructor activates Auto or selects **Measure now ** .
When enabled, the first automatic measurement starts immediately; subsequent
intervals run **from the end of the last measurement ** , not from its beginning.
**Measure now** starts a cycle even when Auto is OFF, if none is in progress. The small **horizontal progress bar **
2026-11-12 14:07:59 +01:00
shows the fraction of the waiting interval elapsed; a **vertical 0– 200 mmHg
gauge** shows the current cuff pressure during measurement.
The duration and success are determined by the signal quality **at the start
of the cycle** (including an absent sensor or an ongoing Poor-signal dropout).
Changing quality while a cycle is running does not retroactively change its
planned duration:
| Starting SpO₂ quality | Cycle duration | Result |
| --- | --- | --- |
| Good (★★★) | 20 s | Measured |
| Adequate (★★) | 40 s | Measured |
| Poor (★) | Randomly 60– 120 s | Simulated 65% chance of a reading |
| None / no sensor | 120 s | No reading |
| **No reading ** checkbox | 120 s | No reading, regardless of quality |
The cuff inflates to **200 mmHg ** then deflates. When the starting signal is
Poor or None, it deflates to about **67 mmHg ** , reinflates to about **133 mmHg ** ,
and finally deflates to zero. At the end, the completed value becomes visible
and **blinks five times by appearing/disappearing ** (without the inverted-color
alarm effect). If the cycle fails, the displayed reading is `---/---` , with
MAP `---` . Previous NIBP values remain visible while the next cuff cycle is
in progress, until the new reading is available.
The **first successful ** measurement uses the initial NIBP SYS/DIA values from
Admin. Subsequent successful values derive from the current invasive arterial
SYS/DIA settings using independently sampled percentage deviations:
| Starting quality | Deviation relative to IBP |
| --- | --- |
| Good | − 5% to +5% |
| Adequate | − 10% to +5% |
| Poor | − 15% to − 5%, if a reading succeeds |
| None | No reading |
Optional **Cuff on SpO₂ extremity ** changes the * effective * pulse-oximeter
quality while the cuff is inflated: above invasive systolic pressure = None;
between invasive systolic and diastolic pressure = Poor; below invasive
diastolic pressure = the configured quality. The quality never becomes better
than the instructor's setting. **NO READING ** , missing pleth waveform and
restoration of the waveform are handled as before.
Optional **Cuff on ART extremity ** modifies the simulated arterial transducer
trace during cuff inflation: above invasive SYS it freezes at the last measured
pressure; between invasive SYS and DIA it pulsates between the cuff pressure
and the currently available NIBP SYS reference; below invasive DIA it returns
to the normal arterial waveform. The ART numerical SYS/DIA/MAP values also
reflect this altered trace. With absent mechanical cardiac capture, the
previous pulseless 0– 5 mmHg simulation is retained and no artificial pulses
are introduced. Both cuff-interference options are off by default.
These cuff and SpO₂ interactions are **deliberately simplified training
artifacts**; they should not be interpreted as validated cuff oscillometry.
2026-11-12 09:36:13 +01:00
## ECG and mechanical coupling
2026-11-12 12:08:46 +01:00
- ECG rhythms: sinus, atrial fibrillation, monomorphic ventricular tachycardia
(potentially perfusing), pulseless ventricular tachycardia (PVT),
2026-11-12 09:36:13 +01:00
ventricular fibrillation and asystole.
- Mechanical capture: **1:1 ** , **2:1 ** , **3:1 ** , **None (PEA) ** , or deterministic
pseudo-random capture (~65%). PR is derived from conducted QRS events, never
controlled by a pulse-rate slider.
- A captured QRS leads to an ART upstroke after a schematic **120 ms ** , and a
peripheral pleth pulse after **300 ms ** . Pleth is strongly damped/filtered.
2026-11-12 12:30:54 +01:00
- VT and PVT selections start with a heart rate of **160 bpm ** , and update
both the HR slider and numeric entry. The instructor may modify this afterward.
2026-11-12 12:08:46 +01:00
- PVT, VF, asystole and PEA suppress mechanical pulses; the ART trace then
drifts smoothly at 0– 5 mmHg rather than representing a pulsatile pressure.
2026-11-12 12:30:54 +01:00
The ART **SYS ** number shows the rounded low transducer pressure (0– 5 mmHg),
while DIA and MAP show `--` because they cannot be reliably estimated.
2026-11-12 14:07:59 +01:00
Previous pressure samples scroll out of view. NIBP follows a separate,
time-based simulated cuff-measurement cycle.
2026-11-12 09:36:13 +01:00
## Invasive arterial pressure and PPV (new in v0.3)
The arterial waveform has a fixed **0– 200 mmHg ** display axis, with tick marks
at **0, 50, 100, 150 and 200 mmHg ** . Nominal ART systolic and diastolic inputs
are limited to 0– 200 mmHg.
**Pulse pressure variation (PPV)** is adjustable from **0% to 60% ** , in 1%
increments, via synchronized slider and text field (Admin → Invasive arterial
blood pressure). Its default is **0% ** (no respiratory modulation). The
respiratory cycle comes from the same respiratory-rate parameter as the
capnogram. **RR = 0 ** disables the respiratory modulation (apnea).
The synthetic PPV definition is:
```text
PPV (%) = 100 × (PPmax − PPmin) / ((PPmax + PPmin) / 2)
```
The model applies a sinusoidal variation to **pulse pressure ** , sampled for
each mechanically conducted beat. The diastolic baseline remains nominally
fixed, so this is primarily a **beat-to-beat systolic swing ** , not an arbitrary
vertical translation of the entire arterial trace. It does not affect ECG,
mechanical capture or pleth amplitude. This is a visual teaching model, not a
validated predictor of fluid responsiveness.
**Example:** ART 120/75 mmHg has nominal pulse pressure 45 mmHg. At PPV 20%,
the ideal pulse-pressure extrema are 40.5 and 49.5 mmHg, corresponding to
systolic peaks of approximately 115.5 and 124.5 mmHg (assuming the diastolic
baseline stays at 75 mmHg). The rendered waveform shape and finite number of
beats per respiratory cycle mean the visible maxima may not reach the ideal
extrema exactly.
The ART sidebar displays the **nominal ** systolic/diastolic pressures and MAP,
plus the **configured ** PPV percentage when PPV is greater than 0. It does not
measure PPV from sampled arterial data. At very high nominal systolic pressure,
the highest modulated pulses can exceed the 200 mmHg scale; the displayed
curve is then **clipped ** at the top, without rescaling the axis.
## Display options (new in v0.3)
The five **Show on monitor ** checkboxes affect the presentation only:
| Checkbox | Hidden monitor content |
| --- | --- |
2026-11-12 12:08:46 +01:00
| ECG | ECG waveform, HR and rhythm alarm (when present) |
2026-11-12 09:36:13 +01:00
| Pulse oximetry | Pleth waveform, SpO₂ and PR |
| Invasive arterial blood pressure | ART waveform, pressure values, MAP and PPV label |
| Capnography | CO₂ waveform, EtCO₂ and RR |
2026-11-12 14:07:59 +01:00
| NIBP | Timed cuff-measurement values and red right-column value box |
2026-11-12 09:36:13 +01:00
2026-11-12 16:02:08 +01:00
Remaining visible waveform rows and the bottom measurements row share an equal
2026-11-12 14:10:46 +01:00
portion of the available height and remain aligned across both columns; zero
2026-11-12 16:02:08 +01:00
waveform channels is supported. Hiding NIBP leaves the three future measurement
placeholders visible.
2026-11-12 09:36:13 +01:00
2026-11-12 10:43:11 +01:00
## ECG morphology correction (v0.3.1)
At high heart rates, the previous ECG generator expressed QRS width as a fixed
fraction of the R– R interval and sampled at 100 Hz. Narrow R waves could fall
between samples, making successive QRS complexes appear to vary dramatically
in amplitude despite a regular sinus rhythm.
- Synthetic P/QRS/T components now have widths specified in milliseconds,
not fixed fractions of the cardiac cycle. P/T positioning and widths adapt
to the R– R interval, while the QRS width remains essentially constant.
- Sampling increased to **250 Hz ** (4 ms intervals) to capture QRS peaks
more consistently, including at **189– 240 bpm ** .
- The ECG morphology remains independent of the respiratory arterial PPV
setting. The arterial and pleth delays and mechanical capture options are
unchanged.
- Regression tests compare peak heights at 60, 75, 120, 189 and 240 bpm,
and verify that changing PPV does not affect the ECG signal.
The ECG remains a schematic educational signal; no voltage calibration,
lead placement model, diagnostic criteria, or patient-specific physiology
are simulated.
2026-11-12 09:36:13 +01:00
## Signal implementation
2026-11-12 10:43:11 +01:00
- 250 Hz synthetic signal samples, 10 s retained history, 8 s scrolling trace.
2026-11-12 09:36:13 +01:00
- Cairo draws into the GTK4 `DrawingArea` and scales with the window.
- A conducted QRS records its own respiratory PPV multiplier at event time.
The arterial pulse thus retains the same amplitude throughout the beat.
- Varying PPV does not alter the peripheral pleth pulse or the number of
mechanical pulses.
2026-11-12 14:07:59 +01:00
- Clinical accuracy, calibration, artifact realism and patient-specific physiology
are outside this prototype; its NIBP cycle and alarms are synthetic.
2026-11-12 09:36:13 +01:00
## Project layout
```text
src/
main.rs GTK application entry point
model.rs Parameters, rhythm/capture settings, display flags
simulation.rs QRS-timed mechanical signals, PPV and respiratory synthesis
render.rs Cairo monitor layout, dynamic visibility, fixed ART axis
2026-11-12 14:07:59 +01:00
nibp.rs Scheduled cuff measurements and measurement results
2026-11-12 09:36:13 +01:00
ui.rs Admin controls and monitor window
```
## Changes since v0.2.2
1. Respiratory PPV with a 0– 60% instructor setting, coupled to the simulated
respiratory cycle and applied **per arterial beat ** .
2. Five independent display visibility toggles, dynamic waveform row layout,
2026-11-12 14:07:59 +01:00
and independent NIBP value-box hiding.
2026-11-12 09:36:13 +01:00
3. ART axis reduced from **0– 250 ** to **0– 200 mmHg ** , with inputs adjusted to
the new range.
4. Added regression tests for PPV arithmetic and its effects on ART, for
hiding ECG while retaining mechanical pulses, for active channel selection,
and for arterial-axis normalization.
**Verification:** The archive is generated from these sources. Run `cargo test`
locally to verify the Rust/GTK build; Rust and GTK4 development components
were not available in the environment where this ZIP was prepared.
2026-11-12 10:43:11 +01:00
## Changes in v0.3.2
1. Added live patient-name header in Admin/Monitor with blank-name fallback.
2. Added four levels of SpO₂ signal quality, quality stars and an irregular,
low-amplitude pleth waveform for Poor quality.
3. Added **Sensor not attached ** with `NO SENSOR` status and suppression of
saturation, pulse rate and pleth waveform.
4. Added tests for signal-quality scaling, displayed readings and disconnected
sensor behavior.
**Build verification:** ZIP integrity and patch application were checked.
The GTK4 application and Rust tests were not compiled in the packaging
environment; run `cargo test` and `cargo run --release` on Fedora.
2026-11-12 12:08:46 +01:00
## v0.4.2 — Rhythm, sensor and missing-reading alarms
- **VT** remains potentially perfusing. The new **PVT ** (pulseless ventricular tachycardia) rhythm retains organized broad QRS complexes but produces no arterial/pleth pulses. VF and asystole are also pulseless regardless of capture selection.
- **ECG**: a flashing **ARRHYTHMIA ** message for VT, PVT and VF; a flashing **ASYSTOLE ** message for asystole. These event alarms do not depend on numerical HR limits.
- **SpO₂**: when the probe is disconnected, a flashing **NO SENSOR ** replaces the saturation reading. Quality 0, loss of mechanical capture or a pulseless rhythm results in flashing **NO READING ** (no numerical SpO₂/PR). Sensor disconnection takes precedence. No pleth waveform is displayed in these conditions.
2026-11-12 12:30:54 +01:00
- **ART**: without mechanical pulses (including PVT/VF/asystole/PEA), the simulated invasive pressure line has slow non-pulsatile drift between **0 and 5 mmHg ** . In v0.4.2, the numeric display showed `--/--` ; v0.4.3 changes this to a rounded measured SYS of 0– 5 mmHg, with `--` for DIA and MAP.
2026-11-12 12:08:46 +01:00
- **ECG rhythm name** has been removed from the monitor; only HR and the associated alarm message, when present, are visible. The instructor continues to select the rhythm in Admin.
- Numerical alarm thresholds and the Adult preset from v0.4.1 are unchanged. Synthetic demonstration behavior only; not suitable for clinical decisions.
2026-11-12 12:30:54 +01:00
## v0.4.3 — Low arterial pressure, VT rate preset and intermittent Poor SpO₂
- Pulseless rhythms, PEA or otherwise absent mechanical capture: invasive SYS
reports the **current measured 0– 5 mmHg ** pressure, e.g. `3/--` with
`MAP -- mmHg` . **Only SYS ** is tested against configured ART SYS limits;
no spurious MAP/DIA threshold alarms are generated from missing readings.
- Selecting **VT ** or **PVT ** in Admin sets HR to **160 bpm ** and updates the
associated slider and text field. Subsequent manual rate changes are allowed.
Perfusing VT still produces QRS-linked pulses subject to capture settings;
PVT remains pulseless.
- **Poor (★)** SpO₂ signal periodically changes to **NO READING ** for a
pseudo-random **5– 20 seconds ** , after a pseudo-random **30– 180 seconds ** of
usable low-quality signal. The technical alarm blinks, SpO₂/PR readings are
suppressed, and the pleth waveform is absent. On recovery it resumes at Poor
quality. The simulated signal history retains visible gaps for outages.
Choosing another signal quality immediately clears the intermittent outage.
- No changes to Adult alarm presets, alarm limit ordering, or the 0– 200 mmHg
arterial scale. All behavior is synthetic and intended for teaching only.
2026-11-12 14:10:46 +01:00
## v0.5.1 — Aligned monitor columns
The left waveform column and right numeric column now share the same row grid.
NIBP reserves an empty cell in the left waveform column instead of shortening
the other numeric rows. Hiding any channel reflows both columns together.
No NIBP measurement logic or alarm behavior was changed.
2026-11-12 14:34:31 +01:00
## v0.5.3 — Audible alarm output
- Alarm-tone playback through Fedora PipeWire (`pw-play` ) or PulseAudio
compatibility (`paplay` ), without any new Rust library dependencies.
- Admin controls to mute/unmute alarms or play a test tone.
- Distinct critical-rhythm and standard/technical patterns; critical priority.
- Audio keeps running independently of the monitor's drawing callback.
- Visual alarms and existing physiological simulation remain unchanged.
2026-11-12 15:16:24 +01:00
### v0.5.5 — CPR plethysmography correction
The delayed CPR pleth waveform no longer wraps its trailing portion into the next compression. The regression test now reports the maximum valid waveform amplitude when failing. No other simulation controls were changed.
2026-11-12 15:21:34 +01:00
### v0.5.6 — CPR pleth filter persistence
Corrects the underlying cause of the v0.5.5 test failure: in pulseless rhythms, the simulation had reset the pleth low-pass filter at every 250 Hz sample, preventing CPR-induced signals from accumulating. The filter now persists during good-quality chest compressions while QRS-triggered mechanical pulses are still cleared. Stopping CPR in VF/PVT immediately restores no reading. Additional regression coverage includes PVT.
2026-11-12 16:02:08 +01:00
### v0.5.7 — Four-group numerical measurement row
The monitor now uses a 75%/25% waveform/numeric column split. The final
row has four equally sized measurement groups: CO/CI; SVRI/GEDI/ELWI;
reserved empty; and the unchanged NIBP readout. Only headings are rendered
in the first two groups; the third has no content. NIBP can be hidden without
removing the final row. No physiological simulation behavior was modified.
2026-11-12 16:10:57 +01:00
### v0.5.8 — ECG touchscreen controls
Added a monitor-styled ECG settings window, opened by touching either the ECG
waveform or numeric HR cell. Edits HR lower/upper alarms and displayed lead
(I, II, III, aVR, aVL, aVF, V1– V6), with input validation and Admin sync.
Lead changes are schematic display projections only; arrhythmia and pulse
simulation remain unchanged.
2026-11-12 16:36:07 +01:00
### v0.5.9 — Touch-optimized ECG settings
Restyled the ECG settings window with light-grey text/controls, a neutral
0.8-pixel outer border and thin 0.8-pixel Cairo separators matching the
monitor. Replaced the on-monitor HR limit text entries with large 5-bpm
**− /+** buttons and independent **ON/OFF ** controls; the ECG lead remains a
touch-selectable dropdown. Pending changes still require Apply, and Cancel
leaves the shared parameters unchanged. No signal generation was altered.
2026-11-12 16:40:51 +01:00
### v0.6.0 — Additional touchscreen modules and NIBP manual-first startup
Added touch/click settings panels for SpO₂, ART, CO₂ and the bottom-right
NIBP cell. Their threshold editors use large, unit-specific +/− and ON/OFF
controls; the panels expose relevant waveform/sensor options and stay
synchronized with Admin. NIBP additionally provides interval selection,
manual **Measure now ** , Auto ON/OFF and cuff options. Startup no longer
initiates a cuff cycle or shows any NIBP reading; Auto is OFF by default.
Existing NIBP cycle physics and signal quality behavior are unchanged.
2026-11-12 19:08:11 +01:00
### v0.6.1 — Alarm-only monitor touch menus
The ECG, SpO₂, ART, CO₂ and NIBP touch menus now edit only lower/upper
alarm limits. Removed ECG lead, signal/sensor, waveform and all NIBP
measurement controls from monitor-side menus. These remain available in
Admin, including manual NIBP measurement and Auto ON/OFF. No physiological
model, alarm evaluation or NIBP startup behavior was changed.
2026-11-12 20:07:35 +01:00
### v0.6.4 — NIBP touch controls restored
The monitor-side NIBP settings menu again contains **Measure now ** ,
**Automatic measurement ON/OFF** and the **measurement interval ** (1, 3, 5,
10, 20, 30, 60 minutes). These controls are above the horizontal SYS/MAP/DIA
alarm matrix and share its monochrome touchscreen styling. Auto and interval
are saved with Apply; Measure now starts a cuff cycle immediately regardless
of Auto. Both monitor and Admin display the selected settings. Other monitor
menus remain limited to alarm thresholds; NIBP cuff placement, the simulated
failed-reading option and non-NIBP signal settings remain Admin-only.