Introduce crate-level ekg module and re-export EkgLead, EkgMonitor,
EkgSnapshot, and HeartElectricalState from lib.
Patient now owns an optional EKG monitor that:
- auto-initializes and syncs to the first Heart organ (lead count)
- supports configure_ekg_leads() for custom lead sets
- exposes ekg_monitor(), ekg_monitor_mut(), and ekg_snapshot()
- is advanced during Patient::update() by observing heart electrical
state
- contributes to patient_summary() output
Examples:
- demo_app adds "set ekg <lead...>" command
- dashboard renders Electrocardiogram section (rhythm, rate, axis,
lead amplitudes)
- lead parsing and human-readable labels added
Organs:
- export CardiacRhythmState from organs::heart
- minor refactors in heart (dedupe impl placement), bladder and brain
code style cleanups
Tests:
- extend patient_lifecycle with EKG assertions
- add ekg_monitor_tracks_leads to validate lead config and snapshot
No breaking changes.
Revamp the console monitor UI in examples/demo_app.rs with ANSI-colored
sections and improved layout for readability.
- Add color palette, dashboard width, and styling helpers
- Introduce banner, section, and stat line builders
- Colorize prompt, status lines, and organ snapshots
- Display validity tags for measurements and styled warnings/errors
- Restructure output into Simulation, Circulation, Heart, Organ
Snapshots, and Status sections
- Cache TTY color detection via OnceLock and respect NO_COLOR
No API changes; improvements are limited to the example app.
- Heart:
- Raise baseline SVR to 18.5 and derive initial CO/afterload from baseline
- Correct baroreflex direction: SVR increases with sympathetic tone
- Recompute BP via raw diastolic + pulse pressure relationship
- Tighten clamps for physiologic ranges and stabilize resting state
- Add unit test: resting_state_stays_stable
- Bladder:
- Replace steep nonlinear compliance with scaled linear compliance
- Add volume-based abdominal term and nonlinear passive gain
- Reduce active pressure gain and clamp max pressure to 80 cm H2O
- Patient/tests:
- Add multi-organ homeostasis stability integration test (5h sim)
- Assert physiologic bounds across lungs, brain, kidneys, liver,
GI, pancreas, spleen, bladder, esophagus, and spinal cord
- Build/examples:
- Add demo-monitor feature flag and demo_app example
These changes improve physiologic realism and long-run stability while
adding coverage to prevent regressions.