FA-64271 / Medication dosing calculations / Open access
INR-guided weekly dose adjustment and daily plan: hold threshold · case 01
An INR of exactly 5.0 is only reduced instead of held.
ROOT CAUSE
The hold threshold excludes 5.0 with a strict comparison.
THE FAILURE
The hold threshold excludes 5.0 with a strict comparison.
Unsuccessful approach: Deriving the threshold from the target range (high + 2) only equals 5.0 for a 2-3 range.
Case contract
Input {inr, weekly_mg, low, high}. Toy table: inr >= 5 HOLD and weekly x0.85; high < inr < 5 x0.90; low <= inr <= high CONTINUE unchanged; low-0.5 <= inr < low x1.05; lower x1.10 (ADJUST otherwise). New weekly total rounds half-up to 0.5 mg; the plan spreads it over 7 days in 0.5 mg units as evenly as possible with the larger doses on the first days. Return {action, weekly_mg, plan}.
Why this case matters
Weekly anticoagulant adjustment combines threshold bands with a dispensing plan; band edges and the distribution rule are independent defects.
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):
inr = Fraction(str(x['inr']))
lo, hi = Fraction(str(x['low'])), Fraction(str(x['high']))
w = Fraction(str(x['weekly_mg']))
action = 'ADJUST'
if inr > 5:
action, w = 'HOLD', w * Fraction(85, 100)
elif inr > hi:
w = w * Fraction(90, 100)
elif inr >= lo:
action = 'CONTINUE'
elif inr >= lo - Fraction(1, 2):
w = w * Fraction(105, 100)
else:
w = w * Fraction(110, 100)
units = math.floor(w * 2 + Fraction(1, 2))
base, extra = divmod(units, 7)
plan = [(base + 1) / 2] * extra + [base / 2] * (7 - extra)
return {'action': action, 'weekly_mg': units / 2, 'plan': plan}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 31, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 26.5, 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 29, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 29.0, 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 31, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 22, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 23.0, 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 26, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 28.5, 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 25, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 26.5, 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '32.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 32.5, 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 32, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 27.0, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 3.5, 3.5]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 30, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 32, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 24, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 25.0, 'plan': [4.0, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 27, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 29.5, 'plan': [4.5, 4.5, 4.5, 4.0, 4.0, 4.0, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 45, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 47.5, 'plan': [7.0, 7.0, 7.0, 7.0, 6.5, 6.5, 6.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '27.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 27.5, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 3.5]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 33, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 28.0, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 31, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 33, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 26, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 27.5, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 3.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 28, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 65, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 68.5, 'plan': [10.0, 10.0, 10.0, 10.0, 9.5, 9.5, 9.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '31', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 34, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 29.0, 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 32, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 34, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 34.0, 'plan': [5.0, 5.0, 5.0, 5.0, 5.0, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 28, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 29.5, 'plan': [4.5, 4.5, 4.5, 4.0, 4.0, 4.0, 4.0]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 29, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 85, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 89.5, 'plan': [13.0, 13.0, 13.0, 13.0, 12.5, 12.5, 12.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '22.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 22.5, 'plan': [3.5, 3.5, 3.5, 3.0, 3.0, 3.0, 3.0]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 35, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 33, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 35, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 35.0, 'plan': [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 30, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 31.5, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 30, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 105, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 110.5, 'plan': [16.0, 16.0, 16.0, 16.0, 15.5, 15.5, 15.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '38', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 38.0, 'plan': [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| INR exactly 5 holds | {'action': 'ADJUST', 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 28.0} | {'action': 'HOLD', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | Failed |
| high target range above 3 | {'action': 'HOLD', 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0], 'weekly_mg': 30.0} | {'action': 'HOLD', 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0], 'weekly_mg': 30.0} | Passed |
| INR at upper target continues | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 29.0} | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 29.0} | Passed |
| INR at lower target continues | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0], 'weekly_mg': 31.0} | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0], 'weekly_mg': 31.0} | Passed |
| INR exactly half below target | {'action': 'ADJUST', 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0], 'weekly_mg': 23.0} | {'action': 'ADJUST', 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0], 'weekly_mg': 23.0} | Passed |
| INR well below target | {'action': 'ADJUST', 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 28.5} | {'action': 'ADJUST', 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 28.5} | Passed |
| weekly rounding half-up | {'action': 'ADJUST', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | {'action': 'ADJUST', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | Passed |
| uneven weekly split | {'action': 'CONTINUE', 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5], 'weekly_mg': 32.5} | {'action': 'CONTINUE', 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5], 'weekly_mg': 32.5} | Passed |
SHA-256 / d29c3ac73ac3d89c857a644121d7f0d52f6164b342d5554f027f68bd649d1ff9
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):
inr = Fraction(str(x['inr']))
lo, hi = Fraction(str(x['low'])), Fraction(str(x['high']))
w = Fraction(str(x['weekly_mg']))
action = 'ADJUST'
if inr >= hi + 2:
action, w = 'HOLD', w * Fraction(85, 100)
elif inr > hi:
w = w * Fraction(90, 100)
elif inr >= lo:
action = 'CONTINUE'
elif inr >= lo - Fraction(1, 2):
w = w * Fraction(105, 100)
else:
w = w * Fraction(110, 100)
units = math.floor(w * 2 + Fraction(1, 2))
base, extra = divmod(units, 7)
plan = [(base + 1) / 2] * extra + [base / 2] * (7 - extra)
return {'action': action, 'weekly_mg': units / 2, 'plan': plan}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 31, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 26.5, 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 29, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 29.0, 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 31, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 22, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 23.0, 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 26, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 28.5, 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 25, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 26.5, 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '32.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 32.5, 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 32, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 27.0, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 3.5, 3.5]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 30, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 32, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 24, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 25.0, 'plan': [4.0, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 27, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 29.5, 'plan': [4.5, 4.5, 4.5, 4.0, 4.0, 4.0, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 45, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 47.5, 'plan': [7.0, 7.0, 7.0, 7.0, 6.5, 6.5, 6.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '27.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 27.5, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 3.5]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 33, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 28.0, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 31, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 33, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 26, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 27.5, 'plan': [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 3.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 28, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 65, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 68.5, 'plan': [10.0, 10.0, 10.0, 10.0, 9.5, 9.5, 9.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '31', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 31.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 34, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 29.0, 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 32, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 34, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 34.0, 'plan': [5.0, 5.0, 5.0, 5.0, 5.0, 4.5, 4.5]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 28, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 29.5, 'plan': [4.5, 4.5, 4.5, 4.0, 4.0, 4.0, 4.0]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 29, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 32.0, 'plan': [5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 85, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 89.5, 'plan': [13.0, 13.0, 13.0, 13.0, 12.5, 12.5, 12.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '22.5', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 22.5, 'plan': [3.5, 3.5, 3.5, 3.0, 3.0, 3.0, 3.0]})],
[('INR exactly 5 holds',
{'inr': '5.0', 'weekly_mg': 35, 'low': 2, 'high': 3},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('high target range above 3',
{'inr': '5.2', 'weekly_mg': 35, 'low': '2.5', 'high': '3.5'},
{'action': 'HOLD', 'weekly_mg': 30.0, 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0]}),
('INR at upper target continues',
{'inr': '3.5', 'weekly_mg': 33, 'low': '2.5', 'high': '3.5'},
{'action': 'CONTINUE', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('INR at lower target continues',
{'inr': '2.0', 'weekly_mg': 35, 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 35.0, 'plan': [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0]}),
('INR exactly half below target',
{'inr': '1.5', 'weekly_mg': 30, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 31.5, 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]}),
('INR well below target',
{'inr': '1.2', 'weekly_mg': 30, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 33.0, 'plan': [5.0, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5]}),
('weekly rounding half-up',
{'inr': '1.8', 'weekly_mg': 105, 'low': 2, 'high': 3},
{'action': 'ADJUST', 'weekly_mg': 110.5, 'plan': [16.0, 16.0, 16.0, 16.0, 15.5, 15.5, 15.5]}),
('uneven weekly split',
{'inr': '2.5', 'weekly_mg': '38', 'low': 2, 'high': 3},
{'action': 'CONTINUE', 'weekly_mg': 38.0, 'plan': [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| INR exactly 5 holds | {'action': 'HOLD', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | {'action': 'HOLD', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | Passed |
| high target range above 3 | {'action': 'ADJUST', 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5], 'weekly_mg': 31.5} | {'action': 'HOLD', 'plan': [4.5, 4.5, 4.5, 4.5, 4.0, 4.0, 4.0], 'weekly_mg': 30.0} | Failed |
| INR at upper target continues | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 29.0} | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 29.0} | Passed |
| INR at lower target continues | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0], 'weekly_mg': 31.0} | {'action': 'CONTINUE', 'plan': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.0], 'weekly_mg': 31.0} | Passed |
| INR exactly half below target | {'action': 'ADJUST', 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0], 'weekly_mg': 23.0} | {'action': 'ADJUST', 'plan': [3.5, 3.5, 3.5, 3.5, 3.0, 3.0, 3.0], 'weekly_mg': 23.0} | Passed |
| INR well below target | {'action': 'ADJUST', 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 28.5} | {'action': 'ADJUST', 'plan': [4.5, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0], 'weekly_mg': 28.5} | Passed |
| weekly rounding half-up | {'action': 'ADJUST', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | {'action': 'ADJUST', 'plan': [4.0, 4.0, 4.0, 4.0, 3.5, 3.5, 3.5], 'weekly_mg': 26.5} | Passed |
| uneven weekly split | {'action': 'CONTINUE', 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5], 'weekly_mg': 32.5} | {'action': 'CONTINUE', 'plan': [5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5], 'weekly_mg': 32.5} | Passed |
SHA-256 / d2f27f1b98ebcc9d609dac6448a4a7da4190c38ee53402867370228814d9676d
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:23.108235+00:00.
Case digest / bcd5bddb0395c4ec53fdf5e0ae47b5034048b5749a85676c4f50b296c9036f21