mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Fixing some formatting bugs
This commit is contained in:
parent
721bfb19fc
commit
f9d1a90689
1 changed files with 48 additions and 38 deletions
|
|
@ -2820,6 +2820,8 @@ def forecast_remaining_sales(loader):
|
|||
|
||||
results = []
|
||||
for ha_name, input_data in loader.data.items():
|
||||
if ha_name == "HA16":
|
||||
dew
|
||||
|
||||
# Original warmfront figures - ECO4
|
||||
original_warmfront_estimates = december_figures[december_figures["HA Name"] == ha_name]
|
||||
|
|
@ -2991,8 +2993,9 @@ def forecast_remaining_sales(loader):
|
|||
("ECO4 pre-ciga", "", "Total - £", ""): eco4_pre_ciga_revenue,
|
||||
("ECO4 pre-ciga", "", "Remaining - £", ""): eco4_pre_ciga_remaining_revenue,
|
||||
# ECO4 - asset list, post ciga, total
|
||||
("ECO4 post-ciga", "", "Estimated total eligible - #", ""): eco4_post_ciga_total_results[
|
||||
"ECO4 - post CIGA - #"],
|
||||
("ECO4 post-ciga", "", "Estimated total eligible - #", "ECO4 total (post-ciga)"):
|
||||
eco4_post_ciga_total_results[
|
||||
"ECO4 - post CIGA - #"],
|
||||
("ECO4 post-ciga", "", "Estimated total eligible - £", ""): eco4_post_ciga_total_results[
|
||||
"ECO4 - post CIGA - £"],
|
||||
("ECO4 post-ciga", "", "Delta vs original estimate - %", ""): eco4_delta_vs_original_estimate,
|
||||
|
|
@ -3059,7 +3062,7 @@ def forecast_remaining_sales(loader):
|
|||
# For the delta columns, we calculate the delta on the totals
|
||||
totals_row[("ECO4 post-ciga", "", "Delta vs original estimate - %", "")] = round(
|
||||
100 * (
|
||||
totals_row[("ECO4 post-ciga", "", "Estimated total eligible - #", "")] -
|
||||
totals_row[("ECO4 post-ciga", "", "Estimated total eligible - #", "ECO4 total (post-ciga)")] -
|
||||
totals_row[("", "Original Warmfront estimate", "Total - #", "ECO4 - November")]
|
||||
) / totals_row[("", "Original Warmfront estimate", "Total - #", "ECO4 - November")],
|
||||
1
|
||||
|
|
@ -3093,9 +3096,11 @@ def forecast_remaining_sales(loader):
|
|||
# GBIS Headlines
|
||||
headline_gbis_original_remaining = totals_row[("GBIS original", "", "Remaining - #", "")]
|
||||
headline_gbis_original_remaining_revenue = totals_row[("GBIS original", "", "Remaining - £", "")]
|
||||
headline_gbis_postcode_list_remaining = totals_row[("", "Warmfront post code list", "Remaining - #", "GBIS total")]
|
||||
headline_gbis_postcode_list_remaining = totals_row[
|
||||
("GBIS Postcode list", "Warmfront post code list", "Remaining - #", "GBIS total")
|
||||
]
|
||||
headline_gbis_postcode_list_remaining_revenue = totals_row[
|
||||
("", "Warmfront post code list", "Remaining - £", "GBIS total")
|
||||
("GBIS Postcode list", "Warmfront post code list", "Remaining - £", "GBIS total")
|
||||
]
|
||||
headline_gbis_delta = 100 * (
|
||||
(headline_gbis_postcode_list_remaining - headline_gbis_original_remaining) /
|
||||
|
|
@ -3205,29 +3210,33 @@ def forecast_remaining_sales(loader):
|
|||
},
|
||||
{
|
||||
("", "", "", "HA Name"): "GBIS rate",
|
||||
("ECO4 original", "", "Remaining - #", ""): "£" + str(gbis_rate)
|
||||
("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str(gbis_rate)
|
||||
},
|
||||
{
|
||||
("", "", "", "HA Name"): "Median CIGA pass rate",
|
||||
("ECO4 original", "", "Total - £", ""): str(round(median_ciga_success_rate * 100, 1)) + "%",
|
||||
("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(
|
||||
round(median_ciga_success_rate * 100, 1)) + "%",
|
||||
},
|
||||
{
|
||||
("", "", "", "HA Name"): "Maximum allowed CIGA pass rate",
|
||||
("ECO4 original", "", "Total - £", ""): str(round(maximum_ciga_conversion * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - £",
|
||||
("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(
|
||||
round(maximum_ciga_conversion * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - #",
|
||||
""): "- Maximum allowed CIGA conversion for HAs without CIGA checks We do not allow above this to be "
|
||||
"conservative"
|
||||
},
|
||||
{
|
||||
("", "", "", "HA Name"): "Median ECO4 (no CIGA) sales conversion rate",
|
||||
("ECO4 original", "", "Total - £", ""): str(round(median_eco4_to_install * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - £",
|
||||
("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(
|
||||
round(median_eco4_to_install * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - #",
|
||||
""): " - Sales conversion rate for a ECO4 property that didn't need a CIGA check. Job must not cancel"
|
||||
},
|
||||
{
|
||||
("", "", "", "HA Name"): "Median ECO4 (subect to CIGA) sales conversion rate",
|
||||
("ECO4 original", "", "Total - £", ""): str(round(median_ciga_pass_to_install * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - £",
|
||||
("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(
|
||||
round(median_ciga_pass_to_install * 100, 1)) + "%",
|
||||
("ECO4 original", "", "Remaining - #",
|
||||
""): " - Sales conversion rate for a ECO4 property that passed a CIGA check. Job must not cancel"
|
||||
}
|
||||
]
|
||||
|
|
@ -3236,6 +3245,7 @@ def forecast_remaining_sales(loader):
|
|||
[
|
||||
results,
|
||||
pd.DataFrame([totals_row]),
|
||||
blank_row,
|
||||
pd.DataFrame(headlines),
|
||||
blank_row,
|
||||
blank_row,
|
||||
|
|
@ -3291,32 +3301,32 @@ def app():
|
|||
loader.load()
|
||||
loader.ha_facts_and_figures()
|
||||
|
||||
forecast_remaining_sales(loader)
|
||||
|
||||
# We load in the additional data required to perform the analysis
|
||||
cleaned = read_from_s3(
|
||||
s3_file_name="cleaned_epc_data/cleaned.bson",
|
||||
bucket_name="retrofit-data-dev"
|
||||
)
|
||||
cleaned = msgpack.unpackb(cleaned, raw=False)
|
||||
cleaned = patch_cleaned(cleaned)
|
||||
|
||||
cleaning_data = read_dataframe_from_s3_parquet(
|
||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
||||
)
|
||||
created_at = datetime.now().isoformat()
|
||||
|
||||
photo_supply_lookup, floor_area_decile_thresholds = SolarPhotoSupply.load(bucket="retrofit-data-dev")
|
||||
|
||||
outputs = get_epc_data(
|
||||
loader=loader,
|
||||
cleaned=cleaned,
|
||||
cleaning_data=cleaning_data,
|
||||
created_at=created_at,
|
||||
photo_supply_lookup=photo_supply_lookup,
|
||||
floor_area_decile_thresholds=floor_area_decile_thresholds,
|
||||
pull_data=pull_data
|
||||
)
|
||||
|
||||
analyse_ha_data(outputs, loader)
|
||||
# cleaned = read_from_s3(
|
||||
# s3_file_name="cleaned_epc_data/cleaned.bson",
|
||||
# bucket_name="retrofit-data-dev"
|
||||
# )
|
||||
# cleaned = msgpack.unpackb(cleaned, raw=False)
|
||||
# cleaned = patch_cleaned(cleaned)
|
||||
#
|
||||
# cleaning_data = read_dataframe_from_s3_parquet(
|
||||
# bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
||||
# )
|
||||
# created_at = datetime.now().isoformat()
|
||||
#
|
||||
# photo_supply_lookup, floor_area_decile_thresholds = SolarPhotoSupply.load(bucket="retrofit-data-dev")
|
||||
#
|
||||
# outputs = get_epc_data(
|
||||
# loader=loader,
|
||||
# cleaned=cleaned,
|
||||
# cleaning_data=cleaning_data,
|
||||
# created_at=created_at,
|
||||
# photo_supply_lookup=photo_supply_lookup,
|
||||
# floor_area_decile_thresholds=floor_area_decile_thresholds,
|
||||
# pull_data=pull_data
|
||||
# )
|
||||
|
||||
# import pickle
|
||||
# with open("ha_analysis.pickle", "wb") as f:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue