Model/backend/documents_parser/tests
Khalim Conn-Kowlessar 068088bc2f Slice S0380.140: §4 cylinder storage loss — extractor picks up §16 thermostat lodging + Table 2b note b restricts ×0.9 to boiler/warm-air/HP systems
Two compounding bugs were over-counting the SAP 10.2 §4 (56)m cylinder
storage loss by ~76 kWh/yr across all 17 cylinder-with-immersion
corpus variants (cascade HW kWh 2460.40 vs worksheet 2384.12):

(1) **Extractor gap.** Elmhurst Summary §15.1 "Hot Water Cylinder"
    block lodges `Cylinder Size` / `Insulation Thickness` but NOT
    `Cylinder Thermostat`. The thermostat is lodged separately in
    §16 "Recommendations" as `Cylinder thermostat (Already installed)`.
    The extractor only searched §15.1, so `cylinder_thermostat`
    resolved to None for every variant on property 001431. The
    cascade then defaulted `has_cylinder_thermostat=False`, applying
    SAP 10.2 Table 2b's ×1.3 "no thermostat" multiplier.

(2) **Cascade spec gap.** `_separately_timed_dhw` returned True for
    any cylinder-lodged cert regardless of HW fuel. Per SAP 10.2
    Table 2b note b) (PDF p.159):

    > "Multiply Temperature Factor by 0.9 if there is separate time
    >  control of domestic hot water (boiler systems, warm air systems
    >  and heat pump systems)"

    Electric immersion is NOT in the bracketed list — the ×0.9
    reduction is restricted to boiler / warm-air / HP systems. Pre-
    slice the cascade over-applied ×0.9 on electric-immersion certs.

Combined, the cascade computed TF = 0.60 × 1.3 × 0.9 = 0.702 vs the
worksheet's TF = 0.60 (base — thermostat present, immersion exempt).
After both fixes the cascade HW kWh matches the worksheet's (64) at
1e-3 precision (2384.116 vs 2384.12).

Corpus impact (16 cylinder-with-immersion variants on 18-hour meter):

| variant      | SAP_c shift | Cost shift |
|--------------|------------:|-----------:|
| electric 1   | -0.20 →   -0.06 |  -£3.34 |
| electric 2   | -1.27 →   +0.47 |  -£4.44 |
| electric 3   | +2.42 →   +2.55 |  -£2.91 |
| electric 5   | -0.06 →   +0.07 |  -£3.06 |
| electric 6   | +1.19 →   +1.33 |  -£3.20 |
| electric 7   | +1.14 →   +1.29 |  -£3.35 |
| electric 8   | -0.41 →   -0.26 |  -£3.50 |
| electric 9   | -0.24 →   -0.12 |  -£2.91 |
| solid fuel 4-11 | -0.45..-0.09 → -0.29..+0.10 | -£3 to -£4 |

The HW kWh line closes cleanly; some SAP residuals sign-flip slightly
because the cascade's now-correct HW kWh exposes the SH+Sec demand
mismatch for storage heaters (electric 3/6/7 — open driver is the
Table 11 `main_heating_category=None` default for codes 401/402,
queued for a mapper-side slice).

Tests:
- new AAA test `test_separately_timed_dhw_excludes_electric_immersion_per_table_2b_note_b`
- 16 corpus pins re-tightened (8 electric + 8 solid fuel)

Extended handover suite: 883 pass (was 882; +1 new test), 0 fail.
Pyright net-zero on touched files (43 → 43 errors, all pre-existing).

Per [[feedback-spec-citation-in-commits]] +
[[feedback-spec-floor-skepticism]] (the "HW +76 kWh uniform overcount"
across 17 variants traced to TWO spec-citable defaults the cascade
was getting wrong, not a precision floor).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 19:03:58 +00:00
..
fixtures Slice S0380.52: cert 000565 Elmhurst-only mapper-driven cascade pin + glazing-label coverage 2026-05-28 22:03:52 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
test_elmhurst_end_to_end.py Slice S0380.17: map Elmhurst §11 glazing-type labels to SAP10 codes 2026-05-27 23:05:52 +00:00
test_elmhurst_extractor.py extract window frame details from elmhurst site notes 🟥 2026-04-27 15:50:25 +00:00
test_end_to_end.py P6.1 follow-on: unbox BuildingPartIdentifier at backend boundaries 2026-05-20 09:58:23 +00:00
test_extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
test_heating_systems_corpus.py Slice S0380.140: §4 cylinder storage loss — extractor picks up §16 thermostat lodging + Table 2b note b restricts ×0.9 to boiler/warm-air/HP systems 2026-05-31 19:03:58 +00:00
test_pdf.py rename example site notes to PasHub_ and add Elmhurst example 2026-04-24 13:01:51 +00:00
test_summary_pdf_mapper_chain.py Slice S0380.133: derive solid-fuel main fuel from §14.0 EES Code 2026-05-31 10:04:28 +00:00