{"abstract":"The taper stops one step early when the dose reaches exactly the minimum.","category":"Medication dosing calculations","checks":6,"contract":"Input {start_mg, step_pct, every_days, min_mg, tablet_mg, days}. Day 0 uses start_mg. On each day d > 0 with d % every_days == 0 (while the dose is non-zero), the dose becomes current*(100-step_pct)/100 rounded half-up to a tablet_mg multiple; if that does not lower the dose, it is lowered by one tablet_mg instead; a result below min_mg stops the taper (0). Return the list of daily doses for days days.","evaluation_group":"w2-meddose-taper-schedule","failed_approach":"Comparing with the tablet size instead of min_mg continues below the stipulated minimum.","family":"w2-meddose-taper-schedule-stop-threshold","id":"FA-64171","implementations":{"attempt":{"sha256":"be5a893a26c96961f5e8c57ce465d258e243c927d4d53dedad7dec9af6baefb2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    dose = Fraction(str(x['start_mg']))\n    t = Fraction(str(x['tablet_mg']))\n    out = []\n    for day in range(x['days']):\n        if day > 0 and day % x['every_days'] == 0 and dose > 0:\n            new = dose * (100 - x['step_pct']) / 100\n            new = math.floor(new / t + Fraction(1, 2)) * t\n            if new >= dose:\n                new = dose - t\n            dose = new if new >= t else Fraction(0)\n        out.append(float(dose))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 11},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 4},\n   [50.0, 50.0, 45.0, 45.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 6},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 8},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 12},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [50.0, 50.0, 45.0, 45.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 7},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 9},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 13},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 6},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 8},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 10},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 14},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 7},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 9},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 11},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 15},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 8},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 10},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 12},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0, 6.0])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"f221139962e48e33e372276163036927565568992ae247627a6da8df0a7b85ee","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    dose = Fraction(str(x['start_mg']))\n    t = Fraction(str(x['tablet_mg']))\n    out = []\n    for day in range(x['days']):\n        if day > 0 and day % x['every_days'] == 0 and dose > 0:\n            new = dose * (100 - x['step_pct']) / 100\n            new = math.floor(new / t + Fraction(1, 2)) * t\n            if new >= dose:\n                new = dose - t\n            dose = new if new > Fraction(str(x['min_mg'])) else Fraction(0)\n        out.append(float(dose))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 11},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 4},\n   [50.0, 50.0, 45.0, 45.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 6},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 8},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 12},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [50.0, 50.0, 45.0, 45.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 7},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 9},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 13},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 6},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 8},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 10},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 14},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 7},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 9},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 11},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 15},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 8},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 10},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 12},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0, 6.0])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"0255bd4022b2d660efaf1d803e7a2f28240979cf27268e4975ea59ee413fd554","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    dose = Fraction(str(x['start_mg']))\n    t = Fraction(str(x['tablet_mg']))\n    out = []\n    for day in range(x['days']):\n        if day > 0 and day % x['every_days'] == 0 and dose > 0:\n            new = dose * (100 - x['step_pct']) / 100\n            new = math.floor(new / t + Fraction(1, 2)) * t\n            if new >= dose:\n                new = dose - t\n            dose = new if new >= Fraction(str(x['min_mg'])) else Fraction(0)\n        out.append(float(dose))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 11},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 4},\n   [50.0, 50.0, 45.0, 45.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 6},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 8},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 12},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [50.0, 50.0, 45.0, 45.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 7},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 9},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 13},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 6},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 8},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 10},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 14},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 7},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 1, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 7.5, 5.0, 2.5, 0.0, 0.0, 0.0, 0.0]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 9},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 5, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 5.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 11},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0])],\n [('weekly 25 percent taper',\n   {'start_mg': 60, 'step_pct': 25, 'every_days': 3, 'min_mg': 5, 'tablet_mg': 5, 'days': 15},\n   [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0, 25.0, 20.0, 20.0, 20.0]),\n  ('half-tablet boundary rounds up',\n   {'start_mg': 50, 'step_pct': 15, 'every_days': 2, 'min_mg': 5, 'tablet_mg': 5, 'days': 8},\n   [50.0, 50.0, 45.0, 45.0, 40.0, 40.0, 35.0, 35.0]),\n  ('rounding stall forces one tablet step',\n   {'start_mg': 10, 'step_pct': 10, 'every_days': 2, 'min_mg': '2.5', 'tablet_mg': '2.5', 'days': 8},\n   [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5]),\n  ('stops below minimum',\n   {'start_mg': 20, 'step_pct': 50, 'every_days': 2, 'min_mg': 10, 'tablet_mg': 5, 'days': 10},\n   [20.0, 20.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]),\n  ('dose equal to minimum continues',\n   {'start_mg': 40, 'step_pct': 50, 'every_days': 1, 'min_mg': 10, 'tablet_mg': 5, 'days': 5},\n   [40.0, 20.0, 10.0, 0.0, 0.0]),\n  ('fractional tablet percentages',\n   {'start_mg': 30, 'step_pct': 30, 'every_days': 2, 'min_mg': 1, 'tablet_mg': 1, 'days': 12},\n   [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0, 8.0, 8.0, 6.0, 6.0])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-meddose-taper-schedule-stop-threshold","generated_at":"2026-09-29T14:47:21.851145+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Tapers compound percentage reductions with dispensing granularity; stepping day, rounding and stop rules are distinct decisions.","repair":"Continue while the new dose is >= min_mg.","root_cause":"The continuation check excludes a dose equal to min_mg.","sha256":"2096a0cdc864b6d3ed51e5c8a662490b93eea239e07d2bb0540bdcd0bd8749f6","title":"Percentage taper schedule rounded to tablets: stop threshold · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.247,"exit_code":1,"observations":[{"actual":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"check":"weekly 25 percent taper","expected":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"passed":true},{"actual":[50.0,50.0,45.0,45.0],"check":"half-tablet boundary rounds up","expected":[50.0,50.0,45.0,45.0],"passed":true},{"actual":[10.0,10.0,7.5,7.5,5.0,5.0,2.5,2.5],"check":"rounding stall forces one tablet step","expected":[10.0,10.0,7.5,7.5,5.0,5.0,2.5,2.5],"passed":true},{"actual":[20.0,20.0,10.0,10.0,5.0,5.0],"check":"stops below minimum","expected":[20.0,20.0,10.0,10.0,0.0,0.0],"passed":false},{"actual":[40.0,20.0,10.0,5.0,0.0],"check":"dose equal to minimum continues","expected":[40.0,20.0,10.0,0.0,0.0],"passed":false},{"actual":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"check":"fractional tablet percentages","expected":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"weekly 25 percent taper\", \"actual\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"expected\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"passed\": true}, {\"check\": \"half-tablet boundary rounds up\", \"actual\": [50.0, 50.0, 45.0, 45.0], \"expected\": [50.0, 50.0, 45.0, 45.0], \"passed\": true}, {\"check\": \"rounding stall forces one tablet step\", \"actual\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5], \"expected\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5], \"passed\": true}, {\"check\": \"stops below minimum\", \"actual\": [20.0, 20.0, 10.0, 10.0, 5.0, 5.0], \"expected\": [20.0, 20.0, 10.0, 10.0, 0.0, 0.0], \"passed\": false}, {\"check\": \"dose equal to minimum continues\", \"actual\": [40.0, 20.0, 10.0, 5.0, 0.0], \"expected\": [40.0, 20.0, 10.0, 0.0, 0.0], \"passed\": false}, {\"check\": \"fractional tablet percentages\", \"actual\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"expected\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.561,"exit_code":1,"observations":[{"actual":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"check":"weekly 25 percent taper","expected":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"passed":true},{"actual":[50.0,50.0,45.0,45.0],"check":"half-tablet boundary rounds up","expected":[50.0,50.0,45.0,45.0],"passed":true},{"actual":[10.0,10.0,7.5,7.5,5.0,5.0,0.0,0.0],"check":"rounding stall forces one tablet step","expected":[10.0,10.0,7.5,7.5,5.0,5.0,2.5,2.5],"passed":false},{"actual":[20.0,20.0,0.0,0.0,0.0,0.0],"check":"stops below minimum","expected":[20.0,20.0,10.0,10.0,0.0,0.0],"passed":false},{"actual":[40.0,20.0,0.0,0.0,0.0],"check":"dose equal to minimum continues","expected":[40.0,20.0,10.0,0.0,0.0],"passed":false},{"actual":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"check":"fractional tablet percentages","expected":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"weekly 25 percent taper\", \"actual\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"expected\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"passed\": true}, {\"check\": \"half-tablet boundary rounds up\", \"actual\": [50.0, 50.0, 45.0, 45.0], \"expected\": [50.0, 50.0, 45.0, 45.0], \"passed\": true}, {\"check\": \"rounding stall forces one tablet step\", \"actual\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 0.0, 0.0], \"expected\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5], \"passed\": false}, {\"check\": \"stops below minimum\", \"actual\": [20.0, 20.0, 0.0, 0.0, 0.0, 0.0], \"expected\": [20.0, 20.0, 10.0, 10.0, 0.0, 0.0], \"passed\": false}, {\"check\": \"dose equal to minimum continues\", \"actual\": [40.0, 20.0, 0.0, 0.0, 0.0], \"expected\": [40.0, 20.0, 10.0, 0.0, 0.0], \"passed\": false}, {\"check\": \"fractional tablet percentages\", \"actual\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"expected\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.288,"exit_code":0,"observations":[{"actual":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"check":"weekly 25 percent taper","expected":[60.0,60.0,60.0,45.0,45.0,45.0,35.0,35.0,35.0,25.0,25.0],"passed":true},{"actual":[50.0,50.0,45.0,45.0],"check":"half-tablet boundary rounds up","expected":[50.0,50.0,45.0,45.0],"passed":true},{"actual":[10.0,10.0,7.5,7.5,5.0,5.0,2.5,2.5],"check":"rounding stall forces one tablet step","expected":[10.0,10.0,7.5,7.5,5.0,5.0,2.5,2.5],"passed":true},{"actual":[20.0,20.0,10.0,10.0,0.0,0.0],"check":"stops below minimum","expected":[20.0,20.0,10.0,10.0,0.0,0.0],"passed":true},{"actual":[40.0,20.0,10.0,0.0,0.0],"check":"dose equal to minimum continues","expected":[40.0,20.0,10.0,0.0,0.0],"passed":true},{"actual":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"check":"fractional tablet percentages","expected":[30.0,30.0,21.0,21.0,15.0,15.0,11.0,11.0],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"weekly 25 percent taper\", \"actual\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"expected\": [60.0, 60.0, 60.0, 45.0, 45.0, 45.0, 35.0, 35.0, 35.0, 25.0, 25.0], \"passed\": true}, {\"check\": \"half-tablet boundary rounds up\", \"actual\": [50.0, 50.0, 45.0, 45.0], \"expected\": [50.0, 50.0, 45.0, 45.0], \"passed\": true}, {\"check\": \"rounding stall forces one tablet step\", \"actual\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5], \"expected\": [10.0, 10.0, 7.5, 7.5, 5.0, 5.0, 2.5, 2.5], \"passed\": true}, {\"check\": \"stops below minimum\", \"actual\": [20.0, 20.0, 10.0, 10.0, 0.0, 0.0], \"expected\": [20.0, 20.0, 10.0, 10.0, 0.0, 0.0], \"passed\": true}, {\"check\": \"dose equal to minimum continues\", \"actual\": [40.0, 20.0, 10.0, 0.0, 0.0], \"expected\": [40.0, 20.0, 10.0, 0.0, 0.0], \"passed\": true}, {\"check\": \"fractional tablet percentages\", \"actual\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"expected\": [30.0, 30.0, 21.0, 21.0, 15.0, 15.0, 11.0, 11.0], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}