Expanding gbis eligibiity checks

This commit is contained in:
Khalim Conn-Kowlessar 2024-02-27 10:20:55 +00:00
parent 97ce8dc32e
commit 0fbf004512
3 changed files with 59 additions and 21 deletions

View file

@ -352,9 +352,41 @@ class Eligibility:
# Check if the property is suitable for cavity wall
self.cavity_insulation()
self.gbis_warmfront = (self.cavity["suitability"]) and (
int(self.epc["current-energy-efficiency"]) <= 68
)
current_sap = int(self.epc["current-energy-efficiency"])
# We have a strict suitability check and a non-strict check
# Perfect strictness
if (self.cavity["type"] == "empty") and (current_sap < 69):
self.gbis_warmfront = {
"eligible": True,
"strict": True,
"message": "Perfect suitability",
}
return
# Near perfect
if self.cavity["suitability"] and (current_sap < 55):
self.gbis_warmfront = {
"eligible": True,
"strict": True,
"message": "Near perfect suitability",
}
return
# Suitable cavity, but high sap
if self.cavity["suitability"] and (current_sap >= 55):
self.gbis_warmfront = {
"eligible": True,
"strict": False,
"message": "Meets cavity, fails SAP check",
}
return
self.gbis_warmfront = {
"eligible": False,
"strict": False,
"message": "All conditions fail",
}
def check_eco4_warmfront(self):
"""
@ -388,6 +420,10 @@ class Eligibility:
self.cavity_insulation()
self.loft_insulation()
# We put in a placeholder when the roof is not a loft
if self.loft["reason"] == "roof not loft":
self.loft["thickness"] = 999
# Case 1: No conditions meet
if not self.cavity["suitability"] and (self.loft["thickness"] > 100) and current_sap >= 55:
self.eco4_warmfront = {
@ -415,7 +451,7 @@ class Eligibility:
self.eco4_warmfront = {
"eligible": True,
"strict": True,
"message": "Perfect suitability",
"message": "Near perfect suitability",
"cavity_type": self.cavity["type"],
"loft_type": self.loft["thickness_classification"]
}

View file

@ -1270,15 +1270,6 @@ def get_epc_data(
results_df["post_install_sap"] = None
results_df["eligibility_classification"] = None
eco4 = asset_list[asset_list["ECO Eligibility"] == "eco4"]
z = results_df[results_df["row_id"].isin(eco4["asset_list_row_id"])]
z["walls"].value_counts()
z1 = z[z["walls"] == "Cavity wall, as built, no insulation"]
k = z1[z1["roof"] == "Pitched, 100 mm loft insulation"]
property_meta = asset_list[asset_list["asset_list_row_id"] == k["row_id"].values[0]].squeeze()
z[z["walls"] == "Cavity wall, as built, insulated"]["roof"].value_counts()
z[z["walls"] == "Cavity wall, as built, insulated"]["roof"].value_counts()
if not scoring_df.empty:
scoring_df = scoring_df.drop(
columns=[
@ -1763,6 +1754,17 @@ def patch_cleaned(cleaned):
]
)
cleaned["roof-description"].extend(
[
{'original_description': 'Pitched, 300+mm loft insulation',
'clean_description': 'Pitched, 300+ mm loft insulation', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_pitched': True, 'is_roof_room': False, 'is_loft': True,
'is_flat': False, 'is_thatched': False, 'is_at_rafters': False, 'is_assumed': False,
'has_dwelling_above': False, 'is_valid': True, 'insulation_thickness': '300+'
}
]
)
# Patch mainheatcont-description
cleaned["mainheatcont-description"].extend(
[

View file

@ -203,11 +203,11 @@ class TrainingDataset(BaseDataset):
common_cols = [[col + "_starting", col + "_ending"] for col in common_cols]
self.df = self.df.loc[
:,
no_suffix_cols
+ only_ending_cols
+ [col for cols in common_cols for col in cols],
]
:,
no_suffix_cols
+ only_ending_cols
+ [col for cols in common_cols for col in cols],
]
def _remove_abnormal_change_in_floor_area(self):
"""
@ -509,7 +509,7 @@ class TrainingDataset(BaseDataset):
expanded_df["is_sandstone_or_limestone"]
== expanded_df["is_sandstone_or_limestone_ending"]
)
]
]
elif component == "floor":
expanded_df = expanded_df[
(expanded_df["is_suspended"] == expanded_df["is_suspended_ending"])
@ -526,7 +526,7 @@ class TrainingDataset(BaseDataset):
expanded_df["is_to_external_air"]
== expanded_df["is_to_external_air_ending"]
)
]
]
elif component == "roof":
expanded_df = expanded_df[
(expanded_df["is_pitched"] == expanded_df["is_pitched_ending"])
@ -539,7 +539,7 @@ class TrainingDataset(BaseDataset):
expanded_df["has_dwelling_above"]
== expanded_df["has_dwelling_above_ending"]
)
]
]
return expanded_df