FAILURE MAP
← Case archive

FA-64786 / Clinical triage scoring / Open access

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

A measured 10% weight loss does not force the severe category.

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

ROOT CAUSE

The override threshold excludes exactly 10%.

VERIFIED REPAIR

Force MODERATE_SEVERE for weight loss >= 10%.

Unsuccessful approach: Requiring at least one clinical sign ignores the objective override in children without signs.

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 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': 'SOME', 'score': 2}{'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': 8}{'category': 'MODERATE_SEVERE', 'score': 8}Passed
weight loss 3 percent without signs{'category': 'SOME', 'score': 0}{'category': 'SOME', 'score': 0}Passed

SHA-256 / 1385fe3d358681e9729090e5d51856a817893c3b5b58bd92e4ce48bed705f8f0

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 and s >= 1:
            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': 'SOME', 'score': 0}{'category': 'MODERATE_SEVERE', 'score': 0}Failed
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 / 7ce7fb992a9f2995f74e63c7ac7f523263c5736385c40a18ffb4bed3fb14e1cf

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

Case digest / 78e201781a86a498064b351aefde9a16c315d1c868ef5970f7f2c75427624f55