Introduce a time-based breathing cycle with phases and diaphragm
movement to improve realism and observability.
- Add BreathingPhase enum (Inhalation, Exhalation, Pause)
- Compute phase fractions/durations from RR and chemoreceptor drive
- Advance phases over time and update diaphragm position/velocity
- Call update_breath_cycle from Lungs::update
- Extend summary with phase and diaphragm position
- Re-export BreathingPhase and Lungs in lib and organs mod
- Add unit test for phase transitions and kinematics
No breaking changes; public API gains a new enum and fields.
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.
- cross-compile examples/demo_app with demo-monitor when
upload-artifacts is true and a target is provided
- package demo binary as medicallib_demo_app-<version>-<triple> archive
with bin/<demo_app> included
- add strict bash flags, ensure dist dir exists, and fail early if the
demo binary is missing
- use platform linkers via env for linux/windows GNU targets
- keep existing library package; now upload both artifacts
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.
Introduce richer neuro-visceral coupling and signal integration across
organs to improve physiological realism:
- Add Brain, Esophagus, Bladder, Stomach, Spinal signal structs
- Couple bladder with spinal autonomics and brain state to drive
parasympathetic/sympathetic/somatic outputs and thresholds
- Deliver esophageal bolus into stomach; update hiatal pressure and LES
tone from stomach distension/acid/motility
- Move stomach emptying into intestines within patient update loop
- Replace spleen state penalty with immune activity-based adjustment
- Simplify gallbladder control using intestinal nutrient energy
- Refine heart autonomic tone using brain/spinal outputs
- Re-export BladderPhase, SleepStage, EsophagealStage
No breaking API changes.
- Implement rich state machines and hemodynamic/metabolic models across
organs (brain, heart, lungs, kidneys, liver, stomach, intestines,
pancreas, gallbladder, spleen, spinal cord, bladder, esophagus)
- Add new enums for organ phases/states (e.g., SleepStage,
VentilatoryState, CardiacRhythmState, RenalAutoregulationState,
GastricPhase, etc.)
- Extend organ structs with explicit physiology fields; rewrite update()
loops and summaries to reflect realistic dynamics
- Wire inter-organ signaling in Patient (oxygenation, CPP, autonomic,
hormones, bile, bile acids, urine→bladder, gastric emptying→intestines)
using a relax_value smoothing helper
- Minor formatting in build.rs
BREAKING CHANGE: public organ structs gained/renamed fields and updated
summaries; code using struct literals or prior field names will break.
Use constructors (e.g., new()) and updated fields; summary outputs have
changed.
Use git log --stat since last tag (fallback to last 10) so the AI sees
file change stats, echo the log for visibility, and update the prompt to
reference "commits and changes" for more accurate, user-facing notes.
- add OPENAI_API_KEY env to release notes step
- attempt AI generation via OpenAI API using git log context
- write release_notes.md on success, otherwise fall back to simple notes
- handle missing API key or API errors gracefully
- update logging to print final release notes without blocking release
- Drop GPT-based release notes; generate from git log into
release_notes.md
- Remove OPENAI_API_KEY requirement
- Replace curl-based release creation and asset uploads with
akkuman/gitea-release-action@v1 (uses body_path and files)
- Add NODE_OPTIONS=--experimental-fetch for the action
This reduces complexity, removes an external dependency, and makes
releases more deterministic and maintainable.
Introduce a create-release job triggered on push to master/main. The job
downloads build artifacts, extracts the version from Cargo.toml,
determines the last tag, generates AI-based release notes from the git
log, creates a Gitea release, and uploads packaged assets.
- needs: package; runs on ubuntu-22.04
- downloads artifacts via gitea-download-artifact
- generates release notes using OpenAI (gpt-4o)
- creates release via Gitea API and uploads assets
Requires repository secrets:
- RELEASE_TOKEN for release creation and asset upload
- OPENAI_API_KEY for release notes generation
Switch artifact path from explicit tar.gz and zip globs to the
entire dist/ directory to capture all build outputs reliably and
simplify the workflow configuration.
Adopt cbindgen in the build script to keep the C header aligned with the
Rust FFI definitions. Store the patient handle as a void pointer to avoid
layout mismatches and refresh the generated header and repository
guidelines.