diff --git a/model_data/app.py b/model_data/app.py index 45c4a4f0..02c7f6f4 100644 --- a/model_data/app.py +++ b/model_data/app.py @@ -33,7 +33,7 @@ def app(): """ epc_directories = [entry for entry in EPC_DIRECTORY.iterdir() if entry.is_dir()] - for directory in tqdm(epc_directories): + for directory in tqdm(epc_directories[295:]): data = pd.read_csv(directory / "certificates.csv", low_memory=False) # Rename the columns to the same format as the api returns data.columns = [c.replace("_", "-").lower() for c in data.columns] diff --git a/model_data/epc_attributes/FloorAttributes.py b/model_data/epc_attributes/FloorAttributes.py index 629581eb..5a901679 100644 --- a/model_data/epc_attributes/FloorAttributes.py +++ b/model_data/epc_attributes/FloorAttributes.py @@ -55,9 +55,16 @@ class FloorAttributes(Definitions): r'trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m-¦k', self.description ) + uvalue_match2 = re.search( + r'trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m.+k', self.description + ) + # Step 2: Generalized translation with placeholder - if uvalue_match: - uvalue = uvalue_match.group(1) + if uvalue_match is not None or uvalue_match2 is not None: + if uvalue_match is not None: + uvalue = uvalue_match.group(1) + else: + uvalue = uvalue_match2.group(1) self.description = f"average thermal transmittance {uvalue} w/m-¦K" else: diff --git a/model_data/epc_attributes/MainFuelAttributes.py b/model_data/epc_attributes/MainFuelAttributes.py index 4f4f8079..35059865 100644 --- a/model_data/epc_attributes/MainFuelAttributes.py +++ b/model_data/epc_attributes/MainFuelAttributes.py @@ -33,7 +33,8 @@ class MainFuelAttributes(Definitions): 'bioethanol', 'solid fuel', 'manufactured smokeless fuel', - "lng" # Liquified natural gas + "lng", # Liquified natural gas + "electric heat pump" ] COMPLEX_FUEL_KEYWORDS = [ diff --git a/model_data/epc_attributes/MainheatAttributes.py b/model_data/epc_attributes/MainheatAttributes.py index f37e3baf..04fb3ccb 100644 --- a/model_data/epc_attributes/MainheatAttributes.py +++ b/model_data/epc_attributes/MainheatAttributes.py @@ -45,11 +45,16 @@ class MainHeatAttributes(Definitions): "pwmp gwres sygçön tarddu yn yr awyr, rheiddiaduron, trydan": "air source heat pump, radiators, electric", "gwresogyddion ystafell, nwy prif gyflenwad": "room heaters, mains gas", "bwyler a rheiddiaduron, dau danwydd mwynau a choed": "boiler and radiators, dual fuel mineral and wood", + "gwresogyddion ystafell, dau danwydd mwynau a choed": "room heaters, dual fuel (mineral and wood)", "pwmp gwres sygçön tarddu yn y ddaear, dan y llawr, trydan": "ground source heat pump, underfloor, electric", "gwresogi dan y llawr trydan": "electric underfloor heating", # This descripton is slightly unclear & was repeated "st+¦r wresogyddion trydan, st+¦r wresogyddion trydan": "room heaters, electric", "pwmp gwres sygçön tarddu yn y ddaear, rheiddiaduron, trydan": "ground source heat pump, radiators, electric", + "gwresogyddion ystafell, pelenni coed": "room heaters, wood pellets", + "gwresogyddion ystafell, glo": "room heaters, coal", + "bwyler a gwres dan y llawr, lpg": "boiler and underfloor heating, LPG", + "bwyler a gwres dan y llawr, trydan": "boiler and underfloor heating, electric" } REMAP = { diff --git a/model_data/epc_attributes/MainheatControlAttributes.py b/model_data/epc_attributes/MainheatControlAttributes.py index b1519a24..231afbd0 100644 --- a/model_data/epc_attributes/MainheatControlAttributes.py +++ b/model_data/epc_attributes/MainheatControlAttributes.py @@ -101,6 +101,10 @@ class MainheatControlAttributes(Definitions): "dim": "none", "dim rheolaeth thermostatig ar dymheredd yr ystafell": "no thermostatic control of room temperature", "thermostatau ar y cyfarpar": "appliance thermostats", + "rhaglennydd a thermostatau ystafell": "programmer and room thermostats", + "system dalu wedigçöi chysylltu +ó defnyddio gwres cymunedol, rhaglennydd a thermostat ystafell": ( + "Charging system linked to use of community heating, programmer and room thermostat" + ), } def __init__(self, description: str): diff --git a/model_data/epc_attributes/RoofAttributes.py b/model_data/epc_attributes/RoofAttributes.py index 14f08f88..c83ad98a 100644 --- a/model_data/epc_attributes/RoofAttributes.py +++ b/model_data/epc_attributes/RoofAttributes.py @@ -38,7 +38,7 @@ class RoofAttributes(Definitions): :param description: Description of the roof. """ - self.description: str = description.lower() + self.description: str = description.lower().strip() self.nodata = not description or description in self.DATA_ANOMALY_MATCHES self.welsh_translation_search() @@ -62,6 +62,9 @@ class RoofAttributes(Definitions): self.description) uvalue_search = re.search(r"trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m-¦k", self.description) + uvalue_search2 = re.search( + r'trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m.+k', self.description, re.IGNORECASE + ) # Step 2: Generalized translation with placeholder if (loft_insulation_thickness_match is not None) | \ @@ -75,8 +78,11 @@ class RoofAttributes(Definitions): insulation_thickness = loft_insulation_thickness_match3.group(1) self.description = f"pitched, {insulation_thickness} loft insulation" - elif uvalue_search: - uvalue = uvalue_search.group(1) + elif uvalue_search is not None or uvalue_search2 is not None: + if uvalue_search is not None: + uvalue = uvalue_search.group(1) + else: + uvalue = uvalue_search2.group(1) self.description = f"average thermal transmittance {uvalue} W/m-¦K" else: translation = self.WELSH_TEXT.get(self.description) diff --git a/model_data/tests/test_data/test_main_fuel_attributes_cases.py b/model_data/tests/test_data/test_main_fuel_attributes_cases.py index 72ec9bfb..b67ad563 100644 --- a/model_data/tests/test_data/test_main_fuel_attributes_cases.py +++ b/model_data/tests/test_data/test_main_fuel_attributes_cases.py @@ -78,6 +78,9 @@ mainfuel_cases = [ 'is_community': False, 'no_individual_heating_or_community_network': False, 'complex_fuel_type': None}, {'original_description': "LNG", 'fuel_type': 'lng', 'tariff_type': None, 'is_community': False, + 'no_individual_heating_or_community_network': False, 'complex_fuel_type': None}, + {"original_description": "Community heating schemes: heat from electric heat pump", + 'fuel_type': 'electric heat pump', 'tariff_type': None, 'is_community': True, 'no_individual_heating_or_community_network': False, 'complex_fuel_type': None} ] diff --git a/model_data/tests/test_data/test_mainheat_attributes_cases.py b/model_data/tests/test_data/test_mainheat_attributes_cases.py index 41de6dc1..c05ac47d 100644 --- a/model_data/tests/test_data/test_mainheat_attributes_cases.py +++ b/model_data/tests/test_data/test_mainheat_attributes_cases.py @@ -1530,4 +1530,89 @@ mainheat_cases = [ 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, 'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False, "has_electric_heat_pumps": False, "has_micro-cogeneration": False}, + {'original_description': 'Gwresogyddion ystafell, dau danwydd (mwynau a choed)', 'has_radiators': False, + 'has_fan_coil_units': False, 'has_pipes_in_screed_above_insulation': False, + 'has_pipes_in_insulated_timber_floor': False, 'has_pipes_in_concrete_slab': False, 'has_boiler': False, + 'has_air_source_heat_pump': False, 'has_room_heaters': True, 'has_electric_storage_heaters': False, + 'has_warm_air': False, 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, + 'has_community_scheme': False, 'has_ground_source_heat_pump': False, 'has_no_system_present': False, + 'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': False, + 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False, 'has_oil': False, + 'has_wood_pellets': False, 'has_anthracite': False, 'has_dual_fuel_mineral_and_wood': True, + 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, 'has_electricaire': False, + 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False, "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Room heaters, wood pellets', 'has_radiators': False, 'has_fan_coil_units': False, + 'has_pipes_in_screed_above_insulation': False, 'has_pipes_in_insulated_timber_floor': False, + 'has_pipes_in_concrete_slab': False, 'has_boiler': False, 'has_air_source_heat_pump': False, + 'has_room_heaters': True, 'has_electric_storage_heaters': False, 'has_warm_air': False, + 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, 'has_community_scheme': False, + 'has_ground_source_heat_pump': False, 'has_no_system_present': False, 'has_portable_electric_heaters': False, + 'has_water_source_heat_pump': False, 'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False, + 'has_LPG': False, 'has_coal': False, 'has_oil': False, 'has_wood_pellets': True, 'has_anthracite': False, + 'has_dual_fuel_mineral_and_wood': False, 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, + 'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Gwresogyddion ystafell, pelenni coed', 'has_radiators': False, + 'has_fan_coil_units': False, + 'has_pipes_in_screed_above_insulation': False, 'has_pipes_in_insulated_timber_floor': False, + 'has_pipes_in_concrete_slab': False, 'has_boiler': False, 'has_air_source_heat_pump': False, + 'has_room_heaters': True, 'has_electric_storage_heaters': False, 'has_warm_air': False, + 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, 'has_community_scheme': False, + 'has_ground_source_heat_pump': False, 'has_no_system_present': False, 'has_portable_electric_heaters': False, + 'has_water_source_heat_pump': False, 'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False, + 'has_LPG': False, 'has_coal': False, 'has_oil': False, 'has_wood_pellets': True, 'has_anthracite': False, + 'has_dual_fuel_mineral_and_wood': False, 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, + 'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Gwresogyddion ystafell, glo', 'has_radiators': False, 'has_fan_coil_units': False, + 'has_pipes_in_screed_above_insulation': False, 'has_pipes_in_insulated_timber_floor': False, + 'has_pipes_in_concrete_slab': False, 'has_boiler': False, 'has_air_source_heat_pump': False, + 'has_room_heaters': True, 'has_electric_storage_heaters': False, 'has_warm_air': False, + 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, 'has_community_scheme': False, + 'has_ground_source_heat_pump': False, 'has_no_system_present': False, 'has_portable_electric_heaters': False, + 'has_water_source_heat_pump': False, 'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False, + 'has_LPG': False, 'has_coal': True, 'has_oil': False, 'has_wood_pellets': False, 'has_anthracite': False, + 'has_dual_fuel_mineral_and_wood': False, 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, + 'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Boiler and underfloor heating, LPG', 'has_radiators': False, + 'has_fan_coil_units': False, 'has_pipes_in_screed_above_insulation': False, + 'has_pipes_in_insulated_timber_floor': False, 'has_pipes_in_concrete_slab': False, 'has_boiler': True, + 'has_air_source_heat_pump': False, 'has_room_heaters': False, 'has_electric_storage_heaters': False, + 'has_warm_air': False, 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, + 'has_community_scheme': False, 'has_ground_source_heat_pump': False, 'has_no_system_present': False, + 'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': False, + 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False, 'has_oil': False, + 'has_wood_pellets': False, 'has_anthracite': False, 'has_dual_fuel_mineral_and_wood': False, + 'has_smokeless_fuel': False, 'has_lpg': True, 'has_assumed': False, 'has_electricaire': False, + 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True, "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Bwyler a gwres dan y llawr, LPG', 'has_radiators': False, + 'has_fan_coil_units': False, 'has_pipes_in_screed_above_insulation': False, + 'has_pipes_in_insulated_timber_floor': False, 'has_pipes_in_concrete_slab': False, 'has_boiler': True, + 'has_air_source_heat_pump': False, 'has_room_heaters': False, 'has_electric_storage_heaters': False, + 'has_warm_air': False, 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, + 'has_community_scheme': False, 'has_ground_source_heat_pump': False, 'has_no_system_present': False, + 'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': False, + 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False, 'has_oil': False, + 'has_wood_pellets': False, 'has_anthracite': False, 'has_dual_fuel_mineral_and_wood': False, + 'has_smokeless_fuel': False, 'has_lpg': True, 'has_assumed': False, 'has_electricaire': False, + 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True, "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Bwyler a gwres dan y llawr, trydan', 'has_radiators': False, + 'has_fan_coil_units': False, 'has_pipes_in_screed_above_insulation': False, + 'has_pipes_in_insulated_timber_floor': False, 'has_pipes_in_concrete_slab': False, 'has_boiler': True, + 'has_air_source_heat_pump': False, 'has_room_heaters': False, 'has_electric_storage_heaters': False, + 'has_warm_air': False, 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False, + 'has_community_scheme': False, 'has_ground_source_heat_pump': False, 'has_no_system_present': False, + 'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': True, + 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False, 'has_oil': False, + 'has_wood_pellets': False, 'has_anthracite': False, 'has_dual_fuel_mineral_and_wood': False, + 'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, 'has_electricaire': False, + 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True, "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, ] diff --git a/model_data/tests/test_data/test_mainheat_control_attributes_cases.py b/model_data/tests/test_data/test_mainheat_control_attributes_cases.py index b5197a84..abd0c21b 100644 --- a/model_data/tests/test_data/test_mainheat_control_attributes_cases.py +++ b/model_data/tests/test_data/test_mainheat_control_attributes_cases.py @@ -204,4 +204,13 @@ mainheat_control_cases = [ {'original_description': 'Thermostatau ar y cyfarpar', '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': 'Rhaglennydd a thermostatau ystafell', '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': 'System dalu wediGÇÖi chysylltu +ó defnyddio gwres cymunedol, rhaglennydd a ' + 'thermostat ystafell', + '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}, ]