Spaces:
Sleeping
Sleeping
metadata
title: Sundew Diabetes Commons
sdk: docker
colorFrom: green
colorTo: blue
pinned: true
emoji: πΏ
license: mit
πΏ Sundew Diabetes Watch β Advanced Edition
Mission: Deliver low-cost, energy-aware diabetes risk monitoring for everyone β with a special focus on communities across Africa.
This app demonstrates the full capabilities of Sundewβs bio-inspired adaptive algorithms, including:
- β¨ PipelineRuntime with a custom
DiabetesSignificanceModel - π Real-time energy tracking with bio-inspired regeneration
- π― PI-control threshold adaptation with live visualization
- π Bootstrap confidence intervals for statistical validation
- π¬ Six-factor diabetes risk computation (glycemic deviation, velocity, IOB, COB, activity, variability)
- π€ Ensemble model (LogReg + RandomForest + GBM)
- πΎ Telemetry export for hardware validation workflows
- π 89.8% energy savings versus always-on inference (validated on real CGM data)
β Proven Results
Tested on 216 continuous glucose monitoring events (β18 hours):
- Activation rate: 10.2% (22/216 events) β intelligently selective
- Energy savings: 89.8% β essential for battery-powered wearables
- Risk detection: Correctly identifies hypoglycemia (<70 mg/dL) and hyperglycemia (>180 mg/dL)
- Adaptive thresholds: PI controller dynamically adjusts from 0.10 β 0.95 based on glucose patterns
π Quick Start
- Try the demo: Sundew Diabetes Watch
- Upload data: Use your CSV or the sample_diabetes_data.csv
- Observe: Real-time significance scoring, threshold adaptation, and energy tracking
- Experiment: Tweak Energy Pressure, Gate Temperature, and presets
π οΈ How It Works
- Upload CGM data with columns:
timestamp, glucose_mgdl, carbs_g, insulin_units, steps, hr - Custom significance model computes a multi-factor diabetes risk score
- Sundew gating decides when to run the heavy ensemble model
- PI control auto-adjusts thresholds to maintain target activation
- Energy management uses bio-inspired regeneration and realistic costs
- Statistical validation via bootstrap 95% CIs (F1, Precision, Recall)
- Telemetry export (JSON) for power-measurement correlation
πΊ Live Visualizations
- Glucose levels: Continuous CGM stream
- Significance vs. threshold: See the PI controller adapt in real time
- Energy level: Bio-inspired regeneration over time
- Risk components (Γ6): Interpretable breakdown of the score
- Performance dashboard: F1, Precision, Recall with confidence intervals
- Alerts: High-risk notifications
π§ Configuration Presets
- custom_health_hd82: Healthcare-optimized (β82% energy savings, ~0.196 recall)
- tuned_v2: Balanced general-purpose baseline
- auto_tuned: Dataset-adaptive configuration
- conservative: Maximum savings (lower activation)
- energy_saver: Battery-optimized for edge devices
Disclaimer: Research prototype. Not medical advice. Not FDA/CE approved.
π» Developing Locally
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
streamlit run app_advanced.py
π§ Technical Details
Algorithm: Sundew bio-inspired adaptive gating
Model: Ensemble (LogReg + RandomForest + GBM)
Risk factors: Six-component diabetes-specific significance model
Control: PI threshold adaptation with energy-pressure feedback
Energy model: Random regeneration (1.0β3.0 per tick) + realistic costs
Validation: Bootstrap resampling (1,000 iterations) for 95% CI
π References
Sundew Algorithms
Documentation
Paper (coming soon)
Built with β€οΈ for underserved communities worldwide.