working on thrive and added method for calculating led costs given an isntaller quote

This commit is contained in:
Khalim Conn-Kowlessar 2025-05-16 15:19:22 +01:00
parent ff83aef2b3
commit cf00d38b15
3 changed files with 113 additions and 2 deletions

View file

@ -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
)

View file

@ -0,0 +1,97 @@
"""
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)

View file

@ -601,11 +601,24 @@ 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