Amend ADR-0019: gov-API code 8 is system built, not park home 🟪

Record why the generator now keys system-built on both code 6 and the
gov-EPC API code 8, citing the GOV.UK RdSAP WallConstructionCode XSD, and
flag the remaining mapper-level enum-normalisation work as open.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DX8oAGsGkBHq3U4dsxYRzz
This commit is contained in:
Jun-te Kim 2026-07-28 10:33:52 +00:00
parent d1f064433c
commit aa4446757f

View file

@ -8,6 +8,8 @@ The solid-wall Recommendation Generator must decide, per Property, which wall-in
**System-built** is keyed on `wall_construction == 6` (`WALL_SYSTEM_BUILT`; the Elmhurst `SY System build` label). This code is currently *overloaded*: `B Basement wall` also maps to 6 (`BASEMENT_WALL_CONSTRUCTION_CODE`, `mapper.py:2100`), so the generator additionally guards on `main_wall_is_basement` — a basement wall is never solid-wall-insulation-suitable and is excluded regardless of construction. Because `main_wall_is_basement` is presently derived as `wall_construction == 6`, *every* code-6 wall is treated as basement today, so the system-built branch is inert until the calculator disambiguates system-built from basement (target: MAIN `wall_construction == 6` with `main_wall_is_basement` False — tracked in Hestia-Homes/Model#1177). The strict-xfail pin `test_system_built_generator_offers_ewi_and_iwi_each_pinning_its_after` is the tripwire for that fix. Note `wall_construction == 8` is **Park home** (`PH`) on the Elmhurst path, *not* system-built — do not key system-built on 8.
> **Amendment (2026-07, `fix/wall-construction-enum-mapping`).** The "do not key system-built on 8" clause was wrong for the *gov-EPC API* path — the path that populates every production cert. Per the authoritative GOV.UK RdSAP `WallConstructionCode` enumeration (communitiesuk/epb-data-warehouse `.../RdSAP/UDT/SAP-Domains.xsd`), **8 = "system built"** in every schema version (17.0-21.0.1), and **10 = "park home wall"**; only the Elmhurst summary path reuses 8 for park home. Because the gov→internal translator (`mapper._api_wall_construction_code`) does *not* remap 8→6, a system-built wall reaches the generator as code 8 and was suppressed as a park home — withholding EWI/IWI from ~5.1k certs (~2.1k uninsulated main walls) in a 2026 DB sweep. The generator now keys system-built on **both** code 6 (Elmhurst/internal) and code 8 (gov API), matching `u_wall`'s existing `_GOV_API_WALL_CODE_TO_TYPE[8] = WALL_SYSTEM_BUILT`, and excludes park homes on the gov-canonical code 10. The deeper fix — normalising the whole gov enum into the internal `WALL_*` space at the mapper boundary (so `fabric_description` export, overlays, and the code-6 basement overload stop diverging) — remains open; it is higher-risk because gov 8→internal 6 collides with `BASEMENT_WALL_CONSTRUCTION_CODE` and the Model#1177 basement disambiguation.
| Construction | Cavity fill | IWI | EWI |
|---|---|---|---|
| Cavity | ✅ only | ❌ | ❌ |