mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
tighten conditions for making recommendations
This commit is contained in:
parent
fde3a3f24c
commit
00c35bf8cf
5 changed files with 16 additions and 42 deletions
|
|
@ -157,12 +157,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
data_processor = DataProcessor(None, newdata=True)
|
||||
data_processor.insert_data(pd.DataFrame([p.get_model_data()]))
|
||||
data_processor.pre_process()
|
||||
data_processor.data = data_processor.clean_missings_after_description_process(
|
||||
data_processor.data, [
|
||||
c for c in data_processor.data.columns if
|
||||
("thermal_transmittance" in c) or ("insulation_thickness" in c)
|
||||
]
|
||||
)
|
||||
|
||||
starting_epc_data = data_processor.get_component_features(suffix="_STARTING")
|
||||
ending_epc_data = data_processor.get_component_features(suffix="_ENDING")
|
||||
|
|
@ -180,38 +174,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
ending_epc_data=ending_epc_data,
|
||||
fixed_data=fixed_data,
|
||||
)
|
||||
if i == 0:
|
||||
none_cols = []
|
||||
for col in scoring_dict.keys():
|
||||
if col in [
|
||||
"UPRN", "id", "LOCAL_AUTHORITY",
|
||||
]:
|
||||
continue
|
||||
|
||||
if col in [
|
||||
"SAP_STARTING", "HEAT_DEMAND_STARTING", "CARBON_STARTING", "FLOOR_HEIGHT_STARTING",
|
||||
"TOTAL_FLOOR_AREA_STARTING", "DAYS_TO_STARTING", "estimated_perimeter_STARTING",
|
||||
"SAP_ENDING", "HEAT_DEMAND_ENDING",
|
||||
"CARBON_ENDING", "FLOOR_HEIGHT_ENDING",
|
||||
"TOTAL_FLOOR_AREA_ENDING", "DAYS_TO_ENDING", "estimated_perimeter_ENDING"
|
||||
]:
|
||||
try:
|
||||
if scoring_dict[col] is None:
|
||||
blah1
|
||||
float(scoring_dict[col])
|
||||
continue
|
||||
except:
|
||||
raise Exception("wtf")
|
||||
|
||||
unique_vals = sap_change_dataset[col].unique()
|
||||
if scoring_dict[col] not in unique_vals:
|
||||
if scoring_dict[col] is None:
|
||||
none_cols.append(col)
|
||||
continue
|
||||
blah
|
||||
|
||||
if none_cols:
|
||||
blahblah
|
||||
|
||||
recommendations_scoring_data.append(scoring_dict)
|
||||
|
||||
|
|
@ -224,6 +186,13 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
# Merge the cleaning data onto recommendations_scoring_data
|
||||
|
||||
# Perform the same cleaning as in the model
|
||||
recommendations_scoring_data = DataProcessor.clean_missings_after_description_process(
|
||||
recommendations_scoring_data, [
|
||||
c for c in recommendations_scoring_data.columns if
|
||||
("thermal_transmittance" in c) or ("insulation_thickness" in c)
|
||||
]
|
||||
)
|
||||
|
||||
recommendations_scoring_data = DataProcessor.apply_averages_cleaning(
|
||||
data_to_clean=recommendations_scoring_data,
|
||||
cleaning_data=cleaning_data,
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ def create_recommendation_scoring_data(
|
|||
scoring_dict["floor_insulation_thickness"] = "none"
|
||||
|
||||
if scoring_dict["roof_insulation_thickness"] is None:
|
||||
scoring_dict["floor_insulation_thickness"] = "none"
|
||||
scoring_dict["roof_insulation_thickness"] = "none"
|
||||
|
||||
# We update the description to indicate it's insulated
|
||||
if recommendation["type"] == "wall_insulation":
|
||||
|
|
|
|||
|
|
@ -57,8 +57,11 @@ class FloorRecommendations(Definitions):
|
|||
|
||||
year_built = self.property.year_built
|
||||
|
||||
if self.property.floor["another_property_below"]:
|
||||
# If there's another property below, it's likely impractical to recommend a floor upgrade
|
||||
if self.property.floor["another_property_below"] | (self.property.floor["insulation_thickness"] in [
|
||||
"average", "above average"
|
||||
]):
|
||||
# If there's another property below, it's likely impractical to recommend a floor upgrade,
|
||||
# or if the floor is already insualted
|
||||
return
|
||||
|
||||
# If the property is a flat that isn't at ground level, it's likely impractical to recommend a floor upgrade
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class WallRecommendations(Definitions):
|
|||
insulation_thickness = self.property.walls["insulation_thickness"]
|
||||
|
||||
# We check if the wall is already insulated and if so, we exit
|
||||
if insulation_thickness in ["average", "above average"]:
|
||||
if (insulation_thickness in ["average", "above average"]) or self.property.walls["is_filled_cavity"]:
|
||||
return
|
||||
|
||||
if u_value:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ UPGRADES_MAP = {
|
|||
'Solid brick, as built, no insulation': 'Solid brick, as built, insulated',
|
||||
'Suspended, no insulation': 'Suspended, insulated',
|
||||
'Solid, no insulation': 'Solid, insulated',
|
||||
'Cavity wall, as built, no insulation': 'Cavity wall, as built, insulated',
|
||||
'Cavity wall, as built, partial insulation': 'Cavity wall, as built, insulated',
|
||||
}
|
||||
|
||||
PARTIAL_CAVITY_DESCRIPTIONS = [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue