added in extra shit to output

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-14 18:25:50 +00:00
parent 9b255029b3
commit 3b65a71793

View file

@ -5200,6 +5200,22 @@ def fml_analysis(loader):
"Cavity wall, as built, partial insulation (assumed)"
]
codes = [
"HA39", "HA14", "HA24", "HA15", "HA32", "HA28", "HA6", "HA1", "HA7",
"HA16", "HA107", "HA25", "HA50", "HA41", "HA48", "HA2", "HA63", "HA12",
"HA117", "HA13", "HA35", "HA34", "HA56", "HA19", "HA18", "HA9", "HA27",
"HA30", "HA31", "HA54", "HAXX", "HA49", "HAXXX"
]
values = [
706, 2161, 1053, 793, 0, 656, 1200, 1647, 4248, 2703, 1087, 1876, 2135,
1078, 775, 538, 518, 401, 466, 2627, 98, 1050, 524, 191, 538, 384, 204,
281, 422, 74, 313, 71, 6
]
# Create a dictionary mapping
remaining_eligible_mapping = dict(zip(codes, values))
results = []
for ha_name in has_bruh:
@ -5207,6 +5223,7 @@ def fml_analysis(loader):
loader.december_figures["HA Name"] == ha_name
].copy()
original_remaining = original_figures["ECO4 remaining"].values[0]
postcode_list_remaining = remaining_eligible_mapping[ha_name]
# Read in the epc data
asset_list = loader.data[ha_name]["asset_list"].copy()
@ -5271,7 +5288,7 @@ def fml_analysis(loader):
raise Exception("SOMETHING WENT WRONG")
if any(fuck_this["ECO Eligibility"].str.contains("subject to archetype")):
blah
raise Exception("DO THE DAMN ARCHETYPE CHECK BRO")
# clean roof insulation
fuck_this["roof_insulation_thickness"] = fuck_this["roof_insulation_thickness"].fillna("0")
@ -5313,6 +5330,13 @@ def fml_analysis(loader):
(no_ciga_check_needed["current-energy-efficiency"].astype(float) <= 80)
]
# For anything not needing a CIGA check, some of it will be GBIS
no_ciga_check_needed_eligible_gbis = no_ciga_check_needed[
(no_ciga_check_needed["walls-description"].isin(no_ciga_cavity_descriptions)) &
(no_ciga_check_needed["current-energy-efficiency"].astype(float) <= 80) &
(~no_ciga_check_needed["asset_list_row_id"].isin(no_ciga_check_needed_eligible["asset_list_row_id"].values))
]
# Characterise no CIGA check needed
# TODO: WHAT ABOUT PASSED CIGA - don't need to apply the further deduction
@ -5359,6 +5383,8 @@ def fml_analysis(loader):
# Need to add on the non-ciga
total_expectation = ciga_check_expectation + without_ciga_expectation + passed_ciga_expectation
total_gbis_expectation = no_ciga_check_needed_eligible_gbis.shape[0]
if proportion_with_survey < 100:
# We estimate the rest
without_survey_needing_ciga = fuck_this[
@ -5395,12 +5421,17 @@ def fml_analysis(loader):
if without_survey_eco4.empty:
without_survey_eco4_expected = 0
without_survey_gbis_expected = 0
else:
# We apply the same conversion rate as the properties with a survey
without_survey_eco4_expected = np.round(
without_survey_eco4.shape[0] * (without_ciga_expectation / no_ciga_check_needed.shape[0])
)
without_survey_gbis_expected = np.round(
without_survey_eco4.shape[0] * (total_gbis_expectation / no_ciga_check_needed.shape[0])
)
total_expectation = (
total_expectation +
without_survey_without_ciga_expected +
@ -5408,6 +5439,8 @@ def fml_analysis(loader):
without_survey_eco4_expected
)
total_gbis_expectation = total_gbis_expectation + without_survey_gbis_expected
surveys = loader.data[ha_name]["survey_list"]
sold_now = 0
if not surveys.empty:
@ -5421,20 +5454,22 @@ def fml_analysis(loader):
{
"HA Name": ha_name,
"Original ECO4 Estimate - Remaining": original_remaining,
"Postcode List - Remaining": postcode_list_remaining,
"Of which sold": sales_since_nov,
"Of which ECO4 Eligible - Remaining": int(total_expectation),
"Of which GBIS Eligibile - Remaining": int(total_gbis_expectation),
"Proportion with a survey": proportion_with_survey,
}
)
results_df = pd.DataFrame(results)
results_df["Delta vs November"] = 100 * (
results_df["Of which ECO4 Eligible - Remaining"] - results_df["Original ECO4 Estimate - Remaining"]
) / results_df["Original ECO4 Estimate - Remaining"]
# results_df["Delta vs November"] = 100 * (
# results_df["Of which ECO4 Eligible - Remaining"] - results_df["Original ECO4 Estimate - Remaining"]
# ) / results_df["Original ECO4 Estimate - Remaining"]
# TODO: Split into high and low confidence?
#
# TODO: Add in estimated GBIS (for eco jobs, of which look like gbis)
# TODO: Change the left hand side number for our post CIGA estimates
def app():