FA-65276 / Epidemic compartment models / Open access
Household secondary attack rate: index requirement · case 01
Households without any index case dilute the attack rate.
ROOT CAUSE
Households with no index case are not excluded.
THE FAILURE
Households with no index case are not excluded.
Unsuccessful approach: Testing index<0 never excludes zero-index households.
Case contract
Each household is [size, index_cases, secondary]; skip households without an index case, without members at risk, or with more secondaries than at-risk members; pooled SAR = sum secondary / sum (size-index); per-size table sorted by size ascending; return [pooled rounded 6 or None, table].
Why this case matters
Compartmental epidemic calculations drive outbreak forecasts, vaccine targets and hospital planning; a single wrong flow, rate conversion or boundary silently changes every downstream number.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(households):
num = 0
den = 0
by_size = {}
for size, index, secondary in households:
at_risk = size - index
if at_risk <= 0:
continue
if secondary > at_risk:
continue
num += secondary
den += at_risk
a, b = by_size.get(size, (0, 0))
by_size[size] = (a + secondary, b + at_risk)
overall = round(num / den, 6) if den else None
table = [[k, round(a / b, 6)] for k, (a, b) in sorted(by_size.items())]
return [overall, table]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],
[('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],
[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],
[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],
[('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])]]
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 |
|---|---|---|---|
| control: mixed households | [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]] | [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]] | Passed |
| control: two index cases | [0.454545, [[3, 0.5], [6, 0.444444]]] | [0.454545, [[3, 0.5], [6, 0.444444]]] | Passed |
| regression: no index household | [0.333333, [[3, 1.0], [4, 0.142857]]] | [0.6, [[3, 1.0], [4, 0.333333]]] | Failed |
| control: single-person household | [1.0, [[2, 1.0]]] | [1.0, [[2, 1.0]]] | Passed |
| control: data error secondary too high | [0.5, [[3, 0.5], [5, 0.5]]] | [0.5, [[3, 0.5], [5, 0.5]]] | Passed |
| control: empty input | [None, []] | [None, []] | Passed |
| control: descending sizes | [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]] | [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]] | Passed |
SHA-256 / e52512e06194f05b69f1ecb560e9f5193afaffd0bdfc5baa366549b9bc4e0d30
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(households):
num = 0
den = 0
by_size = {}
for size, index, secondary in households:
at_risk = size - index
if index < 0 or at_risk <= 0:
continue
if secondary > at_risk:
continue
num += secondary
den += at_risk
a, b = by_size.get(size, (0, 0))
by_size[size] = (a + secondary, b + at_risk)
overall = round(num / den, 6) if den else None
table = [[k, round(a / b, 6)] for k, (a, b) in sorted(by_size.items())]
return [overall, table]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],
[('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],
[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],
[('control: mixed households',
([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),
[0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),
('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),
('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],
[('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),
('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),
('control: data error secondary too high',
([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),
[0.5, [[3, 0.5], [5, 0.5]]]),
('control: empty input', ([],), [None, []]),
('control: descending sizes',
([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),
[0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),
('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),
('control: large and small',
([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),
[0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])]]
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 |
|---|---|---|---|
| control: mixed households | [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]] | [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]] | Passed |
| control: two index cases | [0.454545, [[3, 0.5], [6, 0.444444]]] | [0.454545, [[3, 0.5], [6, 0.444444]]] | Passed |
| regression: no index household | [0.333333, [[3, 1.0], [4, 0.142857]]] | [0.6, [[3, 1.0], [4, 0.333333]]] | Failed |
| control: single-person household | [1.0, [[2, 1.0]]] | [1.0, [[2, 1.0]]] | Passed |
| control: data error secondary too high | [0.5, [[3, 0.5], [5, 0.5]]] | [0.5, [[3, 0.5], [5, 0.5]]] | Passed |
| control: empty input | [None, []] | [None, []] | Passed |
| control: descending sizes | [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]] | [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]] | Passed |
SHA-256 / a9498403ea4d688d9b1f5b49782f8f1ee9fb621e739c483e182dce48f86af61f
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. 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:32.515052+00:00.
Case digest / 994a077ed72c4ce5c75de77393797e9e82fc7952f83c6f34913fa1f899fd469d