From 4d6a73fd7b2e8d0a30b37d2f2f0c4438e86d1d9a Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 14 Nov 2025 23:43:07 +0000 Subject: [PATCH] handling more fuel types --- backend/app/assumptions.py | 3 +++ backend/ml_models/AnnualBillSavings.py | 2 +- backend/tests/test_integration.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/app/assumptions.py b/backend/app/assumptions.py index 0172466e..924bd2a0 100644 --- a/backend/app/assumptions.py +++ b/backend/app/assumptions.py @@ -82,6 +82,9 @@ DESCRIPTIONS_TO_FUEL_TYPES = { "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}, "Water source heat pump, radiators, electric": {"fuel": "Electricity", "cop": AVERAGE_ASHP_EFFICIENCY / 100}, + "Air source heat pump, Systems with radiators, electric": {"fuel": "Electricity", + "cop": AVERAGE_ASHP_EFFICIENCY / 100}, + "Ground source heat pump, underfloor, electric": {"fuel": "Electricity", "cop": AVERAGE_ASHP_EFFICIENCY / 100}, } # 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 243cae52..4a2a6f1f 100644 --- a/backend/ml_models/AnnualBillSavings.py +++ b/backend/ml_models/AnnualBillSavings.py @@ -286,7 +286,7 @@ class AnnualBillSavings: # The solar thermal covers a % of the heating kwh, so we need to adjust the cost return (kwh / cop) * assumptions.SOLAR_CONSUMPTION_PROPORTION * cls.GAS_PRICE_CAP - if fuel == "Electricity + Solar Thermal": + if fuel in ["Electricity + Solar Thermal", 'Unmapped + Solar Thermal']: # The solar thermal covers a % of the heating kwh, so we need to adjust the cost return (kwh / cop) * assumptions.SOLAR_CONSUMPTION_PROPORTION * cls.ELECTRICITY_PRICE_CAP diff --git a/backend/tests/test_integration.py b/backend/tests/test_integration.py index f0c53f16..ac61a09c 100644 --- a/backend/tests/test_integration.py +++ b/backend/tests/test_integration.py @@ -90,8 +90,10 @@ costs_by_floor_area = costs_by_floor_area.groupby("current-energy-efficiency")[ ["lighting-cost-current_scaled", "heating-cost-current_scaled", "hot-water-cost-current_scaled"] ].mean().reset_index() +epc_data = epc_data[~pd.isnull(epc_data["UPRN"])] + sample_epc_data = epc_data[pd.to_datetime(epc_data["LODGEMENT_DATE"]) >= "2015-01-01"].drop_duplicates("UPRN").sample( - 3000).reset_index(drop=True) + 5000).reset_index(drop=True) # TODO: In Property find_energy_sources, sort out biomass community heating - what fuel type # TODO: We might be able to remove find_energy_sources entirely and remove estimate_electrical_consumption. It's used