Fix bolus/basal insulin categorization: split SMB from manual corrections (#20) #24

Merged
willemjan merged 1 commits from dev into main 2026-08-01 20:53:11 +00:00
Owner

AndroidAPS records an automatic SMB micro-bolus as eventType Correction Bolus with type SMB, not as its own eventType. bolus_stats() grouped by eventType alone, so every SMB was silently counted as a manual correction. Verified against production data: 100% of Correction Bolus treatments over 90 days were actually type=SMB. Also adds basal_stats(), computing delivered basal directly from Temp Basal treatments (rate x duration) without needing the pump profile. Verified against real 90-day production data: Basal 2041E, Meal Bolus 1711E, SMB 1432E (57.6 E/day total, clinically plausible). Closes #20.

AndroidAPS records an automatic SMB micro-bolus as eventType Correction Bolus with type SMB, not as its own eventType. bolus_stats() grouped by eventType alone, so every SMB was silently counted as a manual correction. Verified against production data: 100% of Correction Bolus treatments over 90 days were actually type=SMB. Also adds basal_stats(), computing delivered basal directly from Temp Basal treatments (rate x duration) without needing the pump profile. Verified against real 90-day production data: Basal 2041E, Meal Bolus 1711E, SMB 1432E (57.6 E/day total, clinically plausible). Closes #20.
willemjan added 1 commit 2026-08-01 20:53:04 +00:00
AndroidAPS records an automatic SMB micro-bolus as eventType "Correction
Bolus" with type "SMB", not as its own eventType. bolus_stats() was
grouping by eventType alone, so every SMB was silently counted as a manual
correction bolus. Verified against production data: 100% of "Correction
Bolus" treatments over 90 days were actually type=SMB.

Also adds basal_stats(), computing delivered basal directly from Temp
Basal treatments (rate x duration) without needing the pump profile.

Closes gitea #20.
willemjan merged commit d637ad39e4 into main 2026-08-01 20:53:11 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: willemjan/glucose-dashboard#24