diff --git a/etl/eligibility/Eligibility.py b/etl/eligibility/Eligibility.py index 15e3158f..f7a5ed98 100644 --- a/etl/eligibility/Eligibility.py +++ b/etl/eligibility/Eligibility.py @@ -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"] } diff --git a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py index 1ba75e2b..28efadd0 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -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( [ diff --git a/etl/epc/Dataset.py b/etl/epc/Dataset.py index dac829e2..7040d66c 100644 --- a/etl/epc/Dataset.py +++ b/etl/epc/Dataset.py @@ -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