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) + } + )