From 0594ab7a7eed59230b991a5514826ed7cdc5ca7e Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 21 Jul 2023 10:40:47 +0100 Subject: [PATCH] windows and lighting debugged --- model_data/epc_attributes/WindowAttributes.py | 9 +++++++++ .../tests/test_data/test_lighting_attributes_cases.py | 3 ++- .../tests/test_data/test_window_attributes_cases.py | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/model_data/epc_attributes/WindowAttributes.py b/model_data/epc_attributes/WindowAttributes.py index 8b087cb1..836d3dd0 100644 --- a/model_data/epc_attributes/WindowAttributes.py +++ b/model_data/epc_attributes/WindowAttributes.py @@ -17,6 +17,10 @@ class WindowAttributes(BaseUtility): "throughout": "full" } + WELSH_TEXT = { + "gwydrau dwbl llawn": "full double glazing", + } + def __init__(self, description: str): self.description: str = clean_description(description.lower()) @@ -24,6 +28,11 @@ class WindowAttributes(BaseUtility): # and indicate there was no data 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: if not any( rt in self.description for rt in diff --git a/model_data/tests/test_data/test_lighting_attributes_cases.py b/model_data/tests/test_data/test_lighting_attributes_cases.py index 57418aa1..7ddec1d3 100644 --- a/model_data/tests/test_data/test_lighting_attributes_cases.py +++ b/model_data/tests/test_data/test_lighting_attributes_cases.py @@ -29,5 +29,6 @@ test_cases = [ {'original_description': 'Below average lighting efficiency', 'low_energy_proportion': 0.25}, {'original_description': 'Excellent lighting efficiency', 'low_energy_proportion': 1.0}, {'original_description': 'Low energy lighting in 2% of fixed outlets', 'low_energy_proportion': 0.02}, - {'original_description': 'No Low energy lighting', 'low_energy_proportion': 0} + {'original_description': 'No Low energy lighting', 'low_energy_proportion': 0}, + {'original_description': 'Goleuadau ynni-isel mewn 60% oGÇÖr mannau gosod', 'low_energy_proportion': 0.6} ] diff --git a/model_data/tests/test_data/test_window_attributes_cases.py b/model_data/tests/test_data/test_window_attributes_cases.py index c3b944fd..41162e5f 100644 --- a/model_data/tests/test_data/test_window_attributes_cases.py +++ b/model_data/tests/test_data/test_window_attributes_cases.py @@ -35,5 +35,7 @@ windows_cases = [ {'original_description': 'Some secondary glazing', 'has_glazing': True, 'glazing_coverage': 'partial', 'glazing_type': 'secondary', 'no_data': False}, {'original_description': 'Some triple glazing', 'has_glazing': True, 'glazing_coverage': 'partial', - 'glazing_type': 'triple', 'no_data': False} + 'glazing_type': 'triple', 'no_data': False}, + {'original_description': 'Gwydrau dwbl llawn', 'has_glazing': True, 'glazing_coverage': 'full', + 'glazing_type': 'double', 'no_data': False} ]