mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handing facts and figures for ha28
This commit is contained in:
parent
0909b811ee
commit
87c77e53c0
1 changed files with 53 additions and 39 deletions
|
|
@ -398,6 +398,8 @@ class DataLoader:
|
|||
return "CIGA Checks"
|
||||
elif "CIGA checks" in workbook.sheetnames:
|
||||
return "CIGA checks"
|
||||
elif "CIGA check" in workbook.sheetnames:
|
||||
return "CIGA check"
|
||||
else:
|
||||
return "CIGA"
|
||||
|
||||
|
|
@ -1318,14 +1320,16 @@ class DataLoader:
|
|||
"ECO4 A/W": "ECO4",
|
||||
"ECO4 GBIS (ECO+)": "GBIS",
|
||||
"ECO4 GBIS (ECO+) JJC UNDER 73m²": "GBIS",
|
||||
"ECO4 AFFORDABLE WARMTH": "ECO4"
|
||||
"ECO4 AFFORDABLE WARMTH": "ECO4",
|
||||
"Affordable Warmth": "ECO4"
|
||||
}
|
||||
|
||||
eco_eligibility_map = {
|
||||
"not eligble": "not eligible",
|
||||
"eco 4(subject to ciga)": "eco4 (subject to ciga)",
|
||||
"eco4 (subject to ciga/archetype check": "eco4 (subject to ciga)",
|
||||
"eco4 (subject to archetype check)": "eco4"
|
||||
"eco4 (subject to archetype check)": "eco4",
|
||||
"eco4 (subject to ciga/archetype)": "eco4 (subject to ciga)",
|
||||
}
|
||||
|
||||
ha_facts_and_figures = []
|
||||
|
|
@ -1384,46 +1388,56 @@ class DataLoader:
|
|||
sales_report = {}
|
||||
if not survey_list.empty:
|
||||
scheme_column = survey_list.columns[0]
|
||||
# We clean up the survey list installation or cancelled
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list["INSTALLED OR CANCELLED"].str.lower()
|
||||
# Remove all punctuation
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list["installed_or_cancelled_clean"].str.replace(
|
||||
r'[^\w\s]', '', regex=True
|
||||
)
|
||||
# Remove double spaces
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list["installed_or_cancelled_clean"].str.replace(
|
||||
r'\s+', ' ', regex=True
|
||||
)
|
||||
# Remove trailing spaces
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list["installed_or_cancelled_clean"].str.strip()
|
||||
|
||||
# Remap the values in the scheme column
|
||||
survey_list[scheme_column] = survey_list[scheme_column].replace(scheme_map)
|
||||
# We clean up the survey list installation or cancelled
|
||||
if "INSTALLED OR CANCELLED" in survey_list.columns:
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list["INSTALLED OR CANCELLED"].str.lower()
|
||||
# Remove all punctuation
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list[
|
||||
"installed_or_cancelled_clean"].str.replace(
|
||||
r'[^\w\s]', '', regex=True
|
||||
)
|
||||
# Remove double spaces
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list[
|
||||
"installed_or_cancelled_clean"].str.replace(
|
||||
r'\s+', ' ', regex=True
|
||||
)
|
||||
# Remove trailing spaces
|
||||
survey_list["installed_or_cancelled_clean"] = survey_list[
|
||||
"installed_or_cancelled_clean"].str.strip()
|
||||
|
||||
survey_list["installation_status"] = None
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["installed", "installed see notes"]),
|
||||
"installed",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["cancelled"]),
|
||||
"cancelled",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
# Find partial installations
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].str.contains("still to be installed"),
|
||||
"partially installed",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
# Find partial cancellations
|
||||
# TODO: We might have more indications of partial cancellations
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["loft cancelled"]),
|
||||
"partially cancelled",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
survey_list["installation_status"] = None
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["installed", "installed see notes"]),
|
||||
"installed",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["cancelled"]),
|
||||
"cancelled",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
# Find partial installations
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].str.contains("still to be installed"),
|
||||
"partially installed",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
# Find partial cancellations
|
||||
# TODO: We might have more indications of partial cancellations
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list["installed_or_cancelled_clean"].isin(["loft cancelled"]),
|
||||
"partially cancelled",
|
||||
survey_list["installation_status"]
|
||||
)
|
||||
else:
|
||||
# We have some examples, e.g. HA28, where we do not have the installed or cancelled column
|
||||
survey_list["installation_status"] = np.where(
|
||||
survey_list['INSTALL/ CANCELLATION DATE'].str.lower().str.contains("cancelled"),
|
||||
"cancelled",
|
||||
"installed",
|
||||
)
|
||||
|
||||
# Finally, for other cases, we set the status to "in progress"
|
||||
survey_list["installation_status"] = survey_list["installation_status"].fillna("in progress")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue