From cfdfa8581af3de2a8e41cc4b2d1e80a8110c384b Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 15 Jun 2023 13:06:54 +0100 Subject: [PATCH] increasing scope of attributes being detected by hotwater attributes: --- epc_data/app.py | 4 ++-- epc_data/attributes/HotWaterAttributes.py | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/epc_data/app.py b/epc_data/app.py index b879ef96..e30d1844 100644 --- a/epc_data/app.py +++ b/epc_data/app.py @@ -40,13 +40,13 @@ def handler(): cleaner.clean() # For testing: - from epc_data.attributes.MainFuelAttributes import MainFuelAttributes + from epc_data.attributes.HotWaterAttributes import HotWaterAttributes from collections import Counter count = Counter([x["main-fuel"] for x in data]) descriptions = {x["hotwater-description"] for x in data} out = [] for description in descriptions: - res = MainFuelAttributes(description).process() + res = HotWaterAttributes(description).process() out.append( { "original_description": description, diff --git a/epc_data/attributes/HotWaterAttributes.py b/epc_data/attributes/HotWaterAttributes.py index 4e5e111e..3e86d87f 100644 --- a/epc_data/attributes/HotWaterAttributes.py +++ b/epc_data/attributes/HotWaterAttributes.py @@ -18,11 +18,18 @@ class HotWaterAttributes: 'community scheme', ] + THERMOSTAT_CHARACTERISTICS = [ + 'no cylinder thermostat', + ] + + HEATING_SCOPE = [ + 'water heating only', + ] + OTHER_CHARACTERISTICS = [ 'waste water heat recovery', 'plus solar', 'off-peak', - 'no cylinder thermostat', 'flue gas heat recovery', 'standard tariff', 'chp', @@ -40,6 +47,8 @@ class HotWaterAttributes: for keywords in [ self.HEATER_TYPES, self.SYSTEM_TYPES, + self.THERMOSTAT_CHARACTERISTICS, + self.HEATING_SCOPE, self.OTHER_CHARACTERISTICS, self.NO_SYSTEM_PRESENT_KEYWORDS, ] @@ -53,7 +62,10 @@ class HotWaterAttributes: result: Dict[str, Union[str, bool]] = { "heater_type": find_keyword(self.description, self.HEATER_TYPES), "system_type": find_keyword(self.description, self.SYSTEM_TYPES), - "characteristics": find_keyword(self.description, self.OTHER_CHARACTERISTICS), + "thermostat_characteristics": find_keyword(self.description, self.THERMOSTAT_CHARACTERISTICS), + "heating_scope": find_keyword(self.description, self.HEATING_SCOPE), + "other_characteristics": [find_keyword(self.description, [keyword]) for keyword in + self.OTHER_CHARACTERISTICS if find_keyword(self.description, [keyword])], "no_system_present": find_keyword(self.description, self.NO_SYSTEM_PRESENT_KEYWORDS), }