FAILURE MAP
← Case archive

FA-64796 / Clinical triage scoring / Open access

Four-item dehydration scale with weight-loss override: tears item order · case 01

Absent tears score 1 and decreased tears score 2.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The tears option list has the decreased and absent entries swapped.

VERIFIED REPAIR

Order tears as present (0), decreased (1), absent (2).

Unsuccessful approach: Reversing the whole list scores normal tears as the worst finding.

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', 'absent', 'decreased'])]
    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 fixtureActualExpectedOutcome
well child{'category': 'NONE', 'score': 0}{'category': 'NONE', 'score': 0}Passed
score exactly 4{'category': 'MODERATE_SEVERE', 'score': 5}{'category': 'SOME', 'score': 4}Failed
score exactly 5{'category': 'MODERATE_SEVERE', 'score': 6}{'category': 'MODERATE_SEVERE', 'score': 5}Failed
tears absent only{'category': 'SOME', 'score': 2}{'category': 'SOME', 'score': 3}Failed
tears decreased only{'category': 'SOME', 'score': 3}{'category': 'SOME', 'score': 2}Failed
weight loss exactly 10 percent{'category': 'MODERATE_SEVERE', 'score': 3}{'category': 'MODERATE_SEVERE', 'score': 2}Failed
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': 7}{'category': 'MODERATE_SEVERE', 'score': 8}Failed
weight loss 3 percent without signs{'category': 'SOME', 'score': 0}{'category': 'SOME', 'score': 0}Passed

SHA-256 / 4bc7acbc6f21c686c8ff1b9e6220007c743dae98393725495001c3696e0e597d

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', ['absent', 'decreased', 'present'])]
    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 fixtureActualExpectedOutcome
well child{'category': 'SOME', 'score': 2}{'category': 'NONE', 'score': 0}Failed
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': 1}{'category': 'SOME', 'score': 3}Failed
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': 2}{'category': 'MODERATE_SEVERE', 'score': 0}Failed
weight loss 4 percent with severe signs{'category': 'MODERATE_SEVERE', 'score': 6}{'category': 'MODERATE_SEVERE', 'score': 8}Failed
weight loss 3 percent without signs{'category': 'SOME', 'score': 2}{'category': 'SOME', 'score': 0}Failed

SHA-256 / e3ffff1b51ed913f58939d1f8150a9ca1d84e8588ae4c1bc6bb71398dfbb1ad8

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 fixtureActualExpectedOutcome
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.130696+00:00.

Case digest / 8c16b55ee4f66824f011aaca88f9f7bdf7212ed3d4661abd20f600073e5b8483