FA-64726 / Clinical triage scoring / Open access
Age-adjusted sore throat score: fever criterion · case 01
A temperature of exactly 38.0 earns the fever point.
ROOT CAUSE
The fever threshold is inclusive.
VERIFIED REPAIR
Score fever only above 38.0.
Unsuccessful approach: Comparing whole degrees misses 38.1-38.9.
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': 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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': 3} | {'action': 'TEST', 'score': 2} | Failed |
| 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 / 8d49b6ab7e3b06f9fada4c7ee61e309248fc2166ef55ca04f598aea8f5a8845d
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 math.floor(t / 10) > 38 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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': 2} | {'action': 'TEST', 'score': 3} | Failed |
| 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': 'NO_TEST', 'score': 1} | {'action': 'TEST', 'score': 2} | Failed |
| all criteria child | {'action': 'TEST_OR_EMPIRIC', 'score': 4} | {'action': 'TEST_OR_EMPIRIC', 'score': 5} | Failed |
| elderly with all criteria | {'action': 'TEST', 'score': 2} | {'action': 'TEST', 'score': 3} | Failed |
SHA-256 / 021c6e973d9a082d507f710e74b7ecd1c79288161102305dae5d00a44014d24a
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.414962+00:00.
Case digest / 1c3f96b5ca25cc7ae6e7d2b39f14c89d94c73f85aa4ac20249d7dde606f0aee7