added non-invasive rec

This commit is contained in:
Khalim Conn-Kowlessar 2024-11-15 18:42:08 +00:00
parent 9b038a8dcb
commit 0796b384fb
4 changed files with 31 additions and 11 deletions

2
.idea/Model.iml generated
View file

@ -7,7 +7,7 @@
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
</content> </content>
<orderEntry type="jdk" jdkName="Stonewater-wave-3" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Fastapi-backend" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyNamespacePackagesService"> <component name="PyNamespacePackagesService">

2
.idea/misc.xml generated
View file

@ -3,7 +3,7 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.10 (backend)" /> <option name="sdkName" value="Python 3.10 (backend)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Stonewater-wave-3" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Fastapi-backend" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser"> <component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" /> <option name="shown" value="true" />
</component> </component>

View file

@ -1,7 +1,7 @@
import pandas as pd import pandas as pd
from utils.s3 import save_csv_to_s3 from utils.s3 import save_csv_to_s3
PORTFOLIO_ID = 111 PORTFOLIO_ID = 120
USER_ID = 8 USER_ID = 8
@ -13,9 +13,9 @@ def app():
asset_list = [ asset_list = [
{ {
"uprn": 100050770761, "uprn": 100030334057,
"address": "12 Sheardown Street", "address": "5, Lynton Street",
"postcode": "DN4 0BH" "postcode": "DE22 3RW"
} }
] ]
asset_list = pd.DataFrame(asset_list) asset_list = pd.DataFrame(asset_list)
@ -30,11 +30,22 @@ def app():
non_invasive_recommendations = [ non_invasive_recommendations = [
{ {
"uprn": 100050770761, "uprn": 100030334057,
"recommendations": [ "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, "sap_points": 2,
"survey": True
} }
] ]
} }
@ -49,8 +60,8 @@ def app():
valuation_data = [ valuation_data = [
{ {
"uprn": 100050770761, "uprn": 100030334057,
"value": 67_000 "value": 133_000
} }
] ]
# Store valuation data to s3 # Store valuation data to s3

View file

@ -172,6 +172,11 @@ class FloorRecommendations(Definitions):
insulation_materials = pd.DataFrame(insulation_materials) 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 lowest_selected_u_value = None
for _, insulation_material_group in insulation_materials.groupby("description"): for _, insulation_material_group in insulation_materials.groupby("description"):
@ -217,6 +222,9 @@ class FloorRecommendations(Definitions):
else: else:
raise NotImplementedError("Implement me!") 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_ending_config = FloorAttributes(new_description).process()
floor_simulation_config = check_simulation_difference( floor_simulation_config = check_simulation_difference(
new_config=floor_ending_config, old_config=self.property.floor, prefix="floor_" 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), "description": self._make_floor_description(material),
"starting_u_value": u_value, "starting_u_value": u_value,
"new_u_value": new_u_value, "new_u_value": new_u_value,
"sap_points": None, "sap_points": sap_points,
"survey": survey,
"already_installed": already_installed, "already_installed": already_installed,
"simulation_config": simulation_config, "simulation_config": simulation_config,
"description_simulation": { "description_simulation": {