diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 9ba1b023..c885f333 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -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"), diff --git a/recommendations/FloorRecommendations.py b/recommendations/FloorRecommendations.py index f194ebd9..d477e022 100644 --- a/recommendations/FloorRecommendations.py +++ b/recommendations/FloorRecommendations.py @@ -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, } diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py index 04d4779b..bae17483 100644 --- a/recommendations/WallRecommendations.py +++ b/recommendations/WallRecommendations.py @@ -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