CardioTwin
Converting old research on heart simulations into a functioning web app.
Core trick
Ports MATLAB cardiac model kernels to a backend that streams signaling-inhibition updates into synchronized ECG and pumping outputs.
Description
Converting old research on heart simulations into a functioning web app.
README excerpt
# CardioTwin CardioTwin is an interactive cardiac simulation app built for the OpenAI Codex Hackathon. It lets users inhibit signaling pathways and observe synchronized downstream effects across: - molecular signaling activity - electrical behavior (ECG-like trace) - mechanical pumping behavior The project combines two parallel build streams: - converted MATLAB model kernels for backend dynamics - interactive React simulation UI for intervention and visualization ## Project Goals - Demonstrate causal pathway intervention, not static visualization. - Show real-time propagation from signaling changes to electrical and mechanical outputs. - Keep a stable frontend/backend API contract for rapid iteration. ## How It Works 1. The UI sends pathway inhibition updates (`0.0 -> 1.0`) to the backend. 2. The backend maps those controls to converted model parameters (`Ltot`, `Atot`, `FSK`, `IBMX`). 3. The converted ODE model advances by simulation steps. 4. The API returns a single state envelope with: - pathway activity values - ECG proxy trace points - pumping phase and pump metric ## Architecture - `frontend/`: React + Vite app with interactive signaling diagram, ECG panel, and heart mechanics panel. - `backend/`: FastAPI simulation API. - `backend/converted_model/`: translated MATLAB equations and scenario helpers. - `models/`: original MATLAB assets (`.m`, `.mat`, calibration inputs). ## API - `GET /health` - `GET /state` - `POST /simulate/step` - `POST /interven