v0.5.7 — Four-group numerical measurement row
This commit is contained in:
parent
c9a5e14567
commit
a09cd2c4ee
7 changed files with 478 additions and 47 deletions
2
patient-monitor-simulation/Cargo.lock
generated
2
patient-monitor-simulation/Cargo.lock
generated
|
|
@ -438,7 +438,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "patient-monitor-simulation"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
dependencies = [
|
||||
"gtk4",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "patient-monitor-simulation"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,26 @@ Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenst
|
|||
> EKG, invasive arterielle Druckkurve, Plethysmogramm und Kapnogramm sind schematische mathematische Annäherungen.
|
||||
> Die Simulation wurde nicht klinisch validiert und ist kein Medizinprodukt.
|
||||
|
||||
## Monitoraufteilung (v0.5.7)
|
||||
|
||||
Der nutzbare Monitorbereich wird in einem festen Verhältnis von **75 % für die
|
||||
Kurvenspalte** und **25 % für die numerische Spalte** aufgeteilt. Dies gilt auch
|
||||
bei Änderung der Fenstergröße. Die letzte Zeile besteht aus vier gleich breiten
|
||||
Wertefeldern:
|
||||
|
||||
| Feld 1 (25 %) | Feld 2 (25 %) | Feld 3 (25 %) | Feld 4 (25 %) |
|
||||
| --- | --- | --- | --- |
|
||||
| CO / CI | SVRI · GEDI · ELWI | *(leer)* | NIBP |
|
||||
|
||||
In den ersten beiden Feldern sind ausschließlich die Beschriftungen sichtbar;
|
||||
Messwerte und Berechnungen werden erst in einer späteren Version implementiert.
|
||||
Das dritte Feld bleibt vollständig leer. Im vierten Feld bleiben die bestehenden
|
||||
NIBP-Messwerte, der Manschettendruckbalken, die Fortschrittsanzeige und die
|
||||
Alarme erhalten. Wenn NIBP ausgeblendet wird, verschwindet nur der Inhalt des
|
||||
vierten Feldes; die gesamte untere Wertezeile bleibt bestehen.
|
||||
Beim Ausblenden anderer Parameter werden die verbleibenden Kurvenzeilen wie
|
||||
bisher dynamisch verteilt.
|
||||
|
||||
## Thoraxkompressionen (v0.5.4)
|
||||
|
||||
Im Admin-Bereich **Chest compressions** startet die grüne Schaltfläche
|
||||
|
|
|
|||
|
|
@ -1,11 +1,36 @@
|
|||
--- README.de.md
|
||||
+++ README.de.md
|
||||
@@ -469,3 +469,8 @@
|
||||
technische Alarme; kritische Alarme haben Vorrang.
|
||||
- Die Audioausgabe ist von der Kurvendarstellung entkoppelt.
|
||||
- Bisherige optische Alarme und Simulationsfunktionen bleiben unverändert.
|
||||
@@ -1,4 +1,4 @@
|
||||
-# Patient Monitor Simulation (PaMSim) — v0.5.4
|
||||
+# Patient Monitor Simulation (PaMSim) — v0.5.7
|
||||
|
||||
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||
|
||||
@@ -103,11 +123,10 @@ Lange Namen werden an die verfügbare Breite angepasst oder abgeschnitten.
|
||||
Wird die Sichtbarkeit eines Parameters deaktiviert, verschwinden sowohl seine Kurve als auch die zugehörigen Messwerte.
|
||||
Die verbleibenden Kurvenbereiche vergrößern sich entsprechend.
|
||||
Das Ausblenden eines Monitorbereichs unterbricht **nicht** die Signalerzeugung oder physiologische Kopplung: Wird beispielsweise das EKG ausgeblendet, können arterielle und plethysmographische Pulse weiterhin auftreten.
|
||||
-Für NIBP wird in der linken Kurvenspalte eine **leere Zelle** freigehalten.
|
||||
-Damit sind die Kurvenbereiche und die numerischen Wertefelder in der rechten Spalte
|
||||
-in allen Zeilen exakt aufeinander ausgerichtet.
|
||||
-NIBP kann unabhängig ausgeblendet werden; dabei verschwindet die gesamte NIBP-Zeile
|
||||
-und die übrigen Zeilen nutzen den frei werdenden Platz.
|
||||
+Die unterste Zeile enthält vier gleich breite numerische Wertefelder. Das
|
||||
+vierte Feld für NIBP ist an der rechten Monitorspalte ausgerichtet.
|
||||
+NIBP kann unabhängig ausgeblendet werden; dabei bleibt die untere Zeile mit
|
||||
+den drei noch nicht implementierten Messgruppen bestehen.
|
||||
|
||||
Das Monitorfenster lässt sich in der Größe verändern.
|
||||
Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird er verlassen.
|
||||
@@ -499,3 +518,11 @@ Die verzögerte Plethysmographiekurve bei Thoraxkompressionen überlappt nicht m
|
||||
### v0.5.6 – Persistenz des Pleth-Filters bei Thoraxkompressionen
|
||||
|
||||
Die eigentliche Ursache des Testfehlers aus v0.5.5 wurde behoben: Bei pulslosen Rhythmen wurde der Pleth-Tiefpassfilter bislang mit jedem 250-Hz-Abtastwert zurückgesetzt. Während qualitativ guter Thoraxkompressionen bleibt der Filterzustand nun erhalten; QRS-getriggerte mechanische Pulse werden weiterhin verworfen. Nach dem Beenden der Kompressionen bei VF/PVT verschwindet das Pleth-Signal sofort. Ein zusätzlicher Regressionstest deckt PVT ab.
|
||||
+
|
||||
+### v0.5.7 – Vier numerische Messgruppen in der unteren Zeile
|
||||
+
|
||||
+### v0.5.5 – Korrektur der CPR-Plethysmographie
|
||||
+
|
||||
+Die verzögerte Plethysmographiekurve bei Thoraxkompressionen überlappt nicht mehr mit der nächsten Kompression. Der Regressionstest gibt bei einem Fehlschlag die maximale gültige Kurvenamplitude aus. Sonstige Simulationseinstellungen bleiben unverändert.
|
||||
+Feste Aufteilung von 75 % Kurvenspalte und 25 % numerischer Spalte. In der
|
||||
+untersten Zeile stehen vier gleich breite Bereiche: CO/CI, SVRI/GEDI/ELWI,
|
||||
+ein vollständig leerer Platzhalter und NIBP. Die ersten beiden Bereiche
|
||||
+zeigen derzeit nur ihre Bezeichnungen. Wird NIBP ausgeblendet, bleibt die
|
||||
+untere Zeile bestehen. Das Simulationsverhalten ist unverändert.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Patient Monitor Simulation (PaMSim) — v0.5.4
|
||||
# Patient Monitor Simulation (PaMSim) — v0.5.7
|
||||
|
||||
A two-window, Rust/GTK4 patient-monitor simulator for teaching on Fedora Linux.
|
||||
|
||||
|
|
@ -6,6 +6,23 @@ A two-window, Rust/GTK4 patient-monitor simulator for teaching on Fedora Linux.
|
|||
> plethysmography and capnography are schematic mathematical approximations. The
|
||||
> simulation has no clinical validation and is not a medical device.
|
||||
|
||||
## 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.
|
||||
|
||||
## Chest compressions (v0.5.4)
|
||||
|
||||
The **Chest compressions** Admin group provides a large **Start Chest Compressions**
|
||||
|
|
@ -80,10 +97,11 @@ Long names are automatically resized or clipped to fit the header.
|
|||
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 occupies a dedicated right-column row with an **empty waveform cell** on the
|
||||
left. All waveform rows and their corresponding numeric boxes share the same
|
||||
height and horizontal boundaries. NIBP can be hidden independently; its entire
|
||||
row is then removed and the remaining rows expand evenly.
|
||||
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.
|
||||
|
||||
The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
|
||||
fullscreen. On Wayland, move the monitor to the presentation screen before
|
||||
|
|
@ -236,8 +254,8 @@ can be taught.
|
|||
## NIBP measurement cycle (v0.5.0)
|
||||
|
||||
NIBP is **red**, with a dedicated value box in the **right-hand numeric column**.
|
||||
An **empty left-hand waveform cell** occupies the same row, keeping every numeric
|
||||
value box horizontally aligned with its waveform region. The previous static
|
||||
The bottom measurement row has three placeholder groups to its left, keeping
|
||||
NIBP aligned with the standard 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
|
||||
|
|
@ -366,9 +384,10 @@ The five **Show on monitor** checkboxes affect the presentation only:
|
|||
| Capnography | CO₂ waveform, EtCO₂ and RR |
|
||||
| NIBP | Timed cuff-measurement values and red right-column value box |
|
||||
|
||||
Remaining visible waveform rows and the NIBP-only row share an equal
|
||||
Remaining visible waveform rows and the bottom measurements row share an equal
|
||||
portion of the available height and remain aligned across both columns; zero
|
||||
waveform channels is supported.
|
||||
waveform channels is supported. Hiding NIBP leaves the three future measurement
|
||||
placeholders visible.
|
||||
|
||||
## ECG morphology correction (v0.3.1)
|
||||
|
||||
|
|
@ -500,3 +519,11 @@ The delayed CPR pleth waveform no longer wraps its trailing portion into the nex
|
|||
### 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.
|
||||
|
||||
### 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.
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ pub fn draw(cr: &Context, width: i32, height: i32, p: &Parameters, sim: &Simulat
|
|||
let header = (h * 0.083).clamp(32.0, 68.0);
|
||||
let channels = visible_channels(p);
|
||||
let body_height = (h - header - pad).max(20.0);
|
||||
// A single grid governs both columns. NIBP has an empty waveform cell
|
||||
// on the left, so all numeric boxes line up with their waveform rows.
|
||||
let (row_height, nibp_top) = monitor_rows(header, body_height, channels.len(), p.show_nibp);
|
||||
let sidebar = (w * 0.235).clamp(125.0, 370.0).min(w * 0.44);
|
||||
let split_x = w - sidebar - pad;
|
||||
// Waveforms occupy three quarters of the drawable width and numeric
|
||||
// values one quarter. The final row is four equal-sized numeric cells.
|
||||
let (row_height, measurements_top) = monitor_rows(header, body_height, channels.len());
|
||||
let (split_x, quarter_width) = monitor_columns(w, pad);
|
||||
let numeric_width = (quarter_width - 2.0 * pad).max(1.0);
|
||||
let trace_left = pad + 6.0;
|
||||
let trace_right = (split_x - pad).max(trace_left + 40.0);
|
||||
let trace_right = (split_x - pad).max(trace_left + 1.0);
|
||||
let text_scale = (w.min(h * 1.7) / 850.0).clamp(0.65, 1.5);
|
||||
|
||||
let patient_title = if p.patient_name.trim().is_empty() {
|
||||
|
|
@ -72,25 +72,58 @@ pub fn draw(cr: &Context, width: i32, height: i32, p: &Parameters, sim: &Simulat
|
|||
draw_trace(cr, channel, color, trace_left, trace_right,
|
||||
top + row_height * 0.25, bottom - row_height * 0.06, p, sim);
|
||||
draw_vitals(cr, channel, color, split_x + pad,
|
||||
top, row_height, sidebar - 2.0 * pad, p, sim);
|
||||
top, row_height, numeric_width, p, sim);
|
||||
}
|
||||
|
||||
if let Some(top) = nibp_top {
|
||||
// Intentionally blank waveform cell to the left of the NIBP box.
|
||||
stroke_line(cr, pad, top + row_height, w - pad, top + row_height, MUTED, 0.65);
|
||||
draw_nibp_box(cr, split_x + pad, top,
|
||||
sidebar - 2.0 * pad, row_height, p, sim);
|
||||
}
|
||||
// The last row contains four adjacent measurement groups, each spanning
|
||||
// exactly one quarter of the drawable width. The fourth is the normal
|
||||
// right-hand NIBP numeric column. The other groups are future placeholders.
|
||||
draw_measurements_row(cr, pad, measurements_top, row_height, quarter_width,
|
||||
numeric_width, p, sim);
|
||||
}
|
||||
|
||||
/// Compute the same row boundaries for the waveform and numeric columns.
|
||||
/// NIBP, when visible, occupies the final row and leaves its left cell empty.
|
||||
fn monitor_rows(header: f64, body_height: f64, trace_count: usize, show_nibp: bool)
|
||||
-> (f64, Option<f64>) {
|
||||
let row_count = trace_count + usize::from(show_nibp);
|
||||
let row_height = body_height / row_count.max(1) as f64;
|
||||
let nibp_top = show_nibp.then_some(header + trace_count as f64 * row_height);
|
||||
(row_height, nibp_top)
|
||||
/// Left/right split and the width of each bottom-row group. Outer margins
|
||||
/// are excluded, so 75% / 25% holds at all window sizes (no width clamping).
|
||||
fn monitor_columns(window_width: f64, pad: f64) -> (f64, f64) {
|
||||
let quarter_width = (window_width - 2.0 * pad).max(1.0) / 4.0;
|
||||
(pad + 3.0 * quarter_width, quarter_width)
|
||||
}
|
||||
|
||||
/// The bottom measurement row always exists, even when NIBP is hidden: the
|
||||
/// remaining three groups are reserved for future parameters. Waveform rows
|
||||
/// above it still reflow when individual channels are hidden.
|
||||
fn monitor_rows(header: f64, body_height: f64, trace_count: usize) -> (f64, f64) {
|
||||
let row_height = body_height / (trace_count + 1) as f64;
|
||||
let measurements_top = header + trace_count as f64 * row_height;
|
||||
(row_height, measurements_top)
|
||||
}
|
||||
|
||||
const FUTURE_MEASUREMENT_LABELS: [&str; 3] = ["CO / CI", "SVRI · GEDI · ELWI", ""];
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn draw_measurements_row(cr: &Context, left: f64, top: f64, height: f64,
|
||||
quarter_width: f64, numeric_width: f64,
|
||||
p: &Parameters, sim: &Simulator) {
|
||||
let bottom = top + height;
|
||||
stroke_line(cr, left, bottom, left + 4.0 * quarter_width, bottom, MUTED, 0.65);
|
||||
let label_size = (height * 0.135).clamp(11.0, 19.0);
|
||||
for (index, label) in FUTURE_MEASUREMENT_LABELS.iter().enumerate() {
|
||||
let cell_left = left + index as f64 * quarter_width;
|
||||
if index > 0 {
|
||||
stroke_line(cr, cell_left, top, cell_left, bottom, MUTED, 0.65);
|
||||
}
|
||||
if !label.is_empty() {
|
||||
// Placeholder labels only: no numerical values or simulated data.
|
||||
fitted_text(cr, label, cell_left + quarter_width * 0.06,
|
||||
top + height * 0.24, label_size,
|
||||
quarter_width * 0.88, LIGHT_GREY);
|
||||
}
|
||||
}
|
||||
// The existing global column separator supplies the fourth divider.
|
||||
if p.show_nibp {
|
||||
draw_nibp_box(cr, left + 3.0 * quarter_width + (quarter_width - numeric_width) * 0.5, top,
|
||||
numeric_width, height, p, sim);
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_nibp_box(cr: &Context, x: f64, top: f64, width: f64, height: f64,
|
||||
|
|
@ -555,26 +588,41 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn monitor_rows_align_waveforms_and_numbers_with_blank_nibp_left_cell() {
|
||||
fn monitor_rows_align_waveforms_and_bottom_measurements() {
|
||||
let header = 60.0;
|
||||
let body_height = 700.0;
|
||||
let (height, nibp_top) = monitor_rows(header, body_height, 4, true);
|
||||
let (height, measurements_top) = monitor_rows(header, body_height, 4);
|
||||
assert_eq!(height, 140.0);
|
||||
assert_eq!(nibp_top, Some(620.0));
|
||||
assert_eq!(measurements_top, 620.0);
|
||||
// Every waveform row and its corresponding numeric row share boundaries.
|
||||
for index in 0..4 {
|
||||
let top = header + index as f64 * height;
|
||||
let bottom = top + height;
|
||||
assert_eq!(bottom, header + (index + 1) as f64 * height);
|
||||
}
|
||||
assert_eq!(nibp_top.unwrap() + height, header + body_height);
|
||||
assert_eq!(measurements_top + height, header + body_height);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn monitor_rows_reflow_when_nibp_or_waveforms_are_hidden() {
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 4, false), (175.0, None));
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 0, true), (700.0, Some(60.0)));
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 0, false), (700.0, None));
|
||||
fn bottom_measurements_remain_when_nibp_or_waveforms_are_hidden() {
|
||||
// Hiding NIBP only clears the fourth cell; the placeholders stay.
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 4), (140.0, 620.0));
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 2), (700.0 / 3.0, 60.0 + 2.0 * (700.0 / 3.0)));
|
||||
assert_eq!(monitor_rows(60.0, 700.0, 0), (700.0, 60.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn waveform_split_is_three_quarters_and_bottom_groups_are_equal() {
|
||||
for (width, pad) in [(800.0, 10.0), (1280.0, 20.0), (2560.0, 20.0)] {
|
||||
let (split, group) = monitor_columns(width, pad);
|
||||
let usable = width - 2.0 * pad;
|
||||
assert!((split - (pad + 0.75 * usable)).abs() < 1e-9);
|
||||
assert!((group - 0.25 * usable).abs() < 1e-9);
|
||||
assert!((split - (pad + 3.0 * group)).abs() < 1e-9);
|
||||
assert!((pad + 4.0 * group - (width - pad)).abs() < 1e-9);
|
||||
}
|
||||
assert_eq!(FUTURE_MEASUREMENT_LABELS,
|
||||
["CO / CI", "SVRI · GEDI · ELWI", ""]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue