pass averages to lighting cleaner

This commit is contained in:
Khalim Conn-Kowlessar 2025-08-28 23:17:15 +01:00
parent 2acf5c3534
commit 4bc208b8fd
3 changed files with 8 additions and 6 deletions

View file

@ -9,6 +9,7 @@ from etl.epc.Dataset import TrainingDataset
from etl.epc.Record import EPCRecord
from etl.epc.settings import LATEST_FIELD, MANDATORY_FIXED_FEATURES
from etl.epc_clean.epc_attributes.all_cleaners import all_cleaner_map
from etl.epc_clean.tests.test_lighting_attributes import averages
from utils.logger import setup_logger
from utils.s3 import read_dataframe_from_s3_parquet
from etl.epc.settings import DATA_ANOMALY_MATCHES
@ -624,7 +625,10 @@ class Property:
if len(attributes) == 0:
# We attempt to perform the clean on the fly
cleaner_cls = all_cleaner_map[description]
cleaner_cls = cleaner_cls(self.data[description])
if description == "lighting-description":
cleaner_cls = cleaner_cls(self.data[description], averages=None)
else:
cleaner_cls = cleaner_cls(self.data[description])
processed = {
"original_description": self.data[description],
"clean_description": cleaner_cls.description.replace(

View file

@ -174,11 +174,6 @@ for p in input_properties:
input_properties
]
for p in tqdm(input_properties):
# TEMP
p.DATA_ANOMALY_MATCHES = DATA_ANOMALY_MATCHES
p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=mocked_kwh_predictions)
# Run the recommendations
recommendations = {}
recommendations_scoring_data = []

View file

@ -28,6 +28,9 @@ class LightingAttributes(Definitions):
self.nodata = (not description) or (description in self.DATA_ANOMALY_MATCHES) or (
description in self.OBSERVED_ERRORS) or (description == "SAP05:Lighting")
if description == "SAP05:Lighting":
self.description = description # Reset self.description
def welsh_translation_search(self):
"""
For welsh text describing the percentage of low energy lighting, we match the regular