Hea — Early Health Risk Detector

Inspiration

We noticed a critical gap in health monitoring: the "grey zone" between feeling slightly off and getting a clinical diagnosis. Most health apps track metrics (steps, heart rate) but miss the subtle, subjective signals—a change in tone, a persistent fatigue description, or a slight withdrawal from social activities.

We were inspired to build a privacy-first wellness companion that listens to these "weak signals." By combining structured data (sleep, mood) with unstructured text (daily journals), Hea aims to catch burnout, fatigue, and viral prodromes before they become severe, empowering users with early, actionable insights without needing access to sensitive medical records.

What it does

Hea uses a Dual-AI Architecture to monitor your daily wellness:

  1. Instant Wellness Feedback (Gemini Flash): As soon as you log your day—whether via emoji, text, or sliders—Hea responds instantly with a personalized, encouraging wellness tip. It feels like chatting with an empathetic friend who remembers how you felt yesterday.

  2. Deep Pattern Recognition (Gemini Pro + Custom ML): Behind the scenes, Hea analyzes multi-day trends. It fuses:

    • NLP Signals: Detects fatigue, stress, or anxiety markers in your journal entries (using DistilBERT).
    • Time-Series Anomalies: Spots deviations in your sleep or mood baseline (using LSTM networks).
    • Fusion Logic: Combines these to predict emerging risks like "Burnout Risk: Moderate" or "Viral Prodrome: Low."

The result? Users get a clear, human-readable insight card explaining why a risk was flagged (e.g., "Your sleep dropped 15% this week while stress language increased") and practical next steps.

How we built it

We built a full-stack, cloud-native prototype:

🧠 The Brain (AI & ML)

  • Google Gemini 1.5 Flash: For low-latency (<500ms), high-warmth daily interactions.
  • Google Gemini 1.5 Pro: As the "Reasoning Engine" for complex multi-day pattern analysis and generating explainable insights.
  • Custom Models (PyTorch):
    • Hybrid Fusion Model: We implemented a late-fusion neural network that combines text embeddings \( E_{txt} \in \mathbb{R}^{128} \) with time-series features \( E_{ts} \in \mathbb{R}^{64} \) into a shared latent space for classification.
    • Equation: $$ P(risk|x) = \sigma(W_2 \cdot \text{ReLU}(W_1 \cdot [E_{txt} || E_{ts}] + b_1) + b_2) $$

⚙️ The Backend

  • FastAPI (Python): High-performance async API handling requests.
  • SQLAlchemy + SQLite/Postgres: Robust data persistence with strict schema validation.
  • Security: OWASP-compliant headers, strict data sanitization, and rate limiting.

🎨 The Frontend

  • React + Vite: Blazing fast UI with a custom Glassmorphism Design System matching tryhea.com.
  • Recharts: For visualizing health trends.
  • Framer Motion: For smooth, organic animations that make the app feel "alive."

☁️ Infrastructure

  • Terraform (IaC): configured a complete AWS environment (Lambda, API Gateway, DynamoDB, S3) with a single command.
  • CI/CD: GitHub Actions pipeline for automated testing and deployment.

Challenges we ran into

  1. Synthetic Data Scarcity: Real health data is sensitive and hard to get. We built a custom Synthetic Data Generator that simulates 4 distinct risk profiles (Healthy, Burnout, Viral, Anxiety) over 30-day periods to train our initial models.
  2. Privacy vs. Utility: We wanted powerful insights without storing PHI (Protected Health Information). We solved this by using local embeddings and ensuring our architecture can run inference without ever sending raw data to a third-party trained model for the core signals.
  3. Latency: Deep analysis is slow; user experience needs to be fast. We adopted an async architecture where the user gets an instant "Quick Tip" (Flash) while the heavier "Risk Analysis" (Pro/Custom ML) happens in the background.

Accomplishments that we're proud of

  • Seamless Gemini Integration: Orchestrating two different Gemini models to play to their strengths (Speed vs. Reasoning).
  • Zero-Knowledge Architecture: Designed the system so that risk assessments can be generated without retaining raw text indefinitely (GDPR Right to Erasure is one click).
  • Full DevOps Pipeline: From git push to a deployed AWS Lambda function with Terraform, the project is structured like a production-grade application, not just a hackathon script.

What we learned

  • Weak Signals Matter: Aggregating small changes (sleep down 30 mins + slightly more negative words) is a far better predictor of wellness than any single metric.
  • Trust is UI: A "Black Box" AI scares users. By adding an "Explainability Layer" (generating human-readable reasons for every alert), we turned a monitoring tool into a trusted companion.
  • Infrastructure as Code: Spending time on Terraform early saved us hours of debugging "it works on my machine" deployment issues.

What's next for Hea Early Health Risk Detector

  • Wearable Integration: Direct sync with Apple Health / Fitbit to replace manual entry.
  • Voice Logging: Allowing users to just "talk to Hea" to log their day, using Whisper for transcription.
  • Federated Learning: Moving the model training to the device so user data never leaves their phone.
  • Community Challenges: Anonymous, aggregate wellness goals for teams or communities.

Built With

Share this project:

Updates

Submission history