FA-64791 / Clinical triage scoring / Open access
Four-item dehydration scale with weight-loss override: override never downgrades · case 01
A severely dehydrated child with 4% weight loss is downgraded to SOME.
ROOT CAUSE
The 3% rule overwrites any category instead of only raising NONE.
VERIFIED REPAIR
Apply the 3% rule only when the category is NONE.
Unsuccessful approach: Adding s > 0 means a child with no signs and 3% loss is never raised to SOME.
Case contract
Input {appearance (normal|thirsty_restless|drowsy_limp), eyes (normal|slightly_sunken|very_sunken), mucous (moist|sticky|dry), tears (present|decreased|absent), weight_loss_pct (or null)}. Items score 0/1/2 in the listed order. Category: 0 NONE, 1-4 SOME, 5-8 MODERATE_SEVERE. A measured weight loss >= 10% forces MODERATE_SEVERE; >= 3% raises NONE to SOME but never lowers a category. Return {score, category}.
Why this case matters
Ordinal clinical scales combined with an objective override can fail in item mapping, band edges and override direction.
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):
items = [('appearance', ['normal', 'thirsty_restless', 'drowsy_limp']), ('eyes', ['normal', 'slightly_sunken', 'very_sunken']),
('mucous', ['moist', 'sticky', 'dry']), ('tears', ['present', 'decreased', 'absent'])]
s = sum(opts.index(x[k]) for k, opts in items)
cat = 'NONE' if s == 0 else 'SOME' if s <= 4 else 'MODERATE_SEVERE'
w = x['weight_loss_pct']
if w is not None:
w = Fraction(str(w))
if w >= 10:
cat = 'MODERATE_SEVERE'
elif w >= 3:
cat = 'SOME'
return {'score': s, 'category': cat}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '11'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.1'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.1'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '12'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.2'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.2'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '0'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '13'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.3'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.3'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '14'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.4'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.4'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '15'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.5'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.5'},
{'score': 0, 'category': 'SOME'})]]
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 |
|---|---|---|---|
| well child | {'category': 'NONE', 'score': 0} | {'category': 'NONE', 'score': 0} | Passed |
| score exactly 4 | {'category': 'SOME', 'score': 4} | {'category': 'SOME', 'score': 4} | Passed |
| score exactly 5 | {'category': 'MODERATE_SEVERE', 'score': 5} | {'category': 'MODERATE_SEVERE', 'score': 5} | Passed |
| tears absent only | {'category': 'SOME', 'score': 3} | {'category': 'SOME', 'score': 3} | Passed |
| tears decreased only | {'category': 'SOME', 'score': 2} | {'category': 'SOME', 'score': 2} | Passed |
| weight loss exactly 10 percent | {'category': 'MODERATE_SEVERE', 'score': 2} | {'category': 'MODERATE_SEVERE', 'score': 2} | Passed |
| weight loss 10 percent no signs | {'category': 'MODERATE_SEVERE', 'score': 0} | {'category': 'MODERATE_SEVERE', 'score': 0} | Passed |
| weight loss 4 percent with severe signs | {'category': 'SOME', 'score': 8} | {'category': 'MODERATE_SEVERE', 'score': 8} | Failed |
| weight loss 3 percent without signs | {'category': 'SOME', 'score': 0} | {'category': 'SOME', 'score': 0} | Passed |
SHA-256 / 61056a76a9892cf52eae4efd4e50e06b833f511d07e2e934f73e63af99f3773d
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):
items = [('appearance', ['normal', 'thirsty_restless', 'drowsy_limp']), ('eyes', ['normal', 'slightly_sunken', 'very_sunken']),
('mucous', ['moist', 'sticky', 'dry']), ('tears', ['present', 'decreased', 'absent'])]
s = sum(opts.index(x[k]) for k, opts in items)
cat = 'NONE' if s == 0 else 'SOME' if s <= 4 else 'MODERATE_SEVERE'
w = x['weight_loss_pct']
if w is not None:
w = Fraction(str(w))
if w >= 10:
cat = 'MODERATE_SEVERE'
elif w >= 3 and cat != 'MODERATE_SEVERE' and s > 0:
cat = 'SOME'
return {'score': s, 'category': cat}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '11'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.1'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.1'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '12'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.2'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.2'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '0'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '13'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.3'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.3'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '14'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.4'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.4'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '15'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.5'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.5'},
{'score': 0, 'category': 'SOME'})]]
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 |
|---|---|---|---|
| well child | {'category': 'NONE', 'score': 0} | {'category': 'NONE', 'score': 0} | Passed |
| score exactly 4 | {'category': 'SOME', 'score': 4} | {'category': 'SOME', 'score': 4} | Passed |
| score exactly 5 | {'category': 'MODERATE_SEVERE', 'score': 5} | {'category': 'MODERATE_SEVERE', 'score': 5} | Passed |
| tears absent only | {'category': 'SOME', 'score': 3} | {'category': 'SOME', 'score': 3} | Passed |
| tears decreased only | {'category': 'SOME', 'score': 2} | {'category': 'SOME', 'score': 2} | Passed |
| weight loss exactly 10 percent | {'category': 'MODERATE_SEVERE', 'score': 2} | {'category': 'MODERATE_SEVERE', 'score': 2} | Passed |
| weight loss 10 percent no signs | {'category': 'MODERATE_SEVERE', 'score': 0} | {'category': 'MODERATE_SEVERE', 'score': 0} | Passed |
| weight loss 4 percent with severe signs | {'category': 'MODERATE_SEVERE', 'score': 8} | {'category': 'MODERATE_SEVERE', 'score': 8} | Passed |
| weight loss 3 percent without signs | {'category': 'NONE', 'score': 0} | {'category': 'SOME', 'score': 0} | Failed |
SHA-256 / 52c2f4b14f47486a7ccebe9d9a3eb14487c3db6a71e6e8a79820e43759116488
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
items = [('appearance', ['normal', 'thirsty_restless', 'drowsy_limp']), ('eyes', ['normal', 'slightly_sunken', 'very_sunken']),
('mucous', ['moist', 'sticky', 'dry']), ('tears', ['present', 'decreased', 'absent'])]
s = sum(opts.index(x[k]) for k, opts in items)
cat = 'NONE' if s == 0 else 'SOME' if s <= 4 else 'MODERATE_SEVERE'
w = x['weight_loss_pct']
if w is not None:
w = Fraction(str(w))
if w >= 10:
cat = 'MODERATE_SEVERE'
elif w >= 3 and cat == 'NONE':
cat = 'SOME'
return {'score': s, 'category': cat}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '11'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.1'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.1'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '12'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.2'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.2'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '0'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '13'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.3'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.3'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '1'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 1, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '14'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.4'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.4'},
{'score': 0, 'category': 'SOME'})],
[('well child',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '2'},
{'score': 0, 'category': 'NONE'}),
('score exactly 4',
{'appearance': 'thirsty_restless',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 4, 'category': 'SOME'}),
('score exactly 5',
{'appearance': 'drowsy_limp',
'eyes': 'slightly_sunken',
'mucous': 'sticky',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 5, 'category': 'MODERATE_SEVERE'}),
('tears absent only',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'sticky', 'tears': 'absent', 'weight_loss_pct': None},
{'score': 3, 'category': 'SOME'}),
('tears decreased only',
{'appearance': 'normal',
'eyes': 'slightly_sunken',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': None},
{'score': 2, 'category': 'SOME'}),
('weight loss exactly 10 percent',
{'appearance': 'thirsty_restless',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'decreased',
'weight_loss_pct': '10'},
{'score': 2, 'category': 'MODERATE_SEVERE'}),
('weight loss 10 percent no signs',
{'appearance': 'normal', 'eyes': 'normal', 'mucous': 'moist', 'tears': 'present', 'weight_loss_pct': '15'},
{'score': 0, 'category': 'MODERATE_SEVERE'}),
('weight loss 4 percent with severe signs',
{'appearance': 'drowsy_limp',
'eyes': 'very_sunken',
'mucous': 'dry',
'tears': 'absent',
'weight_loss_pct': '4.5'},
{'score': 8, 'category': 'MODERATE_SEVERE'}),
('weight loss 3 percent without signs',
{'appearance': 'normal',
'eyes': 'normal',
'mucous': 'moist',
'tears': 'present',
'weight_loss_pct': '3.5'},
{'score': 0, 'category': 'SOME'})]]
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 |
|---|---|---|---|
| well child | {'category': 'NONE', 'score': 0} | {'category': 'NONE', 'score': 0} | Passed |
| score exactly 4 | {'category': 'SOME', 'score': 4} | {'category': 'SOME', 'score': 4} | Passed |
| score exactly 5 | {'category': 'MODERATE_SEVERE', 'score': 5} | {'category': 'MODERATE_SEVERE', 'score': 5} | Passed |
| tears absent only | {'category': 'SOME', 'score': 3} | {'category': 'SOME', 'score': 3} | Passed |
| tears decreased only | {'category': 'SOME', 'score': 2} | {'category': 'SOME', 'score': 2} | Passed |
| weight loss exactly 10 percent | {'category': 'MODERATE_SEVERE', 'score': 2} | {'category': 'MODERATE_SEVERE', 'score': 2} | Passed |
| weight loss 10 percent no signs | {'category': 'MODERATE_SEVERE', 'score': 0} | {'category': 'MODERATE_SEVERE', 'score': 0} | Passed |
| weight loss 4 percent with severe signs | {'category': 'MODERATE_SEVERE', 'score': 8} | {'category': 'MODERATE_SEVERE', 'score': 8} | Passed |
| weight loss 3 percent without signs | {'category': 'SOME', 'score': 0} | {'category': 'SOME', 'score': 0} | Passed |
SHA-256 / 1880cae4ca4f1062d9b63d120776b05d5b0021de4a1d5a87aafa62cf161d50b5
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:28.112349+00:00.
Case digest / d251989bc3bffc8a0bb334a9aa0f9cb4655e573b8b4df685d8c4e86ca37be1b1