About the project
Inspiration
Dexcom's API gives third-party apps glucose data an hour late, on purpose. People with prediabetes or type 2 diabetes (not on insulin) end up with numbers, not coaching. We wanted a coach that reasons about the present, suggests something small and useful before a spike, and is honest about how good its predictions are.
What it does
Gummi is an iPhone CGM coach fronted by a jelly koala whose mood follows your glucose.
- Home: coach cards, Gummi, and a chart with Dexcom readings (solid), Gummi's estimate of the delayed hour (dotted), and a 2-hour forecast (dashed).
- Chat: "Can I have a cookie?" simulates the food and shows both curves before you eat. "I just had a granola bar" logs it.
- Food: a food log where every meal gets a prediction, and 2 hours later Gummi grades itself against two baselines: the published CGM-only model and the last reading.
- Activity: cards an event-driven agent posts on its own: morning briefings, walk nudges, meal stories, evening recaps.
- Day: time in range, the day hour by hour, and Gummi's report card.
- Walks: live steps from the iPhone pedometer, with the walk's effect labeled by source (published research or your own data).
How we built it
Three of us, one lane each:
- iOS (Swift, SwiftUI): a procedural 3D koala in RealityKit with jelly physics, rendered at 120 fps through RealityRenderer into Metal. Live updates over server-sent events. Swift Charts, HealthKit, and Core Motion.
- Backend (a Databricks App on FastAPI): in-memory live state, the model running in-process, and a chat agent plus four background agents on Databricks Foundation Model APIs. Every run is traced in MLflow.
- Data (Databricks): the BIG IDEAs study data (16 participants) loaded into Unity Catalog. A ridge model on CGM history plus meal absorption curves, trained with participant-grouped cross-validation. During the replay, each person is predicted by a fold model that never saw them. A Lakeflow declarative pipeline streams every event into Delta tables, and the gold accuracy tables feed the agents.
Grades use mean absolute error: $\text{MAE}=\frac{1}{n}\sum_{i=1}^{n}\lvert \hat{y}_i-y_i\rvert$.
Challenges
- Free Edition's daily compute limit stopped our App, models, and warehouse mid-build. We added a "server asleep" fallback with offline demo data, and the backend now resumes cleanly after an outage.
- After the replay passed the end of one participant's data, the estimate kept extrapolating for 65 hours. Gummi now refuses to estimate when the newest reading is more than 3 hours old.
- RealityView capped the koala at 60 fps, so we wrote our own render loop to reach 120 Hz.
- Replay leakage: one model trained on everyone would grade itself in-sample, so each participant is predicted by a fold model that never saw them.
Accomplishments
- Out-of-sample error at 30 minutes (mean absolute error, mg/dL): Gummi 8.9 vs CGM-only 9.5 vs last value 10.7. At 60 minutes: 12.1 vs 13.4 vs 14.9.
- Reproduced the published CGM-only baseline (13.90 mg/dL at 30 minutes, RMSE).
- In the demo, Gummi predicted 185 for an evening snack, the actual peak was 186, and it beat CGM-only (155).
What we learned
Logged meals are what make post-meal forecasts better, and honest baselines matter more than a single impressive number.
What's next
Real users through Dexcom's production API, personal walk-effect testing, and Apple Watch steps.
Built With
- agent-bricks
- auto-loader
- core-motion
- databricks
- databricks-apps
- databricks-foundation-model-apis
- delta-lake
- fastapi
- genie
- healthkit
- lakeflow-declarative-pipelines
- metal
- mlflow
- numpy
- pandas
- python
- realitykit
- scikit-learn
- swift
- swift-charts
- swiftui
- unity-catalog
- usernotifications
- xcodegen
Log in or sign up for Devpost to join the conversation.