From 79746e9a3643f9e18b78dce8081208238ba758a3 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 3 Oct 2024 10:59:40 +0100 Subject: [PATCH] finished adding measure_type to recommendations and added check to ensure it's populated --- recommendations/HotwaterRecommendations.py | 6 +++--- recommendations/Recommendations.py | 5 +++++ recommendations/SecondaryHeating.py | 1 + recommendations/SolarPvRecommendations.py | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/recommendations/HotwaterRecommendations.py b/recommendations/HotwaterRecommendations.py index 0d34c894..636a7be0 100644 --- a/recommendations/HotwaterRecommendations.py +++ b/recommendations/HotwaterRecommendations.py @@ -58,10 +58,9 @@ class HotwaterRecommendations: self.recommendations.append( { "phase": phase, - "parts": [ - # TODO - ], + "parts": [], "type": "hot_water_tank_insulation", + "measure_type": "hot_water_tank_insulation", "description": description, "starting_u_value": None, "new_u_value": None, @@ -107,6 +106,7 @@ class HotwaterRecommendations: "phase": phase, "parts": [], "type": "cylinder_thermostat", + "measure_type": "cylinder_thermostat", "description": description, "starting_u_value": None, "new_u_value": None, diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index 78725c2d..1b152238 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -267,6 +267,11 @@ class Recommendations: property_recommendations, ) + # Check to make sure measure_type is populated + for recs in property_recommendations: + if any(pd.isnull(rec.get("measure_type")) for rec in recs): + raise ValueError("Measure type is not populated") + return property_recommendations, property_representative_recommendations @staticmethod diff --git a/recommendations/SecondaryHeating.py b/recommendations/SecondaryHeating.py index aed48da2..7c20bcdd 100644 --- a/recommendations/SecondaryHeating.py +++ b/recommendations/SecondaryHeating.py @@ -52,6 +52,7 @@ class SecondaryHeating: "phase": phase, "parts": [], "type": "secondary_heating", + "measure_type": "secondary_heating", "description": description, "starting_u_value": None, "new_u_value": None, diff --git a/recommendations/SolarPvRecommendations.py b/recommendations/SolarPvRecommendations.py index bb38c73c..08f077d2 100644 --- a/recommendations/SolarPvRecommendations.py +++ b/recommendations/SolarPvRecommendations.py @@ -126,6 +126,7 @@ class SolarPvRecommendations: "phase": phase, "parts": [], "type": "solar_pv", + "measure_type": "solar_pv", "description": description, "starting_u_value": None, "new_u_value": None, @@ -221,6 +222,7 @@ class SolarPvRecommendations: "phase": phase, "parts": [], "type": "solar_pv", + "measure_type": "solar_pv", "description": description, "starting_u_value": None, "new_u_value": None,