v0.5.0: tweak NIBP

This commit is contained in:
GABRIEL Sebastian 2026-11-12 14:07:59 +01:00
commit ef269099bd
12 changed files with 2900 additions and 109 deletions

View file

@ -1,4 +1,4 @@
# Patient Monitor Simulation (PaMSim) — v0.4.4
# Patient Monitor Simulation (PaMSim) — v0.5.0
A two-window, Rust/GTK4 patient-monitor simulator for teaching on Fedora Linux.
@ -22,7 +22,7 @@ session (e.g., Fedora KDE/Wayland).
**Admin sections** have a narrow colored stripe on their left edge to match the
monitor: ECG **green**, SpO₂ **yellow**, invasive arterial pressure **red**,
capnography **light grey**, NIBP **light grey**. The Patient section remains
capnography **light grey**, NIBP **red**. The Patient section remains
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.
@ -40,7 +40,7 @@ Waveforms and vital signs disappear together when their respective
visibility checkbox is cleared. Remaining waveform rows expand to use the space.
Hiding a display channel does **not** stop signal generation or physiological
coupling: for example, hiding ECG does not stop ART or pleth pulses. NIBP can
be hidden independently; this also removes its footer.
be hidden independently; this also removes its value box from the right column.
The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
fullscreen. On Wayland, move the monitor to the presentation screen before
@ -161,6 +161,68 @@ 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.
## NIBP measurement cycle (v0.5.0)
NIBP is **red**, with a dedicated value box in the **right-hand numeric column**.
The previous static NIBP footer has been removed. In Admin, choose an interval
of **1, 3, 5, 10, 20, 30, or 60 minutes** (default 5). The initial cuff cycle
begins when the simulation starts; subsequent intervals run **from the end of
the last measurement**, not from its beginning. **Measure now** starts an
additional cycle if none is in progress. The small **horizontal progress bar**
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.
## ECG and mechanical coupling
- ECG rhythms: sinus, atrial fibrillation, monomorphic ventricular tachycardia
@ -177,8 +239,8 @@ can be taught.
drifts smoothly at 0–5 mmHg rather than representing a pulsatile pressure.
The ART **SYS** number shows the rounded low transducer pressure (0–5 mmHg),
while DIA and MAP show `--` because they cannot be reliably estimated.
Previous pressure samples scroll out of view. NIBP is a static,
separately entered cuff reading.
Previous pressure samples scroll out of view. NIBP follows a separate,
time-based simulated cuff-measurement cycle.
## Invasive arterial pressure and PPV (new in v0.3)
@ -228,7 +290,7 @@ The five **Show on monitor** checkboxes affect the presentation only:
| 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 |
| NIBP | Static cuff pressure values and NIBP footer |
| NIBP | Timed cuff-measurement values and red right-column value box |
Remaining visible waveforms keep their relative order and receive an equal
share of the available area; zero waveform channels is supported.
@ -263,8 +325,8 @@ are simulated.
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.
- Clinical accuracy, dynamic NIBP measurements, alarms, artifacts, calibration,
precise waveform timing, and patient physiology are outside this prototype.
- Clinical accuracy, calibration, artifact realism and patient-specific physiology
are outside this prototype; its NIBP cycle and alarms are synthetic.
## Project layout
@ -274,6 +336,7 @@ src/
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
nibp.rs Scheduled cuff measurements and measurement results
ui.rs Admin controls and monitor window
```
@ -282,7 +345,7 @@ src/
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,
and independent NIBP-footer hiding.
and independent NIBP value-box hiding.
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