From 4a216fb42301b781b8f95ba6aee55bb816ed1759 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 24 Sep 2024 15:43:33 +0100 Subject: [PATCH] handling property with u-values in survey which is not a new dwelling --- etl/costs/app.py | 2 ++ recommendations/HeatingRecommender.py | 17 ++++++++--------- recommendations/RoofRecommendations.py | 2 +- recommendations/VentilationRecommendations.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/etl/costs/app.py b/etl/costs/app.py index 85c2410e..797191d2 100644 --- a/etl/costs/app.py +++ b/etl/costs/app.py @@ -82,6 +82,7 @@ def app(): db_engine = create_engine(db_string, pool_size=5, max_overflow=5) cwi_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="cavity_wall_insulation", header=0) + ventilation_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="Ventilation", header=0) loft_insulation_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="loft_insulation", header=0) iwi_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="internal_wall_insulation", header=0) suspended_floor_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="suspended_floor_insulation", header=0) @@ -95,6 +96,7 @@ def app(): costs = pd.concat( [ cwi_costs, + ventilation_costs, loft_insulation_costs, iwi_costs, suspended_floor_costs, diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index 3daf0268..b54f89bb 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -1034,17 +1034,16 @@ class HeatingRecommender: # Overwrite the existing boiler recommendation self.heating_recommendations.extend(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( - rec["type"] == "heating" for rec in self.heating_recommendations - ) - if has_heating_recommendation: - recommendation_phase += 1 - # The heating controls recommendation is distrinct from the boiler upgrade recommendation - # We insert phase into the recommendations for heating controls + # We consider a heating control upgrade as a measure which occures in the same phase as a boiler upgrade + # Namely, we have the following options within this phase + # 1) Boiler + heating controls + # 2) Boiler only + # 3) Heating controls only + # But they are options that are not mutually exclusive + # So, we actually set heating controls as a heating recommendation for recommendation in controls_recommender.recommendation: recommendation["phase"] = recommendation_phase + # recommendation["type"] = "heating" self.heating_control_recommendations.extend(controls_recommender.recommendation) diff --git a/recommendations/RoofRecommendations.py b/recommendations/RoofRecommendations.py index 89b8205f..fbd99d67 100644 --- a/recommendations/RoofRecommendations.py +++ b/recommendations/RoofRecommendations.py @@ -132,7 +132,7 @@ class RoofRecommendations: # The Roof is already compliant return - if self.property.data["transaction-type"] == "new dwelling": + if self.property.data["transaction-type"] in ["new dwelling", "not sale or rental"]: return raise NotImplementedError("Implement me") diff --git a/recommendations/VentilationRecommendations.py b/recommendations/VentilationRecommendations.py index 34439827..5913ab9c 100644 --- a/recommendations/VentilationRecommendations.py +++ b/recommendations/VentilationRecommendations.py @@ -52,7 +52,7 @@ class VentilationRecommendations(Definitions): already_installed = "cavity_wall_insulation" in self.property.already_installed - estimated_cost = n_units * part[0]["cost"] if not already_installed else 0 + estimated_cost = n_units * part[0]["total_cost"] if not already_installed else 0 labour_hours = 4 * n_units if not already_installed else 0 labour_days = 4 * n_units / 8.0 if not already_installed else 0