From 0796b384fb3aa8bf6cb3689c21cd5c5ac5acfc87 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 15 Nov 2024 18:42:08 +0000 Subject: [PATCH] added non-invasive rec --- .idea/Model.iml | 2 +- .idea/misc.xml | 2 +- etl/customers/remote_assessments/app.py | 27 +++++++++++++++++-------- recommendations/FloorRecommendations.py | 11 +++++++++- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.idea/Model.iml b/.idea/Model.iml index 762580d9..df6c4faa 100644 --- a/.idea/Model.iml +++ b/.idea/Model.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index c916a158..50cad4ca 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,7 +3,7 @@ - + diff --git a/etl/customers/remote_assessments/app.py b/etl/customers/remote_assessments/app.py index a0d01f7d..33015d87 100644 --- a/etl/customers/remote_assessments/app.py +++ b/etl/customers/remote_assessments/app.py @@ -1,7 +1,7 @@ import pandas as pd from utils.s3 import save_csv_to_s3 -PORTFOLIO_ID = 111 +PORTFOLIO_ID = 120 USER_ID = 8 @@ -13,9 +13,9 @@ def app(): asset_list = [ { - "uprn": 100050770761, - "address": "12 Sheardown Street", - "postcode": "DN4 0BH" + "uprn": 100030334057, + "address": "5, Lynton Street", + "postcode": "DE22 3RW" } ] asset_list = pd.DataFrame(asset_list) @@ -30,11 +30,22 @@ def app(): non_invasive_recommendations = [ { - "uprn": 100050770761, + "uprn": 100030334057, "recommendations": [ { - "type": "extension_cavity_wall_insulation", + "type": "internal_wall_insulation", + "sap_points": 9, + "survey": True + }, + { + "type": "external_wall_insulation", + "sap_points": 9, + "survey": True + }, + { + "type": "suspended_floor_insulation", "sap_points": 2, + "survey": True } ] } @@ -49,8 +60,8 @@ def app(): valuation_data = [ { - "uprn": 100050770761, - "value": 67_000 + "uprn": 100030334057, + "value": 133_000 } ] # Store valuation data to s3 diff --git a/recommendations/FloorRecommendations.py b/recommendations/FloorRecommendations.py index 25741e7a..ed00bbe9 100644 --- a/recommendations/FloorRecommendations.py +++ b/recommendations/FloorRecommendations.py @@ -172,6 +172,11 @@ class FloorRecommendations(Definitions): insulation_materials = pd.DataFrame(insulation_materials) + non_invasive_recs = next( + (r for r in self.property.non_invasive_recommendations if + r["type"] == insulation_materials["type"].values[0]), {} + ) + lowest_selected_u_value = None for _, insulation_material_group in insulation_materials.groupby("description"): @@ -217,6 +222,9 @@ class FloorRecommendations(Definitions): else: raise NotImplementedError("Implement me!") + sap_points = non_invasive_recs.get("sap_points", None) + survey = non_invasive_recs.get("survey", False) + floor_ending_config = FloorAttributes(new_description).process() floor_simulation_config = check_simulation_difference( new_config=floor_ending_config, old_config=self.property.floor, prefix="floor_" @@ -245,7 +253,8 @@ class FloorRecommendations(Definitions): "description": self._make_floor_description(material), "starting_u_value": u_value, "new_u_value": new_u_value, - "sap_points": None, + "sap_points": sap_points, + "survey": survey, "already_installed": already_installed, "simulation_config": simulation_config, "description_simulation": {