mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added unknown descriptions properties
This commit is contained in:
parent
b2d4037b21
commit
9c5befbff6
2 changed files with 38 additions and 29 deletions
|
|
@ -105,6 +105,18 @@ class EpcWallDescriptions(Enum):
|
|||
sandstone_as_built_unknown = "Sandstone, as built, unknown insulation"
|
||||
cob_as_built_unknown = "Cob, as built, unknown insulation"
|
||||
|
||||
@property
|
||||
def unknown_descriptions(self) -> List["EpcWallDescriptions"]:
|
||||
return [
|
||||
EpcWallDescriptions.cavity_as_built_unknown,
|
||||
EpcWallDescriptions.solid_brick_as_built_unknown,
|
||||
EpcWallDescriptions.system_as_built_unknown,
|
||||
EpcWallDescriptions.timber_frame_as_built_unknown,
|
||||
EpcWallDescriptions.granite_as_built_unknown,
|
||||
EpcWallDescriptions.sandstone_as_built_unknown,
|
||||
EpcWallDescriptions.cob_as_built_unknown,
|
||||
]
|
||||
|
||||
|
||||
class EpcRoofDescriptions(Enum):
|
||||
# Loft
|
||||
|
|
@ -174,6 +186,21 @@ class EpcRoofDescriptions(Enum):
|
|||
sloping_pitched_limited_insulation: str = "Pitched, limited insulation"
|
||||
sloping_pitched_insulated: str = "Pitched, insulated"
|
||||
|
||||
# Unknown descriptions which may get mapped later or handled via fallback
|
||||
flat_as_built_unknown: str = "Flat, as built, unknown insulation"
|
||||
loft_as_built_unknown: str = "Loft, as built, unknown insulation"
|
||||
thatched_as_built_unknown: str = "Thatched, as built, unknown insulation"
|
||||
sloping_pitched_as_built_unknown: str = "Pitched, as built, unknown insulation"
|
||||
|
||||
@property
|
||||
def unknown_descriptions(self) -> List["EpcRoofDescriptions"]:
|
||||
return [
|
||||
EpcRoofDescriptions.flat_as_built_unknown,
|
||||
EpcRoofDescriptions.loft_as_built_unknown,
|
||||
EpcRoofDescriptions.thatched_as_built_unknown,
|
||||
EpcRoofDescriptions.sloping_pitched_as_built_unknown,
|
||||
]
|
||||
|
||||
|
||||
class EpcEfficiency(Enum):
|
||||
VERY_POOR = "Very Poor"
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ AS_BUILT_WALL_CLASSIFIERS = {
|
|||
"Cob": map_cob_wall_insulation,
|
||||
}
|
||||
|
||||
UNKNOWN_AGE_FALLBACK = {
|
||||
WALL_UNKNOWN_AGE_FALLBACK = {
|
||||
"Cavity": EpcWallDescriptions.cavity_as_built_unknown,
|
||||
"Solid Brick": EpcWallDescriptions.solid_brick_as_built_unknown,
|
||||
"Timber Frame": EpcWallDescriptions.timber_frame_as_built_unknown,
|
||||
|
|
@ -234,7 +234,7 @@ def fill_as_built(row):
|
|||
|
||||
# Missing construction age → conservative fallback
|
||||
if pd.isnull(row.construction_age_band):
|
||||
return UNKNOWN_AGE_FALLBACK.get(wall_type)
|
||||
return WALL_UNKNOWN_AGE_FALLBACK.get(wall_type)
|
||||
|
||||
classifier = AS_BUILT_WALL_CLASSIFIERS.get(wall_type)
|
||||
if classifier is None:
|
||||
|
|
@ -284,33 +284,6 @@ assert data["landlord_wall_efficiency"].isnull().sum() == 0
|
|||
|
||||
# ------------ Roof Construction ------------
|
||||
|
||||
roof_aggs = data[["Roof Construction", "Roof Insulation"]].drop_duplicates().to_dict("records")
|
||||
|
||||
[
|
||||
# Dwelling above
|
||||
|
||||
# Pitched, loft
|
||||
|
||||
# Flat
|
||||
|
||||
# Thatched
|
||||
|
||||
# Sloping
|
||||
|
||||
# Sloping ceiling:
|
||||
# With measured insulation
|
||||
# 12mm insulation: Pitched, limited insulation, Very Poor
|
||||
# 25mm, 50mm insulation: Pitched, limited insulation, Poor
|
||||
# 75mm - 125mm, Pitched, insulated, average
|
||||
# 150mm - 250mm, Pitched, insulated, good
|
||||
# 270mm+, Pitched, insulated, very good
|
||||
# As built / unknown:
|
||||
# before 1900, 1900-1929, 1930-1949, 1950-1966, 1967-1975, -> Pitched, no insulation, Very Poor
|
||||
# 1976-1982 -> Pitched, limited insulation, Poor
|
||||
# 1983-1990, to 1996-2002 Pitched, insulated, Average
|
||||
# 2003 - 2006, 2012-2022 -> Pitched, insulated, Good
|
||||
# 2023 onwards -> Pitched, insulated, Very Good
|
||||
]
|
||||
|
||||
roof_mapping = {
|
||||
# Dwelling above
|
||||
|
|
@ -459,6 +432,15 @@ AS_BUILT_ROOF_CLASSIFIERS = {
|
|||
"PitchedWithSlopingCeiling": classify_sloping_ceiling_roof,
|
||||
}
|
||||
|
||||
ROOF_UNKNOWN_AGE_FALLBACK = {
|
||||
"Flat": EpcRoofDescriptions.flat_as_built_unknown,
|
||||
"PitchedWithSlopingCeiling": EpcRoofDescriptions.sloping_pitched_as_built_unknown,
|
||||
"PitchedThatched": EpcRoofDescriptions.thatched_as_built_unknown,
|
||||
"PitchedNormalLoftAccess": EpcRoofDescriptions.loft_as_built_unknown,
|
||||
"PitchedNormalNoLoftAccess": EpcRoofDescriptions.loft_as_built_unknown,
|
||||
|
||||
}
|
||||
|
||||
|
||||
def fill_roof_as_built(row):
|
||||
# Already resolved
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue