mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
adding aiha costing
This commit is contained in:
parent
56fb33a64a
commit
93d375bc7a
1 changed files with 38 additions and 8 deletions
|
|
@ -65,7 +65,7 @@ def main():
|
||||||
|
|
||||||
# THis is the data we need for the AIHA project
|
# THis is the data we need for the AIHA project
|
||||||
measures_data = extracted_surveys[
|
measures_data = extracted_surveys[
|
||||||
["survey_key", "address", "postcode", "current-energy-efficiency", "current-energy-rating"]
|
["survey_key", "address", "postcode", "current-energy-efficiency", "current-energy-rating", "number_of_floors"]
|
||||||
]
|
]
|
||||||
measures_data = measures_data.sort_values("survey_key", ascending=True)
|
measures_data = measures_data.sort_values("survey_key", ascending=True)
|
||||||
|
|
||||||
|
|
@ -459,15 +459,20 @@ def main():
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
descs = []
|
scaffolding_data = [
|
||||||
for r in recommended_measures:
|
{
|
||||||
for m in r["recommended_measures"]:
|
"number_of_floors": 2,
|
||||||
descs.append(m["description"])
|
"price": 841,
|
||||||
descs = list(set(descs))
|
},
|
||||||
|
{
|
||||||
|
"number_of_floors": 3,
|
||||||
|
"price": 1077,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
# TODO - need to add scaffolding
|
# TODO - Need an update cost for cylinder insulation
|
||||||
pricing_data = [
|
pricing_data = [
|
||||||
{'item': '80mm cylinder insulation', 'unit_price': None, 'unit': 'unit'},
|
{'item': '80mm cylinder insulation', 'unit_price': 50, 'unit': 'unit'},
|
||||||
{'item': '100mm internal wall insulation', 'unit_price': 244.8, 'unit': 'hlp_m2'},
|
{'item': '100mm internal wall insulation', 'unit_price': 244.8, 'unit': 'hlp_m2'},
|
||||||
{'item': 'CWI to rdSAP default standard', 'unit_price': 14.21, 'unit': 'hlp_m2'},
|
{'item': 'CWI to rdSAP default standard', 'unit_price': 14.21, 'unit': 'hlp_m2'},
|
||||||
{'item': 'Window draught proofing improvements', 'unit_price': None, 'unit': 'unit'},
|
{'item': 'Window draught proofing improvements', 'unit_price': None, 'unit': 'unit'},
|
||||||
|
|
@ -486,6 +491,31 @@ def main():
|
||||||
]
|
]
|
||||||
pricing_data = pd.DataFrame(pricing_data)
|
pricing_data = pd.DataFrame(pricing_data)
|
||||||
|
|
||||||
|
for recommendation in recommended_measures:
|
||||||
|
|
||||||
|
property_data = measures_data[measures_data["survey_key"] == recommendation["survey_key"]].squeeze()
|
||||||
|
|
||||||
|
for measure in recommendation["recommended_measures"]:
|
||||||
|
measure_pricing = pricing_data[pricing_data["item"] == measure["description"]]
|
||||||
|
measure_unit = measure_pricing["unit"].values[0]
|
||||||
|
if measure_unit is None:
|
||||||
|
blah
|
||||||
|
continue
|
||||||
|
|
||||||
|
if measure_unit == "unit":
|
||||||
|
measure["Total Cost"] = float(measure_pricing["unit_price"].values[0])
|
||||||
|
continue
|
||||||
|
|
||||||
|
if measure_unit == "unit_needs_scaffolding":
|
||||||
|
# We need the number of floors
|
||||||
|
n_floors = property_data["number_of_floors"]
|
||||||
|
cost_of_scalfolding = [x for x in scaffolding_data if x["number_of_floors"] == n_floors][0]["price"]
|
||||||
|
measure["Total Cost"] = float(measure_pricing["unit_price"].values[0]) + cost_of_scalfolding
|
||||||
|
|
||||||
|
blah
|
||||||
|
|
||||||
|
measure["total"] = pricing_data[pricing_data["item"] == measure["measure"]]["unit_price"].values[0]
|
||||||
|
|
||||||
# Step 1: Normalize the recommended_measures data into a DataFrame.
|
# Step 1: Normalize the recommended_measures data into a DataFrame.
|
||||||
normalized_measures = []
|
normalized_measures = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue