203 lines
10 KiB
Diff
203 lines
10 KiB
Diff
|
|
diff --git a/Cargo.toml b/Cargo.toml
|
|||
|
|
index 6ee2389..2302d65 100644
|
|||
|
|
--- a/Cargo.toml
|
|||
|
|
+++ b/Cargo.toml
|
|||
|
|
@@ -1,6 +1,6 @@
|
|||
|
|
[package]
|
|||
|
|
name = "patient-monitor-simulation"
|
|||
|
|
-version = "0.5.0"
|
|||
|
|
+version = "0.5.1"
|
|||
|
|
edition = "2021"
|
|||
|
|
license = "MIT"
|
|||
|
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
|||
|
|
diff --git a/README.de.md b/README.de.md
|
|||
|
|
index 3c43a45..bcd4209 100644
|
|||
|
|
--- a/README.de.md
|
|||
|
|
+++ b/README.de.md
|
|||
|
|
@@ -1,4 +1,4 @@
|
|||
|
|
-# Patient Monitor Simulation (PaMSim) — v0.5.0
|
|||
|
|
+# Patient Monitor Simulation (PaMSim) — v0.5.1
|
|||
|
|
|
|||
|
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
|||
|
|
|
|||
|
|
@@ -36,7 +36,11 @@ 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.
|
|||
|
|
-NIBP kann unabhängig ausgeblendet werden; dabei verschwindet auch das separate rote Wertefeld in der rechten Monitorspalte.
|
|||
|
|
+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.
|
|||
|
|
|
|||
|
|
Das Monitorfenster lässt sich in der Größe verändern.
|
|||
|
|
Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird er verlassen.
|
|||
|
|
@@ -367,3 +371,11 @@ Beide Manschetten-Interferenzoptionen sind standardmäßig deaktiviert.
|
|||
|
|
|
|||
|
|
**Die NIBP-Simulation ist ausschließlich ein didaktisches Modell und keine
|
|||
|
|
klinisch validierte oszillometrische Messung.**
|
|||
|
|
+
|
|||
|
|
+## v0.5.1 — Ausrichtung der Monitorspalten
|
|||
|
|
+
|
|||
|
|
+Die linke Kurvenspalte und die rechte numerische Spalte verwenden nun dieselbe
|
|||
|
|
+Zeilenaufteilung. Neben dem NIBP-Wertefeld bleibt links eine leere Zelle, statt
|
|||
|
|
+die anderen Wertefelder vertikal zusammenzudrängen. Beim Ausblenden einzelner
|
|||
|
|
+Monitorbereiche werden beide Spalten gemeinsam neu aufgeteilt.
|
|||
|
|
+Das Messverhalten und die Alarmfunktionen bleiben unverändert.
|
|||
|
|
diff --git a/README.md b/README.md
|
|||
|
|
index 66c1469..d1f48c0 100644
|
|||
|
|
--- a/README.md
|
|||
|
|
+++ b/README.md
|
|||
|
|
@@ -1,4 +1,4 @@
|
|||
|
|
-# Patient Monitor Simulation (PaMSim) — v0.5.0
|
|||
|
|
+# Patient Monitor Simulation (PaMSim) — v0.5.1
|
|||
|
|
|
|||
|
|
A two-window, Rust/GTK4 patient-monitor simulator for teaching on Fedora Linux.
|
|||
|
|
|
|||
|
|
@@ -39,8 +39,10 @@ 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 can
|
|||
|
|
-be hidden independently; this also removes its value box from the right column.
|
|||
|
|
+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.
|
|||
|
|
|
|||
|
|
The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
|
|||
|
|
fullscreen. On Wayland, move the monitor to the presentation screen before
|
|||
|
|
@@ -164,7 +166,9 @@ 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
|
|||
|
|
+An **empty left-hand waveform cell** occupies the same row, keeping every numeric
|
|||
|
|
+value box horizontally aligned with its waveform region. 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
|
|||
|
|
@@ -292,8 +296,9 @@ 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 waveforms keep their relative order and receive an equal
|
|||
|
|
-share of the available area; zero waveform channels is supported.
|
|||
|
|
+Remaining visible waveform rows and the NIBP-only row share an equal
|
|||
|
|
+portion of the available height and remain aligned across both columns; zero
|
|||
|
|
+waveform channels is supported.
|
|||
|
|
|
|||
|
|
## ECG morphology correction (v0.3.1)
|
|||
|
|
|
|||
|
|
@@ -399,3 +404,10 @@ environment; run `cargo test` and `cargo run --release` on Fedora.
|
|||
|
|
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.
|
|||
|
|
+
|
|||
|
|
+## 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.
|
|||
|
|
diff --git a/src/render.rs b/src/render.rs
|
|||
|
|
index def9706..b3dc04d 100644
|
|||
|
|
--- a/src/render.rs
|
|||
|
|
+++ b/src/render.rs
|
|||
|
|
@@ -35,12 +35,9 @@ 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);
|
|||
|
|
- // NIBP occupies a dedicated box at the bottom of the numerical right column.
|
|||
|
|
- // Trace rows remain full height on the left.
|
|||
|
|
- let nibp_box_height = if p.show_nibp { (h * 0.24).clamp(135.0, 210.0).min(body_height * 0.55) }
|
|||
|
|
- else { 0.0 };
|
|||
|
|
- let trace_row_height = body_height / channels.len().max(1) as f64;
|
|||
|
|
- let vital_row_height = (body_height - nibp_box_height) / channels.len().max(1) as f64;
|
|||
|
|
+ // 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;
|
|||
|
|
let trace_left = pad + 6.0;
|
|||
|
|
@@ -67,26 +64,35 @@ pub fn draw(cr: &Context, width: i32, height: i32, p: &Parameters, sim: &Simulat
|
|||
|
|
stroke_line(cr, split_x, header, split_x, h - pad, MUTED, 0.9);
|
|||
|
|
|
|||
|
|
for (index, (channel, title, color)) in channels.iter().copied().enumerate() {
|
|||
|
|
- let top = header + index as f64 * trace_row_height;
|
|||
|
|
- let bottom = top + trace_row_height;
|
|||
|
|
- stroke_line(cr, pad, bottom, split_x, bottom, MUTED, 0.65);
|
|||
|
|
- text(cr, title, trace_left + 4.0, top + trace_row_height * 0.17,
|
|||
|
|
- (trace_row_height * 0.11).clamp(10.0, 17.0), color, false);
|
|||
|
|
+ let top = header + index as f64 * row_height;
|
|||
|
|
+ let bottom = top + row_height;
|
|||
|
|
+ stroke_line(cr, pad, bottom, w - pad, bottom, MUTED, 0.65);
|
|||
|
|
+ text(cr, title, trace_left + 4.0, top + row_height * 0.17,
|
|||
|
|
+ (row_height * 0.11).clamp(10.0, 17.0), color, false);
|
|||
|
|
draw_trace(cr, channel, color, trace_left, trace_right,
|
|||
|
|
- top + trace_row_height * 0.25, bottom - trace_row_height * 0.06, p, sim);
|
|||
|
|
- let vital_top = header + index as f64 * vital_row_height;
|
|||
|
|
- stroke_line(cr, split_x, vital_top + vital_row_height,
|
|||
|
|
- w - pad, vital_top + vital_row_height, MUTED, 0.65);
|
|||
|
|
+ top + row_height * 0.25, bottom - row_height * 0.06, p, sim);
|
|||
|
|
draw_vitals(cr, channel, color, split_x + pad,
|
|||
|
|
- vital_top, vital_row_height, sidebar - 2.0 * pad, p, sim);
|
|||
|
|
+ top, row_height, sidebar - 2.0 * pad, p, sim);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- if p.show_nibp {
|
|||
|
|
- draw_nibp_box(cr, split_x + pad, h - pad - nibp_box_height,
|
|||
|
|
- sidebar - 2.0 * pad, nibp_box_height, 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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
+/// 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)
|
|||
|
|
+}
|
|||
|
|
+
|
|||
|
|
fn draw_nibp_box(cr: &Context, x: f64, top: f64, width: f64, height: f64,
|
|||
|
|
p: &Parameters, sim: &Simulator) {
|
|||
|
|
let right = x + width;
|
|||
|
|
@@ -548,6 +554,29 @@ fn text(cr: &Context, value: &str, x: f64, baseline: f64,
|
|||
|
|
mod tests {
|
|||
|
|
use super::*;
|
|||
|
|
|
|||
|
|
+ #[test]
|
|||
|
|
+ fn monitor_rows_align_waveforms_and_numbers_with_blank_nibp_left_cell() {
|
|||
|
|
+ let header = 60.0;
|
|||
|
|
+ let body_height = 700.0;
|
|||
|
|
+ let (height, nibp_top) = monitor_rows(header, body_height, 4, true);
|
|||
|
|
+ assert_eq!(height, 140.0);
|
|||
|
|
+ assert_eq!(nibp_top, Some(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);
|
|||
|
|
+ }
|
|||
|
|
+
|
|||
|
|
+ #[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));
|
|||
|
|
+ }
|
|||
|
|
+
|
|||
|
|
#[test]
|
|||
|
|
fn alarm_states_do_not_trigger_for_unavailable_readouts() {
|
|||
|
|
let p = Parameters::default();
|