From 6279924773bdc323f141f9dc3759f4f1b3d7bfe7 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 29 Jun 2026 19:37:11 +0000 Subject: [PATCH] =?UTF-8?q?Stop=20a=20System-built=20landlord=20override?= =?UTF-8?q?=20being=20mis-read=20as=20a=20basement=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit System-built is RdSAP code 6, colliding with the gov-EPC code-6 basement sentinel that main_wall_is_basement falls back to. The wall overlay now pins wall_is_basement=False for system-built, mirroring the gov-API mapper's _clear_basement_flag_when_system_built, so the override no longer adds a phantom basement (which inflated both wall and ground-floor heat loss). Co-Authored-By: Claude Opus 4.8 (1M context) --- domain/epc/property_overlays/wall_type_overlay.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/domain/epc/property_overlays/wall_type_overlay.py b/domain/epc/property_overlays/wall_type_overlay.py index 0620819c..848ced77 100644 --- a/domain/epc/property_overlays/wall_type_overlay.py +++ b/domain/epc/property_overlays/wall_type_overlay.py @@ -31,6 +31,9 @@ _MATERIAL_CONSTRUCTION: dict[str, int] = { "Curtain Wall": 9, } +# RdSAP `WALL_SYSTEM_BUILT` — shares code 6 with the gov-EPC basement sentinel. +_WALL_SYSTEM_BUILT = 6 + # RdSAP `wall_insulation_type` codes by insulation-state suffix # (domain/sap10_ml/rdsap_uvalues.py): external 1, filled-cavity 2, internal 3, # as-built/uninsulated 4, cavity+external 6, cavity+internal 7. @@ -66,11 +69,18 @@ def wall_overlay_for( if building_part == 0 else BuildingPartIdentifier.extension(building_part) ) + # System-built is RdSAP code 6, which collides with the gov-EPC code-6 + # basement sentinel that `main_wall_is_basement` falls back to. A landlord + # naming a System-built wall is asserting the material, not a basement — pin + # the flag False so the override isn't mis-read as one (ADR-0033 / the + # overlay mirror of the mapper's `_clear_basement_flag_when_system_built`). + wall_is_basement = False if construction == _WALL_SYSTEM_BUILT else None return EpcSimulation( building_parts={ identifier: BuildingPartOverlay( wall_construction=construction, wall_insulation_type=insulation, + wall_is_basement=wall_is_basement, ) } )