Added wip labour adjustment table

This commit is contained in:
Khalim Conn-Kowlessar 2023-11-22 17:59:53 +00:00
parent 4848c2f9c1
commit 20bc4cab0e

View file

@ -1,5 +1,53 @@
import numpy as np
# Example - delete me
from backend.Property import Property
print("DELETE ME IN COSTS CLASS")
from epc_api.client import EpcClient
epc_client = EpcClient(auth_token=AUTH_TOKEN)
p1 = Property(
postcode="NN1 5JY",
address1="2 South Terrace",
epc_client=epc_client,
id=0
)
p2 = Property(
postcode="PO12 4TY",
address1="25 Albert Street",
epc_client=epc_client,
id=0
)
p1.search_address_epc()
p2.search_address_epc()
p1.set_basic_property_dimensions()
p2.set_basic_property_dimensions()
regional_labour_variations = [
{"Region": "Outer London (Spons 2023)", "Adjustment_Factor": 1.00},
{"Region": "Inner London", "Adjustment_Factor": 1.05},
{"Region": "South East", "Adjustment_Factor": 0.96},
{"Region": "South West", "Adjustment_Factor": 0.90},
{"Region": "East of England", "Adjustment_Factor": 0.93},
{"Region": "East Midlands", "Adjustment_Factor": 0.88},
{"Region": "West Midlands", "Adjustment_Factor": 0.87},
{"Region": "North East", "Adjustment_Factor": 0.83},
{"Region": "North West", "Adjustment_Factor": 0.88},
{"Region": "Yorkshire and Humberside", "Adjustment_Factor": 0.86},
{"Region": "Wales", "Adjustment_Factor": 0.88},
{"Region": "Scotland", "Adjustment_Factor": 0.88},
{"Region": "Northern Ireland", "Adjustment_Factor": 0.76}
]
county_map = {
"Northamptonshire": "East Midlands",
"Hampshire": "South East",
}
class Costs:
"""
@ -32,6 +80,16 @@ class Costs:
if not hasattr(property_instance, 'insulation_wall_area'):
raise ValueError("Property instance must have an 'insulation_wall_area' attribute")
self.property = property_instance
self.regional_labour_variations = regional_labour_variations
self.county = county_map.get(self.property.data["county"], None)
if self.county is None:
raise ValueError("County not found in county map")
self.labour_adjustment_factor = [
x["Adjustment_Factor"] for x in self.regional_labour_variations if
x["Region"] == self.county
][0]
def cavity_wall_insulation(self, material):
"""
@ -62,7 +120,7 @@ class Costs:
volume = 0.075 * wall_area
base_material_cost = material_cost_per_m2 * wall_area
labour_cost = material["labour_cost"] * wall_area
labour_cost = material["labour_cost"] * wall_area * self.labour_adjustment_factor
subtotal_before_profit = base_material_cost + labour_cost
@ -111,7 +169,7 @@ class Costs:
floor_area = self.property.floor_area
base_material_cost = material_cost_per_m2 * floor_area
labour_cost = material["labour_cost"] * floor_area
labour_cost = material["labour_cost"] * floor_area * self.labour_adjustment_factor
subtotal_before_profit = base_material_cost + labour_cost
@ -296,6 +354,8 @@ class Costs:
labour_costs = (demolition_labour_costs + insulation_labour_costs + vapour_barrier_labour_costs +
redecoration_labour_costs + finishes_labour_costs)
labour_costs = labour_costs * self.labour_adjustment_factor
materials_costs = (demolition_material_costs + insulation_material_costs + vapour_barrier_material_costs +
redecoration_material_costs + finishes_material_costs)