mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
29 lines
924 B
Python
29 lines
924 B
Python
import re
|
|
from model_data.epc_attributes.attribute_utils import clean_description
|
|
|
|
|
|
class LightingAttributes:
|
|
def __init__(self, description, averages):
|
|
self.description: str = clean_description(description.lower())
|
|
self.averages = averages
|
|
|
|
def low_energy_proportions(self):
|
|
|
|
description = self.description
|
|
|
|
if 'no low energy lighting' in description:
|
|
return 0
|
|
|
|
if "all fixed outlets" in description:
|
|
return 1
|
|
|
|
if ('good lighting efficiency' in description) or ('excellent lighting efficiency' in description) or \
|
|
('below average lighting efficiency' in description):
|
|
return self.averages[self.averages == description]["low-energy-lighting"].values[0]
|
|
|
|
match = re.search(r'\d+', description)
|
|
if match:
|
|
proportion = int(match.group()) / 100.0
|
|
return proportion
|
|
|
|
return 0
|