from datatypes.epc.roof import EpcRoofDescriptions from datatypes.epc.construction_age_band import EpcConstructionAgeBand def map_flat_roof(age_band: EpcConstructionAgeBand) -> EpcRoofDescriptions: """ For a flat, as built roof, these are the breakdowns: 2023 onwards → Flat, insulated 2003–2022 → Flat, insulated 1983–2002 → Flat, insulated 1976–1982 → Flat, limited insulation 1967–1975 → Flat, limited insulation 1950–1966 and earlier → Flat, no insulation :param age_band: Input age band :return: EpcRoofDescriptions """ year = age_band.start_year() if year >= 1983: return EpcRoofDescriptions.flat_insulated if year >= 1967: return EpcRoofDescriptions.flat_limited_insulation return EpcRoofDescriptions.flat_no_insulation def map_sloping_ceiling_roof(age_band: EpcConstructionAgeBand) -> EpcRoofDescriptions: """ For a sloping ceiling, as built roof, these are the breakdowns: 2023 onwards → Sloping pitched, insulated 2003–2022 → Sloping pitched, insulated 1983–2002 → Sloping pitched, insulated 1976–1982 → Sloping pitched, limited insulation 1967–1975 and earlier → Sloping pitched, no insulation :param age_band: Input age band :return: EpcRoofDescriptions """ year = age_band.start_year() if year >= 1983: return EpcRoofDescriptions.sloping_pitched_insulated if year >= 1976: return EpcRoofDescriptions.sloping_pitched_limited_insulation return EpcRoofDescriptions.sloping_pitched_no_insulation as_built_roof_classifiers = { # Only need to apply this to flat and sloping ceiling roofs "Flat": map_flat_roof, "PitchedWithSlopingCeiling": map_sloping_ceiling_roof, }