A CDA project built for QAS.AI — Dr. Ciprian Ionita
Heart Failure with Reduced Ejection Fraction

Sensor-Driven
Medication Titration
for Heart Failure

An AI agent that watches HFrEF patients through 5 wearable sensors and automatically decides when to adjust 4 life-saving medications — 24 hours a day, no clinic visit needed.

Only 1%
Reach Target Drug Doses
7
Clinical Research Papers
6,319
Real MIMIC-IV Patients
1.6M
Decision-Ready Rows

A lot goes wrong
between appointments

Patients are prescribed 4 drugs and told to return in 2 weeks. In between, nobody is watching.

The Numbers

2 wks
Average time between medication adjustments in current practice
47%
Of HFrEF patients also have Chronic Kidney Disease — complicating drug decisions
50%
5-year mortality rate — worse than many cancers
1%
Of eligible patients receive ALL 4 drugs at target doses simultaneously
💧

Fluid Builds Silently

Lung fluid accumulates between visits. By the time a patient feels breathless, they may already need hospital admission.

📉

Blood Pressure Drops Undetected

Dangerous hypotension can develop from medication interactions. Without monitoring, it goes unnoticed.

🔬

Kidney Function Declines

RAAS inhibitors and diuretics stress the kidneys. Creatinine and eGFR need continuous tracking to prevent acute injury.

🤖

Our Solution

5 wearable sensors. 7-step clinical logic. Automated drug decisions every 24 hours — based on 7 peer-reviewed guidelines.

5 sensors. Continuous.
Non-invasive.

Each sensor feeds directly into the logic engine. No manual readings. No patient visits.

🫀
ECG Patch
Heart rhythm + arrhythmia detection. Identifies AF which changes the HR target from 70 to 110 bpm.
→ Beta Blocker
🩺
Blood Pressure
Continuous systolic BP. Must be ≥ 100 mmHg before any RAAS uptitration. Gate 1 of the 3-gate check.
→ RAAS Gate
💓
Heart Rate + HRV
BPM vs target drives beta blocker decisions. HRV sudden drop is an early warning before other sensors degrade.
→ BB Titration
🫁
SpO₂ Sensor
Oxygen saturation. Below 90% overrides everything — immediate emergency escalation, all automated logic stops.
→ Emergency Gate
🌊
Impedance Patch
Thoracic fluid %. The most critical sensor. >35% = WET, <30% = DRY. This classification drives all 4 drug decisions.
→ ALL Drugs

Every rule traced to
a clinical paper

No rules are invented. Every IF-ELSE condition is directly cited to one of these 7 peer-reviewed publications.

01
AHA/ACC/HFSA 2022 HF Guidelines
Circulation, 2022
Foundation rulebook: 4 GDMT drugs, titration frequency, monitoring parameters, dose targets from landmark trials.
02
ACC 2024 Expert Consensus Pathway
JACC, 2024
Wet/dry concept, trajectory monitoring, 3-gate RAAS safety check (SBP + K+ + eGFR), SBP≥100 gate origin.
03
Wearable Sensors & Remote HF Monitoring
JACC Digital Health / PMC, 2023
SpO2 thresholds (normal ≥95%, emergency <90%), lung fluid normal <30%, critical >40%, HRV as early warning.
04
Diuretic Titration & Kidney Function
Michigan Medicine / ESC / CKJ, 2022–23
Creatinine safety thresholds (rise <0.5 safe, >50% stop), K+ tiers, eGFR safety zones, wet+kidney fail protocol.
05
Beta Blocker Titration in HFrEF
Circulation / Frontiers CV Medicine, 2023
Dry-before-you-try rule, exact HR targets (70 normal / 110 AF), COPD drug restriction (Bisoprolol/Metoprolol only).
06
RAAS Inhibitors: ACEi vs ARB vs ARNI
ACC 2024 / StatPearls
ARNI preference hierarchy, mandatory 36hr washout ACEi→ARNI, potassium binder strategy, creatinine reduce diuretic first.
07
SGLT2 Inhibitors + MRA in HFrEF
StatPearls 2025 / ESC 2023 / DAPA-HF / EMPEROR-Reduced
Fixed 10mg dose, eGFR dip is normal and expected, SGLT2 lowers K+ to protect MRA continuation, T1DM contraindication.

How data flows through
the system

From raw sensor readings to a structured drug decision — every step automated and traceable.

INPUT LAYER
5 Wearable Sensors
🫀
ECG Patch
HR, HRV, Arrhythmia
🩺
BP Sensor
Systolic mmHg
🫁
SpO₂ Sensor
Oxygen %
🌊
Impedance Patch
Lung fluid %
🔬
Lab Results
Creat · K+ · eGFR
fetch & parse
LOGIC ENGINE
7-Step IF-ELSE Rules
1Emergency Gates
2Fluid Classification
3Diuretic Decision
4RAAS Inhibitor
5Beta Blocker
6SGLT2 + MRA
7Trajectory Check
decisions
OUTPUT LAYER
Drug Decisions + Alert
Diuretic
INCREASE — 40mg → 80mg
Beta Blocker
SKIP — patient WET
RAAS
UPTITRATE — all gates pass
SGLT2
MAINTAIN — 10mg
Repeats every 24 hours
TECH STACK
LangChain LangGraph StateGraph Claude Sonnet / GPT-4o Python + Pydantic MIMIC-IV v3.1 DuckDB FastAPI + WebSocket LangSmith

MIMIC-IV: Real patient
data to test the logic

We filtered 500,000 hospital admissions down to 6,319 HFrEF patients with complete sensor, drug, and lab records.

5-Step Filtering Pipeline

Full MIMIC-IV
~500,000
Heart Failure (ICD codes)
~40,000
HFrEF Specifically (I50.22)
33,131
+ Has GDMT Drug Records
14,144
+ Has Sensor Signal Data
6,319 ✓
1.6M
Decision-ready rows
43
Columns per row
267K
Drug records
2.7M
Lab results

Final Dataset Schema (43 columns)

Sensor Signals
heart_ratesbp spo2resp_rate weight_kg
Lab Results
creatininepotassium egfrsodium bunanion_gap phhematocrit plateletswbc
Drug Records
dose_diureticdose_raas dose_betablockerdose_mra dose_sglt2drug_diuretic drug_raasdrug_betablocker
Comorbidity Flags
has_afibhas_ckd has_t1dmhas_t2dm has_copdhas_cardiomyopathy
Logic Engine Flags
flag_emergency_spo2 flag_low_sbp flag_high_potassium flag_high_creatinine flag_low_hr flag_high_hr

The 7-step
logic engine

Applied in order, every cycle. Each step has mandatory gates — pass all gates or hold.

1
Emergency Gates
Check all safety limits first. Any single trigger stops all drug logic immediately and alerts the clinician.
SpO2 < 90% → EMERGENCY SBP < 90 → HOLD ALL K+ > 6.0 → STOP RAAS+MRA Creat > 3.5 → STOP RAAS+Diuretic HR < 40 → Reduce BB
2
Fluid Classification
The impedance patch reading determines WET, BORDERLINE, or DRY status. This single classification governs every downstream drug decision.
Fluid > 35% → WET 30–35% → BORDERLINE Fluid < 30% → DRY AF → HR target 110bpm
3
Diuretic Decision
Furosemide / Torsemide dose adjusted based on fluid status, kidney function, and potassium level.
WET + safe labs → INCREASE WET + Creat rose >50% → ESCALATE IV DRY + Creat rising → REDUCE K+ < 3.5 → REDUCE
4
RAAS Inhibitor
All 3 gates must pass simultaneously. One failure means HOLD. ARNI (Sacubitril/Valsartan) preferred. ACEi → ARNI requires mandatory 36-hour washout.
Gate 1: SBP ≥ 100 Gate 2: K+ < 5.5 Gate 3: eGFR ≥ 30 All pass → UPTITRATE ARNI
5
Beta Blocker Decision
Patient must be DRY first — never uptitrate when lungs are congested. COPD restricts drug choice to Bisoprolol or Metoprolol only.
WET/BORDERLINE → SKIP DRY + HR > target → UPTITRATE HR < 50 → REDUCE COPD → Biso/Metro only
6
SGLT2 + MRA
Managed as a pair. SGLT2 lowers potassium which protects the MRA from needing to be stopped when K+ rises.
eGFR ≥ 20 → SGLT2 10mg T1DM → CONTRAINDICATED K+ < 5.0 + eGFR ≥ 30 → MRA K+ 5.0–5.5 on SGLT2 → Monitor
7
Trajectory Check
Review the last 3 readings together. All worsening = stop automated logic and escalate. HRV drop is an early warning flag.
3 readings worsening → ESCALATE HRV drop → Early warning SBP dropped >20pts → Flag Fluid ↓ + stable → IMPROVING

Try the logic engine
yourself

Adjust the patient parameters below and see exactly what the AI agent decides — and why.

HFrEF AI Agent — Patient Simulation

Patient Parameters

SpO₂ (%)96
Systolic BP (mmHg)118
Heart Rate (bpm)82
Lung Fluid % (Impedance)32
Creatinine (mg/dL)1.2
Potassium K+ (mEq/L)4.4
eGFR (mL/min)52
Atrial Fibrillation (AF)
Type 1 Diabetes (T1DM)
COPD / Asthma

Agent Decision

Step 1 — Emergency Status
✓ SAFE — No emergency triggers
Step 2 — Fluid Status
BORDERLINE — Monitor closely
Steps 3–6 — Drug Decisions
DiureticHOLDBorderline fluid, monitor
RAAS InhibitorUPTITRATEAll 3 gates pass
Beta BlockerSKIPNot dry yet
SGLT2MAINTAIN 10mgeGFR ≥ 20, safe
MRAMAINTAINK+ and eGFR safe
Step 7 — Trajectory
STABLE — Continue current plan
Clinical Reasoning
Fluid at 32% (borderline range 30–35%). Not wet enough to increase diuretic, not dry enough to start beta blocker. RAAS gates all pass — SBP 118 ≥ 100, K+ 4.4 < 5.5, eGFR 52 ≥ 30 — so RAAS can be uptitrated. SGLT2 and MRA are safe to maintain. Next priority: get fluid below 30% to unlock beta blocker.

The team

QAS.AI
Industry Client
Dr. Ciprian Ionita — Clinical AI research partner and project sponsor
J
Jayachandra Galda
AI/ML Engineering
Agent architecture, logic framework, dataset pipeline, presentations
H
Hema Priya Balaji
Decision Logic
7-step IF-ELSE decision tree, drug rule formalisation
S
Srinivasa Rao Tummalapalli
Data Engineering
MIMIC-IV access, SQL filtering pipeline, dataset construction
Ask PIXEL MINDS
RAG · Llama 3.3 · FAISS
Powered by your RAG backend · Ask anything about the project
PIXEL MINDS AI
Hi! I'm the PIXEL MINDS project assistant. I know everything about the HFrEF AI agent — the logic engine, dataset, research papers, and team. Ask me anything! 🫀