From 9bcd78ecccda83f36b869feb4124f61eaa86e395 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 11 Sep 2023 11:08:47 +0100 Subject: [PATCH] adding welsh translations --- model_data/app.py | 47 ----------------- model_data/epc_attributes/FloorAttributes.py | 4 +- .../epc_attributes/HotWaterAttributes.py | 3 +- .../epc_attributes/MainheatAttributes.py | 5 +- .../MainheatControlAttributes.py | 1 + model_data/epc_attributes/RoofAttributes.py | 23 ++++++--- .../test_data/test_floor_attributes_cases.py | 3 ++ .../test_hot_water_attributes_cases.py | 7 ++- .../test_mainheat_attributes_cases.py | 51 ++++++++++++++++++- .../test_mainheat_control_attributes_cases.py | 6 +++ .../test_data/test_roof_attributes_cases.py | 8 +++ 11 files changed, 98 insertions(+), 60 deletions(-) diff --git a/model_data/app.py b/model_data/app.py index 2e1e3ac1..5106a0e4 100644 --- a/model_data/app.py +++ b/model_data/app.py @@ -32,53 +32,6 @@ def app(): :return: """ - # epc_client = EpcClient(auth_token=EPC_AUTH_TOKEN) - # - # constituencies = {'E14000555', 'E14000726', 'E14000720', 'E14000721', 'E14000553', 'E14000752'} - # property_types = ["bungalow", "flat", "house", "maisonette", "park home"] - # floor_areas = ["unknown", "s", "m", "l", "xl", "xxl", "xxxl"] - # - # # We pull properties from local authorities, by property type. This will allow us to build - # # a dataset of up to 10k properties per local authority/property type combination - # # For particularly old EPC data, we have inconsistent records so we'll only include EPCS that were - # # conducted after 2010, since SAP09 was introduced in 2009 an later SAP12 was introduced in England - # # and Wales from 31 July 2014 - # # Download data from August 2014 onwards - # data = [] - # for c in tqdm(constituencies): - # for pt in property_types: - # for fa in floor_areas: - # data.extend( - # pagenated_epc_download( - # client=epc_client, - # params={ - # "constituency": c, - # "property-type": pt, - # "from-month": 8, - # "from-year": 2014, - # "floor-area": fa, - # }, - # page_size=5000, - # n_pages=10, - # ) - # ) - - # Production of sample data for land registry - # address_meta = [ - # { - # "postcode": x["postcode"].upper(), - # "address1": x["address1"].upper(), - # "address2": x["address2"].upper(), - # "address3": x["address3"].upper(), - # "address": x["address"], - # "uprn": x["uprn"] - # } for x in data - # ] - # - # import pickle - # with open("sample_addresses.pkl", "wb") as f: - # pickle.dump(address_meta, f) - # Begin by setting up an empty cleaner cleaner = EpcClean([]) diff --git a/model_data/epc_attributes/FloorAttributes.py b/model_data/epc_attributes/FloorAttributes.py index 3605f0aa..1da037ae 100644 --- a/model_data/epc_attributes/FloorAttributes.py +++ b/model_data/epc_attributes/FloorAttributes.py @@ -21,7 +21,9 @@ class FloorAttributes(Definitions): "crog, dim inswleiddio": "suspended, no insulation", "(eiddo arall islaw)": "(other premises below)", "solet, inswleiddio cyfyngedig (rhagdybiaeth)": "solid, limited insulation (assumed)", - "solet, inswleiddio cyfyngedig": "solid, limited insulation" + "solet, inswleiddio cyfyngedig": "solid, limited insulation", + "crog, wedigçöi inswleiddio (rhagdybiaeth)": "suspended, insulated (assumed)", + "crog, wedigçöi inswleiddio": "suspended, insulated" } def __init__(self, description: str): diff --git a/model_data/epc_attributes/HotWaterAttributes.py b/model_data/epc_attributes/HotWaterAttributes.py index 7f6b78df..49e5eca7 100644 --- a/model_data/epc_attributes/HotWaterAttributes.py +++ b/model_data/epc_attributes/HotWaterAttributes.py @@ -100,7 +100,8 @@ class HotWaterAttributes(Definitions): "ogçör brif system, dim thermostat ar y silindr": "from main system, no cylinder thermostat", "twymwr tanddwr, an-frig": "electric immersion, off-peak", "ogçör brif system, gydag ynnigçör haul": "from main system, plus solar", - "twymwr tanddwr, tarriff safonol": "electric immersion, standard tariff" + "twymwr tanddwr, tarriff safonol": "electric immersion, standard tariff", + "trydan ar unwaith yn y fan lle maegçön cael ei ddefnyddio": 'electric instantaneous at point of use' } def __init__(self, description: str): diff --git a/model_data/epc_attributes/MainheatAttributes.py b/model_data/epc_attributes/MainheatAttributes.py index 3f938730..5ac2334a 100644 --- a/model_data/epc_attributes/MainheatAttributes.py +++ b/model_data/epc_attributes/MainheatAttributes.py @@ -29,7 +29,10 @@ class MainHeatAttributes(Definitions): "bwyler a rheiddiaduron, olew": "boiler and radiators, oil", "heat pumptrydan": "electric heat pump", "bwyler a rheiddiaduron, trydan": "boiler and radiators, electric", - "bwyler a gwres dan y llawr, olew": "boiler and underfloor heating, oil" + "bwyler a gwres dan y llawr, olew": "boiler and underfloor heating, oil", + 'bwyler a rheiddiaduron, lpg': 'boiler and radiators, lpg', + "gwresogyddion ystafell, trydan": "room heaters, electric", + "pwmp gwres sygçön tarddu yn yr awyr, dan y llawr, trydan": "air source heat pump, underfloor heating, electric" } REMAP = { diff --git a/model_data/epc_attributes/MainheatControlAttributes.py b/model_data/epc_attributes/MainheatControlAttributes.py index 0f43fbf8..a9f9e117 100644 --- a/model_data/epc_attributes/MainheatControlAttributes.py +++ b/model_data/epc_attributes/MainheatControlAttributes.py @@ -78,6 +78,7 @@ class MainheatControlAttributes(Definitions): "rhaglennydd a thermostat ystafell": "programmer and room thermostat", "rheoligçör t+ól +ó llaw": "manual charge control", "rheolaeth amser a rheolaeth parthau tymheredd": "time and temperature zone control", + "rhaglennydd a thermostatau ar y cyfarpar": "programmer, room thermostat", } def __init__(self, description: str): diff --git a/model_data/epc_attributes/RoofAttributes.py b/model_data/epc_attributes/RoofAttributes.py index bbaaac94..67538652 100644 --- a/model_data/epc_attributes/RoofAttributes.py +++ b/model_data/epc_attributes/RoofAttributes.py @@ -11,12 +11,17 @@ class RoofAttributes(Definitions): WELSH_TEXT = { "ar oleddf, dim inswleiddio": "pitched, no insulation", "ar oleddf, dim inswleiddio (rhagdybiaeth)": "pitched, no insulation (assumed)", - "(annedd arall uwchben)": "(another dwelling above)", - "yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)": "Flat, limited insulation (assumed)", - "yn wastad, inswleiddio cyfyngedig": "Flat, limited insulation", "ar oleddf, wedigçöi inswleiddio (rhagdybiaeth)": "pitched, insulated (assumed)", "ar oleddf, wedigçöi inswleiddio": "pitched, insulated", - "(eiddo arall uwchben)": "(another dwelling above)" + "ar oleddf, inswleiddio cyfyngedig (rhagdybiaeth)": "pitched, limited insulation (assumed)", + "ar oleddf, inswleiddio cyfyngedig": "pitched, limited insulation", + "yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)": "flat, limited insulation (assumed)", + "yn wastad, inswleiddio cyfyngedig": "flat, limited insulation", + "yn wastad, dim inswleiddio (rhagdybiaeth)": "flat, no insulation (assumed)", + "yn wastad, dim inswleiddio": "flat, no insulation", + "(eiddo arall uwchben)": "(another dwelling above)", + "(annedd arall uwchben)": "(another dwelling above)", + "ystafell(oedd) to, wedigçöi hinswleiddio": "roof room(s), insulated", } def __init__(self, description: str): @@ -42,13 +47,17 @@ class RoofAttributes(Definitions): search for regular expressions and translate """ - insulation_thickness_match = re.search(r"(\d+ mm) o inswleiddio yn y llofft", self.description) + insulation_thickness_match = re.search(r"ar oleddf, (\d+ mm) o inswleiddio yn y llofft", self.description) + insulation_thickness_match2 = re.search(r"ar oleddf, (\d+ mm) lo inswleiddio yn y llof", self.description) uvalue_search = re.search(r"trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m-¦k", self.description) # Step 2: Generalized translation with placeholder - if insulation_thickness_match: - insulation_thickness = insulation_thickness_match.group(1) + if (insulation_thickness_match is not None) | (insulation_thickness_match2 is not None): + if insulation_thickness_match is not None: + insulation_thickness = insulation_thickness_match.group(1) + else: + insulation_thickness = insulation_thickness_match2.group(1) self.description = f"pitched, {insulation_thickness} loft insulation" elif uvalue_search: uvalue = uvalue_search.group(1) diff --git a/model_data/tests/test_data/test_floor_attributes_cases.py b/model_data/tests/test_data/test_floor_attributes_cases.py index ccf8ee81..278d8c08 100644 --- a/model_data/tests/test_data/test_floor_attributes_cases.py +++ b/model_data/tests/test_data/test_floor_attributes_cases.py @@ -350,4 +350,7 @@ clean_floor_cases = [ {'original_description': 'Solet, inswleiddio cyfyngedig (rhagdybiaeth)', 'thermal_transmittance': None, 'thermal_transmittance_unit': None, 'is_assumed': True, 'is_to_unheated_space': False, 'is_to_external_air': False, 'is_suspended': False, 'is_solid': True, 'insulation_thickness': 'below average', "another_property_below": False}, + {'original_description': 'Crog, wediGÇÖi inswleiddio (rhagdybiaeth)', 'thermal_transmittance': None, + 'thermal_transmittance_unit': None, 'is_assumed': True, 'is_to_unheated_space': False, 'is_to_external_air': False, + 'is_suspended': True, 'is_solid': False, 'insulation_thickness': 'average', "another_property_below": False}, ] diff --git a/model_data/tests/test_data/test_hot_water_attributes_cases.py b/model_data/tests/test_data/test_hot_water_attributes_cases.py index 3003111a..7d98923d 100644 --- a/model_data/tests/test_data/test_hot_water_attributes_cases.py +++ b/model_data/tests/test_data/test_hot_water_attributes_cases.py @@ -154,5 +154,10 @@ hotwater_cases = [ {'original_description': 'Twymwr tanddwr, tarriff safonol', 'heater_type': 'electric immersion', 'system_type': None, 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None, 'tariff_type': 'standard tariff', 'extra_features': None, 'chp_systems': None, 'distribution_system': None, - 'no_system_present': None, 'assumed': False, "appliance": None} + 'no_system_present': None, 'assumed': False, "appliance": None}, + {'original_description': 'Trydan ar unwaith yn y fan lle maeGÇÖn cael ei ddefnyddio', + 'heater_type': 'electric instantaneous', + 'system_type': None, 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None, + 'tariff_type': None, 'extra_features': None, 'chp_systems': None, 'distribution_system': None, + 'no_system_present': None, 'assumed': False, "appliance": 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 5330084a..1149b04f 100644 --- a/model_data/tests/test_data/test_mainheat_attributes_cases.py +++ b/model_data/tests/test_data/test_mainheat_attributes_cases.py @@ -1201,6 +1201,53 @@ mainheat_cases = [ 'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False, 'has_oil': True, '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_assumed_for_most_rooms': False, 'has_underfloor_heating': True}, + {'original_description': 'Bwyler a rheiddiaduron, LPG', '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': 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': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Gwresogyddion ystafell, 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': 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': 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': False, + "has_electric_heat_pumps": False, + "has_micro-cogeneration": False}, + {'original_description': 'Air source heat pump, Underfloor heating, electric', + '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': True, '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}, + {'original_description': 'Pwmp gwres syGÇÖn tarddu yn yr awyr, dan y llawr, trydan, electric', + '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': True, '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 54b45874..d514e43a 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 @@ -147,4 +147,10 @@ mainheat_control_cases = [ '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': 'Programmer, 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': 'Rhaglennydd a thermostatau ar y cyfarpar', '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}, ] diff --git a/model_data/tests/test_data/test_roof_attributes_cases.py b/model_data/tests/test_data/test_roof_attributes_cases.py index ab006169..1abbb9e5 100644 --- a/model_data/tests/test_data/test_roof_attributes_cases.py +++ b/model_data/tests/test_data/test_roof_attributes_cases.py @@ -366,4 +366,12 @@ clean_roof_test_cases = [ 'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': False, 'is_loft': False, 'is_flat': False, 'is_thatched': False, 'is_at_rafters': False, 'is_assumed': False, 'has_dwelling_above': True, 'is_valid': True, 'insulation_thickness': None}, + {'original_description': 'Ar oleddf, inswleiddio cyfyngedig (rhagdybiaeth)', 'thermal_transmittance': None, + 'thermal_transmittance_unit': None, 'is_pitched': True, 'is_roof_room': False, 'is_loft': False, 'is_flat': False, + 'is_thatched': False, 'is_at_rafters': False, 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True, + 'insulation_thickness': 'below average'}, + {'original_description': 'Ystafell(oedd) to, wediGÇÖi hinswleiddio', 'thermal_transmittance': None, + 'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': True, 'is_loft': False, 'is_flat': False, + 'is_thatched': False, 'is_at_rafters': False, 'is_assumed': False, 'has_dwelling_above': False, 'is_valid': True, + 'insulation_thickness': 'average'}, ]