debugging roof attributes and adding additional test

This commit is contained in:
Khalim Conn-Kowlessar 2023-07-21 10:21:49 +01:00
parent 347e2c5617
commit 09515bd0c5
2 changed files with 16 additions and 2 deletions

View file

@ -8,6 +8,10 @@ class RoofAttributes(BaseUtility):
ROOF_TYPES = ['pitched', 'roof room', 'loft', 'flat', 'thatched', 'at rafters', 'assumed']
DWELLING_ABOVE = ["another dwelling above", "other premises above"]
WELSH_TEXT = {
"ar oleddf, dim inswleiddio": "pitched, no insulation",
}
def __init__(self, description: str):
"""
:param description: Description of the roof.
@ -15,7 +19,12 @@ class RoofAttributes(BaseUtility):
self.description: str = description.lower()
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 self.nodata and not any(
rt in self.description for rt in self.ROOF_TYPES + self.DWELLING_ABOVE + ["average thermal transmittance"]
):

View file

@ -344,5 +344,10 @@ clean_roof_test_cases = [
{'original_description': 'Thatched, with additional insulation', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': False, 'is_loft': False, 'is_flat': False,
'is_thatched': True, 'is_at_rafters': False, 'is_assumed': False, 'has_dwelling_above': False, 'is_valid': True,
'insulation_thickness': 'above average'}
'insulation_thickness': 'above average'},
{'original_description': 'Ar oleddf, dim inswleiddio', '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': False, 'has_dwelling_above': False, 'is_valid': True,
'insulation_thickness': 'none'}
]