From 854c784bd9c4341546ea57d2a0549b40552fbd92 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 25 Oct 2024 19:32:15 +0100 Subject: [PATCH] working on the costing methodology --- etl/customers/aiha/xml_extraction.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/etl/customers/aiha/xml_extraction.py b/etl/customers/aiha/xml_extraction.py index 29ac44c6..4d4705c9 100644 --- a/etl/customers/aiha/xml_extraction.py +++ b/etl/customers/aiha/xml_extraction.py @@ -3,6 +3,7 @@ from io import BytesIO import pandas as pd +from etl.ownership.config import EXCLUDED_UPRNS from etl.xml_survey_extraction.XmlParser import XmlParser SURVEY_FOLDER_PATH = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/AIHA/RESIDENT SURVEYS" @@ -91,6 +92,7 @@ def main(): # - AIH001-11 - The layout of this unit is confusing, is there roof access? # - AIH001-12 - Why was there not access to the cylinder? # - AIH001-12 - Is the need to draught proofing due to the windows? + # - AIH001-04 - is the flat roof area correct? recommended_measures = [ { @@ -132,6 +134,7 @@ def main(): { "measure": "Loft Insulation", "description": "300mm loft insulation", + "floor_area": 80, # Based on area of 1st floor "sap_points": 8, "ending_sap": 61 }, @@ -152,6 +155,7 @@ def main(): { "measure": "Flat Roof Insulation", "description": "100mm flat roof insulation", + "floor_area": 39.1482, # based on area of top floor "sap_points": 4, "ending_sap": 52 }, @@ -185,6 +189,7 @@ def main(): { "measure": "Flat Roof Insulation", "description": "100mm flat roof insulation", + "floor_area": 49.48, # based on area of top floor "sap_points": 5, "ending_sap": 59, }, @@ -256,6 +261,7 @@ def main(): { "measure": "Loft Insulation", "description": "300mm loft insulation", + "floor_area": 54.2864, # Based on area of top floor "sap_points": 2, "ending_sap": 58, }, @@ -390,6 +396,7 @@ def main(): { "measure": "Flat Roof Insulation", "description": "100mm flat roof insulation", + "floor_area": 33.06, # Based on area of the extension "sap_points": 2, "ending_sap": 61, }, @@ -445,7 +452,8 @@ def main(): }, { "measure": "Loft Insulation", - "description": "300mm loft insulation", + "description": "300mm loft insulation", # Based on area of main building + "floor_area": 59.20, "sap_points": 1, "ending_sap": 69, }, @@ -511,10 +519,18 @@ def main(): 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 + continue - blah + if measure_unit == "floor_m2": + floor_area = measure["floor_area"] + measure["Total Cost"] = float(measure_pricing["unit_price"].values[0]) * floor_area + continue - measure["total"] = pricing_data[pricing_data["item"] == measure["measure"]]["unit_price"].values[0] + if measure_unit == "hlp_m2": + hlp = measure["hlp"] + measure["Total Cost"] = float(measure_pricing["unit_price"].values[0]) * hlp + + raise Exception("Unknown unit type") # Step 1: Normalize the recommended_measures data into a DataFrame. normalized_measures = []