From 32d702e9306614f29d2d4a1268e6706bf99b9314 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 27 Sep 2024 17:10:04 +0100 Subject: [PATCH] moved leds recommendations earlier --- backend/app/plan/router.py | 11 ++++++++++- recommendations/Recommendations.py | 12 ++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 05c79a22..90353052 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -738,6 +738,7 @@ async def trigger_plan(body: PlanTriggerRequest): { "property_id": property_id, "uprn": [p.uprn for p in input_properties if p.id == property_id][0], + "address": [p.address for p in input_properties if p.id == property_id][0], "recommendation_id": rec["recommendation_id"], "type": rec["type"], "description": rec["description"], @@ -753,7 +754,9 @@ async def trigger_plan(body: PlanTriggerRequest): 10024087902, 121016121, 121016128 ] recommendation_impact_df = recommendation_impact_df[recommendation_impact_df["uprn"].isin(surveyed_uprns)] - recommendation_impact_df = recommendation_impact_df[recommendation_impact_df["type"] == "windows_glazing"] + # recommendation_impact_df = recommendation_impact_df[recommendation_impact_df["type"].isin( + # ["windows_glazing", "internal_wall_insulation"]) + # ] actual_impacts_df = pd.DataFrame( [ @@ -793,6 +796,12 @@ async def trigger_plan(body: PlanTriggerRequest): actual_impacts_df, how="inner", on=["uprn", "type"] ) + property_recs = recommendation_impact_df[recommendation_impact_df["uprn"] == 121016128] + property = [p for p in input_properties if p.uprn == 121016128][0] + print(property.data["current-energy-efficiency"]) + print(property_recs["sap_points"].sum()) + property_recs["address"] + # from utils.s3 import read_dataframe_from_s3_parquet # training_data = read_dataframe_from_s3_parquet( # bucket_name="retrofit-data-dev", diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index 5037f450..d5e37f8e 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -157,6 +157,12 @@ class Recommendations: property_recommendations.append(self.floor_recommender.recommendations) phase += 1 + if "low_energy_lighting" in measures: + self.lighting_recommender.recommend(phase=phase) + if self.lighting_recommender.recommendation: + property_recommendations.append(self.lighting_recommender.recommendation) + phase += 1 + if "windows" in measures and "mixed_glazing" not in non_invasive_recommendation_types: # If we have a mixed glazing recommendation, we prioritise this over the windows recommendation self.windows_recommender.recommend(phase=phase) @@ -233,12 +239,6 @@ class Recommendations: property_recommendations.append(self.hotwater_recommender.recommendations) phase += 1 - if "low_energy_lighting" in measures: - self.lighting_recommender.recommend(phase=phase) - if self.lighting_recommender.recommendation: - property_recommendations.append(self.lighting_recommender.recommendation) - phase += 1 - if "secondary_heating" in measures: self.secondary_heating_recommender.recommend(phase=phase) if self.secondary_heating_recommender.recommendation: