diff --git a/model_data/app.py b/model_data/app.py index 0e75ee34..2e1e3ac1 100644 --- a/model_data/app.py +++ b/model_data/app.py @@ -108,9 +108,9 @@ def app(): # TODO: cleaner.cleaned datasets to s3 # TODO: Add property age band into this - uvalue_estimates = UvalueEstimations(data=data) - uvalue_estimates.get_estimates(cleaner=cleaner) - # TODO: Store these to a s3 - uvalue_estimates.walls - uvalue_estimates.floors - uvalue_estimates.roofs + # uvalue_estimates = UvalueEstimations(data=data) + # uvalue_estimates.get_estimates(cleaner=cleaner) + # # TODO: Store these to a s3 + # uvalue_estimates.walls + # uvalue_estimates.floors + # uvalue_estimates.roofs diff --git a/model_data/epc_attributes/FloorAttributes.py b/model_data/epc_attributes/FloorAttributes.py index 33299ccf..374753ac 100644 --- a/model_data/epc_attributes/FloorAttributes.py +++ b/model_data/epc_attributes/FloorAttributes.py @@ -1,3 +1,4 @@ +import re from typing import Dict, Union from model_data.BaseUtility import Definitions from model_data.epc_attributes.attribute_utils import extract_thermal_transmittance, extract_component_types @@ -26,11 +27,7 @@ class FloorAttributes(Definitions): description in self.OBSERVED_ERRORS) # Try and perform a translation, incase it's in welsh - translation = self.WELSH_TEXT.get(self.description) - - if translation: - self.nodata = False - self.description = translation + self.translate_welsh_text() if not self.nodata and not any( rt in self.description for rt in @@ -38,6 +35,23 @@ class FloorAttributes(Definitions): ): raise ValueError('Invalid description') + def translate_welsh_text(self): + + uvalue_match = 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) + self.description = f"average thermal transmittance {uvalue} W/m-¦K" + + else: + translation = self.WELSH_TEXT.get(self.description) + if translation: + self.nodata = False + self.description = translation + def process(self) -> Dict[str, Union[str, bool, int, None]]: if self.nodata: diff --git a/model_data/epc_attributes/HotWaterAttributes.py b/model_data/epc_attributes/HotWaterAttributes.py index 8d118751..603b9fff 100644 --- a/model_data/epc_attributes/HotWaterAttributes.py +++ b/model_data/epc_attributes/HotWaterAttributes.py @@ -98,7 +98,8 @@ class HotWaterAttributes(Definitions): "ogçör brif system, adfer gwres nwyon ffliw": "from main system, flue gas heat recovery", "bwyler/cylchredydd nwy": "gas boiler/circulator", "ogçör brif system, dim thermostat ar y silindr": "from main system, no cylinder thermostat", - "twymwr tanddwr, an-frig": "electric immersion, off-peak" + "twymwr tanddwr, an-frig": "electric immersion, off-peak", + "ogçör brif system, gydag ynnigçör haul": "from main system, plus solar" } def __init__(self, description: str): diff --git a/model_data/epc_attributes/MainheatAttributes.py b/model_data/epc_attributes/MainheatAttributes.py index 119c029e..75c4c304 100644 --- a/model_data/epc_attributes/MainheatAttributes.py +++ b/model_data/epc_attributes/MainheatAttributes.py @@ -14,6 +14,7 @@ class MainHeatAttributes(Definitions): # buildings. The main output of micro-CHP systems is heat, with electricity generation as a secondary output. "micro-cogeneration", "solar assisted heat pump", + "exhaust source heat pump", ] FUEL_TYPES = ["electric", "mains gas", "wood logs", "LPG", "coal", "oil", "wood pellets", "anthracite", "dual fuel mineral and wood", "smokeless fuel", "lpg"] diff --git a/model_data/epc_attributes/RoofAttributes.py b/model_data/epc_attributes/RoofAttributes.py index 8d50db77..c86b52f2 100644 --- a/model_data/epc_attributes/RoofAttributes.py +++ b/model_data/epc_attributes/RoofAttributes.py @@ -11,7 +11,8 @@ 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)" + "(annedd arall uwchben)": "(another dwelling above)", + "yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)": "Flat, limited insulation (assumed)", } def __init__(self, description: str): 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 8e7592b9..3335f5a0 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 @@ -145,5 +145,10 @@ hotwater_cases = [ {'original_description': 'Twymwr tanddwr, an-frig', 'heater_type': 'electric immersion', 'system_type': None, 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None, 'tariff_type': 'off-peak', 'extra_features': None, 'chp_systems': None, 'distribution_system': None, 'no_system_present': None, - 'assumed': False, "appliance": None} + 'assumed': False, "appliance": None}, + {'original_description': 'OGÇÖr brif system, gydag ynniGÇÖr haul', 'heater_type': None, + 'system_type': 'from main system', + 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None, 'tariff_type': None, + 'extra_features': 'plus solar', 'chp_systems': None, 'distribution_system': None, 'no_system_present': None, + 'assumed': False, "appliance": 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 b7454eb3..7957ab63 100644 --- a/model_data/tests/test_data/test_roof_attributes_cases.py +++ b/model_data/tests/test_data/test_roof_attributes_cases.py @@ -353,5 +353,9 @@ clean_roof_test_cases = [ {'original_description': 'Ar oleddf, dim inswleiddio (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': 'none'} + 'insulation_thickness': 'none'}, + {'original_description': 'Yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)', 'thermal_transmittance': None, + 'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': False, 'is_loft': False, 'is_flat': True, + 'is_thatched': False, 'is_at_rafters': False, 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True, + 'insulation_thickness': 'below average'} ]