refine conditions for recommending ewi in mds

This commit is contained in:
Khalim Conn-Kowlessar 2024-06-04 11:36:28 +01:00
parent bbe35400bd
commit 548672cc10
2 changed files with 17 additions and 10 deletions

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):
"""
@ -511,7 +511,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"])
@ -528,7 +528,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"])
@ -541,7 +541,7 @@ class TrainingDataset(BaseDataset):
expanded_df["has_dwelling_above"]
== expanded_df["has_dwelling_above_ending"]
)
]
]
return expanded_df
@ -742,7 +742,7 @@ class TrainingDataset(BaseDataset):
self.df[col] = self.df[col].fillna("Unknown")
def _null_validation(self, information: str):
print(f"Null validation after {information}")
# print(f"Null validation after {information}")
if pd.isnull(self.df).sum().sum():
raise ValueError(f"Null values found in dataset, after step {information}")

View file

@ -124,7 +124,10 @@ class Mds:
# There are certain measures where we need to
if measure == "external_wall_insulation":
# Check if the wall is not cavity since the other wall types can take external wall insulation
if self.wall_recommender.ewi_valid():
if (
self.wall_recommender.ewi_valid() and
not self.property_instance.walls["insulation_thickness"] in ["average", "above average"]
):
pruned_measures.append(measure)
continue
@ -177,9 +180,13 @@ class Mds:
if measure == "solar_pv":
if self.solar_recommender.is_solar_pv_valid():
pruned_measures.append(measure)
continue
raise NotImplementedError("Implement me")
if not pruned_measures:
continue
pruned_measures_formatted = []
for pm in pruned_measures:
pruned_measures_formatted.append({pm: self.format_map[pm]})