FAILURE MAP
← Case archive

FA-64366 / Clinical triage scoring / Open access

Sepsis screen from inflammatory criteria and bedside score: temperature criterion · case 01

A temperature of exactly 38.0 counts as an inflammatory criterion.

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

ROOT CAUSE

Both temperature thresholds are treated as inclusive.

VERIFIED REPAIR

Count temperature only when strictly above 38.0 or strictly below 36.0.

Unsuccessful approach: Dropping the hypothermia clause misses low temperatures entirely.

Case contract

Input {temp (1 dp), hr, rr, paco2 (or null), wbc, bands_pct, sbp, gcs, suspected_infection}. Toy inflammatory criteria (count): temp > 38.0 or < 36.0; hr > 90; rr > 20 or paco2 < 32 when measured; wbc > 12 or < 4 or bands > 10%. Bedside score: rr >= 22, sbp <= 100, gcs < 15. Without suspected infection the alert is NONE; otherwise SEPSIS_ALERT when the bedside score >= 2, else SIRS_ALERT when criteria >= 2, else NONE. Return {sirs, qsofa, alert}.

Why this case matters

Screening rules count criteria with open and closed thresholds and combine two scores with precedence; each is a separable defect.

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):
    t = Fraction(str(x['temp'])) * 10
    w = Fraction(str(x['wbc']))
    rr = x['rr']
    s = 0
    s += 1 if t >= 380 or t <= 360 else 0
    s += 1 if x['hr'] > 90 else 0
    s += 1 if rr > 20 or (x['paco2'] is not None and x['paco2'] < 32) else 0
    s += 1 if w > 12 or w < 4 or x['bands_pct'] > 10 else 0
    q = 0
    q += 1 if rr >= 22 else 0
    q += 1 if x['sbp'] <= 100 else 0
    q += 1 if x['gcs'] < 15 else 0
    if not x['suspected_infection']:
        alert = 'NONE'
    elif q >= 2:
        alert = 'SEPSIS_ALERT'
    elif s >= 2:
        alert = 'SIRS_ALERT'
    else:
        alert = 'NONE'
    return {'sirs': s, 'qsofa': q, 'alert': alert}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('hypothermia counts',
   {'temp': '35.5',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 93,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.5',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.1',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 12,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 97,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 89,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.6',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 94,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.6',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.2',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 13,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 98,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 90,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.7',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 98,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 28,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.7',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.3',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 14,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 99,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.8',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.8',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.4',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 15,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 94,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.9',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 100,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.9',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.5',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 16,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 101,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 95,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})]]
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
hypothermia counts{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
temperature exactly 38.0 not counted{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Failed
missing blood gas not counted{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Passed
low carbon dioxide with normal rate{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
leukopenia counts{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
band forms count{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
respiratory rate exactly 22{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
rate 21 only meets inflammatory criterion{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
bedside positive without inflammatory criteria{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}Passed
both scores positive{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}Passed
no suspected infection{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}Passed

SHA-256 / f9e43ff577348b5a1663230a902f330097ec9a6a2b7f8a538f169bda9484f0e5

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):
    t = Fraction(str(x['temp'])) * 10
    w = Fraction(str(x['wbc']))
    rr = x['rr']
    s = 0
    s += 1 if t > 380 else 0
    s += 1 if x['hr'] > 90 else 0
    s += 1 if rr > 20 or (x['paco2'] is not None and x['paco2'] < 32) else 0
    s += 1 if w > 12 or w < 4 or x['bands_pct'] > 10 else 0
    q = 0
    q += 1 if rr >= 22 else 0
    q += 1 if x['sbp'] <= 100 else 0
    q += 1 if x['gcs'] < 15 else 0
    if not x['suspected_infection']:
        alert = 'NONE'
    elif q >= 2:
        alert = 'SEPSIS_ALERT'
    elif s >= 2:
        alert = 'SIRS_ALERT'
    else:
        alert = 'NONE'
    return {'sirs': s, 'qsofa': q, 'alert': alert}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('hypothermia counts',
   {'temp': '35.5',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 93,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.5',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.1',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 12,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 97,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 89,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.6',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 94,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.6',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.2',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 13,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 98,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 90,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.7',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 98,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 28,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.7',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.3',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 14,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 99,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.8',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.8',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.4',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 15,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 94,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.9',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 100,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.9',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.5',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 16,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 101,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 95,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})]]
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
hypothermia counts{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Failed
temperature exactly 38.0 not counted{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Passed
missing blood gas not counted{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Passed
low carbon dioxide with normal rate{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
leukopenia counts{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
band forms count{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
respiratory rate exactly 22{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
rate 21 only meets inflammatory criterion{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
bedside positive without inflammatory criteria{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}Passed
both scores positive{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}Passed
no suspected infection{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}Passed

SHA-256 / f16dfa03b8514ff679c163ece06ae69d182eeeb4ab648e93fed86ff09f7689ec

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):
    t = Fraction(str(x['temp'])) * 10
    w = Fraction(str(x['wbc']))
    rr = x['rr']
    s = 0
    s += 1 if t > 380 or t < 360 else 0
    s += 1 if x['hr'] > 90 else 0
    s += 1 if rr > 20 or (x['paco2'] is not None and x['paco2'] < 32) else 0
    s += 1 if w > 12 or w < 4 or x['bands_pct'] > 10 else 0
    q = 0
    q += 1 if rr >= 22 else 0
    q += 1 if x['sbp'] <= 100 else 0
    q += 1 if x['gcs'] < 15 else 0
    if not x['suspected_infection']:
        alert = 'NONE'
    elif q >= 2:
        alert = 'SEPSIS_ALERT'
    elif s >= 2:
        alert = 'SIRS_ALERT'
    else:
        alert = 'NONE'
    return {'sirs': s, 'qsofa': q, 'alert': alert}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('hypothermia counts',
   {'temp': '35.5',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 93,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.5',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.1',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 12,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 97,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 89,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.6',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 94,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.6',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.2',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 13,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 98,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 90,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.7',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 98,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 28,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.7',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.3',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 14,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 99,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 91,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.8',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 96,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 29,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.8',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.4',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 15,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 94,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 92,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})],
 [('hypothermia counts',
   {'temp': '35.9',
    'hr': 95,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('temperature exactly 38.0 not counted',
   {'temp': '38.0',
    'hr': 100,
    'rr': 18,
    'paco2': None,
    'wbc': '8',
    'bands_pct': 2,
    'sbp': 120,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('missing blood gas not counted',
   {'temp': '37.0',
    'hr': 97,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 0, 'alert': 'NONE'}),
  ('low carbon dioxide with normal rate',
   {'temp': '37.0',
    'hr': 80,
    'rr': 16,
    'paco2': 30,
    'wbc': '13',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('leukopenia counts',
   {'temp': '38.9',
    'hr': 80,
    'rr': 16,
    'paco2': None,
    'wbc': '3.5',
    'bands_pct': 0,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('band forms count',
   {'temp': '37.0',
    'hr': 99,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 16,
    'sbp': 125,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 2, 'qsofa': 0, 'alert': 'SIRS_ALERT'}),
  ('respiratory rate exactly 22',
   {'temp': '37.0',
    'hr': 80,
    'rr': 22,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 101,
    'gcs': 15,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 1, 'alert': 'NONE'}),
  ('rate 21 only meets inflammatory criterion',
   {'temp': '37.0',
    'hr': 80,
    'rr': 21,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 100,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 1, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('bedside positive without inflammatory criteria',
   {'temp': '37.0',
    'hr': 80,
    'rr': 18,
    'paco2': None,
    'wbc': '9',
    'bands_pct': 0,
    'sbp': 95,
    'gcs': 13,
    'suspected_infection': True},
   {'sirs': 0, 'qsofa': 2, 'alert': 'SEPSIS_ALERT'}),
  ('both scores positive',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 88,
    'gcs': 14,
    'suspected_infection': True},
   {'sirs': 4, 'qsofa': 3, 'alert': 'SEPSIS_ALERT'}),
  ('no suspected infection',
   {'temp': '38.9',
    'hr': 120,
    'rr': 26,
    'paco2': None,
    'wbc': '15',
    'bands_pct': 0,
    'sbp': 93,
    'gcs': 14,
    'suspected_infection': False},
   {'sirs': 4, 'qsofa': 3, 'alert': 'NONE'})]]
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
hypothermia counts{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
temperature exactly 38.0 not counted{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Passed
missing blood gas not counted{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}{'alert': 'NONE', 'qsofa': 0, 'sirs': 1}Passed
low carbon dioxide with normal rate{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
leukopenia counts{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
band forms count{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}{'alert': 'SIRS_ALERT', 'qsofa': 0, 'sirs': 2}Passed
respiratory rate exactly 22{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
rate 21 only meets inflammatory criterion{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 1}Passed
bedside positive without inflammatory criteria{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}{'alert': 'SEPSIS_ALERT', 'qsofa': 2, 'sirs': 0}Passed
both scores positive{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}{'alert': 'SEPSIS_ALERT', 'qsofa': 3, 'sirs': 4}Passed
no suspected infection{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}{'alert': 'NONE', 'qsofa': 3, 'sirs': 4}Passed

SHA-256 / 6ce9d8421ec1e61df6bde2077aff8a8abc6697adc349c57547d97a4b2a2311d2

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

Case digest / aed06f5b3c38aef002591ca6d7ac497192f491a4b42eac229fb78bb4e5de9565