diff --git a/backend/ml_models/Valuation.py b/backend/ml_models/Valuation.py index 92d019a4..4a720fc8 100644 --- a/backend/ml_models/Valuation.py +++ b/backend/ml_models/Valuation.py @@ -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") diff --git a/etl/costs/app.py b/etl/costs/app.py index 1ecbbb5f..98a324bc 100644 --- a/etl/costs/app.py +++ b/etl/costs/app.py @@ -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 ] ) diff --git a/recommendations/Costs.py b/recommendations/Costs.py index c9ead002..e9fe4495 100644 --- a/recommendations/Costs.py +++ b/recommendations/Costs.py @@ -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 diff --git a/recommendations/LightingRecommendations.py b/recommendations/LightingRecommendations.py new file mode 100644 index 00000000..48bb2c0f --- /dev/null +++ b/recommendations/LightingRecommendations.py @@ -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)