Model/backend/onboarders/mappings/as_built_roof_classifiers.py
2026-02-02 18:47:42 +00:00

55 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from backend.onboarders.epc_descriptions import EpcConstructionAgeBand, EpcRoofDescriptions
def classify_flat_roof(age_band: EpcConstructionAgeBand) -> EpcRoofDescriptions:
"""
For a flat, as built roof, these are the breakdowns:
2023 onwards → Flat, insulated
20032022 → Flat, insulated
19832002 → Flat, insulated
19761982 → Flat, limited insulation
19671975 → Flat, limited insulation
19501966 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 classify_sloping_ceiling_roof(age_band: EpcConstructionAgeBand) -> EpcRoofDescriptions:
"""
For a sloping ceiling, as built roof, these are the breakdowns:
2023 onwards → Sloping pitched, insulated
20032022 → Sloping pitched, insulated
19832002 → Sloping pitched, insulated
19761982 → Sloping pitched, limited insulation
19671975 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": classify_flat_roof,
"PitchedWithSlopingCeiling": classify_sloping_ceiling_roof,
}