Healthcare IT
2025 — Present

Heartbeat

Proactive Health Engine — Dual-Brain AI

84K+ line proactive health engine with dual-brain AI architecture: a tactical LLM (8B) for real-time decisions and a strategic LLM (70B) for trend analysis across 50+ interactions. Polymorphic User DNA profiles serve babies, celiac patients, students, and seniors through a single adaptive schema with metaphor-driven UX.

Year

2025 — Present

Role

Architect & Developer

Tech Stack

8 technologies

The Challenge

Health apps provide reactive data — logs, charts, averages — but lack proactive intelligence.

  • No app predicts that a baby will reject the 7pm bottle based on 3 weeks of feeding patterns
  • No app detects that a senior's blood pressure trend will cross a threshold in 48 hours
  • The missing layer is an AI that thinks strategically across time, not just responds to the current moment

The Approach

Dual-brain architecture with polymorphic user profiles:

  • Tactical LLM (Llama 3.1 8B via Groq, <500ms) — real-time decisions every interaction
  • Strategic LLM (Llama 3.3 70B) — Deep Pulse analysis over 50+ accumulated heartbeats to detect patterns invisible at the individual level
  • Polymorphic User DNA — single database schema with metaphor-driven UX: The Nest (baby), The Shield (celiac), The Library (student), The Greenhouse (senior)
  • Same JSON columns carry completely different health semantics per profile type

The Solution

Multiple interconnected engines working across the full health spectrum:

  • Deep Pulse — detects multi-day patterns, produces typed insights (ALERTA_TENDENCIA, PREDICCIÓN, OPTIMIZACIÓN_RUTINA) with confidence scores
  • Travel Engine — Haversine distance with hysteresis for travel state detection and flight inference (>1000km in <2h). Adjusts per profile: jet-lag mode for babies, gluten databases per country for celiacs, medication timezone shifts for seniors
  • I2I Visual Evolution — image ancestry chain where each generation descends from the previous one with adaptive strength (0.1 subtle → 0.9 dramatic) reflecting real-time health state
  • Crisis Simulation — multi-day stress scenarios exercising all three layers together
  • Gamification — psychological reinforcement: points, streaks, level progression, and visual metaphors (growing gardens, fortified shields) for behavioral health loops

24+ API endpoints, 43+ LLM tool definitions, 4-provider AI abstraction with automatic fallback.

Key Results

  • 84K+ lines of code across 58 files (24 backend endpoints, 10K+ line frontend)
  • Dual-brain AI: tactical (8B, real-time) + strategic (70B, trend analysis)
  • Polymorphic profiles: 4 user types in one adaptive schema
  • Travel Engine with flight detection and timezone-aware health adjustments
  • I2I image ancestry chains with semantic search (BGE-M3 embeddings)
  • Gamification as psychological tool for behavioral health reinforcement
  • Android app via Capacitor (NutriNen Baby)
  • 4-provider LLM abstraction: Groq, Cloudflare AI, Gemini, DeepSeek

Tech Stack

Vanilla JS Cloudflare Workers D1/SQLite Groq Gemini DeepSeek FLUX (I2I) Capacitor
$ cat project.json
{
"name": "Heartbeat",
"status": "production",
"stack": [8],
"results": [8]
}