From 86b5387a05b4de8c48865b947d3e5c692b595a26 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Wed, 17 Jun 2026 14:15:46 +0000 Subject: [PATCH] Show lodged vs effective main wall per property in the modelling e2e run Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/run_modelling_e2e.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/run_modelling_e2e.py b/scripts/run_modelling_e2e.py index e58087db..644be17f 100644 --- a/scripts/run_modelling_e2e.py +++ b/scripts/run_modelling_e2e.py @@ -61,7 +61,10 @@ from typing import Any, Optional _REPO_ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(_REPO_ROOT)) # worktree root first — avoid the import trap -from datatypes.epc.domain.epc_property_data import EpcPropertyData # noqa: E402 +from datatypes.epc.domain.epc_property_data import ( # noqa: E402 + BuildingPartIdentifier, + EpcPropertyData, +) from domain.property.property import Property, PropertyIdentity # noqa: E402 from repositories.property.landlord_override_overlays import ( # noqa: E402 overlays_from, @@ -168,6 +171,18 @@ def _dump_overrides(engine: Engine, property_ids: list[int]) -> None: print() +def _main_wall_summary(epc: EpcPropertyData) -> str: + """The MAIN building part's wall codes — what the calculator scores for the + wall U-value. Used to show whether a Landlord Override moved them.""" + for part in epc.sap_building_parts: + if part.identifier is BuildingPartIdentifier.MAIN: + return ( + f"wall_construction={part.wall_construction} " + f"wall_insulation_type={part.wall_insulation_type}" + ) + return "no MAIN building part" + + def _scenario_for(session: Session, scenario_id: int) -> Scenario: """Read the Scenario the run targets (read-only). An Increasing-EPC Scenario must carry a ``goal_value`` (band) — the old null-band rows were a fixed bug @@ -450,6 +465,15 @@ def main() -> None: ), ) effective_epc: EpcPropertyData = overlaid_property.effective_epc + lodged_wall = _main_wall_summary(epc) + effective_wall = _main_wall_summary(effective_epc) + if lodged_wall != effective_wall: + print( + f" overlay moved the main wall: lodged [{lodged_wall}] " + f"-> effective [{effective_wall}]" + ) + else: + print(f" overlay no-op on main wall: [{lodged_wall}]") spatial: Optional[SpatialReference] = _spatial_for(geospatial, uprn) restrictions: PlanningRestrictions = ( spatial.restrictions if spatial is not None else PlanningRestrictions()