diff --git a/epc_data/app.py b/epc_data/app.py index 0986332a..9bb3a722 100644 --- a/epc_data/app.py +++ b/epc_data/app.py @@ -56,7 +56,7 @@ def handler(): df = df.reset_index(drop=True) import numpy as np - idx = 3 + idx = 36 record = df[df.index == idx].to_dict("records")[0] record = {k: v for k, v in record.items() if v not in [None, np.nan, False]} from pprint import pprint diff --git a/epc_data/attributes/MainheatControlAttributes.py b/epc_data/attributes/MainheatControlAttributes.py index 01744de7..245d274d 100644 --- a/epc_data/attributes/MainheatControlAttributes.py +++ b/epc_data/attributes/MainheatControlAttributes.py @@ -7,11 +7,17 @@ class MainheatControlAttributes: THERMOSTATIC_CONTROL_KEYWORDS = [ 'room thermostats', 'appliance thermostats', - 'trvs', 'room thermostat', 'temperature zone control', 'time and temperature zone control', - 'no thermostatic control' + # 'no thermostatic control', + # 'no room thermostat' + ] + + # TRVs stands for Thermostatic Radiator Valves which control the heating temperature of individual radiators + # This is split out distinctly + TRVS_KEYWORDS = [ + 'trvs', ] # These systems provide a way to store and manage energy usage @@ -26,14 +32,22 @@ class MainheatControlAttributes: # These systems are mainly focused on on/off operations SWITCH_SYSTEM_KEYWORDS = [ 'programmer', + ] + + # These systems enhance operation, efficiency, or safety. e.g. a boiler energy manager + # manages the efficiency of boiler operation. There is an argument to separate 'boiler energy manager' and 'bypass' + AUXILIARY_SYSTEM_KEYWORDS = [ + 'boiler energy manager', + 'bypass', 'flow switch', - 'bypass' ] # These keywords indicate a lack of control system NO_CONTROL_SYSTEM_KEYWORDS = [ 'no time or thermostatic control', - 'none' + 'no thermostatic control', + 'none', + 'no room thermostat' ] # These systems provide control specifically for Domestic Hot Water @@ -63,7 +77,8 @@ class MainheatControlAttributes: self.CHARGING_SYSTEM_KEYWORDS, self.SWITCH_SYSTEM_KEYWORDS, self.DHW_CONTROL_KEYWORDS, - self.COMMUNITY_HEATING_KEYWORDS + self.COMMUNITY_HEATING_KEYWORDS, + self.TRVS_KEYWORDS ] ): raise ValueError('Invalid description') @@ -80,7 +95,10 @@ class MainheatControlAttributes: "dhw_control": self._find_keyword(self.DHW_CONTROL_KEYWORDS), "community_heating": self._find_keyword(self.COMMUNITY_HEATING_KEYWORDS), "multiple_room_thermostats": any( - phrase in self.description for phrase in self.MULTIPLE_ROOM_THERMOSTATS_PHRASES), + phrase in self.description for phrase in self.MULTIPLE_ROOM_THERMOSTATS_PHRASES + ), + "auxiliary_systems": self._find_keyword(self.AUXILIARY_SYSTEM_KEYWORDS), + "trvs": self._find_keyword(self.TRVS_KEYWORDS) } return result diff --git a/epc_data/tests/test_data/test_mainheat_control_attributes_cases.py b/epc_data/tests/test_data/test_mainheat_control_attributes_cases.py new file mode 100644 index 00000000..7e29b928 --- /dev/null +++ b/epc_data/tests/test_data/test_mainheat_control_attributes_cases.py @@ -0,0 +1,127 @@ +mainheat_control_cases = [ + {'original_description': '2207 Time and temperature zone control', + 'thermostatic_control': 'time and temperature zone control', 'charging_system': None, 'switch_system': None, + 'no_control': None, 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, + 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Appliance thermostats', 'thermostatic_control': 'appliance thermostats', + 'charging_system': None, 'switch_system': None, 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Automatic charge control', 'thermostatic_control': None, + 'charging_system': 'automatic charge control', 'switch_system': None, 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Charging system linked to use of community heating, TRVs', 'thermostatic_control': None, + 'charging_system': 'charging system', 'switch_system': None, 'no_control': None, 'dhw_control': None, + 'community_heating': 'use of community heating', 'multiple_room_thermostats': False, 'auxiliary_systems': None, + 'trvs': 'trvs'}, + {'original_description': 'Charging system linked to use of community heating, programmer and TRVs', + 'thermostatic_control': None, 'charging_system': 'charging system', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': 'use of community heating', + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': 'trvs'}, { + 'original_description': 'Charging system linked to use of community heating, programmer and at least two room ' + 'stats', + 'thermostatic_control': None, 'charging_system': 'charging system', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': 'use of community heating', + 'multiple_room_thermostats': True, 'auxiliary_systems': None, 'trvs': None}, { + 'original_description': 'Charging system linked to use of community heating, programmer and at least two room ' + 'thermostats', + 'thermostatic_control': 'room thermostats', 'charging_system': 'charging system', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': 'use of community heating', + 'multiple_room_thermostats': True, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Charging system linked to use of community heating, programmer and room thermostat', + 'thermostatic_control': 'room thermostat', 'charging_system': 'charging system', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': 'use of community heating', + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Charging system linked to use of community heating, room thermostat only', + 'thermostatic_control': 'room thermostat', 'charging_system': 'charging system', 'switch_system': None, + 'no_control': None, 'dhw_control': None, 'community_heating': 'use of community heating', + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Controls for high heat retention storage heaters', 'thermostatic_control': None, + 'charging_system': 'high heat retention storage heaters', 'switch_system': None, 'no_control': None, + 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, + 'trvs': None}, {'original_description': 'Flat rate charging, TRVs', 'thermostatic_control': None, + 'charging_system': 'flat rate charging', 'switch_system': None, 'no_control': None, + 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, + 'auxiliary_systems': None, 'trvs': 'trvs'}, + {'original_description': 'Flat rate charging, no thermostatic control of room temperature', + 'thermostatic_control': None, 'charging_system': 'flat rate charging', 'switch_system': None, + 'no_control': 'no thermostatic control', 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Flat rate charging, programmer and TRVs', 'thermostatic_control': None, + 'charging_system': 'flat rate charging', 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': 'trvs'}, + {'original_description': 'Flat rate charging, programmer and at least two room thermostats', + 'thermostatic_control': 'room thermostats', 'charging_system': 'flat rate charging', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': True, + 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Flat rate charging, programmer and room thermostat', + 'thermostatic_control': 'room thermostat', 'charging_system': 'flat rate charging', 'switch_system': 'programmer', + 'no_control': None, 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, + 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Flat rate charging, programmer, no room thermostat', + 'thermostatic_control': 'room thermostat', 'charging_system': 'flat rate charging', 'switch_system': 'programmer', + 'no_control': 'no room thermostat', 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Flat rate charging, room thermostat only', 'thermostatic_control': 'room thermostat', + 'charging_system': 'flat rate charging', 'switch_system': None, 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Manual charge control', 'thermostatic_control': None, + 'charging_system': 'manual charge control', 'switch_system': None, 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'No thermostatic control of room temperature', 'thermostatic_control': None, + 'charging_system': None, 'switch_system': None, 'no_control': 'no thermostatic control', 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'No time or thermostatic control of room temperature', 'thermostatic_control': None, + 'charging_system': None, 'switch_system': None, 'no_control': 'no time or thermostatic control', + 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, + 'trvs': None}, + {'original_description': 'None', 'thermostatic_control': None, 'charging_system': None, 'switch_system': None, + 'no_control': 'none', 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, + 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Not relevant (supplies DHW only)', 'thermostatic_control': None, 'charging_system': None, + 'switch_system': None, 'no_control': None, 'dhw_control': 'dhw only', 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer and appliance thermostats', 'thermostatic_control': 'appliance thermostats', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer and at least two room thermostats', 'thermostatic_control': 'room thermostats', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': True, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer and room thermostat', 'thermostatic_control': 'room thermostat', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer and room thermostats', 'thermostatic_control': 'room thermostats', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer, TRVs and boiler energy manager', 'thermostatic_control': None, + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': 'boiler energy manager', + 'trvs': 'trvs'}, + {'original_description': 'Programmer, TRVs and bypass', 'thermostatic_control': None, 'charging_system': None, + 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': 'bypass', 'trvs': 'trvs'}, + {'original_description': 'Programmer, TRVs and flow switch', 'thermostatic_control': None, 'charging_system': None, + 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': 'flow switch', 'trvs': 'trvs'}, + {'original_description': 'Programmer, no room thermostat', 'thermostatic_control': 'room thermostat', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': 'no room thermostat', 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Programmer, room thermostat and TRVs', 'thermostatic_control': 'room thermostat', + 'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None, + 'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': 'trvs'}, + {'original_description': 'Room thermostat only', 'thermostatic_control': 'room thermostat', 'charging_system': None, + 'switch_system': None, 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Room thermostats only', 'thermostatic_control': 'room thermostats', + 'charging_system': None, 'switch_system': None, 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'TRVs and bypass', 'thermostatic_control': None, 'charging_system': None, + 'switch_system': None, 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': 'bypass', 'trvs': 'trvs'}, + {'original_description': 'Temperature zone control', 'thermostatic_control': 'temperature zone control', + 'charging_system': None, 'switch_system': None, 'no_control': None, 'dhw_control': None, 'community_heating': None, + 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None}, + {'original_description': 'Time and temperature zone control', + 'thermostatic_control': 'time and temperature zone control', 'charging_system': None, 'switch_system': None, + 'no_control': None, 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False, + 'auxiliary_systems': None, 'trvs': None} +]