From 406365753bcdf2b75a4ec66787aa375746896cb4 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 13:41:35 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20a=20landlord=20age-band=20override=20?= =?UTF-8?q?onto=20the=20main=20building=20part=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../construction_age_band_overlay.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/domain/epc/property_overlays/construction_age_band_overlay.py b/domain/epc/property_overlays/construction_age_band_overlay.py index d4cc6eae..55054168 100644 --- a/domain/epc/property_overlays/construction_age_band_overlay.py +++ b/domain/epc/property_overlays/construction_age_band_overlay.py @@ -13,10 +13,27 @@ from __future__ import annotations from typing import Optional -from domain.modelling.simulation import EpcSimulation +from datatypes.epc.domain.epc_property_data import BuildingPartIdentifier +from domain.modelling.simulation import BuildingPartOverlay, EpcSimulation + +# RdSAP England-&-Wales construction age bands (letter codes A..M). +_VALID_AGE_BANDS: frozenset[str] = frozenset("ABCDEFGHIJKLM") def age_band_overlay_for( age_band_value: str, building_part: int ) -> Optional[EpcSimulation]: - raise NotImplementedError + band = age_band_value.strip().upper() + if band not in _VALID_AGE_BANDS: + return None + + identifier = ( + BuildingPartIdentifier.MAIN + if building_part == 0 + else BuildingPartIdentifier.extension(building_part) + ) + return EpcSimulation( + building_parts={ + identifier: BuildingPartOverlay(construction_age_band=band) + } + )