mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
adding placeholder methods for recommendation engine
This commit is contained in:
parent
773bd291a1
commit
28dab3a6ff
6 changed files with 40 additions and 4 deletions
|
|
@ -51,6 +51,8 @@ class Property(BaseUtility):
|
|||
self.heat_loss_corridor = None
|
||||
self.mains_gas = None
|
||||
self.floor_height = None
|
||||
self.insulation_wall_area = None
|
||||
self.floor_area = None
|
||||
|
||||
if epc_client:
|
||||
self.epc_client = epc_client
|
||||
|
|
@ -241,6 +243,8 @@ class Property(BaseUtility):
|
|||
self.set_heat_loss_corridor()
|
||||
self.set_mains_gas()
|
||||
self.set_floor_height()
|
||||
self.set_wall_area()
|
||||
self.set_floor_area()
|
||||
|
||||
for description, attribute in cleaned.items():
|
||||
|
||||
|
|
@ -424,3 +428,22 @@ class Property(BaseUtility):
|
|||
}
|
||||
|
||||
return property_details_epc
|
||||
|
||||
def set_wall_area(self):
|
||||
"""
|
||||
This method is placeholder
|
||||
It implements our floor area model to produce an estimate of the property's insulatable wall area
|
||||
"""
|
||||
|
||||
import random
|
||||
self.insulation_wall_area = random.uniform(60, 100)
|
||||
|
||||
def set_floor_area(self):
|
||||
"""
|
||||
Sets the floor area based on the EPC data
|
||||
|
||||
"""
|
||||
# We don't know the number of floors at the moment so we're going to assume 1
|
||||
# however this is something we'll need to use Verisk data for
|
||||
|
||||
self.floor_area = float(self.data["total-floor-area"])
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ def get_materials():
|
|||
"""
|
||||
Session = sessionmaker(bind=db_engine)
|
||||
with Session() as session:
|
||||
materials = session.query(Material).all()
|
||||
materials = session.query(Material).filter(Material.is_active).all()
|
||||
|
||||
return materials if materials else []
|
||||
|
|
|
|||
|
|
@ -280,7 +280,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
"default": True,
|
||||
"starting_u_value": rec.get("starting_u_value"),
|
||||
"new_u_value": rec.get("new_u_value"),
|
||||
"sap_points": rec["sap_points"] # TODO: Add this to output
|
||||
# TODO: Placeholder for SAP points in place
|
||||
"sap_points": rec["sap_points"]
|
||||
# Remaining outputs yet to be handled
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from backend.Property import Property
|
|||
from recommendations.rdsap_tables import default_wall_thickness, age_band_data
|
||||
from recommendations.recommendation_utils import (
|
||||
r_value_per_mm_to_u_value, calculate_u_value_uplift, is_diminishing_returns, update_lowest_selected_u_value,
|
||||
get_recommended_part, get_uvalue_estimate
|
||||
get_recommended_part, get_uvalue_estimate, estimate_sap_points
|
||||
)
|
||||
|
||||
suspended_floor_insulation_parts = [
|
||||
|
|
@ -306,6 +306,7 @@ class FloorRecommendations(BaseUtility):
|
|||
"description": self._make_floor_description(part, depth),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
"sap_points": estimate_sap_points()
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from backend.Property import Property
|
|||
from model_data.BaseUtility import BaseUtility
|
||||
from recommendations.recommendation_utils import (
|
||||
r_value_per_mm_to_u_value, calculate_u_value_uplift, is_diminishing_returns, update_lowest_selected_u_value,
|
||||
get_recommended_part, get_uvalue_estimate
|
||||
get_recommended_part, get_uvalue_estimate, estimate_sap_points
|
||||
)
|
||||
|
||||
external_wall_insulation_parts = [
|
||||
|
|
@ -338,6 +338,7 @@ class WallRecommendations(BaseUtility):
|
|||
"description": "Install " + self._make_description(part, depth),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
"sap_points": estimate_sap_points(),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -400,6 +401,7 @@ class WallRecommendations(BaseUtility):
|
|||
),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": combined_new_u_value,
|
||||
"sap_points": estimate_sap_points()
|
||||
}
|
||||
self.recommendations.append(recommendation)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@ from backend.Property import Property
|
|||
from statistics import mean
|
||||
|
||||
|
||||
def estimate_sap_points():
|
||||
"""
|
||||
This is a placeholder function. We will implement the proper version soon
|
||||
:return:
|
||||
"""
|
||||
|
||||
return 999
|
||||
|
||||
|
||||
def r_value_per_mm_to_u_value(depth_mm: int, r_value_per_mm: float):
|
||||
"""
|
||||
Converts R-value per mm to U-value in W/m²K.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue