# Sample Diabetes Data - Test Your App! ๐Ÿ“Š ## ๐Ÿ“ File: `sample_diabetes_data.csv` This is **realistic synthetic CGM data** for a full day (24 hours) with interesting events! --- ## ๐ŸŽฏ What's in the Data ### Timeline: January 15, 2025 (6:00 AM - 11:55 PM) **200 data points** @ 5-minute intervals ### Key Events to Watch For: #### 1. **Morning Hypo Risk** (6:00 AM - 7:20 AM) - Glucose drops from 95 โ†’ 80 mg/dL - **Alert should trigger** around 7:15 AM - **Breakfast bolus**: 45g carbs + 4.5u insulin at 7:20 AM - Recovery to 128 mg/dL #### 2. **Post-Breakfast Spike** (7:20 AM - 8:30 AM) - Glucose rises to 128 mg/dL - Gradual descent back to normal range #### 3. **Morning Exercise** (10:30 AM - 12:00 PM) - Heart rate increases (65 โ†’ 130 BPM) - Steps accumulate rapidly - Glucose stays stable due to activity #### 4. **Lunch Spike** (12:00 PM - 1:15 PM) - **Large meal**: 60g carbs + 6u insulin - Glucose spikes to **176 mg/dL** (near hyper threshold) - **Alert should trigger** around 1:00 PM - Gradual descent over 3 hours #### 5. **Late Afternoon Stability** (3:00 PM - 6:00 PM) - Glucose stable in target range (100-110 mg/dL) - Minimal significance scores expected #### 6. **Dinner** (6:00 PM - 7:00 PM) - 55g carbs + 5.5u insulin - Moderate spike to 159 mg/dL - Controlled descent #### 7. **SEVERE HYPO EVENT** โš ๏ธ (10:00 PM) - **CRITICAL**: Glucose drops to **15 mg/dL**! - Overcorrection with 3u insulin (mistake scenario) - **Multiple alerts expected** - Emergency 15g carbs consumed - Recovery to safe levels #### 8. **Overnight Stability** (11:00 PM onwards) - Glucose settles around 100 mg/dL - Normal sleep HR (52-60 BPM) --- ## ๐Ÿงช Expected Results ### Activation Patterns: - **High activation**: During hypo (7:15 AM, 10:00 PM), hyper (1:00 PM) - **Low activation**: Stable periods (3-6 PM, after 11 PM) - **Target activation rate**: ~15-20% overall ### Alerts Expected: Approximately **3-5 high-risk alerts**: 1. Morning hypo warning (~7:15 AM) 2. Lunch hyper warning (~1:00-1:15 PM) 3. **CRITICAL hypo** (~10:00-10:20 PM) - multiple alerts ### Energy Savings: - **~80-85%** energy saved vs always-on - Most savings during stable periods - More activations during risk events ### Significance Components: Watch how they change: - **Glycemic deviation**: High during hypo/hyper - **Velocity risk**: Spikes during rapid changes - **IOB risk**: High after insulin doses - **COB risk**: High after meals - **Activity risk**: Elevated during exercise - **Variability**: Shows instability during events --- ## ๐ŸŽฎ How to Test ### Option 1: Local App ```bash cd "C:\Users\adminidiakhoa\sundew_algorithms\HULL_use\diabetes\sundew_diabetes_watch" streamlit run app_advanced.py ``` 1. **Uncheck** "Use synthetic example" 2. Click "Browse files" 3. Upload `sample_diabetes_data.csv` 4. Watch the magic! โœจ ### Option 2: Hugging Face Space 1. Visit: https://huggingface.co/spaces/mgbam/sundew_diabetes_watch 2. Upload `sample_diabetes_data.csv` 3. Explore the visualizations --- ## ๐Ÿ” What to Look For ### 1. Performance Dashboard - Total events: **200** - Activations: **30-40** (15-20%) - Energy savings: **80-85%** - Alerts: **3-5** ### 2. Glucose Chart - See the full day pattern - Identify meal spikes - Spot hypo events ### 3. Significance vs Threshold - **Watch the PI controller adapt!** - Threshold moves to maintain 15% activation - Significance spikes during risk events ### 4. Energy Level - **Bio-inspired regeneration** visible - Drops during activations - Regenerates during idle periods - Should fluctuate, not flat ### 5. Significance Components - **6 colored lines** showing risk factors - Glycemic deviation dominates during extremes - Velocity spikes during rapid changes - IOB/COB after meals ### 6. Alerts Table Look for warnings around: - 7:15 AM (morning hypo approach) - 1:00 PM (post-lunch hyper) - 10:05-10:20 PM (critical hypo) ### 7. Bootstrap Confidence Intervals - F1 Score with 95% CI - Precision with 95% CI - Recall with 95% CI - Check that CI ranges are reasonable --- ## ๐Ÿ“Š Advanced Analysis ### Export Telemetry 1. Check "Export Telemetry JSON" 2. Download `sundew_diabetes_telemetry.json` 3. Contains all 200 events with full details 4. Use for: - Hardware power measurement correlation - Detailed analysis in Excel/Python - Custom visualizations - Research papers ### Compare Presets Try different Sundew configurations: **`custom_health_hd82`** (Recommended for diabetes) - 82% energy savings target - Healthcare-optimized - Expect: High recall, lower precision **`tuned_v2`** (Balanced) - General purpose - Good balance - Expect: Medium recall/precision **`conservative`** (Maximum savings) - Minimal activations - Expect: Lower recall, higher savings **`aggressive`** (Maximum safety) - More activations - Expect: Higher recall, lower savings --- ## ๐Ÿ“ Data Format **Columns:** - `timestamp`: DateTime in ISO format - `glucose_mgdl`: Blood glucose in mg/dL (40-400 range) - `carbs_g`: Carbohydrate intake in grams (0-60) - `insulin_units`: Insulin dosage in units (0-6) - `steps`: Cumulative step count (0-1065) - `hr`: Heart rate in BPM (48-130) **Frequency**: 5-minute intervals (standard CGM) **Duration**: 18 hours (6 AM - 12 AM) --- ## ๐ŸŽฏ Challenge Yourself ### Can You Spot: 1. The exact time glucose crosses below 70 mg/dL? 2. How long it takes to recover from the severe hypo? 3. Which meal caused the highest glucose spike? 4. When the PI controller adjusts threshold most dramatically? 5. The period with lowest energy consumption? ### Experiment With: - Different target activation rates (5%, 15%, 30%) - Different energy pressure values - Different hypo/hyper thresholds - Different Sundew presets --- ## ๐ŸŒŸ Pro Tips 1. **Enable all visualizations** for full effect 2. **Watch the threshold adapt** in real-time (Significance vs Threshold chart) 3. **Check the 10 PM hypo** - algorithm should light up! 4. **Export telemetry** to see component breakdown 5. **Try bootstrap CI** for statistical rigor --- ## ๐ŸŽ“ Learning Outcomes After testing with this data, you'll understand: โœ… How Sundew adapts threshold to maintain target activation โœ… How 6-factor significance scoring works โœ… How energy regeneration creates sustainable monitoring โœ… How bootstrap CI provides statistical confidence โœ… How ensemble models improve predictions โœ… How alerts trigger during real risk events --- ## ๐Ÿš€ Next Steps 1. **Test with this data** to verify app works 2. **Create your own data** with different patterns 3. **Compare results** across different presets 4. **Export telemetry** for deeper analysis 5. **Share results** with your network! --- **This data showcases the algorithm at its finest!** ๐ŸŒฟโœจ The severe hypo at 10 PM will really make Sundew **SHINE**!