FA-63977 / Medication dosing calculations / Member archive
Meal and correction insulin bolus with insulin on board: hypoglycaemia hold threshold · case 02
A glucose of exactly 70 mg/dL blocks a meal bolus.
Case contract
Input {bg, target, isf, carbs_g, icr, iob, max_units}. Toy rule: bg < 70 returns HOLD with 0 units. correction = (bg-target)/isf; when positive, insulin on board is subtracted from it and the result floored at 0; a negative correction (bg below target) is kept and reduces the meal dose. meal = carbs_g/icr. total = max(0, meal + correction), capped at max_units, then rounded DOWN to 0.5 units. Return {action GIVE|HOLD, units}.
Why this case matters
Bolus calculators combine several unit ratios and safety rules; insulin-on-board, hypoglycaemia holds and pen resolution are separate decision points.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| glucose exactly 70 is dosed | {"action": "HOLD", "units": 0.0} | {"action": "GIVE", "units": 5.0} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗