AI-driven hypoglycemia prediction — 30 minutes before it happens.
For people living with Type 1 diabetes, hypoglycemia (low blood sugar) can strike without warning — during sleep, exercise, or daily life. Reactive treatment (eating sugar after symptoms appear) is often too late.
Eq Foresight is an iOS app that uses on-device AI to predict hypoglycemic events 30 minutes in advance, enabling proactive treatment before symptoms begin.
| Feature | Description |
|---|---|
| 30-Minute Prediction | CoreML cascade of 4 models (5, 10, 15, 30 min horizons) running entirely on-device |
| Real-Time Dashboard | Live glucose chart + dotted prediction line with confidence bands |
| Smart Alerts | Escalating notifications (warning → alarm → pump stop) with intelligent cooldowns |
| Activity Mode | Automatically adjusts glucose targets during exercise to prevent workout-induced lows |
| Morning Briefing | Automated overnight analysis — "Your night was stable, lowest point 4.2 mmol/L at 03:15" |
| Auto-Tune | Analyzes 24h of data to suggest personalized insulin sensitivity and carb ratio adjustments |
| iOS 18 Widget & Live Activity | Current glucose, risk trend, and quick-launch on Lock Screen and Home Screen |
| Privacy-First | All AI inference runs locally. No data leaves the device. No cloud. No subscription. |
┌───────────────────────────────────────────────┐
│ Eq Foresight iOS App │
│ ┌─────────────┐ ┌─────────────┐ ┌────────┐ │
│ │ Dashboard │ │ History │ │Settings│ │
│ │ (SwiftUI) │ │ (SwiftUI) │ │(SwiftUI│ │
│ └──────┬──────┘ └──────┬──────┘ └───┬────┘ │
│ │ │ │ │
│ ┌──────┴────────────────┴─────────────┴────┐ │
│ │ DashboardViewModel (MVVM) │ │
│ │ ┌────────────┐ ┌────────────────────┐ │ │
│ │ │DataBuffer │ │ InferenceEngine │ │ │
│ │ │(23 features│ │ ┌──────────────┐ │ │ │
│ │ │ 36-48 steps│ │ │ HypoPredictor│ │ │ │
│ │ │ 4h history)│ │ │ 4 CoreML │ │ │ │
│ │ └─────┬──────┘ │ │ models │ │ │ │
│ │ │ │ └──────────────┘ │ │ │
│ └────────┼─────────┴────────────────────┘ │ │
│ │ │ │
│ ┌────────┴──────────┐ ┌─────────────────┐ │ │
│ │ NightscoutService │ │ HealthKitService│ │ │
│ │ (Glucose + │ │ (Heart Rate, │─┘ │
│ │ Treatments) │ │ Blood Glucose)│ │
│ └───────────────────┘ └─────────────────┘ │
└───────────────────────────────────────────────┘
Data Flow:
- HealthKit provides heart rate and (optionally) blood glucose — offline-resilient, low latency
- Nightscout provides CGM history and treatment logs (bolus, carbs) — SHA1-authenticated
- DataBuffer maintains a rolling 4-hour window of 23 features, normalized to Python training format
- InferenceEngine runs 4 CoreML models in parallel, producing probability scores for each horizon
- DashboardViewModel orchestrates UI updates, notifications, and widget data sharing
Deep dive: docs/architecture.md
- SwiftUI + MVVM pattern with
@MainActorisolation - CoreML (4 bundled
.mlpackagemodels,MLComputeUnits.all) - HealthKit (heart rate, blood glucose, workout detection)
- WidgetKit + Live Activities (iOS 17+)
- Background Tasks (
BGTaskSchedulerwith 25s timeout guards) - User Notifications with custom actions (Log Carbs, Snooze)
- XcodeGen for reproducible
.xcodeprojgeneration
- Python with PyTorch / TensorFlow for model training
- Feature engineering pipeline producing 23 time-series features from raw CGM, HR, insulin, and carb data
- Cascade architecture — 4 models trained for different prediction horizons (h1, h2, h3, h6)
- CoreML export with
coremltoolsfor on-device inference - Iso-calibration for probability calibration across horizons
📸 Screenshots will be added here. Key views to showcase:
- Dashboard — hero glucose value, risk gauge, prediction graph
- Activity Mode — blue-themed workout view with adjusted targets
- Morning Briefing — overnight summary card with TIR
- Settings — physiology profile, auto-tune results
- Widget — Home Screen widget with glucose, trend, and risk bar
- All AI inference runs on-device. No server, no cloud processing, no data monetization.
- No automated dosing. The app provides warnings and carb recommendations, but never controls insulin delivery.
- Open Nightscout integration. Users own their data; the app only reads what the user already manages.
🟡 Active Development. The iOS app is in late-stage development with on-device inference, background processing, and real-time widgets functional. CoreML models are trained and calibrated. Beta testing planned.
The full source code for both the iOS app and the ML training pipeline is available in private repositories. Access is granted to potential employers, collaborators, and investors upon request.
- iOS App: Private repository (Swift, SwiftUI, CoreML, HealthKit)
- ML Pipeline: Private repository (Python, PyTorch, feature engineering, CoreML export)
📩 Interested in reviewing the code? Contact me or connect on LinkedIn.
andyDTU — iOS Engineer & ML Engineer focused on health technology and on-device AI.
Proactive. Private. Powerful.