diff --git a/backend/app/assumptions.py b/backend/app/assumptions.py index 66660e06..32d63a95 100644 --- a/backend/app/assumptions.py +++ b/backend/app/assumptions.py @@ -80,6 +80,7 @@ DESCRIPTIONS_TO_FUEL_TYPES = { }, "Electric heat pump for water heating only": {"fuel": "Electricity", "cop": 1}, "Ground source heat pump, warm air, electric": {"fuel": "Electricity", "cop": AVERAGE_ASHP_EFFICIENCY / 100}, + "Room heaters, mains gas, Electric storage heaters": {"fuel": "Natural Gas", "cop": 0.85} } # These are the measure types where if there is a ventilation recommendation, we force the inclusion of it diff --git a/backend/ml_models/AnnualBillSavings.py b/backend/ml_models/AnnualBillSavings.py index 4291b1d1..243cae52 100644 --- a/backend/ml_models/AnnualBillSavings.py +++ b/backend/ml_models/AnnualBillSavings.py @@ -263,7 +263,8 @@ class AnnualBillSavings: if fuel == "Electricity": return (kwh / cop) * cls.ELECTRICITY_PRICE_CAP - if fuel in ["Natural Gas", "Natural Gas (Community Scheme)"]: + # We handle "Unmapped" in a similar fashion to gas + if fuel in ["Natural Gas", "Natural Gas (Community Scheme)", "Unmapped"]: return (kwh / cop) * cls.GAS_PRICE_CAP if fuel == "LPG": diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index 87311306..fdd4376d 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -1161,6 +1161,7 @@ class HeatingRecommender: if recommendation_type not in [ "boiler", + "hhr", ]: raise ValueError(f"Given invalid recommendation type {recommendation_type}") diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index f2dc5804..cc5b7895 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -681,7 +681,9 @@ class Recommendations: ): # Handle the case of community schemes - if (heating_description == "Community scheme") or (hotwater_description == "Community scheme"): + if (heating_description == "Community scheme") or (hotwater_description == "Community scheme") and ( + "not community" not in main_fuel_description + ): if main_fuel_description in ["mains gas (community)", "UNKNOWN"]: return { "heating_fuel_type": "Natural Gas (Community Scheme)", @@ -702,7 +704,7 @@ class Recommendations: if hotwater_description in [ "From main system", "From main system, no cylinder thermostat", - 'From main system, waste water heat recovery' + 'From main system, waste water heat recovery', ]: return { "heating_fuel_type": heating_fuel, "hotwater_fuel_type": heating_fuel, @@ -718,7 +720,14 @@ class Recommendations: "heating_cop": mapped["cop"], "hotwater_cop": 1 } - mapped_hotwater = descriptions_to_fuel_types[hotwater_description] + mapped_hotwater = descriptions_to_fuel_types.get(hotwater_description) + if mapped_hotwater is None: + # TODO: This is a non-ideal placeholder but we put something in place for a process that falls over + # fairly regularly. A task has been added to planner to refactor this + # We have observed an edge case where the fuel is described as not being community + # but the hot water is. We handle as such + logger.warning("Hot water description not mapped: %s", heating_description) + mapped_hotwater = {"fuel": 'Unmapped', "cop": 0.9} return { "heating_fuel_type": heating_fuel, "hotwater_fuel_type": mapped_hotwater["fuel"],