Commit Graph

41 Commits

Author SHA1 Message Date
zack3d bf1e547a8c feat(lungs): add breathing cycle and diaphragm kinematics
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.
2025-09-28 15:03:12 -07:00
zack3d a74f9c408b feat(patient): add EKG monitor with configurable leads
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.
2025-09-26 01:01:46 -07:00
zack3d 0e6365bf7f ci(artifacts): build and package demo app artifacts cross-target
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 22s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 19s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 2m3s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 2m3s
Multi-Platform CI / Create GitHub Release (push) Successful in 29s
- 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
2025-09-24 03:09:19 -07:00
zack3d a7638c411a feat(examples): add colorized dashboard to demo
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.
2025-09-24 03:06:22 -07:00
zack3d 886484919d feat(organs): retune heart and bladder dynamics
- 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.
2025-09-24 02:55:29 -07:00
zack3d 21b9ca894f ver inc
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 18s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Has been skipped
Multi-Platform CI / Package for Windows x86_64 (push) Has been skipped
Multi-Platform CI / Create GitHub Release (push) Has been skipped
v0.2.0
2025-09-24 02:03:26 -07:00
zack3d d849f71127 feat(patient): integrate brain/bladder/esophagus/stomach coupling
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.
2025-09-24 02:01:53 -07:00
zack3d f439894864 feat(organs): add detailed physiology + coupling
- 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.
2025-09-24 01:34:34 -07:00
zack3d dea5049be5 ci(workflows): add git --stat to AI release notes
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.
2025-09-24 00:50:53 -07:00
zack3d 052eeb447c bruh
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 21s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Has been skipped
Multi-Platform CI / Package for Windows x86_64 (push) Has been skipped
Multi-Platform CI / Create GitHub Release (push) Has been skipped
v0.1.1
2025-09-24 00:42:19 -07:00
zack3d 8f4fabd630 Test Incrament
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 19s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Failing after 35s
Multi-Platform CI / Package for Windows x86_64 (push) Failing after 36s
Multi-Platform CI / Create GitHub Release (push) Has been skipped
2025-09-24 00:40:05 -07:00
zack3d e548c13f8c ci(workflows): fix jq selector for AI release notes
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 19s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 1m11s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 1m13s
Multi-Platform CI / Create GitHub Release (push) Successful in 16s
Update response path from .choices[0].text to
.output[1].content[0].text to match API response schema and
restore successful notes generation
2025-09-24 00:35:03 -07:00
zack3d cde8b70bd3 ci(workflows): add AI release notes with fallback
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 19s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 1m13s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 1m14s
Multi-Platform CI / Create GitHub Release (push) Successful in 18s
- 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
2025-09-24 00:19:19 -07:00
zack3d 8a4d4b1b75 ci(workflows): use release action and simplify notes
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 18s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Has been skipped
Multi-Platform CI / Package for Windows x86_64 (push) Has been skipped
Multi-Platform CI / Create GitHub Release (push) Has been skipped
- 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.
v0.1.0
2025-09-24 00:12:36 -07:00
zack3d b1ac4a0b78 ci(workflows): add release job with notes, assets
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 22s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 1m10s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 1m12s
Multi-Platform CI / Create GitHub Release (push) Successful in 17s
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
2025-09-23 23:54:05 -07:00
zack3d 5561118b45 ci(workflows): upload dist directory as artifact
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 20s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 1m10s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 1m18s
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.
2025-09-23 23:43:17 -07:00
zack3d b5b6619118 refactor(ffi): generate header via cbindgen
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.
2025-09-23 23:16:53 -07:00
zack3d b1be9d63dc wee
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 22s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Successful in 58s
Multi-Platform CI / Package for Windows x86_64 (push) Successful in 54s
2025-09-23 20:53:25 -07:00
zack3d 8785546403 bu
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 23s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux (push) Successful in 39s
Multi-Platform CI / Package for Windows (Cross-Compiled) (push) Successful in 55s
2025-09-23 20:47:16 -07:00
zack3d 5f51ebd62f weh
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 22s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / package (ubuntu-22.04) (push) Successful in 37s
Multi-Platform CI / package (windows-latest) (push) Successful in 36s
2025-09-23 20:38:33 -07:00
zack3d eeec0f42b3 bruh
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 21s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 17s
Multi-Platform CI / package (ubuntu-22.04) (push) Successful in 35s
Multi-Platform CI / package (windows-latest) (push) Successful in 36s
2025-09-23 20:21:00 -07:00
zack3d db523f7af5 wf
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 22s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 17s
Multi-Platform CI / package (ubuntu-22.04) (push) Failing after 27s
Multi-Platform CI / package (windows-latest) (push) Failing after 26s
2025-09-23 20:18:02 -07:00
zack3d c0ab799d34 Delete .gitea/workflows/ci.yml
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 19s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / package (ubuntu-22.04) (push) Successful in 52s
Multi-Platform CI / package (windows-latest) (push) Successful in 57s
2025-09-24 05:11:16 +02:00
zack3d 4edfb42fdd gg
Quick CI / quick-test (push) Failing after 1m14s
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 19s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / package (ubuntu-22.04) (push) Successful in 53s
Multi-Platform CI / package (windows-latest) (push) Successful in 56s
2025-09-22 03:02:41 -07:00
zack3d b9ff7f6495 balls
Quick CI / quick-test (push) Failing after 1m12s
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 6m0s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 5m46s
Multi-Platform CI / package (ubuntu-22.04) (push) Successful in 6m21s
Multi-Platform CI / package (windows-latest) (push) Successful in 6m18s
2025-09-22 01:05:11 -07:00
zack3d 3fc010301d dez
Quick CI / quick-test (push) Failing after 1m12s
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 7m13s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 7m8s
Multi-Platform CI / package (ubuntu-22.04) (push) Failing after 7m12s
Multi-Platform CI / package (windows-latest) (push) Failing after 7m13s
2025-09-22 00:24:27 -07:00
zack3d d71b0ec5ff hgdhgfcvbncnb
Quick CI / quick-test (push) Failing after 1m16s
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Failing after 1m23s
Multi-Platform CI / test-platforms (windows-latest) (push) Failing after 1m21s
Multi-Platform CI / package (ubuntu-22.04) (push) Has been skipped
Multi-Platform CI / package (windows-latest) (push) Has been skipped
2025-09-22 00:04:53 -07:00
zack3d 5d01c3a261 vnbm
Quick CI / quick-test (push) Failing after 1m14s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 2m40s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 2m0s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m22s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m20s
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 23:57:41 -07:00
zack3d b0ac70dd19 hgjk
Quick CI / quick-test (push) Failing after 1m13s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 1m0s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 37s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m20s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m19s
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 23:50:28 -07:00
zack3d 837008b88a deez
Quick CI / quick-test (push) Failing after 1m13s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 52s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 36s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m14s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m13s
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 23:38:02 -07:00
zack3d 8095743cbf pain
Quick CI / quick-test (push) Failing after 1m18s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 1m35s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 40s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m14s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m14s
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 23:13:49 -07:00
zack3d 904f369c54 wtfgghdafg
Quick CI / quick-test (push) Failing after 1m16s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 40s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 39s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m15s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m15s
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 23:07:50 -07:00
zack3d eb63ffc7db wf
Quick CI / quick-test (push) Failing after 1m14s
Multi-Platform CI / test-platforms (macos-latest, aarch64-apple-darwin) (push) Failing after 39s
Multi-Platform CI / test-platforms (macos-latest, x86_64-apple-darwin) (push) Failing after 38s
Multi-Platform CI / test-platforms (ubuntu-22.04, aarch64-unknown-linux-gnu) (push) Failing after 44s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 39s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 39s
Multi-Platform CI / test-native (macos-latest) (push) Failing after 1m16s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m14s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m15s
Multi-Platform CI / package (macos-latest, aarch64-apple-darwin) (push) Has been skipped
Multi-Platform CI / package (macos-latest, x86_64-apple-darwin) (push) Has been skipped
Multi-Platform CI / package (ubuntu-22.04, aarch64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 22:57:45 -07:00
zack3d 641114de60 wf
Quick CI / quick-test (push) Failing after 1m15s
Multi-Platform CI / test-platforms (macos-latest, aarch64-apple-darwin) (push) Failing after 56s
Multi-Platform CI / test-platforms (macos-latest, x86_64-apple-darwin) (push) Failing after 40s
Multi-Platform CI / test-platforms (ubuntu-22.04, aarch64-unknown-linux-gnu) (push) Failing after 1m20s
Multi-Platform CI / test-platforms (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Failing after 40s
Multi-Platform CI / test-platforms (windows-latest, aarch64-pc-windows-msvc) (push) Failing after 40s
Multi-Platform CI / test-platforms (windows-latest, x86_64-pc-windows-msvc) (push) Failing after 39s
Multi-Platform CI / test-native (macos-latest) (push) Failing after 1m16s
Multi-Platform CI / test-native (ubuntu-22.04) (push) Failing after 1m16s
Multi-Platform CI / test-native (windows-latest) (push) Failing after 1m17s
Multi-Platform CI / package (macos-latest, aarch64-apple-darwin) (push) Has been skipped
Multi-Platform CI / package (macos-latest, x86_64-apple-darwin) (push) Has been skipped
Multi-Platform CI / package (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been skipped
Multi-Platform CI / package (windows-latest, x86_64-pc-windows-msvc) (push) Has been skipped
2025-09-21 22:47:43 -07:00
zack3d c96e04191a wf
CI / build (push) Failing after 1m18s
2025-09-21 22:34:07 -07:00
zack3d b81fe009e1 bf
CI / build (push) Failing after 35s
2025-09-21 22:28:17 -07:00
zack3d dd9eb361e9 wf
CI / build (push) Failing after 34s
2025-09-21 02:29:36 -07:00
zack3d 750d6beee4 wf
CI / build (push) Failing after 17s
2025-09-21 02:27:05 -07:00
zack3d 0ddfe92f69 wf
CI / build (push) Has been cancelled
2025-09-21 02:21:11 -07:00
zack3d 08a134193a wf
CI / build (push) Has been cancelled
2025-09-21 02:16:06 -07:00
zack3d 0502c756c1 init 2025-09-21 02:14:44 -07:00