From cb70cbf1dac7640bbb4ad49c898e9894f194070e Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 6 Nov 2025 13:08:19 +0000 Subject: [PATCH] fixed find my epc fetch bug getting heating control instead of heating system --- backend/engine/engine.py | 1 - etl/find_my_epc/RetrieveFindMyEpc.py | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/engine/engine.py b/backend/engine/engine.py index 271effab..3b90f623 100644 --- a/backend/engine/engine.py +++ b/backend/engine/engine.py @@ -663,7 +663,6 @@ async def model_engine(body: PlanTriggerRequest): input_properties = OpenUprnClient.set_spatial_data(input_properties, bucket_name=get_settings().DATA_BUCKET) [p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=kwh_preds) for p in input_properties] - # TODO: If a property is semi-detached, we might get roof surfaces for the main building + the neighbour # TODO: If we can't get high image quality, should we use the solar API? Maybe just for semi-detached units with # extensions, since it doesn't seem to do a great job diff --git a/etl/find_my_epc/RetrieveFindMyEpc.py b/etl/find_my_epc/RetrieveFindMyEpc.py index 4a9cf24d..b8c24cb8 100644 --- a/etl/find_my_epc/RetrieveFindMyEpc.py +++ b/etl/find_my_epc/RetrieveFindMyEpc.py @@ -73,6 +73,12 @@ class RetrieveFindMyEpc: def get_feature_row_text(feature_name, index=0): matches = [row for row in rows if row.find("th") and feature_name in row.find("th").text] if len(matches) > index: + # A commonly seen case is when feature_name is Main heating and we want to make sure we get + # main heating and not main heating control + if feature_name == "Main heating": + matches = [ + row for row in matches if row.find("th") and row.find("th").text.strip() == "Main heating" + ] cells = matches[index].find_all("td") description = self.get_text(cells[0]) rating = self.get_text(cells[1])