added classify_flat_roof

This commit is contained in:
Khalim Conn-Kowlessar 2026-02-02 12:40:18 +00:00
parent 63c6c32e22
commit eee99d1358
2 changed files with 36 additions and 18 deletions

View file

@ -0,0 +1,7 @@
class OnboarderBase:
def read(self):
pass
def write(self):
pass

View file

@ -380,22 +380,27 @@ roof_mapping = {
} }
def classify_flat_roof(age_band: EpcConstructionAgeBand): def classify_flat_roof(age_band: EpcConstructionAgeBand) -> EpcRoofDescriptions:
# # flat roof, which if there is observed insulation is just "flat, insulated", however there is a """
# # different efficiency rating depending on insulation thickness For a flat, as built roof, these are the breakdowns:
# # categories:
# # 12mm = very poor & has limited insulation description 2023 onwards Flat, insulated
# # 25, 50 = poor & has limited insulation description 20032022 Flat, insulated
# # 75, 100, 125mm = average (Flat, insulated) 19832002 Flat, insulated
# # 150, 175, 200, 225, 250mm = good (Flat, insulated) 19761982 Flat, limited insulation
# # 270mm+ = very good (Flat, insulated) 19671975 Flat, limited insulation
# # As built 2023 = Flat, insulated, Very good 19501966 and earlier Flat, no insulation
# # 2003 - 2006, up to 2012-2022 = Flat insulated, Good """
# # 1983-1990, 1996-2002 = Flat, insulated, Average
# # 1976-1982 = Flat, limited insulation, poor year = age_band.start_year()
# # 1967 - 1975 = Flat, limited insulation, Very Poor
# # 1950-1966 and earlier bands = flat, no insulation, very poor if year >= 1983:
raise NotImplementedError("Flat roof classification not implemented yet") return EpcRoofDescriptions.flat_insulated
if year >= 1967:
return EpcRoofDescriptions.flat_limited_insulation
return EpcRoofDescriptions.flat_no_insulation
def classify_pitched_loft_unknown(age_band: EpcConstructionAgeBand): def classify_pitched_loft_unknown(age_band: EpcConstructionAgeBand):
@ -421,7 +426,7 @@ AS_BUILT_ROOF_CLASSIFIERS = {
def fill_roof_as_built(row): def fill_roof_as_built(row):
# Already resolved # Already resolved
if row.landlord_roof_description is not None: if not pd.isnull(row.landlord_roof_description):
return row.landlord_roof_description return row.landlord_roof_description
roof_type = row["Roof Construction"] roof_type = row["Roof Construction"]
@ -435,7 +440,13 @@ def fill_roof_as_built(row):
f"Missing age band for roof classification ({roof_type})" f"Missing age band for roof classification ({roof_type})"
) )
return classifier(row.construction_age_band) output = classifier(row.construction_age_band)
if output is None:
raise NotImplementedError(
f"Roof classification returned None for roof type '{roof_type}'"
)
return output
data["landlord_roof_description"] = ( data["landlord_roof_description"] = (