{"abstract":"Large doses are rejected even when the percentage deviation is within tolerance.","category":"Medication dosing calculations","checks":9,"contract":"Input {target_mg, strengths, scored (strengths that may be halved), tol_pct}. For each strength s: step = s/2 if s is scored else s; units = target/step rounded half-up (skip if 0); dose = units*step; tablets = dose/s (skip if more than 4 tablets); keep only |dose-target|*100 <= tol_pct*target. Prefer smallest absolute error, then fewest physical tablets (ceil of tablets), then the largest strength. Return {status OK, strength, tablets, dose_mg} or {status NO_MATCH}.","evaluation_group":"w2-meddose-tablet-selection","failed_approach":"Measuring the percentage against the achieved dose tightens tolerance when rounding down.","family":"w2-meddose-tablet-selection-tolerance-percentage-base","id":"FA-63966","implementations":{"attempt":{"sha256":"0fe3635e9baa7cc435c21356274726fcba73fe54a57e5fd49ef809e2c6bb4c48","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    target = Fraction(str(x['target_mg']))\n    best = None\n    for s in sorted(x['strengths']):\n        step = Fraction(s, 2) if s in x['scored'] else Fraction(s)\n        units = math.floor(target / step + Fraction(1, 2))\n        if units == 0:\n            continue\n        dose = units * step\n        tabs = dose / s\n        if tabs > 4:\n            continue\n        if abs(dose - target) * 100 > x['tol_pct'] * dose:\n            continue\n        key = (abs(dose - target), math.ceil(tabs), -s)\n        if best is None or key < best[0]:\n            best = (key, s, tabs, dose)\n    if best is None:\n        return {'status': 'NO_MATCH'}\n    return {'status': 'OK', 'strength': best[1], 'tablets': float(best[2]), 'dose_mg': float(best[3])}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('unscored tablet may not be halved',\n   {'target_mg': 5, 'strengths': [10, 25], 'scored': [25], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 27},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 15, 'strengths': [30, 75], 'scored': [75], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 28},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 25, 'strengths': [50, 125], 'scored': [125], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 29},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 35, 'strengths': [70, 175], 'scored': [175], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 30},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 45, 'strengths': [90, 225], 'scored': [225], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 31},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.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":"1755017054d54840d5e8fb784bf97be25c98e9ae45947b341418c6bcd33b550a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    target = Fraction(str(x['target_mg']))\n    best = None\n    for s in sorted(x['strengths']):\n        step = Fraction(s, 2) if s in x['scored'] else Fraction(s)\n        units = math.floor(target / step + Fraction(1, 2))\n        if units == 0:\n            continue\n        dose = units * step\n        tabs = dose / s\n        if tabs > 4:\n            continue\n        if abs(dose - target) > x['tol_pct']:\n            continue\n        key = (abs(dose - target), math.ceil(tabs), -s)\n        if best is None or key < best[0]:\n            best = (key, s, tabs, dose)\n    if best is None:\n        return {'status': 'NO_MATCH'}\n    return {'status': 'OK', 'strength': best[1], 'tablets': float(best[2]), 'dose_mg': float(best[3])}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('unscored tablet may not be halved',\n   {'target_mg': 5, 'strengths': [10, 25], 'scored': [25], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 27},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 15, 'strengths': [30, 75], 'scored': [75], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 28},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 25, 'strengths': [50, 125], 'scored': [125], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 29},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 35, 'strengths': [70, 175], 'scored': [175], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 30},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 45, 'strengths': [90, 225], 'scored': [225], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 31},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.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":"4a35ff02faa3cbdbb3323f7349bfcd6bcd62d917328ee74ebee268a6e3408893","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    target = Fraction(str(x['target_mg']))\n    best = None\n    for s in sorted(x['strengths']):\n        step = Fraction(s, 2) if s in x['scored'] else Fraction(s)\n        units = math.floor(target / step + Fraction(1, 2))\n        if units == 0:\n            continue\n        dose = units * step\n        tabs = dose / s\n        if tabs > 4:\n            continue\n        if abs(dose - target) * 100 > x['tol_pct'] * target:\n            continue\n        key = (abs(dose - target), math.ceil(tabs), -s)\n        if best is None or key < best[0]:\n            best = (key, s, tabs, dose)\n    if best is None:\n        return {'status': 'NO_MATCH'}\n    return {'status': 'OK', 'strength': best[1], 'tablets': float(best[2]), 'dose_mg': float(best[3])}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('unscored tablet may not be halved',\n   {'target_mg': 5, 'strengths': [10, 25], 'scored': [25], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 11},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 27},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 1},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 6},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 15, 'strengths': [30, 75], 'scored': [75], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 12},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 28},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 2},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 7},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 25, 'strengths': [50, 125], 'scored': [125], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 13},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 29},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 3},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 8},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 35, 'strengths': [70, 175], 'scored': [175], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 14},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 30},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 4},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 9},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.0})],\n [('unscored tablet may not be halved',\n   {'target_mg': 45, 'strengths': [90, 225], 'scored': [225], 'tol_pct': 10},\n   {'status': 'NO_MATCH'}),\n  ('scored tablet half used',\n   {'target_mg': '7.5', 'strengths': [5, 10], 'scored': [5], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 5, 'tablets': 1.5, 'dose_mg': 7.5}),\n  ('near dose rounds up to whole tablet',\n   {'target_mg': 14, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 3.0, 'dose_mg': 15.0}),\n  ('near dose rounds down to whole tablet',\n   {'target_mg': 11, 'strengths': [5], 'scored': [], 'tol_pct': 15},\n   {'status': 'OK', 'strength': 5, 'tablets': 2.0, 'dose_mg': 10.0}),\n  ('three and a half tablets allowed',\n   {'target_mg': 35, 'strengths': [10], 'scored': [10], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 3.5, 'dose_mg': 35.0}),\n  ('exactly four tablets allowed',\n   {'target_mg': 40, 'strengths': [10], 'scored': [], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 10, 'tablets': 4.0, 'dose_mg': 40.0}),\n  ('tolerance measured against target',\n   {'target_mg': 200, 'strengths': [150], 'scored': [], 'tol_pct': 31},\n   {'status': 'OK', 'strength': 150, 'tablets': 1.0, 'dose_mg': 150.0}),\n  ('equal error prefers larger strength',\n   {'target_mg': 30, 'strengths': [15, 20], 'scored': [20], 'tol_pct': 5},\n   {'status': 'OK', 'strength': 20, 'tablets': 1.5, 'dose_mg': 30.0}),\n  ('accuracy outranks tablet count',\n   {'target_mg': 21, 'strengths': [10, 7], 'scored': [], 'tol_pct': 10},\n   {'status': 'OK', 'strength': 7, 'tablets': 3.0, 'dose_mg': 21.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-tablet-selection-tolerance-percentage-base","generated_at":"2026-09-29T14:47:19.796146+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Dispensing systems translate an ordered dose into real tablets; halving rules, tolerance, and ranking are separate decisions.","repair":"Compare the deviation with tol_pct percent of the target dose.","root_cause":"The tolerance percentage is compared with an absolute milligram difference.","sha256":"259d8191d22903734446d87ac82756dbaaa7bf8ddbf0de68ab36c1efbb50b32d","title":"Tablet strength selection with scored halves: tolerance percentage base · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.896,"exit_code":1,"observations":[{"actual":{"status":"NO_MATCH"},"check":"unscored tablet may not be halved","expected":{"status":"NO_MATCH"},"passed":true},{"actual":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"check":"scored tablet half used","expected":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"passed":true},{"actual":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"check":"near dose rounds up to whole tablet","expected":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"passed":true},{"actual":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"check":"near dose rounds down to whole tablet","expected":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"passed":true},{"actual":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"check":"three and a half tablets allowed","expected":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"passed":true},{"actual":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"check":"exactly four tablets allowed","expected":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"passed":true},{"actual":{"status":"NO_MATCH"},"check":"tolerance measured against target","expected":{"dose_mg":150.0,"status":"OK","strength":150,"tablets":1.0},"passed":false},{"actual":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"check":"equal error prefers larger strength","expected":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"passed":true},{"actual":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"check":"accuracy outranks tablet count","expected":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unscored tablet may not be halved\", \"actual\": {\"status\": \"NO_MATCH\"}, \"expected\": {\"status\": \"NO_MATCH\"}, \"passed\": true}, {\"check\": \"scored tablet half used\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"passed\": true}, {\"check\": \"near dose rounds up to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"passed\": true}, {\"check\": \"near dose rounds down to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"passed\": true}, {\"check\": \"three and a half tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"passed\": true}, {\"check\": \"exactly four tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"passed\": true}, {\"check\": \"tolerance measured against target\", \"actual\": {\"status\": \"NO_MATCH\"}, \"expected\": {\"status\": \"OK\", \"strength\": 150, \"tablets\": 1.0, \"dose_mg\": 150.0}, \"passed\": false}, {\"check\": \"equal error prefers larger strength\", \"actual\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"expected\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"passed\": true}, {\"check\": \"accuracy outranks tablet count\", \"actual\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"expected\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.959,"exit_code":1,"observations":[{"actual":{"dose_mg":10.0,"status":"OK","strength":10,"tablets":1.0},"check":"unscored tablet may not be halved","expected":{"status":"NO_MATCH"},"passed":false},{"actual":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"check":"scored tablet half used","expected":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"passed":true},{"actual":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"check":"near dose rounds up to whole tablet","expected":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"passed":true},{"actual":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"check":"near dose rounds down to whole tablet","expected":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"passed":true},{"actual":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"check":"three and a half tablets allowed","expected":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"passed":true},{"actual":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"check":"exactly four tablets allowed","expected":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"passed":true},{"actual":{"status":"NO_MATCH"},"check":"tolerance measured against target","expected":{"dose_mg":150.0,"status":"OK","strength":150,"tablets":1.0},"passed":false},{"actual":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"check":"equal error prefers larger strength","expected":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"passed":true},{"actual":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"check":"accuracy outranks tablet count","expected":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unscored tablet may not be halved\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 1.0, \"dose_mg\": 10.0}, \"expected\": {\"status\": \"NO_MATCH\"}, \"passed\": false}, {\"check\": \"scored tablet half used\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"passed\": true}, {\"check\": \"near dose rounds up to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"passed\": true}, {\"check\": \"near dose rounds down to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"passed\": true}, {\"check\": \"three and a half tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"passed\": true}, {\"check\": \"exactly four tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"passed\": true}, {\"check\": \"tolerance measured against target\", \"actual\": {\"status\": \"NO_MATCH\"}, \"expected\": {\"status\": \"OK\", \"strength\": 150, \"tablets\": 1.0, \"dose_mg\": 150.0}, \"passed\": false}, {\"check\": \"equal error prefers larger strength\", \"actual\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"expected\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"passed\": true}, {\"check\": \"accuracy outranks tablet count\", \"actual\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"expected\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.261,"exit_code":0,"observations":[{"actual":{"status":"NO_MATCH"},"check":"unscored tablet may not be halved","expected":{"status":"NO_MATCH"},"passed":true},{"actual":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"check":"scored tablet half used","expected":{"dose_mg":7.5,"status":"OK","strength":5,"tablets":1.5},"passed":true},{"actual":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"check":"near dose rounds up to whole tablet","expected":{"dose_mg":15.0,"status":"OK","strength":5,"tablets":3.0},"passed":true},{"actual":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"check":"near dose rounds down to whole tablet","expected":{"dose_mg":10.0,"status":"OK","strength":5,"tablets":2.0},"passed":true},{"actual":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"check":"three and a half tablets allowed","expected":{"dose_mg":35.0,"status":"OK","strength":10,"tablets":3.5},"passed":true},{"actual":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"check":"exactly four tablets allowed","expected":{"dose_mg":40.0,"status":"OK","strength":10,"tablets":4.0},"passed":true},{"actual":{"dose_mg":150.0,"status":"OK","strength":150,"tablets":1.0},"check":"tolerance measured against target","expected":{"dose_mg":150.0,"status":"OK","strength":150,"tablets":1.0},"passed":true},{"actual":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"check":"equal error prefers larger strength","expected":{"dose_mg":30.0,"status":"OK","strength":20,"tablets":1.5},"passed":true},{"actual":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"check":"accuracy outranks tablet count","expected":{"dose_mg":21.0,"status":"OK","strength":7,"tablets":3.0},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unscored tablet may not be halved\", \"actual\": {\"status\": \"NO_MATCH\"}, \"expected\": {\"status\": \"NO_MATCH\"}, \"passed\": true}, {\"check\": \"scored tablet half used\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 1.5, \"dose_mg\": 7.5}, \"passed\": true}, {\"check\": \"near dose rounds up to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 3.0, \"dose_mg\": 15.0}, \"passed\": true}, {\"check\": \"near dose rounds down to whole tablet\", \"actual\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"expected\": {\"status\": \"OK\", \"strength\": 5, \"tablets\": 2.0, \"dose_mg\": 10.0}, \"passed\": true}, {\"check\": \"three and a half tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 3.5, \"dose_mg\": 35.0}, \"passed\": true}, {\"check\": \"exactly four tablets allowed\", \"actual\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"expected\": {\"status\": \"OK\", \"strength\": 10, \"tablets\": 4.0, \"dose_mg\": 40.0}, \"passed\": true}, {\"check\": \"tolerance measured against target\", \"actual\": {\"status\": \"OK\", \"strength\": 150, \"tablets\": 1.0, \"dose_mg\": 150.0}, \"expected\": {\"status\": \"OK\", \"strength\": 150, \"tablets\": 1.0, \"dose_mg\": 150.0}, \"passed\": true}, {\"check\": \"equal error prefers larger strength\", \"actual\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"expected\": {\"status\": \"OK\", \"strength\": 20, \"tablets\": 1.5, \"dose_mg\": 30.0}, \"passed\": true}, {\"check\": \"accuracy outranks tablet count\", \"actual\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"expected\": {\"status\": \"OK\", \"strength\": 7, \"tablets\": 3.0, \"dose_mg\": 21.0}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}