mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Merge pull request #440 from Hestia-Homes/remote-assessment-api
Fixing led costing methodology
This commit is contained in:
commit
7c5eaa698c
3 changed files with 131 additions and 5 deletions
|
|
@ -138,6 +138,7 @@ not_seen["Note"] = np.where(
|
|||
not_seen["Note"] = not_seen["Note"].fillna("Property not in original lists")
|
||||
|
||||
# Store
|
||||
not_seen = os.path.join(
|
||||
data_folder, "Reconciled Programme/Properties not inspected by Domna.xlsx"
|
||||
not_seen.to_csv(
|
||||
os.path.join(data_folder, "Reconciled Programme/Properties not inspected by Domna.csv"),
|
||||
index=False
|
||||
)
|
||||
|
|
|
|||
114
etl/customers/thrive/Programme Analysis.py
Normal file
114
etl/customers/thrive/Programme Analysis.py
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
"""
|
||||
The Thrive programme has not been completed to specification. This script re-builds the programme and attempts to
|
||||
address the following concerns:
|
||||
- Which properties have been surveyed
|
||||
- Of the properties that have been surveyed, what has been installed
|
||||
- Which properties have been visited
|
||||
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
|
||||
# This is Thrive's list of properties and when they should have been surveyed
|
||||
thrive_tracker = pd.read_excel(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Thrive/Programme Reconciliation/Thrive Asset List - "
|
||||
"Standardised.xlsx",
|
||||
sheet_name="Tracker",
|
||||
header=2
|
||||
)
|
||||
|
||||
original_asset_list = pd.read_excel(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Thrive/Programme Reconciliation/Thrive Asset List.xlsx",
|
||||
header=0
|
||||
)
|
||||
|
||||
# Find properties that are on the thrive tracker that
|
||||
missed_properties = thrive_tracker[
|
||||
~thrive_tracker["UPRN"].astype(str).isin(original_asset_list["Client ref 1"].astype(str).values)
|
||||
].copy()
|
||||
|
||||
# We produce the complete list, with all of the columns we need, for data standardisation
|
||||
|
||||
original_columns = {
|
||||
"Client ref 1": "thrive_property_id",
|
||||
"Address": "full_address",
|
||||
"Address Line 1": "address_line_1",
|
||||
"Address Line 2": "address_line_2",
|
||||
"Address Line 3": "address_line_3",
|
||||
"Address Line 4": "address_line_4",
|
||||
"County": "county",
|
||||
"Postcode": "postcode",
|
||||
"Block Name": "block_reference",
|
||||
"Construction Year": "construction_year",
|
||||
"Age band (calculated)": "age_band_calculated",
|
||||
"Property type": "property_type",
|
||||
"Client property type 1": "detailed_property_type",
|
||||
"Client property type 2": "detailed_property_type_2",
|
||||
"bed count": "number_of_bedrooms",
|
||||
"Heating Type": "heating_type",
|
||||
"WFT Findings": "WFT Findings",
|
||||
"ECO Eligibility": "ECO Eligibility",
|
||||
}
|
||||
|
||||
original_asset_list = original_asset_list[original_columns.keys()].rename(columns=original_columns)
|
||||
original_asset_list["Data Source"] = "Thrive Tracker"
|
||||
|
||||
# We append on the missed properties, with the information we have
|
||||
# 'Unnamed: 0', 'Thrive Notes', 'Priority', 'UPRN', 'Short Address', '#',
|
||||
# 'Adress Line 1', 'Postcode', 'Property Type', 'Build Form',
|
||||
# 'Build year', 'Assumed mm ', 'SAP', 'Name', 'Primary Number',
|
||||
# 'Secondary Number', 'Email', 'Thrive use: Tenancy Number',
|
||||
# 'Special Requirements ', 'CIGA', 'Date CIGA check received',
|
||||
# 'Proposed Progamme', 'New Proposed Programme',
|
||||
# 'Missing from Route March?', 'Date Letters Sent (w.c)', 'Work Type',
|
||||
# 'Warmfront Survey Notes', 'Notes Reply (Thrive)', 'Loft Insulation',
|
||||
# 'Cost for Vents', 'Cavity Depth', 'Cavity Condition',
|
||||
# 'Date Submitted to installer', 'PRRN Number',
|
||||
# 'Loft insulation required? (Thrive)', 'Date booked ',
|
||||
# 'Completed\n(yes/no)', 'Date Completed',
|
||||
# 'Vents installed?\n(number and location)',
|
||||
# 'Loft Top Up\n(amount of insulation) ', 'CIGA Warranty Provided ',
|
||||
# 'Notes', 'Works Number', 'CW KGI Uploaded', 'Keystone Fan Added',
|
||||
# 'SA Cavity Condition Updated', 'SA Loft & Energy Updated',
|
||||
# 'PRRN Submitted '
|
||||
|
||||
missed_properties["Full Address"] = (
|
||||
missed_properties["#"].astype(str) + ", " +
|
||||
missed_properties["Adress Line 1"].astype(str) + ", " +
|
||||
missed_properties["Postcode"].astype(str)
|
||||
)
|
||||
missed_columns = {
|
||||
"UPRN": "thrive_property_id",
|
||||
"Full Address": "full_address",
|
||||
"Short Address": "address_line_1",
|
||||
"Postcode": "postcode",
|
||||
"Property Type": "property_type",
|
||||
"Build Form": "build_form",
|
||||
"Build year": "age_band_calculated",
|
||||
"Assumed mm ": "assumed_loft_insulation_thickness",
|
||||
"SAP": "sap_rating",
|
||||
}
|
||||
|
||||
missed_properties = missed_properties[missed_columns.keys()].rename(columns=missed_columns)
|
||||
missed_properties["WFT Findings"] = "Property Not Inspected"
|
||||
missed_properties["ECO Eligibility"] = "Property Not Inspected"
|
||||
missed_properties["Data Source"] = "Thrive Tracker"
|
||||
|
||||
master_list = pd.concat([missed_properties, original_asset_list], ignore_index=True)
|
||||
|
||||
# We were provided with a data update for a sample of properties. We update the data with this information
|
||||
data_update = pd.read_excel(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Thrive/Programme Reconciliation/Thrive Property List "
|
||||
"13_05.xlsx",
|
||||
header=0
|
||||
)
|
||||
|
||||
new_properties = data_update[~data_update["UPRN"].isin(master_list["thrive_property_id"].astype(str).values)]
|
||||
|
||||
|
||||
|
||||
data_update = = data_update[["UPRN", ""]]
|
||||
|
||||
# TODO: Flag the Thrive priorities and create a separate project code for these
|
||||
# TODO: Add the general project code
|
||||
# TODO: Add the thrive
|
||||
|
|
@ -601,21 +601,32 @@ class Costs:
|
|||
|
||||
# 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
|
||||
|
||||
if material["is_installer_quote"]:
|
||||
total_cost = material["total_cost"] * number_of_lights * (1 + contingency)
|
||||
|
||||
labour_hours = 1
|
||||
labour_days = (labour_hours / 8)
|
||||
|
||||
return {
|
||||
"total": total_cost,
|
||||
"labour_hours": labour_hours,
|
||||
"labour_days": labour_days,
|
||||
}
|
||||
|
||||
material_cost = material["material_cost"] * number_of_lights
|
||||
labour_cost = material["labour_cost"] * number_of_lights * self.labour_adjustment_factor
|
||||
|
||||
subtotal_before_profit = material_cost + labour_cost
|
||||
|
||||
contingency_cost = subtotal_before_profit * contingency
|
||||
preliminaries_cost = subtotal_before_profit * self.PRELIMINARIES
|
||||
profit_cost = subtotal_before_profit * self.PROFIT_MARGIN
|
||||
|
||||
subtotal_before_vat = subtotal_before_profit + contingency_cost + preliminaries_cost + profit_cost
|
||||
subtotal_before_vat = subtotal_before_profit + contingency_cost
|
||||
vat_cost = subtotal_before_vat * self.VAT_RATE
|
||||
total_cost = subtotal_before_vat + vat_cost
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue