a74f9c408bffe99ff4ed5c71fc87f63f0dffbd38
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.
medicallib_rust
MedicalSim core library rewrite in Rust.
- Safe, minimal API for medical simulation primitives
- Optional
serdefeature for serialization - Optional
ffifeature to expose a stable C ABI (cdylib)
Build
- Build:
cargo build(tests:cargo test) - FFI build:
cargo build --features ffi --release - Format/Lint:
cargo fmt --allandcargo clippy -D warnings
Examples
- Rust:
cargo run --example usageandcargo run --example patient - C FFI: see
examples/c/ffi_example.c, header inffi/medicallib.h
FFI ABI
- Opaque
MLPatienthandle - Functions:
medicallib_bmi,ml_patient_new/free/update,ml_patient_summary,ml_patient_organ_summary - All allocated strings must be freed with
ml_string_free
Version Matrix
- Rust 1.70+ (Edition 2021)
- OS: Linux, macOS, Windows (see GitHub Actions CI)
Docs
- Architecture:
ARCHITECTURE.md - Migration (C++ -> Rust):
MIGRATION.md - C/C++ install:
INSTALL.md
Packaging (binary distribution)
- Linux/macOS: run
../scripts/package.sh [target-triple]frommedicallib_rust/(ormake package). - Windows: run
..\scripts\package.ps1 [target-triple]frommedicallib_rust\. - Artifacts are placed in
medicallib_rust/dist/as both.tar.gz(Unix) and.zip.
CI: GitHub + Gitea
- GitHub Actions workflow:
.github/workflows/ci.yml - Gitea Actions workflow:
.gitea/workflows/ci.yml
Description