moce patches
This commit is contained in:
parent
2c0dc760d9
commit
5665d68db0
37 changed files with 1472 additions and 570 deletions
65
patches/patient-monitor-simulation-v0.5.4-to-v0.5.5.patch
Normal file
65
patches/patient-monitor-simulation-v0.5.4-to-v0.5.5.patch
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "patient-monitor-simulation"
|
||||
-version = "0.5.4"
|
||||
+version = "0.5.5"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -490,3 +490,8 @@
|
||||
- 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.
|
||||
+
|
||||
+
|
||||
+### 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.
|
||||
--- a/README.de.md
|
||||
+++ b/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.
|
||||
+
|
||||
+
|
||||
+### 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.
|
||||
--- a/src/simulation.rs
|
||||
+++ b/src/simulation.rs
|
||||
@@ -154,9 +154,12 @@
|
||||
}
|
||||
|
||||
fn pleth_wave(&self) -> f64 {
|
||||
- // A delayed, deliberately weak mechanical pleth pulse.
|
||||
- let phase = (self.phase - 0.26).rem_euclid(1.0);
|
||||
- smooth_step(phase / 0.27) * (1.0 - smooth_step((phase - 0.27) / 0.62))
|
||||
+ // A delayed, low-amplitude pulse for effective CPR. Using a bounded
|
||||
+ // within-compression phase instead of wrapping the delay prevents
|
||||
+ // a pulse's trailing portion leaking into the *next* compression.
|
||||
+ let phase = self.phase - 0.25;
|
||||
+ if phase <= 0.0 { return 0.0; }
|
||||
+ smooth_step(phase / 0.22) * (1.0 - smooth_step((phase - 0.35) / 0.35))
|
||||
}
|
||||
|
||||
fn ecg_artifact(&self, time: f64) -> f64 {
|
||||
@@ -751,8 +754,12 @@
|
||||
assert_eq!(sim.spo2_quality(&p), Spo2Quality::Poor);
|
||||
assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||
assert!(sim.spo2_pulse_rate(&p).is_some_and(|v| (90..=110).contains(&v)));
|
||||
- assert!(sim.samples.iter().rev().take(400).any(|s| s.pleth > 0.05 && s.pleth_valid));
|
||||
- assert!(sim.samples.iter().rev().take(400).all(|s| s.pleth_quality == Spo2Quality::Poor));
|
||||
+ let recent: Vec<_> = sim.samples.iter().rev().take(400).collect();
|
||||
+ let max_valid_pleth = recent.iter().filter(|s| s.pleth_valid)
|
||||
+ .map(|s| s.pleth).fold(0.0_f64, f64::max);
|
||||
+ assert!(max_valid_pleth > 0.05,
|
||||
+ "good CPR in VF must generate valid pleth pulses; max valid amplitude={max_valid_pleth:.4}");
|
||||
+ assert!(recent.iter().all(|s| s.pleth_quality == Spo2Quality::Poor));
|
||||
}
|
||||
|
||||
#[test]
|
||||
Loading…
Reference in a new issue