From 347e2c561783760f3bf2e29a78e7f39402cfe580 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 21 Jul 2023 09:27:48 +0100 Subject: [PATCH] fixing mainheat attributes and added extra test --- model_data/epc_attributes/MainheatAttributes.py | 9 +++++++++ .../test_data/test_mainheat_attributes_cases.py | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/model_data/epc_attributes/MainheatAttributes.py b/model_data/epc_attributes/MainheatAttributes.py index 4f245879..727ce0e6 100644 --- a/model_data/epc_attributes/MainheatAttributes.py +++ b/model_data/epc_attributes/MainheatAttributes.py @@ -20,11 +20,20 @@ class MainHeatAttributes(BaseUtility): "pipes in insulated timber floor", "pipes in concrete slab"] OTHERS = ["assumed", "electricaire", "assumed for most rooms"] + WELSH_TEXT = { + "bwyler a rheiddiaduron, nwy prif gyflenwad": "boiler and radiators, mains gas", + } + def __init__(self, description: str): self.description: str = clean_description(description.lower()) # Remove special characters self.nodata = not description or description in self.DATA_ANOMALY_MATCHES + translation = self.WELSH_TEXT.get(self.description) + if translation: + self.nodata = False + self.description = translation + if not description or not any( rt in self.description for rt in self.HEAT_SYSTEMS + self.FUEL_TYPES + self.DISTRIBUTION_SYSTEMS + self.OTHERS 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 25ff5c04..83835ee0 100644 --- a/model_data/tests/test_data/test_mainheat_attributes_cases.py +++ b/model_data/tests/test_data/test_mainheat_attributes_cases.py @@ -1090,5 +1090,18 @@ mainheat_cases = [ 'has_warm_air': False, 'has_water_source_heat_pump': False, 'has_wood_logs': False, - 'has_wood_pellets': False} + 'has_wood_pellets': False}, + {'original_description': 'Bwyler a rheiddiaduron, nwy prif gyflenwad', 'has_radiators': True, + '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': True, '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': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False} ]