FAILURE MAP
← Case archive

FA-64516 / Clinical triage scoring / Open access

Paediatric warning score with age-banded vital ranges: age band upper bound · case 01

A child on their first birthday is scored against infant ranges.

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

ROOT CAUSE

Band limits are treated as inclusive upper bounds.

VERIFIED REPAIR

Select the first band whose exclusive upper limit exceeds the age in months.

Unsuccessful approach: Treating age 0 as missing pushes newborns into the toddler band.

Case contract

Input {age_months, hr, rr, behavior, crt_s, o2_lpm}. Toy normal ranges by age: < 12 months HR 100-160 RR 30-50; 12-47 HR 90-150 RR 24-40; 48-143 HR 70-120 RR 18-30; >= 144 HR 60-100 RR 12-20. Deviation = distance outside the range (0 inside). Cardiovascular: 2 if HR deviation > 20 or refill >= 4 s, 1 if any HR deviation or refill 3 s, else 0. Respiratory: 2 if RR deviation > 10 or oxygen >= 4 L/min, 1 if any RR deviation or any oxygen, else 0. Behaviour: playing/sleeping 0, irritable 1, lethargic 3. escalate when total >= 5 or behaviour scores 3. Return {score, escalate}.

Why this case matters

Paediatric warning scores depend on the right age band and on two-sided deviation from normal ranges.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    m = x['age_months']
    bands = [(12, 100, 160, 30, 50), (48, 90, 150, 24, 40), (144, 70, 120, 18, 30), (10 ** 6, 60, 100, 12, 20)]
    for lim, hlo, hhi, rlo, rhi in bands:
        if m <= lim:
            break
    dh = max(hlo - x['hr'], x['hr'] - hhi, 0)
    dr = max(rlo - x['rr'], x['rr'] - rhi, 0)
    crt = x['crt_s']
    card = 2 if dh > 20 or crt >= 4 else 1 if dh > 0 or crt == 3 else 0
    o2 = x['o2_lpm']
    resp = 2 if dr > 10 or o2 >= 4 else 1 if dr > 0 or o2 > 0 else 0
    beh = {'playing': 0, 'sleeping': 0, 'irritable': 1, 'lethargic': 3}[x['behavior']]
    total = card + resp + beh
    return {'score': total, 'escalate': total >= 5 or beh == 3}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('school-age control',
   {'age_months': 60, 'hr': 91, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 151, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 84, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 81, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 81, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 52, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 126, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 92, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 152, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 83, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 82, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 82, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 53, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 127, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 93, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 26, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 153, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 82, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 83, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 83, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 54, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 128, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 94, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 154, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 81, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 84, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 84, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 55, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 129, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 95, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 155, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 80, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 85, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 85, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 56, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 130, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})]]
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
school-age control{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
first birthday uses toddler band{'escalate': False, 'score': 2}{'escalate': False, 'score': 0}Failed
newborn in infant band{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
bradycardic infant{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
capillary refill 3 seconds{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
refill 4 seconds{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
slow breathing adolescent{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
rate exactly 10 above range{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
fast breathing toddler{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
irritable with oxygen{'escalate': False, 'score': 3}{'escalate': False, 'score': 3}Passed
lethargic alone escalates{'escalate': True, 'score': 3}{'escalate': True, 'score': 3}Passed

SHA-256 / b8eb636d0960d8e09d2f9c8830e1eee12ab3731863cbb64d6a350e7e1eb0d2f3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    m = x['age_months']
    bands = [(12, 100, 160, 30, 50), (48, 90, 150, 24, 40), (144, 70, 120, 18, 30), (10 ** 6, 60, 100, 12, 20)]
    for lim, hlo, hhi, rlo, rhi in bands:
        if m < lim and m > 0:
            break
    dh = max(hlo - x['hr'], x['hr'] - hhi, 0)
    dr = max(rlo - x['rr'], x['rr'] - rhi, 0)
    crt = x['crt_s']
    card = 2 if dh > 20 or crt >= 4 else 1 if dh > 0 or crt == 3 else 0
    o2 = x['o2_lpm']
    resp = 2 if dr > 10 or o2 >= 4 else 1 if dr > 0 or o2 > 0 else 0
    beh = {'playing': 0, 'sleeping': 0, 'irritable': 1, 'lethargic': 3}[x['behavior']]
    total = card + resp + beh
    return {'score': total, 'escalate': total >= 5 or beh == 3}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('school-age control',
   {'age_months': 60, 'hr': 91, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 151, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 84, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 81, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 81, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 52, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 126, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 92, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 152, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 83, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 82, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 82, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 53, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 127, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 93, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 26, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 153, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 82, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 83, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 83, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 54, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 128, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 94, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 154, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 81, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 84, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 84, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 55, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 129, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 95, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 155, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 80, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 85, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 85, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 56, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 130, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})]]
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
school-age control{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
first birthday uses toddler band{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
newborn in infant band{'escalate': False, 'score': 4}{'escalate': False, 'score': 0}Failed
bradycardic infant{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
capillary refill 3 seconds{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
refill 4 seconds{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
slow breathing adolescent{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
rate exactly 10 above range{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
fast breathing toddler{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
irritable with oxygen{'escalate': False, 'score': 3}{'escalate': False, 'score': 3}Passed
lethargic alone escalates{'escalate': True, 'score': 3}{'escalate': True, 'score': 3}Passed

SHA-256 / 505f659122fddae9e91ae1ec7c5fc169eea0900bbcb71ae06367cfdbac051e3c

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    m = x['age_months']
    bands = [(12, 100, 160, 30, 50), (48, 90, 150, 24, 40), (144, 70, 120, 18, 30), (10 ** 6, 60, 100, 12, 20)]
    for lim, hlo, hhi, rlo, rhi in bands:
        if m < lim:
            break
    dh = max(hlo - x['hr'], x['hr'] - hhi, 0)
    dr = max(rlo - x['rr'], x['rr'] - rhi, 0)
    crt = x['crt_s']
    card = 2 if dh > 20 or crt >= 4 else 1 if dh > 0 or crt == 3 else 0
    o2 = x['o2_lpm']
    resp = 2 if dr > 10 or o2 >= 4 else 1 if dr > 0 or o2 > 0 else 0
    beh = {'playing': 0, 'sleeping': 0, 'irritable': 1, 'lethargic': 3}[x['behavior']]
    total = card + resp + beh
    return {'score': total, 'escalate': total >= 5 or beh == 3}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('school-age control',
   {'age_months': 60, 'hr': 91, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 151, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 84, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 81, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 81, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 52, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 126, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 101, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 92, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 152, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 83, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 82, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 82, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 53, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 127, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 102, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 93, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 26, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 153, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 82, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 83, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 83, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 54, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 128, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 103, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 94, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 27, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 154, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 81, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 84, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 0, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 84, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 55, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 129, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 104, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})],
 [('school-age control',
   {'age_months': 60, 'hr': 95, 'rr': 24, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('first birthday uses toddler band',
   {'age_months': 12, 'hr': 95, 'rr': 28, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('newborn in infant band',
   {'age_months': 0, 'hr': 155, 'rr': 45, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 0, 'escalate': False}),
  ('bradycardic infant',
   {'age_months': 6, 'hr': 80, 'rr': 40, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('capillary refill 3 seconds',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'playing', 'crt_s': 3, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('refill 4 seconds',
   {'age_months': 60, 'hr': 85, 'rr': 24, 'behavior': 'playing', 'crt_s': 4, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('slow breathing adolescent',
   {'age_months': 150, 'hr': 80, 'rr': 1, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('rate exactly 10 above range',
   {'age_months': 150, 'hr': 85, 'rr': 30, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 1, 'escalate': False}),
  ('fast breathing toddler',
   {'age_months': 30, 'hr': 120, 'rr': 56, 'behavior': 'playing', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 2, 'escalate': False}),
  ('irritable with oxygen',
   {'age_months': 60, 'hr': 130, 'rr': 24, 'behavior': 'irritable', 'crt_s': 2, 'o2_lpm': 2},
   {'score': 3, 'escalate': False}),
  ('lethargic alone escalates',
   {'age_months': 60, 'hr': 105, 'rr': 24, 'behavior': 'lethargic', 'crt_s': 2, 'o2_lpm': 0},
   {'score': 3, 'escalate': True})]]
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
school-age control{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
first birthday uses toddler band{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
newborn in infant band{'escalate': False, 'score': 0}{'escalate': False, 'score': 0}Passed
bradycardic infant{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
capillary refill 3 seconds{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
refill 4 seconds{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
slow breathing adolescent{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
rate exactly 10 above range{'escalate': False, 'score': 1}{'escalate': False, 'score': 1}Passed
fast breathing toddler{'escalate': False, 'score': 2}{'escalate': False, 'score': 2}Passed
irritable with oxygen{'escalate': False, 'score': 3}{'escalate': False, 'score': 3}Passed
lethargic alone escalates{'escalate': True, 'score': 3}{'escalate': True, 'score': 3}Passed

SHA-256 / 08f25e36681183dfe6d3c3ce2ce55d083ab66fee1d8ba419b85890ae10e4a69a

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

Case digest / c996aa8710c8c77dbfab19524f8e065e2d610dcf35c3912048f07323e644b15e