From 5ba48338925aca757fb6e20670ac873d3fb7aa05 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 29 Aug 2025 00:19:47 +0100 Subject: [PATCH] fixed getting innovation rate for rir --- backend/Property.py | 9 +++++++-- backend/tests/test_integration.py | 8 ++++++-- recommendations/RoofRecommendations.py | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 1fc20c88..bd968e9f 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -1211,8 +1211,13 @@ class Property: self.heating_energy_source = self.heating_energy_source[0] if self.heating_energy_source == "Varied (Community Scheme)": - if self.main_fuel["fuel_type"] in ["mains gas", None]: # We assume when None as it's unknown - self.heating_energy_source = "Natural Gas (Community Scheme)" + fuel_map = { + None: "Natural Gas (Community Scheme)", + "mains gas": "Natural Gas (Community Scheme)", + "biomass": "Smokeless Fuel", + } + if self.main_fuel["fuel_type"] in fuel_map: # We assume when None as it's unknown + self.heating_energy_source = fuel_map[self.main_fuel["fuel_type"]] else: raise Exception("Implement me") diff --git a/backend/tests/test_integration.py b/backend/tests/test_integration.py index e8473bb0..b63faf28 100644 --- a/backend/tests/test_integration.py +++ b/backend/tests/test_integration.py @@ -92,6 +92,10 @@ costs_by_floor_area = costs_by_floor_area.groupby("current-energy-efficiency")[ sample_epc_data = epc_data[pd.to_datetime(epc_data["LODGEMENT_DATE"]) >= "2015-01-01"].drop_duplicates("UPRN").sample( 1000).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 +# in the google solar api but is it really needed? I don't think it's super accurate. It might be better to +# just use an average energy consumption by floor area for UK households? # Load the input properties input_properties = [] for row_id, config in tqdm(sample_epc_data.iterrows(), total=len(sample_epc_data)): @@ -174,8 +178,8 @@ for p in input_properties: p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=mocked_kwh_predictions) for p in input_properties ] -for p in input_properties: - p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=mocked_kwh_predictions) +# for p in input_properties: +# p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=mocked_kwh_predictions) # Run the recommendations recommendations = {} diff --git a/recommendations/RoofRecommendations.py b/recommendations/RoofRecommendations.py index a2272c1b..0324c9cb 100644 --- a/recommendations/RoofRecommendations.py +++ b/recommendations/RoofRecommendations.py @@ -581,7 +581,7 @@ class RoofRecommendations: **cost_result, "already_installed": already_installed, "survey": rir_non_invasive_recommendation.get("survey", None), - "innovation_rate": material.to_dict()["innovation_rate"] + "innovation_rate": material.innovation_rate } )