debugging structure of heating recommendations

This commit is contained in:
Khalim Conn-Kowlessar 2024-04-19 16:43:13 +01:00
parent 391cb356ee
commit 8bd899bcba
3 changed files with 12 additions and 6 deletions

View file

@ -380,6 +380,7 @@ async def trigger_plan(body: PlanTriggerRequest):
logger.info("Preparing data for scoring in sap change api")
recommendations_scoring_data = pd.DataFrame(recommendations_scoring_data)
recommendations_scoring_data = recommendations_scoring_data.drop(
columns=["rdsap_change", "heat_demand_change", "carbon_change", "sap_ending", "heat_demand_ending",
"carbon_ending"]

View file

@ -399,7 +399,7 @@ class HeatingRecommender:
if not system_change and len(boiler_recommendation):
# If there is not a system change, we add the boiler recommendation at point.
self.recommendations.append(boiler_recommendation)
self.recommendations.append([boiler_recommendation])
if system_change:
# We combine the heating and controls recommendations, in the case of a system change
@ -417,12 +417,12 @@ class HeatingRecommender:
combined_recommendations.extend(combined_recommendation)
# Overwrite the existing boiler recommendation
self.recommendations.extend(combined_recommendations)
self.recommendations.append(combined_recommendations)
else:
# We increment the recommendation phase, since the heating controls are separate from the boiler upgrade
# but we'll only upgrade if we have a heating recommendation
has_heating_recommendation = any(
recommendation["type"] == "heating" for recommendation in self.recommendations
rec["type"] == "heating" for recommendation in self.recommendations for rec in recommendation
)
if has_heating_recommendation:
recommendation_phase += 1
@ -431,6 +431,6 @@ class HeatingRecommender:
for recommendation in controls_recommender.recommendation:
recommendation["phase"] = recommendation_phase
self.recommendations.extend(controls_recommender.recommendation)
self.recommendations.append(controls_recommender.recommendation)
return

View file

@ -111,11 +111,16 @@ class Recommendations:
if "heating" not in self.exclusions:
self.heating_recommender.recommend(phase=phase)
if self.heating_recommender.recommendations:
property_recommendations.append(self.heating_recommender.recommendations)
if len(self.heating_recommender.recommendations) == 1:
property_recommendations.append(self.heating_recommender.recommendations)
else:
property_recommendations.extend(self.heating_recommender.recommendations)
# We check if we have distinct heating and heating controls recommendations
# If so, we increment by 2 (one of the heating system, one for the heating controls)
# otherwise we incremenet by 1
max_used_phase = max([rec["phase"] for rec in self.heating_recommender.recommendations])
max_used_phase = max(
[rec["phase"] for recs in self.heating_recommender.recommendations for rec in recs]
)
amount_to_increment = max_used_phase - phase + 1
phase += amount_to_increment