further epc clean debuggin

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-08 12:29:40 +03:00
parent 1f7aa64ee7
commit 9bca33cf08
7 changed files with 41 additions and 15 deletions

View file

@ -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

View file

@ -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:

View file

@ -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):

View file

@ -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"]

View file

@ -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):

View file

@ -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},
]

View file

@ -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'}
]