Inspiration

Every time a senior citizen visits their doctor, the physician sees a snapshot — one blood report, one prescription. They can't see that the patient's HbA1c has been climbing for 4 months, or that it correlates with a sleep quality decline that started after a medication dosage change. For the 65+ demographic managing multiple chronic conditions like diabetes, hypertension, and thyroid disorders — who take 5-6 daily medications and get regular blood work — this fragmentation isn't just inconvenient, it's dangerous. Missed correlations between heart rate variability, blood sugar trends, and sleep disruptions can mean the difference between catching a cardiac event early and arriving at the ER too late. We were inspired by how trading terminals overlay dozens of financial indicators on a single screen to spot patterns — and asked: why can't we do the same for health data?

What it does

How we built it

We started with a React frontend and built a comprehensive Node.js/Express backend with a SQLite database containing 15 tables. The core innovation is the multi-tier analysis engine: five base agents (realtime, hourly, daily, weekly, monthly) run on cron schedules with a tiered memory system — each scope summarizes for the next, so the LLM never needs to process the full patient history. On top of these, three rule-based specialist agents compute statistical trend lines (moving averages, linear regression, prediction curves) and personalized stop-loss thresholds (patient baseline + 2 standard deviations).

The frontend's Analytics Terminal was inspired by Bloomberg/TradingView — we normalize all metrics to a 0-100% scale so heart rate (60-120 BPM) and SpO2 (88-100%) can coexist on the same chart without one compressing the other. The intraday API uses adaptive granularity — raw per-reading data for 1-hour windows, minute-level for 4-hour, 5-minute for 12-hour, up to hourly for 48-hour views.

We integrated Azure OpenAI GPT-5-nano for analysis reasoning, implemented HIPAA compliance (audit logging, AES-256-GCM encryption, RBAC), and seeded the database with a realistic 1-year patient history including intentional anomaly windows (AFib episodes, nocturnal hypoglycemia, apnea events) for demonstration.

Challenges we ran into

Chart rendering with multiple Y-axes was our biggest frontend challenge — Recharts silently fails when Line components reference mismatched YAxis IDs, producing blank charts with no errors. We solved this by normalizing all metrics to a single 0-100% scale and showing actual values in a custom tooltip.

Making risk scores react to acute events was tricky — specialist agents initially computed risk from daily averages of a full year, so injecting 10 anomaly readings barely moved the needle. We had to add a dual-component scoring system: 7-day trend analysis (max 50 points) + 10-minute raw-reading acute spike detection (max 50 points).

LLM context management was a core architectural challenge — sending a year of hourly vital data would blow through any token limit. The tiered memory system, where each analysis scope summarizes for the next, was our solution — but designing the right summarization boundaries took significant iteration.

Metric ID normalization between backend (using sys_bp with underscores) and frontend (using sys-bp with hyphens) caused silent data mismatches that took time to diagnose.

Accomplishments that we're proud of

The stop-loss trigger system — personalized dynamic thresholds computed from each patient's own baseline that fire observations when breached, just like a trading stop-loss. When a cardiac event is simulated, the cardiac risk jumps from 0% to 52%, and the diabetes risk also spikes because HR+HRV changes are surrogate indicators for hypoglycemia — cross-condition correlation in real-time.

The demo trigger flow — a single button injects a realistic 60-reading anomaly pattern, creates a trigger with multi-paragraph AI reasoning (evidence, historical correlation, root cause assessment), logs analysis events, and re-runs all specialist agents — demonstrating the full pipeline from anomaly to human review in under 200ms.

The adaptive intraday chart — per-reading granularity for short windows, automatic bucketing for longer windows, with X-axis labels that intelligently adapt from "12:34" to "APR '26" depending on the timeframe — making the health terminal feel as responsive as a Bloomberg terminal.

1-year realistic seed data with medically plausible anomaly windows — cardiac events with elevated HR and depressed SpO2, nocturnal hypoglycemia episodes during sleep hours, progressive sleep apnea with declining deep sleep percentages.

What we learned

We learned that health data correlation is fundamentally a time-series superimposition problem — the same techniques that traders use to spot patterns in financial data (moving averages, trend lines, stop-loss thresholds, multi-indicator overlays) map directly to detecting deteriorating health conditions. A 7-day moving average of HRV is just as meaningful as a 7-day moving average of a stock price.

We also learned that acute events require different detection logic than trends — a patient can have perfect 7-day averages but a life-threatening 10-minute spike. The dual scoring approach (trend + acute) was essential.

Building HIPAA-compliant systems taught us that audit logging and access control can't be afterthoughts — they need to be middleware-level concerns that wrap every API call from day one.

What's next for VitalSync

Real wearable integration — Connect to Apple HealthKit, Google Fit, Fitbit, and Garmin APIs to replace the simulator with actual patient data Cloud migration — Move from SQLite to Supabase/PostgreSQL for multi-patient, multi-provider access Doctor portal — A separate interface for physicians to manage multiple patients, compare cohorts, and receive prioritized alert queues Medication interaction engine — Cross-reference medication changes with biomarker shifts to detect adverse drug interactions Predictive modeling — Train condition-specific ML models on the historical data to predict cardiac events, hypoglycemic episodes, and apnea severity weeks in advance Family/caregiver mobile app — Push notifications for triggered alerts with simplified action steps Multi-language support — Hindi, Tamil, Bengali localization for wider senior citizen adoption in India

Built With

  • audit-logging-other:-uuid
  • dotenv
  • express-database:-sqlite-(better-sqlite3)-ai/llm:-azure-openai-gpt-5-nano-scheduling:-node-cron-validation:-zod-compliance:-aes-256-gcm-encryption
  • languages:-typescript-frontend:-react-18
  • radix-ui-/-shadcn-backend:-node.js
  • rbac-middleware
  • recharts
  • tailwind-css
  • vite
  • zustand
Share this project:

Updates