Model/backend/documents_parser
Khalim Conn-Kowlessar 82b8a16b40 Slice S0380.129: heating-systems corpus residual-pin regression guard
The 001431 corpus at `sap worksheets/heating systems examples/` now
has a permanent test module pinning cascade-vs-worksheet residuals
across all 41 populated heating-system variants. The corpus is a
controlled-variable test set — same dwelling (semi-detached, TFA 90 m²,
age G, W6 9BF, Elmhurst P960 worksheet format) under different heating
configurations — so every cascade-vs-worksheet residual is fully
attributable to the heating subsystem.

`test_heating_systems_corpus_residual_matches_pin` is parametrised by
variant folder name. Per variant it:

  1. Extracts Block 11a (individual) or Block 11b (community) pins
     from the P960 PDF — continuous SAP (`SAP value` row), total fuel
     cost (255)/(355), CO2 (272/372/382/383), PE (286/386/486/483).
  2. Routes the Summary PDF through ElmhurstSiteNotesExtractor →
     EpcPropertyDataMapper.from_elmhurst_site_notes → cert_to_inputs
     → calculate_sap_from_inputs.
  3. Asserts each of the four cascade outputs sits within an absolute
     tolerance of the pinned residual.

Tolerances are tight (SAP ±0.001, cost ±£0.01, CO2 ±0.1 kg/yr, PE
±0.1 kWh/yr) — the *expected residual* moves toward 0 as heating-
cascade gaps close; the *tolerance* never widens. Per
[[feedback-zero-error-strict]] + [[feedback-golden-residuals-near-zero]].

Pins captured at HEAD `729ee29c` (post-S0380.128). All 41 pass.
Smallest residual: `solid fuel 8` +0.87 SAP / −£20 cost (closest to
closure). First negative ΔSAP: `community heating 6` −6.87 SAP / +£158
cost (heat-pump heat network — only variant where cascade UNDERshoots
the worksheet).

Extended handover suite at HEAD post-slice: **873 pass, 0 fail**
(was 832 + 41 new parametrised cases).

Pyright net-zero on new file (0 → 0).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 08:36:08 +00:00
..
handler address JTK review comments 2026-04-20 15:11:17 +00:00
tests Slice S0380.129: heating-systems corpus residual-pin regression guard 2026-05-31 08:36:08 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
db_writer.py include updating epc_property_data to pashub to ara workflow 2026-04-29 09:55:14 +00:00
elmhurst_extractor.py Slice S0380.128: extractor §14.0 closure falls back to "14.1 Community Heating" 2026-05-31 08:26:24 +00:00
extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
local_runner.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00
parser.py load ecmk site notes to db 2026-04-29 11:20:47 +00:00
pdf.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00