About the Project

Inspiration

As an athlete, I’ve seen how recovery determines performance. Most high-level training decisions today rely on wearables — expensive devices that continuously track heart rate variability (HRV), resting heart rate, and sleep metrics.

But that raised a question:

What if recovery intelligence didn’t require a wearable at all?

Modern smartphones already have high-resolution cameras capable of detecting subtle blood-flow variations through remote photoplethysmography (rPPG). With Presage’s SmartSpectra SDK, it became possible to transform a 30-second camera scan into meaningful physiological metrics.

VitalEdge was built to remove friction from recovery tracking and make physiological intelligence accessible to anyone with a phone.


What It Does

VitalEdge uses Presage SmartSpectra to capture:

  • Heart Rate (HR)
  • Heart Rate Variability (HRV via RMSSD)
  • Breathing Rate

From these signals, the app computes a recovery score using a weighted physiological model:

$$ \text{Recovery Score} = 0.7 \cdot z_{\text{HRV}} + 0.2 \cdot z_{\text{HR}} + 0.1 \cdot z_{\text{BR}} $$

Where each metric is normalized using a Z-score:

$$ z = \frac{x - \mu}{\sigma} $$

To prevent instability, Z-scores are clamped and scaled to a bounded output range:

$$ \text{Final Score} \in [0, 100] $$

The recovery score is then passed to Google Gemini, which generates adaptive daily training guidance.

Firebase handles authentication, session state, and AI orchestration.


How We Built It

Frontend

  • SwiftUI (iOS 16+)
  • NavigationStack + sheet-based scan flow
  • ObservableObject state management

Physiological Engine

  • Presage SmartSpectraSwiftSDK
  • Custom RMSSD implementation:

$$ \text{RMSSD} = \sqrt{ \frac{1}{N-1} \sum_{i=1}^{N-1} \left(RR_{i+1} - RR_i\right)^2 } $$

  • Weighted recovery scoring model
  • Clamped normalization for demo stability

Backend & AI

  • Firebase
  • Google Gemini for AI-driven training plan generation
  • Structured prompt engineering based on readiness state

Challenges We Faced

1. SDK Lifecycle Stability

Integrating a real-time physiological SDK required careful lifecycle management. Improper start/stop sequencing led to “connection invalid” states.

Solution:

  • Idempotent session starts
  • Explicit stopProcessing() before stopRecording()
  • Modal scan presentation to isolate camera lifecycle

2. Navigation Architecture

Originally, the scan screen was pushed onto the navigation stack, which allowed swipe-back gestures into active sessions. This caused inconsistent states.

Solution:

  • Converted scan flow to a sheet presentation
  • Ensured results pushed cleanly after dismissal

3. Stable Scoring

Physiological data can be noisy. Raw normalization created extreme outliers.

Solution:

  • Clamp Z-scores
  • Add fallback standard deviations
  • Normalize output range to maintain UX stability

4. Meaningful AI Output

AI-generated plans must reflect physiological context, not generic advice.

Solution:

  • Structured prompts that included:
    • Recovery score
    • HRV status
    • Stress indicator
    • Readiness classification
  • Constrained AI output to actionable training guidance

What We Learned

  • Camera-based rPPG is powerful enough for meaningful recovery inference.
  • AI becomes significantly more valuable when grounded in structured physiological inputs.
  • Navigation architecture matters deeply when working with hardware SDKs.
  • Clean lifecycle management prevents the majority of runtime issues.

Most importantly, we learned that recovery intelligence does not need to be locked behind expensive hardware.


Why This Matters

Autonomic nervous system balance influences:

  • Training adaptation
  • CNS fatigue
  • Injury risk
  • Performance consistency

By combining:

  • Presage (physiological sensing)
  • Firebase (scalable backend)
  • Gemini (AI intelligence)

VitalEdge delivers wearable-free recovery optimization accessible to anyone.


Future Direction

  • Rolling personal baselines
  • Longitudinal recovery trends
  • Predictive fatigue modeling
  • Team performance analytics
  • Adaptive periodization logic

VitalEdge is an early step toward frictionless performance intelligence.

Built With

Share this project:

Updates