FA-64241 / Medication dosing calculations / Open access
Oral liquid volume measured in a dosing syringe: split syringe count · case 01
A 9 mL dose in 5 mL syringes reports a single syringe.
ROOT CAUSE
The number of syringes uses floor division instead of ceiling.
THE FAILURE
The number of syringes uses floor division instead of ceiling.
Unsuccessful approach: Adding one to floor division over-counts exact multiples.
Case contract
Input {weight_kg, mg_per_kg, max_mg, conc_mg, conc_ml (label strength conc_mg per conc_ml), syringe_ml (1, 5 or 10)}. dose = min(mg_per_kg*weight, max_mg); volume = dose/(conc_mg/conc_ml). Graduations: 1 mL syringe 0.01 mL, 5 mL syringe 0.2 mL, 10 mL syringe 0.5 mL. Round half-up to the graduation, but if that delivers more than max_mg round down instead. A rounded volume above syringe capacity returns {status SPLIT, syringes = ceil(volume/capacity)}; otherwise {status OK, volume_ml, dose_mg delivered}.
Why this case matters
Liquid dosing converts mg to mL through a label strength and then to what a syringe can actually measure; each step has a distinct defect.
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):
dose = min(Fraction(str(x['mg_per_kg'])) * Fraction(str(x['weight_kg'])), x['max_mg'])
per_ml = Fraction(x['conc_mg'], x['conc_ml'])
vol = dose / per_ml
grad = {1: Fraction(1, 100), 5: Fraction(1, 5), 10: Fraction(1, 2)}[x['syringe_ml']]
v = math.floor(vol / grad + Fraction(1, 2)) * grad
if v * per_ml > x['max_mg']:
v = math.floor(vol / grad) * grad
if v > x['syringe_ml']:
return {'status': 'SPLIT', 'syringes': int(v // x['syringe_ml'])}
return {'status': 'OK', 'volume_ml': float(v), 'dose_mg': float(v * per_ml)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('suspension per 5 mL label',
{'weight_kg': 13, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.0, 'dose_mg': 200.0}),
('5 mL syringe graduations',
{'weight_kg': 9, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 3.8, 'dose_mg': 91.2}),
('10 mL syringe graduations',
{'weight_kg': 21, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.5, 'dose_mg': 150.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 195, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.5, 'dose_mg': 180.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 39, 'mg_per_kg': 5, 'max_mg': 200, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 200.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.1', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 5, 'max_mg': 1000, 'conc_mg': 10, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 31, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2})],
[('suspension per 5 mL label',
{'weight_kg': 14, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.0, 'dose_mg': 200.0}),
('5 mL syringe graduations',
{'weight_kg': 10, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 4.2, 'dose_mg': 100.8}),
('10 mL syringe graduations',
{'weight_kg': 22, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.5, 'dose_mg': 150.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 215, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 200.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 43, 'mg_per_kg': 5, 'max_mg': 220, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.5, 'dose_mg': 220.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.2', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 10, 'max_mg': 1000, 'conc_mg': 20, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 32, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2})],
[('suspension per 5 mL label',
{'weight_kg': 15, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.5, 'dose_mg': 225.0}),
('5 mL syringe graduations',
{'weight_kg': 11, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 4.6, 'dose_mg': 110.4}),
('10 mL syringe graduations',
{'weight_kg': 23, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 8.0, 'dose_mg': 160.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 235, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.5, 'dose_mg': 220.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 47, 'mg_per_kg': 5, 'max_mg': 240, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.0, 'dose_mg': 240.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.05', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 30, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 34, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})],
[('suspension per 5 mL label',
{'weight_kg': 16, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 250.0}),
('5 mL syringe graduations',
{'weight_kg': 12, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('10 mL syringe graduations',
{'weight_kg': 24, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 8.5, 'dose_mg': 170.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 255, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.0, 'dose_mg': 240.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 51, 'mg_per_kg': 5, 'max_mg': 260, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.5, 'dose_mg': 260.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.15', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 20, 'max_mg': 1000, 'conc_mg': 40, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 36, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})],
[('suspension per 5 mL label',
{'weight_kg': 17, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 250.0}),
('5 mL syringe graduations',
{'weight_kg': 13, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('10 mL syringe graduations',
{'weight_kg': 25, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 9.0, 'dose_mg': 180.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 275, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.5, 'dose_mg': 260.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 55, 'mg_per_kg': 5, 'max_mg': 280, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.0, 'dose_mg': 280.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.12', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 25, 'max_mg': 1000, 'conc_mg': 50, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 37, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| suspension per 5 mL label | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 4.0} | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 4.0} | Passed |
| 5 mL syringe graduations | {'dose_mg': 91.2, 'status': 'OK', 'volume_ml': 3.8} | {'dose_mg': 91.2, 'status': 'OK', 'volume_ml': 3.8} | Passed |
| 10 mL syringe graduations | {'dose_mg': 150.0, 'status': 'OK', 'volume_ml': 7.5} | {'dose_mg': 150.0, 'status': 'OK', 'volume_ml': 7.5} | Passed |
| rounding up would exceed maximum | {'dose_mg': 180.0, 'status': 'OK', 'volume_ml': 4.5} | {'dose_mg': 180.0, 'status': 'OK', 'volume_ml': 4.5} | Passed |
| rounding up lands exactly on maximum | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 5.0} | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 5.0} | Passed |
| volume rounds down to capacity | {'dose_mg': 120.0, 'status': 'OK', 'volume_ml': 5.0} | {'dose_mg': 120.0, 'status': 'OK', 'volume_ml': 5.0} | Passed |
| exact multiple of syringe capacity | {'status': 'SPLIT', 'syringes': 2} | {'status': 'SPLIT', 'syringes': 2} | Passed |
| split across syringes | {'status': 'SPLIT', 'syringes': 1} | {'status': 'SPLIT', 'syringes': 2} | Failed |
SHA-256 / 1d47ec52cfdf92e9f6477b7641b59bb42fe184d6871c39da9e88fc43ffdd0ad9
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):
dose = min(Fraction(str(x['mg_per_kg'])) * Fraction(str(x['weight_kg'])), x['max_mg'])
per_ml = Fraction(x['conc_mg'], x['conc_ml'])
vol = dose / per_ml
grad = {1: Fraction(1, 100), 5: Fraction(1, 5), 10: Fraction(1, 2)}[x['syringe_ml']]
v = math.floor(vol / grad + Fraction(1, 2)) * grad
if v * per_ml > x['max_mg']:
v = math.floor(vol / grad) * grad
if v > x['syringe_ml']:
return {'status': 'SPLIT', 'syringes': int(v // x['syringe_ml']) + 1}
return {'status': 'OK', 'volume_ml': float(v), 'dose_mg': float(v * per_ml)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('suspension per 5 mL label',
{'weight_kg': 13, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.0, 'dose_mg': 200.0}),
('5 mL syringe graduations',
{'weight_kg': 9, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 3.8, 'dose_mg': 91.2}),
('10 mL syringe graduations',
{'weight_kg': 21, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.5, 'dose_mg': 150.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 195, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.5, 'dose_mg': 180.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 39, 'mg_per_kg': 5, 'max_mg': 200, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 200.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.1', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 5, 'max_mg': 1000, 'conc_mg': 10, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 31, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2})],
[('suspension per 5 mL label',
{'weight_kg': 14, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.0, 'dose_mg': 200.0}),
('5 mL syringe graduations',
{'weight_kg': 10, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 4.2, 'dose_mg': 100.8}),
('10 mL syringe graduations',
{'weight_kg': 22, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.5, 'dose_mg': 150.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 215, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 200.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 43, 'mg_per_kg': 5, 'max_mg': 220, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.5, 'dose_mg': 220.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.2', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 10, 'max_mg': 1000, 'conc_mg': 20, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 32, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2})],
[('suspension per 5 mL label',
{'weight_kg': 15, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 4.5, 'dose_mg': 225.0}),
('5 mL syringe graduations',
{'weight_kg': 11, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 4.6, 'dose_mg': 110.4}),
('10 mL syringe graduations',
{'weight_kg': 23, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 8.0, 'dose_mg': 160.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 235, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.5, 'dose_mg': 220.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 47, 'mg_per_kg': 5, 'max_mg': 240, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.0, 'dose_mg': 240.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.05', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 30, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 34, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})],
[('suspension per 5 mL label',
{'weight_kg': 16, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 250.0}),
('5 mL syringe graduations',
{'weight_kg': 12, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('10 mL syringe graduations',
{'weight_kg': 24, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 8.5, 'dose_mg': 170.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 255, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.0, 'dose_mg': 240.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 51, 'mg_per_kg': 5, 'max_mg': 260, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.5, 'dose_mg': 260.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.15', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 20, 'max_mg': 1000, 'conc_mg': 40, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 36, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})],
[('suspension per 5 mL label',
{'weight_kg': 17, 'mg_per_kg': 15, 'max_mg': 500, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 250.0}),
('5 mL syringe graduations',
{'weight_kg': 13, 'mg_per_kg': 10, 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('10 mL syringe graduations',
{'weight_kg': 25, 'mg_per_kg': 7, 'max_mg': 500, 'conc_mg': 100, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 9.0, 'dose_mg': 180.0}),
('rounding up would exceed maximum',
{'weight_kg': 40, 'mg_per_kg': 20, 'max_mg': 275, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 6.5, 'dose_mg': 260.0}),
('rounding up lands exactly on maximum',
{'weight_kg': 55, 'mg_per_kg': 5, 'max_mg': 280, 'conc_mg': 200, 'conc_ml': 5, 'syringe_ml': 10},
{'status': 'OK', 'volume_ml': 7.0, 'dose_mg': 280.0}),
('volume rounds down to capacity',
{'weight_kg': 10, 'mg_per_kg': '12.12', 'max_mg': 500, 'conc_mg': 120, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'OK', 'volume_ml': 5.0, 'dose_mg': 120.0}),
('exact multiple of syringe capacity',
{'weight_kg': 20, 'mg_per_kg': 25, 'max_mg': 1000, 'conc_mg': 50, 'conc_ml': 1, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 2}),
('split across syringes',
{'weight_kg': 37, 'mg_per_kg': 15, 'max_mg': 1000, 'conc_mg': 250, 'conc_ml': 5, 'syringe_ml': 5},
{'status': 'SPLIT', 'syringes': 3})]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| suspension per 5 mL label | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 4.0} | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 4.0} | Passed |
| 5 mL syringe graduations | {'dose_mg': 91.2, 'status': 'OK', 'volume_ml': 3.8} | {'dose_mg': 91.2, 'status': 'OK', 'volume_ml': 3.8} | Passed |
| 10 mL syringe graduations | {'dose_mg': 150.0, 'status': 'OK', 'volume_ml': 7.5} | {'dose_mg': 150.0, 'status': 'OK', 'volume_ml': 7.5} | Passed |
| rounding up would exceed maximum | {'dose_mg': 180.0, 'status': 'OK', 'volume_ml': 4.5} | {'dose_mg': 180.0, 'status': 'OK', 'volume_ml': 4.5} | Passed |
| rounding up lands exactly on maximum | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 5.0} | {'dose_mg': 200.0, 'status': 'OK', 'volume_ml': 5.0} | Passed |
| volume rounds down to capacity | {'dose_mg': 120.0, 'status': 'OK', 'volume_ml': 5.0} | {'dose_mg': 120.0, 'status': 'OK', 'volume_ml': 5.0} | Passed |
| exact multiple of syringe capacity | {'status': 'SPLIT', 'syringes': 3} | {'status': 'SPLIT', 'syringes': 2} | Failed |
| split across syringes | {'status': 'SPLIT', 'syringes': 2} | {'status': 'SPLIT', 'syringes': 2} | Passed |
SHA-256 / cc3f3c8c06f876ccb84d8e68a9aa596e2ed149af33d10f35f7b5f346b0381070
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:22.566402+00:00.
Case digest / db71d38c40388cda564ba8023c18a7d01e59b330f15b8f2961ff1a63f6bafd2d