Model/backend/documents_parser/tests
Khalim Conn-Kowlessar 575cdd539a Slice S0380.3: surface wall_insulation_type=6 for 'FE Filled Cavity + External'
Extends `_ELMHURST_INSULATION_CODE_TO_SAP10` in
`datatypes/epc/domain/mapper.py` with the two-letter dual codes
documented on Elmhurst Summary PDFs:

  "FE" → 6  (Filled cavity + External insulation; cohort fixture)
  "FI" → 7  (Filled cavity + Internal insulation; mirror, no fixture)

The cascade `wall_insulation_type` enum (per
`domain/sap10_ml/rdsap_uvalues.py` lines 120-131) treats codes 6 and
7 as composite-resistance walls (filled cavity in series with an
external/internal insulation layer), routing through a different
U-value calc than the plain filled-cavity default. Cert 0380's
Summary lodges `walls.insulation = "FE Filled Cavity + External"`
which until this slice fell through `_leading_code` to a missing
dict entry and the mapper produced `wall_insulation_type=None`,
defaulting the cascade to the as-built path and overstating walls
heat loss by +58 W/K.

Forcing function (Slice S0380.1): cert 0380 Summary cascade SAP
moves from 81.7528 (Δ -6.7576 — i.e. after Slice S0380.2 only) to
86.8671 (Δ -1.6433) — closes ~76% of the remaining gap. `walls_w_per_k`
drops from 69.6900 to 24.6238. Residual ~13 W/K wall gap vs API's
11.6150 is the next workstream: `wall_insulation_thickness` is still
None on the Summary EPC (API lodges '100mm'). Without the thickness
the cascade applies the composite U-value at the dual-code's default
thickness rather than the lodged 100 mm.

Added focused unit test
`test_summary_0380_filled_cavity_plus_external_insulation_routes_to_code_6`
that pins both `wall_construction == 4` and `wall_insulation_type == 6`
on the mapper boundary, so future debuggers can localise regressions
in the dual-code lookup before walking the full chain.

Pyright baseline preserved:
  datatypes/epc/domain/mapper.py: 32 errors (no new errors introduced)
  backend/documents_parser/tests/test_summary_pdf_mapper_chain.py: 0 errors

Regression suite: 671 pass + 11 fail (vs handover baseline 669 + 10 —
net +2 pass for the two new GREEN unit tests across Slices S0380.2-3,
+1 fail still being the S0380.1 chain test that this slice continues
to close but does not yet fully resolve).

Spec refs:
- SAP 10.2 §3.7 / Table S5 (U-values for masonry walls — composite
  filled-cavity-plus-insulation calc)
- `domain/sap10_ml/rdsap_uvalues.py:120` (RdSAP schema
  `wall_insulation_type` enum: 6 = filled cavity + external)
- Cert 0380 worksheet `dr87-0001-000899.pdf` (lodges Mitsubishi
  PUZ-WM50VHA ASHP on a cavity wall with subsequent external
  insulation — the composite-wall fixture)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 18:06:02 +00:00
..
fixtures chore: stage cert 9501 fixtures (second boiler validation cert) 2026-05-26 18:53:08 +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 fix: address 22 project-wide test failures from previous sweep 2026-05-26 13:34:51 +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_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.3: surface wall_insulation_type=6 for 'FE Filled Cavity + External' 2026-05-27 18:06:02 +00:00