FAILURE MAP
← Case archive

FA-64731 / Clinical triage scoring / Open access

Age-adjusted sore throat score: signed score reporting · case 01

A negative age-adjusted score is reported as 0.

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

ROOT CAUSE

The reported score is clamped at 0, hiding the signed modifier.

VERIFIED REPAIR

Report the signed score as computed.

Unsuccessful approach: abs() turns a -1 score into +1.

Case contract

Input {age, temp (1 dp), cough_absent, exudate, nodes}. Ages below 3 return {error NOT_APPLICABLE}. Points: temp > 38.0, absent cough, tonsillar exudate, tender nodes (1 each); age 3-14 +1, 15-44 0, >= 45 -1. The score is reported as computed (can be -1). Action: <= 1 NO_TEST, 2-3 TEST, >= 4 TEST_OR_EMPIRIC. Return {score, action}.

Why this case matters

Age-adjusted clinical scores add signed modifiers; eligibility, band edges and signed reporting are separate faults.

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):
    a = x['age']
    if a < 3:
        return {'error': 'NOT_APPLICABLE'}
    t = Fraction(str(x['temp'])) * 10
    s = (1 if t > 380 else 0) + bool(x['cough_absent']) + bool(x['exudate']) + bool(x['nodes'])
    s += 1 if a <= 14 else 0 if a <= 44 else -1
    act = 'NO_TEST' if s <= 1 else 'TEST' if s <= 3 else 'TEST_OR_EMPIRIC'
    return {'score': max(s, 0), 'action': act}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('adult control',
   {'age': 26, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.1', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.1', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 51, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.1', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 27, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.2', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.2', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 52, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.2', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 28, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.3', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.3', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 53, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.3', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 29, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.4', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.4', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 54, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.4', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 30, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.5', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.5', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 55, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.5', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})]]
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
adult control{'action': 'NO_TEST', 'score': 0}{'action': 'NO_TEST', 'score': 0}Passed
toddler below eligibility{'error': 'NOT_APPLICABLE'}{'error': 'NOT_APPLICABLE'}Passed
three-year-old eligible{'action': 'NO_TEST', 'score': 1}{'action': 'NO_TEST', 'score': 1}Passed
fourteen-year-old gets child point{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed
fifteen-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
44-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
older adult negative score{'action': 'NO_TEST', 'score': 0}{'action': 'NO_TEST', 'score': -1}Failed
temperature 38.0 not fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
temperature 38.x is fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
all criteria child{'action': 'TEST_OR_EMPIRIC', 'score': 5}{'action': 'TEST_OR_EMPIRIC', 'score': 5}Passed
elderly with all criteria{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed

SHA-256 / de0be575e8708b93153b5135b9b73e274a44ac6f0da8a3d537363cebcfc02b61

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):
    a = x['age']
    if a < 3:
        return {'error': 'NOT_APPLICABLE'}
    t = Fraction(str(x['temp'])) * 10
    s = (1 if t > 380 else 0) + bool(x['cough_absent']) + bool(x['exudate']) + bool(x['nodes'])
    s += 1 if a <= 14 else 0 if a <= 44 else -1
    act = 'NO_TEST' if s <= 1 else 'TEST' if s <= 3 else 'TEST_OR_EMPIRIC'
    return {'score': abs(s), 'action': act}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('adult control',
   {'age': 26, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.1', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.1', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 51, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.1', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 27, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.2', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.2', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 52, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.2', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 28, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.3', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.3', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 53, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.3', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 29, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.4', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.4', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 54, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.4', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 30, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.5', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.5', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 55, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.5', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})]]
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
adult control{'action': 'NO_TEST', 'score': 0}{'action': 'NO_TEST', 'score': 0}Passed
toddler below eligibility{'error': 'NOT_APPLICABLE'}{'error': 'NOT_APPLICABLE'}Passed
three-year-old eligible{'action': 'NO_TEST', 'score': 1}{'action': 'NO_TEST', 'score': 1}Passed
fourteen-year-old gets child point{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed
fifteen-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
44-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
older adult negative score{'action': 'NO_TEST', 'score': 1}{'action': 'NO_TEST', 'score': -1}Failed
temperature 38.0 not fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
temperature 38.x is fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
all criteria child{'action': 'TEST_OR_EMPIRIC', 'score': 5}{'action': 'TEST_OR_EMPIRIC', 'score': 5}Passed
elderly with all criteria{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed

SHA-256 / 073d00886bfe226671b39c817e8e3944b8f36eba25ab7a2464864e03b88c6015

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):
    a = x['age']
    if a < 3:
        return {'error': 'NOT_APPLICABLE'}
    t = Fraction(str(x['temp'])) * 10
    s = (1 if t > 380 else 0) + bool(x['cough_absent']) + bool(x['exudate']) + bool(x['nodes'])
    s += 1 if a <= 14 else 0 if a <= 44 else -1
    act = 'NO_TEST' if s <= 1 else 'TEST' if s <= 3 else 'TEST_OR_EMPIRIC'
    return {'score': s, 'action': act}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('adult control',
   {'age': 26, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.1', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.1', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 51, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.1', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 27, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.2', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.2', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 52, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.2', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 28, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.3', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.3', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 53, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.3', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 29, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.4', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.4', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 54, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.4', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})],
 [('adult control',
   {'age': 30, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 0, 'action': 'NO_TEST'}),
  ('toddler below eligibility',
   {'age': 2, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'error': 'NOT_APPLICABLE'}),
  ('three-year-old eligible',
   {'age': 3, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': 1, 'action': 'NO_TEST'}),
  ('fourteen-year-old gets child point',
   {'age': 14, 'temp': '38.5', 'cough_absent': False, 'exudate': False, 'nodes': True},
   {'score': 3, 'action': 'TEST'}),
  ('fifteen-year-old no modifier',
   {'age': 15, 'temp': '37.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('44-year-old no modifier',
   {'age': 44, 'temp': '37.5', 'cough_absent': True, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('older adult negative score',
   {'age': 55, 'temp': '37.0', 'cough_absent': False, 'exudate': False, 'nodes': False},
   {'score': -1, 'action': 'NO_TEST'}),
  ('temperature 38.0 not fever',
   {'age': 30, 'temp': '38.0', 'cough_absent': False, 'exudate': True, 'nodes': True},
   {'score': 2, 'action': 'TEST'}),
  ('temperature 38.x is fever',
   {'age': 30, 'temp': '38.5', 'cough_absent': False, 'exudate': True, 'nodes': False},
   {'score': 2, 'action': 'TEST'}),
  ('all criteria child',
   {'age': 8, 'temp': '38.9', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 5, 'action': 'TEST_OR_EMPIRIC'}),
  ('elderly with all criteria',
   {'age': 80, 'temp': '38.5', 'cough_absent': True, 'exudate': True, 'nodes': True},
   {'score': 3, 'action': 'TEST'})]]
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
adult control{'action': 'NO_TEST', 'score': 0}{'action': 'NO_TEST', 'score': 0}Passed
toddler below eligibility{'error': 'NOT_APPLICABLE'}{'error': 'NOT_APPLICABLE'}Passed
three-year-old eligible{'action': 'NO_TEST', 'score': 1}{'action': 'NO_TEST', 'score': 1}Passed
fourteen-year-old gets child point{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed
fifteen-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
44-year-old no modifier{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
older adult negative score{'action': 'NO_TEST', 'score': -1}{'action': 'NO_TEST', 'score': -1}Passed
temperature 38.0 not fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
temperature 38.x is fever{'action': 'TEST', 'score': 2}{'action': 'TEST', 'score': 2}Passed
all criteria child{'action': 'TEST_OR_EMPIRIC', 'score': 5}{'action': 'TEST_OR_EMPIRIC', 'score': 5}Passed
elderly with all criteria{'action': 'TEST', 'score': 3}{'action': 'TEST', 'score': 3}Passed

SHA-256 / 49440e8ee171b4bc78942f396e3d80863223f12d4de8933cf9ea2f7a5e6c7720

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

Case digest / 91e10ff37da8101942dfef622c95d279f2c147c2dd3197b6c8487d5d46d970ab