FAILURE MAP
← Case archive

FA-64116 / Medication dosing calculations / Open access

Gravity drip rate and infusion end time: midnight crossing day offset · case 01

An infusion finishing exactly at 00:00 is reported as ending today.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The day offset uses a strict comparison and counts at most one midnight.

VERIFIED REPAIR

Use floor division of total minutes by 1440.

Unsuccessful approach: Using >= fixes the midnight edge but still reports one day for multi-day infusions.

Case contract

Input {volume_ml, duration_min, drop_factor (gtt/mL), start "HH:MM" 24-hour}. drops/min = volume*drop_factor/duration rounded half-up to a whole drop; mL/h = volume*60/duration rounded half-up to 0.1; end = start + duration on a 24-hour clock with day_offset = number of midnights crossed (ending exactly at 00:00 counts as the next day). Return {gtt_min, ml_h, end, day_offset}.

Why this case matters

Manual gravity infusions depend on drop-factor arithmetic and clock arithmetic across midnight, each with its own failure modes.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    gtt = Fraction(x['volume_ml'] * x['drop_factor'], x['duration_min'])
    gtt_i = math.floor(gtt + Fraction(1, 2))
    mlh = Fraction(x['volume_ml'] * 60, x['duration_min'])
    mlh_t = math.floor(mlh * 10 + Fraction(1, 2))
    h, m = map(int, x['start'].split(':'))
    total = h * 60 + m + x['duration_min']
    day = int(total > 1440)
    total = total % 1440
    return {'gtt_min': gtt_i, 'ml_h': mlh_t / 10, 'end': '%02d:%02d' % (total // 60, total % 60), 'day_offset': day}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:05'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:05', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 103, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 34, 'ml_h': 103.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 150, 'drop_factor': 20, 'start': '22:00'},
   {'gtt_min': 67, 'ml_h': 200.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 2940, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 41, 'ml_h': 40.8, 'end': '14:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 31, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 97, 'ml_h': 96.8, 'end': '11:16', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:10'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:10', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 106, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 35, 'ml_h': 106.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 180, 'drop_factor': 20, 'start': '21:30'},
   {'gtt_min': 56, 'ml_h': 166.7, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3000, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 40, 'ml_h': 40.0, 'end': '15:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 32, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 94, 'ml_h': 93.8, 'end': '11:17', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 10, 'start': '14:15'},
   {'gtt_min': 21, 'ml_h': 125.0, 'end': '22:15', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 10, 'start': '08:00'},
   {'gtt_min': 25, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 109, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 36, 'ml_h': 109.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 210, 'drop_factor': 20, 'start': '21:00'},
   {'gtt_min': 48, 'ml_h': 142.9, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3060, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 39, 'ml_h': 39.2, 'end': '16:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 33, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 91, 'ml_h': 90.9, 'end': '11:18', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:20'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:20', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 20, 'start': '08:00'},
   {'gtt_min': 50, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 112, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 37, 'ml_h': 112.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 240, 'drop_factor': 20, 'start': '20:30'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3120, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 38.5, 'end': '17:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 34, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 88, 'ml_h': 88.2, 'end': '11:19', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:25'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:25', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 115, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 38, 'ml_h': 115.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 270, 'drop_factor': 20, 'start': '20:00'},
   {'gtt_min': 37, 'ml_h': 111.1, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3180, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 37.7, 'end': '18:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 35, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 86, 'ml_h': 85.7, 'end': '11:20', 'day_offset': 0})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
macrodrip set afternoon start{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}Passed
drop rate rounds half up{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}Passed
fractional drop rate rounds down{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}Passed
ends exactly at midnight{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}Passed
multi-day infusion{'day_offset': 1, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}{'day_offset': 2, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}Failed
short microdrip before noon{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}Passed

SHA-256 / 1c7240c8dc30570e5f84d8ed09aabffda0a7ec56decdfaef5083ac6c8048c749

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    gtt = Fraction(x['volume_ml'] * x['drop_factor'], x['duration_min'])
    gtt_i = math.floor(gtt + Fraction(1, 2))
    mlh = Fraction(x['volume_ml'] * 60, x['duration_min'])
    mlh_t = math.floor(mlh * 10 + Fraction(1, 2))
    h, m = map(int, x['start'].split(':'))
    total = h * 60 + m + x['duration_min']
    day = int(total >= 1440)
    total = total % 1440
    return {'gtt_min': gtt_i, 'ml_h': mlh_t / 10, 'end': '%02d:%02d' % (total // 60, total % 60), 'day_offset': day}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:05'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:05', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 103, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 34, 'ml_h': 103.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 150, 'drop_factor': 20, 'start': '22:00'},
   {'gtt_min': 67, 'ml_h': 200.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 2940, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 41, 'ml_h': 40.8, 'end': '14:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 31, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 97, 'ml_h': 96.8, 'end': '11:16', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:10'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:10', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 106, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 35, 'ml_h': 106.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 180, 'drop_factor': 20, 'start': '21:30'},
   {'gtt_min': 56, 'ml_h': 166.7, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3000, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 40, 'ml_h': 40.0, 'end': '15:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 32, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 94, 'ml_h': 93.8, 'end': '11:17', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 10, 'start': '14:15'},
   {'gtt_min': 21, 'ml_h': 125.0, 'end': '22:15', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 10, 'start': '08:00'},
   {'gtt_min': 25, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 109, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 36, 'ml_h': 109.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 210, 'drop_factor': 20, 'start': '21:00'},
   {'gtt_min': 48, 'ml_h': 142.9, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3060, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 39, 'ml_h': 39.2, 'end': '16:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 33, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 91, 'ml_h': 90.9, 'end': '11:18', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:20'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:20', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 20, 'start': '08:00'},
   {'gtt_min': 50, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 112, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 37, 'ml_h': 112.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 240, 'drop_factor': 20, 'start': '20:30'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3120, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 38.5, 'end': '17:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 34, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 88, 'ml_h': 88.2, 'end': '11:19', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:25'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:25', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 115, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 38, 'ml_h': 115.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 270, 'drop_factor': 20, 'start': '20:00'},
   {'gtt_min': 37, 'ml_h': 111.1, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3180, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 37.7, 'end': '18:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 35, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 86, 'ml_h': 85.7, 'end': '11:20', 'day_offset': 0})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
macrodrip set afternoon start{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}Passed
drop rate rounds half up{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}Passed
fractional drop rate rounds down{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}Passed
ends exactly at midnight{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}Passed
multi-day infusion{'day_offset': 1, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}{'day_offset': 2, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}Failed
short microdrip before noon{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}Passed

SHA-256 / 0709b07290a8eba65a9a8abb1059a01602f0e06c87248dca5e2a139e4c8ea0b6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    gtt = Fraction(x['volume_ml'] * x['drop_factor'], x['duration_min'])
    gtt_i = math.floor(gtt + Fraction(1, 2))
    mlh = Fraction(x['volume_ml'] * 60, x['duration_min'])
    mlh_t = math.floor(mlh * 10 + Fraction(1, 2))
    h, m = map(int, x['start'].split(':'))
    total = h * 60 + m + x['duration_min']
    day = total // 1440
    total = total % 1440
    return {'gtt_min': gtt_i, 'ml_h': mlh_t / 10, 'end': '%02d:%02d' % (total // 60, total % 60), 'day_offset': day}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:05'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:05', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 103, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 34, 'ml_h': 103.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 150, 'drop_factor': 20, 'start': '22:00'},
   {'gtt_min': 67, 'ml_h': 200.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 2940, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 41, 'ml_h': 40.8, 'end': '14:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 31, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 97, 'ml_h': 96.8, 'end': '11:16', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:10'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:10', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 106, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 35, 'ml_h': 106.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 180, 'drop_factor': 20, 'start': '21:30'},
   {'gtt_min': 56, 'ml_h': 166.7, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3000, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 40, 'ml_h': 40.0, 'end': '15:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 32, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 94, 'ml_h': 93.8, 'end': '11:17', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 10, 'start': '14:15'},
   {'gtt_min': 21, 'ml_h': 125.0, 'end': '22:15', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 10, 'start': '08:00'},
   {'gtt_min': 25, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 109, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 36, 'ml_h': 109.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 210, 'drop_factor': 20, 'start': '21:00'},
   {'gtt_min': 48, 'ml_h': 142.9, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3060, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 39, 'ml_h': 39.2, 'end': '16:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 33, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 91, 'ml_h': 90.9, 'end': '11:18', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 15, 'start': '14:20'},
   {'gtt_min': 31, 'ml_h': 125.0, 'end': '22:20', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 20, 'start': '08:00'},
   {'gtt_min': 50, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 112, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 37, 'ml_h': 112.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 240, 'drop_factor': 20, 'start': '20:30'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3120, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 38.5, 'end': '17:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 34, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 88, 'ml_h': 88.2, 'end': '11:19', 'day_offset': 0})],
 [('macrodrip set afternoon start',
   {'volume_ml': 1000, 'duration_min': 480, 'drop_factor': 20, 'start': '14:25'},
   {'gtt_min': 42, 'ml_h': 125.0, 'end': '22:25', 'day_offset': 0}),
  ('drop rate rounds half up',
   {'volume_ml': 250, 'duration_min': 100, 'drop_factor': 15, 'start': '08:00'},
   {'gtt_min': 38, 'ml_h': 150.0, 'end': '09:40', 'day_offset': 0}),
  ('fractional drop rate rounds down',
   {'volume_ml': 115, 'duration_min': 60, 'drop_factor': 20, 'start': '09:30'},
   {'gtt_min': 38, 'ml_h': 115.0, 'end': '10:30', 'day_offset': 0}),
  ('ends exactly at midnight',
   {'volume_ml': 500, 'duration_min': 270, 'drop_factor': 20, 'start': '20:00'},
   {'gtt_min': 37, 'ml_h': 111.1, 'end': '00:30', 'day_offset': 1}),
  ('multi-day infusion',
   {'volume_ml': 2000, 'duration_min': 3180, 'drop_factor': 60, 'start': '13:15'},
   {'gtt_min': 38, 'ml_h': 37.7, 'end': '18:15', 'day_offset': 2}),
  ('short microdrip before noon',
   {'volume_ml': 50, 'duration_min': 35, 'drop_factor': 60, 'start': '10:45'},
   {'gtt_min': 86, 'ml_h': 85.7, 'end': '11:20', 'day_offset': 0})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
macrodrip set afternoon start{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}{'day_offset': 0, 'end': '22:05', 'gtt_min': 31, 'ml_h': 125.0}Passed
drop rate rounds half up{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}{'day_offset': 0, 'end': '09:40', 'gtt_min': 38, 'ml_h': 150.0}Passed
fractional drop rate rounds down{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}{'day_offset': 0, 'end': '10:30', 'gtt_min': 34, 'ml_h': 103.0}Passed
ends exactly at midnight{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}{'day_offset': 1, 'end': '00:30', 'gtt_min': 67, 'ml_h': 200.0}Passed
multi-day infusion{'day_offset': 2, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}{'day_offset': 2, 'end': '14:15', 'gtt_min': 41, 'ml_h': 40.8}Passed
short microdrip before noon{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}{'day_offset': 0, 'end': '11:16', 'gtt_min': 97, 'ml_h': 96.8}Passed

SHA-256 / 12873decc47feb680c6b69ec2a87c9deaf9d737a7a98868fa6c518f9f8abd494

Verification & scope

A deterministic toy software model with explicitly stipulated thresholds and formulas; it is not clinical guidance, not a validated medical calculator, and makes no claim of conformance to any published protocol. Numbered variants vary patient and order inputs. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:21.202050+00:00.

Case digest / ccf51416c31c534bdae2d2781f8b8676f0dff96d84168eb993311396229112bc