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.
635 lines
30 KiB
Diff
635 lines
30 KiB
Diff
--- a/Cargo.toml
|
||
+++ b/Cargo.toml
|
||
@@ -1,6 +1,6 @@
|
||
[package]
|
||
name = "patient-monitor-simulation"
|
||
-version = "0.6.0"
|
||
+version = "0.6.1"
|
||
edition = "2021"
|
||
license = "MIT"
|
||
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||
--- a/README.de.md
|
||
+++ b/README.de.md
|
||
@@ -1,4 +1,4 @@
|
||
-# Patient Monitor Simulation (PaMSim) — v0.6.0
|
||
+# Patient Monitor Simulation (PaMSim) — v0.6.1
|
||
|
||
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||
|
||
@@ -26,80 +26,52 @@
|
||
Beim Ausblenden anderer Parameter werden die verbleibenden Kurvenzeilen wie
|
||
bisher dynamisch verteilt.
|
||
|
||
-## EKG-Bedienung direkt am Monitor (v0.5.9)
|
||
-
|
||
-Durch Berühren oder Anklicken der **EKG-Zeile** öffnet sich ein eigenes
|
||
-Einstellfenster mit **hellgrauer Schrift auf schwarzem Hintergrund**. Die gesamte
|
||
-EKG-Zeile ist aktiv, sowohl die Kurve links (75 %) als auch das numerische
|
||
-Herzfrequenzfeld rechts (25 %). Die Bedienung ist auch im Vollbildmodus möglich.
|
||
-Bei ausgeblendetem EKG ist die Interaktionsfläche deaktiviert.
|
||
-
|
||
-Im Einstellfenster stehen folgende Optionen zur Verfügung:
|
||
-
|
||
-- **ECG lead:** I, II (Voreinstellung), III, aVR, aVL, aVF und V1–V6. Nach
|
||
- **Apply** ändert sich die Ableitungsbezeichnung im Monitor sowie die
|
||
- schematische Polarität/Amplitude der Kurve. Es handelt sich **nicht** um
|
||
- eine klinisch validierte 12-Kanal-EKG-Ableitung. Frequenz, QRS-Zeitpunkte
|
||
- und mechanische Pulskopplung bleiben unverändert.
|
||
-- **HR alarm limits:** unabhängig einstellbare untere (↓) und obere (↑)
|
||
- Herzfrequenzgrenze in /min. Große Tasten **− / +** ändern den jeweiligen
|
||
- Grenzwert in **5er-Schritten** zwischen 0 und 240. Mit **OFF** lässt sich
|
||
- jede Grenze einzeln deaktivieren; **ON** aktiviert den vorherigen Wert
|
||
- erneut (bei anfänglich nicht gesetzten Werten 60 bzw. 100 /min).
|
||
- Die untere Grenze darf die obere nicht überschreiten.
|
||
-- **Apply** übernimmt beide Alarmgrenzen und die Ableitung gemeinsam;
|
||
- **Cancel** oder **Esc** verwirft die noch nicht übernommenen Eingaben.
|
||
-
|
||
-Die Bedienelemente sind ohne Tastatur verwendbar. Schmale hellgraue
|
||
-Begrenzungslinien und Trennlinien orientieren sich an der Gestaltung des
|
||
-Monitors; die EKG-spezifische grüne Textfarbe wird hier nicht verwendet.
|
||
-
|
||
-Die Einstellungen werden mit der Admin-Oberfläche synchronisiert. Eine am
|
||
-Monitor geänderte Alarmgrenze schaltet die Alarmvoreinstellung auf **Custom**.
|
||
-Auch in der Admin-Oberfläche ist die EKG-Ableitung auswählbar. Die anderen
|
||
-Monitorparameter besitzen ab v0.6.0 ebenfalls berührungsempfindliche Menüs.
|
||
-
|
||
-## Weitere Touch-Menüs am Monitor (v0.6.0)
|
||
-
|
||
-Ein Tipp auf die **Kurve oder die numerischen Werte** von SpO₂, ART oder CO₂
|
||
-öffnet das zugehörige Einstellfenster. Für NIBP ist das **rechte Viertel der
|
||
-untersten Messwertzeile** aktiv. Die Felder CO/CI, SVRI/GEDI/ELWI und das
|
||
-unbelegte dritte Feld erhalten noch keine Touch-Bedienung. Alle Menüs
|
||
-verwenden das Design des EKG-Menüs: **schwarzer Hintergrund, hellgraue Schrift
|
||
-und 0,8 Pixel breite Trennlinien**. Eine Bildschirmtastatur ist nicht nötig.
|
||
-
|
||
-| Bereich | Alarmgrenzen | Weitere Einstellungen |
|
||
+## Touch-Bedienung am Monitor: ausschließlich Alarmgrenzen (v0.6.1)
|
||
+
|
||
+Durch Berühren oder Anklicken der **Kurve oder des numerischen Wertefeldes**
|
||
+von EKG, SpO₂, ART oder CO₂ öffnet sich das entsprechende Alarmmenü. Bei
|
||
+NIBP ist das **rechte Viertel der untersten Wertezeile** aktiv. Die übrigen
|
||
+drei Wertefelder der untersten Zeile bleiben vorerst ohne Touch-Funktion.
|
||
+Die Menüs funktionieren auch im Vollbildmodus und verwenden **schwarzen
|
||
+Hintergrund, sehr hellgraue Schrift sowie 0,8 Pixel breite Begrenzungs-
|
||
+und Trennlinien** wie der Hauptmonitor.
|
||
+
|
||
+**Am Monitor können ausschließlich Alarmgrenzen eingestellt werden.**
|
||
+Für jede untere und obere Alarmgrenze stehen große **−/+**-Tasten sowie
|
||
+separate **ON/OFF**-Tasten zur Verfügung. Nicht gesetzte Grenzwerte sind
|
||
+deaktiviert. Ein unterer Grenzwert darf den oberen nicht überschreiten.
|
||
+Eine Bildschirmtastatur ist nicht erforderlich.
|
||
+
|
||
+| Monitorbereich | Einstellbare Alarmgrenzen | Schrittweite |
|
||
| --- | --- | --- |
|
||
-| SpO₂ | SpO₂, Pulsfrequenz (PR) | Signalqualität, Sensor angeschlossen/nicht angeschlossen |
|
||
-| ART | SYS, MAP, DIA, PPV | Form der arteriellen Druckkurve |
|
||
-| CO₂ | EtCO₂, Atemfrequenz (RR) | Normales oder obstruktives Kapnogramm |
|
||
-| NIBP | SYS, MAP, DIA | Intervall 1/3/5/10/20/30/60 min, Auto ON/OFF, Messausfall, Manschettenlokalisation und **Measure now** |
|
||
-
|
||
-Die einzelnen unteren und oberen Alarmgrenzen werden mit großen **−/+**-
|
||
-und **ON/OFF**-Tasten verändert. Die Schrittweiten betragen 5 /min bei PR,
|
||
-1 % bei SpO₂ und PPV, 5 mmHg bei ART/NIBP, 1 mmHg bei EtCO₂ und
|
||
-1 /min bei der Atemfrequenz. Eine untere Grenze darf nicht höher liegen
|
||
-als die obere.
|
||
-
|
||
-Mit **Apply** werden die Änderungen übernommen und zugleich die Admin-
|
||
-Oberfläche aktualisiert; eine geänderte Alarmgrenze setzt das Preset auf
|
||
-**Custom**. **Cancel** verwirft die Eingaben, **Esc** schließt das Fenster.
|
||
-Die Schaltfläche **Measure now** führt dagegen eine sofortige NIBP-Messung
|
||
-mit den *bereits übernommenen* Einstellungen aus. Änderungen für diese
|
||
-Messung müssen daher zuerst mit **Apply** bestätigt werden.
|
||
+| EKG | Herzfrequenz (HR) | 5/min |
|
||
+| SpO₂ | SpO₂; Pulsfrequenz (PR) | 1 % SpO₂; 5/min PR |
|
||
+| ART | SYS; MAP; DIA; PPV | 5 mmHg Druck; 1 % PPV |
|
||
+| CO₂ | EtCO₂; Atemfrequenz (RR) | 1 mmHg EtCO₂; 1/min RR |
|
||
+| NIBP | SYS; MAP; DIA | 5 mmHg |
|
||
+
|
||
+**Apply** übernimmt die Alarmgrenzen und synchronisiert das Admin-Fenster.
|
||
+Bei manueller Änderung wechselt das Alarm-Preset zu **Custom**. Mit
|
||
+**Cancel** oder **Esc** werden nicht übernommene Änderungen verworfen.
|
||
+
|
||
+Die Auswahl der EKG-Ableitung, SpO₂-Signalqualität und Sensorverbindung,
|
||
+der arteriellen Kurvenform, der Kapnogrammform sowie **sämtliche NIBP-
|
||
+Messfunktionen** sind ausschließlich im **Admin-Fenster** verfügbar. Dazu
|
||
+zählen Messintervall, automatische Messung, **Measure now**, simulierter
|
||
+Messausfall und Manschettenlokalisation. Diese Parameter können über die
|
||
+Alarmmenüs am Monitor nicht verändert werden.
|
||
|
||
### NIBP beim Programmstart
|
||
|
||
Die **automatische NIBP-Messung ist beim Start ausgeschaltet**. Anfangs
|
||
-zeigt der Monitor `---/---` (MAP `---`); es wird keine Messung durchgeführt.
|
||
-Erst **Measure now** oder das Aktivieren von **Automatic measurement**
|
||
-im NIBP-Touch-Menü (alternativ im Admin-Fenster) startet eine erste Messung.
|
||
-Wird Auto eingeschaltet, beginnt der erste Zyklus sofort; danach wird das
|
||
-eingestellte Intervall jeweils ab Ende der letzten Messung gezählt.
|
||
-Das Ausschalten von Auto verhindert neue automatische Messungen, bricht
|
||
-einen bereits begonnenen Zyklus jedoch nicht ab. **Measure now** bleibt
|
||
-bei ausgeschalteter Automatik nutzbar, solange keine Messung läuft.
|
||
-Bei Auto OFF ist der Intervallbalken leer und `AUTO OFF` wird angezeigt.
|
||
+zeigt der Monitor `---/---` (MAP `---`); es findet keine Messung statt.
|
||
+Die erste Messung wird über **Measure now** im Admin-Fenster oder durch
|
||
+Aktivieren von **Automatic NIBP measurement** ausgelöst. Beim Einschalten
|
||
+von Auto beginnt sofort ein Messzyklus; das Intervall zählt anschließend
|
||
+jeweils ab Ende der vorherigen Messung. Beim Ausschalten von Auto wird
|
||
+eine bereits laufende Messung nicht abgebrochen. **Measure now** funktioniert
|
||
+auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
||
+und der Monitor zeigt `AUTO OFF`.
|
||
|
||
## Thoraxkompressionen (v0.5.4)
|
||
|
||
@@ -614,3 +586,11 @@
|
||
kein NIBP-Messwert vorhanden; der erste Zyklus muss manuell oder durch
|
||
Aktivieren der Automatik gestartet werden. Die bisherige NIBP-Messlogik
|
||
wird ansonsten unverändert weiterverwendet.
|
||
+
|
||
+### v0.6.1 – Touch-Menüs ausschließlich für Alarmgrenzen
|
||
+
|
||
+Alle Touch-Menüs für EKG, SpO₂, ART, CO₂ und NIBP enthalten jetzt nur noch
|
||
+untere und obere Alarmgrenzen. EKG-Ableitung, Signal- und Sensoreinstellungen,
|
||
+Kurvenformen sowie NIBP-Messfunktionen wurden aus den Monitor-Menüs entfernt
|
||
+und bleiben im Admin-Fenster verfügbar. Die Simulationslogik, Alarmprüfung
|
||
+und das NIBP-Startverhalten wurden nicht verändert.
|
||
--- a/README.md
|
||
+++ b/README.md
|
||
@@ -1,4 +1,4 @@
|
||
-# Patient Monitor Simulation (PaMSim) — v0.6.0
|
||
+# Patient Monitor Simulation (PaMSim) — v0.6.1
|
||
|
||
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||
|
||
@@ -23,79 +23,49 @@
|
||
bottom measurement row and other three groups remain present. Disabling one
|
||
of the four waveform channels still reflows the remaining rows above it.
|
||
|
||
-## ECG touchscreen settings (v0.5.9)
|
||
-
|
||
-Tap or click **anywhere in the ECG row**, on either the **trace (left 75%)** or
|
||
-**heart-rate readout (right 25%)**, to open a modal **black-and-light-grey ECG settings**
|
||
-window above the monitor. The same interaction works when the monitor is in
|
||
-fullscreen mode. The same interaction now applies to the other channels.
|
||
-Hiding
|
||
-the ECG channel also disables its touch target.
|
||
-
|
||
-The menu offers:
|
||
-
|
||
-- **ECG lead:** I, II (default), III, aVR, aVL, aVF, and V1–V6. The monitor
|
||
- trace label changes immediately after **Apply**, and the waveform undergoes
|
||
- an *illustrative lead-dependent gain/polarity transformation*. This is **not**
|
||
- a diagnostic 12-lead ECG derivation; cardiac timing, HR and mechanical
|
||
- capture do not change when the lead changes.
|
||
-- **HR alarm limits:** optional **↓ Lower** and **↑ Upper**, in bpm.
|
||
- Each limit has large **− / +** touch buttons that adjust the value in
|
||
- **5 bpm steps** (range 0–240), plus an **OFF** button to disable it.
|
||
- When disabled, an **ON** button restores its previous value (or 60 bpm
|
||
- for an unset lower limit and 100 bpm for an unset upper limit).
|
||
- The lower limit must not exceed the upper limit.
|
||
-- **Apply** commits lead and limits together; **Cancel** or **Esc** discards
|
||
- unsaved changes. Both Admin and monitor displays reflect committed changes.
|
||
- Changing limits in the monitor marks the Admin alarm preset as **Custom**.
|
||
-
|
||
-The menu uses light-grey text instead of the ECG waveform color and
|
||
-subtle separators matching the main monitor divider thickness. No keyboard
|
||
-is required for the ECG menu; the Admin window retains numeric text inputs.
|
||
-
|
||
-The Admin ECG section also includes an ECG-lead selector, synchronized with
|
||
-changes made from the monitor. SpO₂, ART, CO₂ and NIBP now also have
|
||
-neutral, touch-operated settings panels (details below).
|
||
-
|
||
-## Additional monitor touchscreen menus (v0.6.0)
|
||
-
|
||
-Tap or click the **waveform or numeric readout** of SpO₂, ART or CO₂ to open
|
||
-that channel's settings panel. For NIBP, tap the **rightmost quarter of the
|
||
-bottom measurement row**. The CO/CI, SVRI/GEDI/ELWI and unused third cells
|
||
-remain non-interactive. All menus share the ECG menu's **black background,
|
||
-light-grey text and thin 0.8 px dividers**. No on-monitor keyboard is needed.
|
||
-
|
||
-| Touched channel | Alarm thresholds | Other touch settings |
|
||
+## Monitor touchscreen: alarm limits only (v0.6.1)
|
||
+
|
||
+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.
|
||
+
|
||
+**Only alarm thresholds can be modified from the monitor-side menus.**
|
||
+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 |
|
||
| --- | --- | --- |
|
||
-| SpO₂ | SpO₂, PR | Signal quality; sensor attached/detached |
|
||
-| ART | SYS, MAP, DIA, PPV | Arterial waveform shape |
|
||
-| CO₂ | EtCO₂, RR | Normal or obstructive capnogram |
|
||
-| NIBP | SYS, MAP, DIA | 1/3/5/10/20/30/60-minute interval, Auto ON/OFF, simulated failed reading, cuff extremity, **Measure now** |
|
||
-
|
||
-Each independent alarm bound is changed via large **−/+** buttons and
|
||
-**ON/OFF**. Touch increments are appropriate for the measurement: 5 bpm for
|
||
-PR; 1% for SpO₂ and PPV; 5 mmHg for ART and NIBP; 1 mmHg for EtCO₂; and
|
||
-1 breath/min for RR. Lower bounds must not exceed upper bounds.
|
||
-
|
||
-**Apply** commits the settings and updates the Admin controls and selected
|
||
-alarm preset (**Custom** if limits were changed). **Cancel** discards edits;
|
||
-**Esc** closes the panel. **Measure now** is an immediate action and starts
|
||
-an NIBP cuff cycle independently of Apply, using the currently active
|
||
-simulation settings. Apply other changed settings first if they should affect
|
||
-the next manual measurement.
|
||
+| 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.
|
||
+
|
||
+ECG lead selection, SpO₂ signal quality and sensor status, ART waveform shape,
|
||
+capnogram shape, and all NIBP measurement controls are **Admin-only**. This
|
||
+includes NIBP measurement interval, Auto ON/OFF, **Measure now**, simulated
|
||
+failed reading, and cuff placement. None of these physiological or technical
|
||
+parameters is changed by the monitor-side alarm menus.
|
||
|
||
### NIBP startup and automatic measurements
|
||
|
||
-**Auto measurement is OFF by default.** The monitor displays `---/---`
|
||
-(MAP `---`) on startup, and there is **no automatic first measurement**.
|
||
-A first result appears only after selecting **Measure now**, or after
|
||
-activating **Automatic measurement** from the NIBP touch menu (also available
|
||
-in Admin). When Auto is first enabled, a measurement starts immediately;
|
||
-thereafter the selected interval counts from completion of the previous cycle.
|
||
-Switching Auto off prevents future scheduled cycles but **does not interrupt
|
||
-a cycle already under way**. Manual measurements can always be initiated
|
||
-when no cycle is running, even with Auto OFF. While Auto is OFF, the NIBP
|
||
-interval bar is empty and the display says `AUTO OFF`.
|
||
+**Auto measurement is OFF by default.** On startup the monitor shows
|
||
+`---/---` (MAP `---`) and no measurement is initiated. To obtain a reading,
|
||
+select **Measure now** in Admin, or enable **Automatic NIBP measurement**
|
||
+there. The first automatic cycle begins immediately after enabling Auto;
|
||
+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.
|
||
|
||
## Chest compressions (v0.5.4)
|
||
|
||
@@ -630,3 +600,11 @@
|
||
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.
|
||
+
|
||
+### 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.
|
||
--- a/src/ui.rs
|
||
+++ b/src/ui.rs
|
||
@@ -108,9 +108,8 @@
|
||
});
|
||
window.add_controller(keys);
|
||
|
||
- // One gesture covers each visible waveform/numeric row and the NIBP
|
||
- // quarter of the bottom row. Hit regions are computed by the renderer,
|
||
- // so mouse and Wayland touch share the same dynamic geometry.
|
||
+ // One gesture opens alarm-only panels for visible waveform/numeric rows
|
||
+ // and NIBP's bottom-right cell. Mouse and Wayland touch share geometry.
|
||
let monitor_menu: MonitorMenuHandle = Rc::new(RefCell::new(None));
|
||
let click = gtk::GestureClick::new();
|
||
click.connect_released({
|
||
@@ -127,7 +126,7 @@
|
||
Some(render::TouchChannel::Ecg) => open_ecg_menu(&app, &window,
|
||
params.clone(), admin_changed.clone(), monitor_menu.clone()),
|
||
Some(channel) => open_module_menu(&app, &window, params.clone(),
|
||
- simulator.clone(), admin_changed.clone(), monitor_menu.clone(), channel),
|
||
+ admin_changed.clone(), monitor_menu.clone(), channel),
|
||
None => (),
|
||
}
|
||
}
|
||
@@ -593,13 +592,6 @@
|
||
window.ecg-settings label.ecg-limit-value {
|
||
color: #e5e9eb; font-weight: bold; font-size: 19px;
|
||
}
|
||
- window.ecg-settings dropdown {
|
||
- color: #e5e9eb; background-color: #141414;
|
||
- border: 1px solid #6b757d; min-height: 48px;
|
||
- }
|
||
- window.ecg-settings dropdown button {
|
||
- color: #e5e9eb; background-color: #141414;
|
||
- }
|
||
window.ecg-settings button {
|
||
color: #e5e9eb; background-image: none;
|
||
background-color: #171717; border: 1px solid #6b757d;
|
||
@@ -726,10 +718,7 @@
|
||
existing.present();
|
||
return;
|
||
}
|
||
- let (limits, lead) = {
|
||
- let p = params.borrow();
|
||
- (p.alarms.hr, p.ecg_lead)
|
||
- };
|
||
+ let limits = params.borrow().alarms.hr;
|
||
let dialog = gtk::Window::builder()
|
||
.application(app)
|
||
.title("ECG settings")
|
||
@@ -737,7 +726,7 @@
|
||
.modal(true)
|
||
.resizable(false)
|
||
.default_width(550)
|
||
- .default_height(410)
|
||
+ .default_height(345)
|
||
.build();
|
||
dialog.add_css_class("ecg-settings");
|
||
dialog.set_decorated(false);
|
||
@@ -763,18 +752,6 @@
|
||
inner.append(&title);
|
||
inner.append(&ecg_menu_divider());
|
||
|
||
- let lead_row = gtk::Box::new(Orientation::Horizontal, 12);
|
||
- let lead_label = gtk::Label::new(Some("ECG lead"));
|
||
- lead_label.set_xalign(0.0);
|
||
- lead_label.set_width_chars(13);
|
||
- let lead_selector = gtk::DropDown::from_strings(EcgLead::LABELS);
|
||
- lead_selector.set_selected(lead.index());
|
||
- lead_selector.set_hexpand(true);
|
||
- lead_row.append(&lead_label);
|
||
- lead_row.append(&lead_selector);
|
||
- inner.append(&lead_row);
|
||
- inner.append(&ecg_menu_divider());
|
||
-
|
||
let limits_header = gtk::Label::new(Some("HR alarm limits · bpm"));
|
||
limits_header.set_xalign(0.0);
|
||
inner.append(&limits_header);
|
||
@@ -812,11 +789,9 @@
|
||
error.set_text("The lower limit must not exceed the upper limit.");
|
||
return;
|
||
}
|
||
- let new_lead = EcgLead::from_index(lead_selector.selected());
|
||
let alarm_changed = {
|
||
let mut p = params.borrow_mut();
|
||
let changed = p.alarms.hr != new_limits;
|
||
- p.ecg_lead = new_lead;
|
||
p.alarms.hr = new_limits;
|
||
changed
|
||
};
|
||
@@ -862,15 +837,6 @@
|
||
assert_eq!(stepped_hr_limit(None, 60, 1), 60);
|
||
assert_eq!(stepped_hr_limit(None, 100, -1), 100);
|
||
}
|
||
-}
|
||
-
|
||
-const NIBP_INTERVALS: [i32; 7] = [1, 3, 5, 10, 20, 30, 60];
|
||
-const NIBP_INTERVAL_LABELS: [&str; 7] = [
|
||
- "1 min", "3 min", "5 min", "10 min", "20 min", "30 min", "60 min"
|
||
-];
|
||
-
|
||
-fn nibp_interval_index(minutes: i32) -> u32 {
|
||
- NIBP_INTERVALS.iter().position(|&value| value == minutes).unwrap_or(2) as u32
|
||
}
|
||
|
||
/// Touchscreen alarm controls for a numerical value. The two bounds are
|
||
@@ -988,35 +954,25 @@
|
||
state
|
||
}
|
||
|
||
-fn module_touch_selector(parent: >k::Box, label: &str, items: &[&str],
|
||
- selected: u32) -> gtk::DropDown {
|
||
- let row = gtk::Box::new(Orientation::Horizontal, 12);
|
||
- let heading = gtk::Label::new(Some(label));
|
||
- heading.set_xalign(0.0);
|
||
- heading.set_width_chars(17);
|
||
- let dropdown = gtk::DropDown::from_strings(items);
|
||
- dropdown.set_selected(selected);
|
||
- dropdown.set_hexpand(true);
|
||
- row.append(&heading);
|
||
- row.append(&dropdown);
|
||
- parent.append(&row);
|
||
- dropdown
|
||
-}
|
||
-
|
||
-fn module_touch_checkbox(parent: >k::Box, text: &str, selected: bool) -> gtk::CheckButton {
|
||
- let control = gtk::CheckButton::with_label(text);
|
||
- control.set_active(selected);
|
||
- parent.append(&control);
|
||
- control
|
||
-}
|
||
-
|
||
-/// Open a modal settings panel using the same black, grey, 0.8 px divider and
|
||
-/// border design as the ECG panel. All settings except Measure now are drafts.
|
||
+/// A monitor-side menu may change only alarm limits. All patient and
|
||
+/// measurement configuration (including NIBP scheduling) stays Admin-only.
|
||
+fn apply_module_alarm_changes(
|
||
+ p: &mut Parameters,
|
||
+ limits: &[(fn(&mut AlarmSettings, AlarmLimits), AlarmLimits)],
|
||
+) -> bool {
|
||
+ let previous = p.alarms.clone();
|
||
+ for (setter, limit) in limits {
|
||
+ setter(&mut p.alarms, *limit);
|
||
+ }
|
||
+ p.alarms != previous
|
||
+}
|
||
+
|
||
+/// Open a modal alarm-limit panel with the same black, grey, 0.8 px divider
|
||
+/// and border design as the ECG panel. Other parameters are Admin-only.
|
||
#[allow(clippy::too_many_arguments)]
|
||
fn open_module_menu(app: &Application, monitor: &ApplicationWindow,
|
||
- params: SharedParams, simulator: Rc<RefCell<Simulator>>,
|
||
- on_change: AdminChanged, open_menu: MonitorMenuHandle,
|
||
- channel: render::TouchChannel) {
|
||
+ params: SharedParams, on_change: AdminChanged,
|
||
+ open_menu: MonitorMenuHandle, channel: render::TouchChannel) {
|
||
if let Some(existing) = open_menu.borrow().as_ref().and_then(|weak| weak.upgrade()) {
|
||
existing.present();
|
||
return;
|
||
@@ -1082,74 +1038,6 @@
|
||
inner.append(&ecg_menu_divider());
|
||
}
|
||
|
||
- // Dedicated sensor/measurement options relevant to each module.
|
||
- let mut mode_selector = None;
|
||
- let mut sensor_toggle = None;
|
||
- let mut nibp_auto = None;
|
||
- let mut nibp_force_failure = None;
|
||
- let mut cuff_on_spo2 = None;
|
||
- let mut cuff_on_art = None;
|
||
- match channel {
|
||
- render::TouchChannel::Spo2 => {
|
||
- mode_selector = Some(module_touch_selector(&inner, "Signal quality", &[
|
||
- "0 — None", "1 — Poor", "2 — Adequate", "3 — Good",
|
||
- ], current.spo2_quality as u32));
|
||
- sensor_toggle = Some(module_touch_checkbox(&inner,
|
||
- "Sensor not attached", !current.spo2_sensor_attached));
|
||
- }
|
||
- render::TouchChannel::Art => {
|
||
- mode_selector = Some(module_touch_selector(&inner, "Arterial waveform", &[
|
||
- "Normal", "Damped", "Hyperdynamic",
|
||
- ], match current.arterial_shape {
|
||
- ArterialShape::Normal => 0, ArterialShape::Damped => 1,
|
||
- ArterialShape::Hyperdynamic => 2,
|
||
- }));
|
||
- }
|
||
- render::TouchChannel::Capno => {
|
||
- mode_selector = Some(module_touch_selector(&inner, "Capnogram", &[
|
||
- "Normal", "Obstructive / shark fin",
|
||
- ], match current.capno_shape {
|
||
- CapnoShape::Normal => 0, CapnoShape::Obstructive => 1,
|
||
- }));
|
||
- }
|
||
- render::TouchChannel::Nibp => {
|
||
- mode_selector = Some(module_touch_selector(&inner, "Interval", &NIBP_INTERVAL_LABELS,
|
||
- nibp_interval_index(current.nibp_interval_minutes)));
|
||
- nibp_auto = Some(module_touch_checkbox(&inner, "Automatic measurement",
|
||
- current.nibp_auto_measurement));
|
||
- nibp_force_failure = Some(module_touch_checkbox(&inner, "No reading (simulate failure)",
|
||
- current.nibp_no_reading));
|
||
- cuff_on_spo2 = Some(module_touch_checkbox(&inner, "Cuff on SpO₂ extremity",
|
||
- current.nibp_cuff_on_spo2));
|
||
- cuff_on_art = Some(module_touch_checkbox(&inner, "Cuff on ART extremity",
|
||
- current.nibp_cuff_on_art));
|
||
- inner.append(&ecg_menu_divider());
|
||
- let measure = gtk::Button::with_label("Measure now");
|
||
- measure.set_size_request(-1, 54);
|
||
- inner.append(&measure);
|
||
- let status = gtk::Label::new(Some(
|
||
- "Manual measurement works even when Auto is OFF."
|
||
- ));
|
||
- status.set_xalign(0.0);
|
||
- status.set_wrap(true);
|
||
- inner.append(&status);
|
||
- measure.connect_clicked({
|
||
- let simulator = simulator.clone();
|
||
- let params = params.clone();
|
||
- move |_| {
|
||
- let in_progress = simulator.borrow().nibp().measuring();
|
||
- if in_progress {
|
||
- status.set_text("Measurement already in progress.");
|
||
- } else {
|
||
- simulator.borrow_mut().start_nibp_now(¶ms.borrow());
|
||
- status.set_text("Cuff measurement started.");
|
||
- }
|
||
- }
|
||
- });
|
||
- }
|
||
- render::TouchChannel::Ecg => (),
|
||
- }
|
||
- inner.append(&ecg_menu_divider());
|
||
let error = gtk::Label::new(None);
|
||
error.set_xalign(0.0);
|
||
error.add_css_class("menu-error");
|
||
@@ -1182,66 +1070,10 @@
|
||
}
|
||
selected_limits.push((field.apply, limits));
|
||
}
|
||
- let changed_alarms;
|
||
- {
|
||
+ let changed_alarms = {
|
||
let mut p = params.borrow_mut();
|
||
- let mut revised = p.alarms.clone();
|
||
- for (setter, limits) in selected_limits {
|
||
- setter(&mut revised, limits);
|
||
- }
|
||
- changed_alarms = revised != p.alarms;
|
||
- p.alarms = revised;
|
||
- match channel {
|
||
- render::TouchChannel::Spo2 => {
|
||
- if let Some(selector) = &mode_selector {
|
||
- p.spo2_quality = match selector.selected() {
|
||
- 1 => Spo2Quality::Poor,
|
||
- 2 => Spo2Quality::Adequate,
|
||
- 3 => Spo2Quality::Good,
|
||
- _ => Spo2Quality::None,
|
||
- };
|
||
- }
|
||
- if let Some(check) = &sensor_toggle {
|
||
- p.spo2_sensor_attached = !check.is_active();
|
||
- }
|
||
- }
|
||
- render::TouchChannel::Art => {
|
||
- if let Some(selector) = &mode_selector {
|
||
- p.arterial_shape = match selector.selected() {
|
||
- 1 => ArterialShape::Damped,
|
||
- 2 => ArterialShape::Hyperdynamic,
|
||
- _ => ArterialShape::Normal,
|
||
- };
|
||
- }
|
||
- }
|
||
- render::TouchChannel::Capno => {
|
||
- if let Some(selector) = &mode_selector {
|
||
- p.capno_shape = if selector.selected() == 1 {
|
||
- CapnoShape::Obstructive
|
||
- } else { CapnoShape::Normal };
|
||
- }
|
||
- }
|
||
- render::TouchChannel::Nibp => {
|
||
- if let Some(selector) = &mode_selector {
|
||
- p.nibp_interval_minutes = NIBP_INTERVALS
|
||
- .get(selector.selected() as usize).copied().unwrap_or(5);
|
||
- }
|
||
- if let Some(check) = &nibp_auto {
|
||
- p.nibp_auto_measurement = check.is_active();
|
||
- }
|
||
- if let Some(check) = &nibp_force_failure {
|
||
- p.nibp_no_reading = check.is_active();
|
||
- }
|
||
- if let Some(check) = &cuff_on_spo2 {
|
||
- p.nibp_cuff_on_spo2 = check.is_active();
|
||
- }
|
||
- if let Some(check) = &cuff_on_art {
|
||
- p.nibp_cuff_on_art = check.is_active();
|
||
- }
|
||
- }
|
||
- render::TouchChannel::Ecg => (),
|
||
- }
|
||
- }
|
||
+ apply_module_alarm_changes(&mut p, &selected_limits)
|
||
+ };
|
||
if let Some(callback) = on_change.borrow().as_ref() {
|
||
callback(changed_alarms);
|
||
}
|
||
@@ -1287,11 +1119,35 @@
|
||
}
|
||
|
||
#[test]
|
||
- fn interval_menu_maps_exactly_to_simulator_minutes() {
|
||
- for (index, minutes) in NIBP_INTERVALS.iter().copied().enumerate() {
|
||
- assert_eq!(nibp_interval_index(minutes), index as u32);
|
||
- }
|
||
- }
|
||
+ fn touchscreen_applies_only_alarm_limits_and_preserves_other_controls() {
|
||
+ let mut p = Parameters::default();
|
||
+ p.ecg_lead = EcgLead::V1;
|
||
+ p.spo2_quality = Spo2Quality::Poor;
|
||
+ p.spo2_sensor_attached = false;
|
||
+ p.arterial_shape = ArterialShape::Damped;
|
||
+ p.capno_shape = CapnoShape::Obstructive;
|
||
+ p.nibp_interval_minutes = 30;
|
||
+ p.nibp_auto_measurement = true;
|
||
+ p.nibp_no_reading = true;
|
||
+ p.nibp_cuff_on_spo2 = true;
|
||
+ p.nibp_cuff_on_art = true;
|
||
+ let limits = AlarmLimits { lower: Some(70), upper: Some(140) };
|
||
+ let spec = module_alarm_specs(render::TouchChannel::Nibp, &p).remove(0);
|
||
+ assert!(apply_module_alarm_changes(&mut p, &[(spec.apply, limits)]));
|
||
+ assert_eq!(p.alarms.nibp_sys, limits);
|
||
+ assert!(!apply_module_alarm_changes(&mut p, &[(spec.apply, limits)]));
|
||
+ assert_eq!(p.ecg_lead, EcgLead::V1);
|
||
+ assert_eq!(p.spo2_quality, Spo2Quality::Poor);
|
||
+ assert!(!p.spo2_sensor_attached);
|
||
+ assert_eq!(p.arterial_shape, ArterialShape::Damped);
|
||
+ assert_eq!(p.capno_shape, CapnoShape::Obstructive);
|
||
+ assert_eq!(p.nibp_interval_minutes, 30);
|
||
+ assert!(p.nibp_auto_measurement);
|
||
+ assert!(p.nibp_no_reading);
|
||
+ assert!(p.nibp_cuff_on_spo2);
|
||
+ assert!(p.nibp_cuff_on_art);
|
||
+ }
|
||
+
|
||
}
|
||
|
||
/// Frame a parameter section with an optional monitor-colored left sidebar.
|