mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Implemented type and description generation into recommendations
This commit is contained in:
parent
51f443a3b5
commit
773bd291a1
3 changed files with 19 additions and 2 deletions
|
|
@ -274,8 +274,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
recommendation_id = create_recommendation(
|
||||
{
|
||||
"type": rec["type"], # TODO: Add this to output
|
||||
"description": rec["description"], # TODO: Add this to output
|
||||
"type": rec["type"],
|
||||
"description": rec["description"],
|
||||
"estimated_cost": estimated_cost,
|
||||
"default": True,
|
||||
"starting_u_value": rec.get("starting_u_value"),
|
||||
|
|
|
|||
|
|
@ -272,6 +272,10 @@ class FloorRecommendations(BaseUtility):
|
|||
# Given the U-value, we recommend solid floor insulation options which are usually solid foam
|
||||
self.recommend_floor_insulation(u_value=u_value, parts=solid_floor_insulation_parts)
|
||||
|
||||
@staticmethod
|
||||
def _make_floor_description(part, depth):
|
||||
return f"Install {depth}{part['depth_unit']} {part['description']} insulation"
|
||||
|
||||
def recommend_floor_insulation(self, u_value, parts):
|
||||
"""
|
||||
This method is tasked with estimating the impact of performing suspended floor insulation
|
||||
|
|
@ -298,6 +302,8 @@ class FloorRecommendations(BaseUtility):
|
|||
"parts": [
|
||||
get_recommended_part(part, depth),
|
||||
],
|
||||
"type": "floor_insulation",
|
||||
"description": self._make_floor_description(part, depth),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,6 +334,8 @@ class WallRecommendations(BaseUtility):
|
|||
recommendations.append(
|
||||
{
|
||||
"parts": [get_recommended_part(part, depth)],
|
||||
"type": "wall_insulation",
|
||||
"description": "Install " + self._make_description(part, depth),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
}
|
||||
|
|
@ -391,6 +393,11 @@ class WallRecommendations(BaseUtility):
|
|||
get_recommended_part(ewi_part, ewi_depth),
|
||||
get_recommended_part(iwi_part, iwi_depth)
|
||||
],
|
||||
"type": "wall_insulation",
|
||||
"description": (
|
||||
"Install " + self._make_description(ewi_part, ewi_depth) + " and " +
|
||||
self._make_description(iwi_part, iwi_depth)
|
||||
),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": combined_new_u_value,
|
||||
}
|
||||
|
|
@ -398,6 +405,10 @@ class WallRecommendations(BaseUtility):
|
|||
|
||||
self.prune_diminishing_recommendations()
|
||||
|
||||
@staticmethod
|
||||
def _make_description(part, depth):
|
||||
return f"{depth}{part['depth_unit']} {part['description']}"
|
||||
|
||||
def prune_diminishing_recommendations(self):
|
||||
# For any recommendations, if we have at least 1 reommendation that does not exhibit diminishing returns
|
||||
# we trim all others that are beyond the diminishing returns threshold
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue