Added low energy lighting to costs etl

This commit is contained in:
Khalim Conn-Kowlessar 2023-11-28 15:48:26 +00:00
parent 7ebfb3b99c
commit e441e5f018
4 changed files with 56 additions and 0 deletions

View file

@ -25,6 +25,8 @@ class PropertyValuation:
def estimate(cls, property_instance, target_epc):
current_value = cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn)
raise ValueError("NEED TO UPDATE THIS")
if not current_value:
raise ValueError("Have not implemented valuation for this property")

View file

@ -73,6 +73,7 @@ def app():
suspended_floor_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="suspended_floor_insulation", header=0)
solid_floor_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="solid_floor_insulation", header=0)
ewi_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="external_wall_insulation", header=0)
lel_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="low_energy_lighting", header=0)
# Form a single table to be uploaded
costs = pd.concat(
@ -83,6 +84,7 @@ def app():
suspended_floor_costs,
solid_floor_costs,
ewi_costs,
lel_costs
]
)

View file

@ -577,3 +577,21 @@ class Costs:
"labour_days": labour_days,
"labour_cost": labour_costs
}
def low_energy_lighting(self, number_of_lights, number_current_lel_lights, material):
"""
Calculates the total cost for low energy lighting based on material and labor costs,
including contingency, preliminaries, profit, and VAT.
:param number_of_lights: Int, number of light
:param number_current_lel_lights: Int, number of low energy lights currently installed in the home
:material: Dict, material data containing costs of fittings
"""
# If there are no lights fitted in the property, we increase the contingency in case there are potential wiring
# blockers
if number_current_lel_lights == 0:
contingency = self.HIGH_RISK_CONTINGENCY
else:
contingency = self.CONTINGENCY

View file

@ -0,0 +1,34 @@
from backend.Property import Property
from typing import List
class LightingRecommendations:
def __init__(self, property_instance: Property, materials: List):
"""
:param property_instance: Instance of the Property class, for the home associated to property_id
:param materials: List of materials to be used in the recommendations
"""
self.property = property_instance
self.materials = materials
def recommend(self):
"""
This method will check if there are any lighting fittings that aren't low energy.
If there are, the will recommend fitting the rest of the outlets with low energy lighting fittings
:return:
"""
if self.property.lighting["low_energy_proportion"] == 100:
return
number_lighting_outlets = self.property.number_lighting_outlets
# Number non lel outlets
number_non_lel_outlets = number_lighting_outlets - (
self.property.lighting["low_energy_proportion"] * number_lighting_outlets
)
number_non_lel_outlets = round(number_non_lel_outlets)