From 028c2edce7ab951987379a7c653324e5863426ae Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 1 Mar 2024 20:48:43 +0000 Subject: [PATCH] Added headlines --- .../ha_15_32/ha_analysis_batch_3.py | 129 +++++++++++++++++- 1 file changed, 126 insertions(+), 3 deletions(-) diff --git a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py index 7da6bb3a..1c320f9c 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -2991,7 +2991,7 @@ def forecast_remaining_sales(loader): # ECO4 - asset list, post ciga, remaining ("ECO4 post-ciga", "", "Estimated remaining eligible - #", ""): eco4_post_ciga_remaining_results[ "ECO4 - post CIGA - #"], - ("ECO4 post-ciga", "", "Estimated remaining total eligible - £", ""): eco4_post_ciga_remaining_results[ + ("ECO4 post-ciga", "", "Estimated remaining eligible - £", ""): eco4_post_ciga_remaining_results[ "ECO4 - post CIGA - £"], ("ECO4 post-ciga", "", "Of which - confirmed (post CIGA or no CIGA required) - #", ""): eco4_post_ciga_remaining_results["Of which confirmed - #"], @@ -3046,6 +3046,126 @@ def forecast_remaining_sales(loader): blank_row = pd.DataFrame([{col: "" for col in results.columns}]) + # Put together a Warmfront original remaining ECO4 vs asset list remaining ECO4 and same for GBIS, as well as totals + + # ECO4 Headlines + headline_eco4_original_remaining = totals_row[("ECO4 original", "", "Remaining - #", "")] + headline_eco4_original_remaining_revenue = totals_row[("ECO4 original", "", "Remaining - £", "")] + headline_eco4_postcode_list_remaining = totals_row[("ECO4 post-ciga", "", "Estimated remaining eligible - #", "")] + headline_eco4_postcode_list_remaining_revenue = totals_row[ + ("ECO4 post-ciga", "", "Estimated remaining eligible - £", "") + ] + headline_eco4_delta = 100 * ( + (headline_eco4_postcode_list_remaining - headline_eco4_original_remaining) / + headline_eco4_original_remaining + ) + headline_eco4_delta = round(headline_eco4_delta, 1) + + # 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_revenue = totals_row[ + ("", "Warmfront post code list", "Remaining - £", "GBIS total") + ] + headline_gbis_delta = 100 * ( + (headline_gbis_postcode_list_remaining - headline_gbis_original_remaining) / + headline_gbis_original_remaining + ) + headline_gbis_delta = round(headline_gbis_delta, 1) + + headline_original_total_revenue_remaining = ( + headline_eco4_original_remaining_revenue + headline_gbis_original_remaining_revenue + ) + + headline_postcode_list_total_revenue_remaining = ( + headline_eco4_postcode_list_remaining_revenue + headline_gbis_postcode_list_remaining_revenue + ) + headline_total_delta = 100 * ( + (headline_postcode_list_total_revenue_remaining - headline_original_total_revenue_remaining) / + headline_original_total_revenue_remaining + ) + headline_total_delta = round(headline_total_delta, 1) + + headlines = [ + { + ("", "", "", "HA Name"): "Headlines", + }, + { + ("", "", "", "HA Name"): "ECO4 Remaining - November - #", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str( + headline_eco4_original_remaining + ) + }, + { + ("", "", "", "HA Name"): "ECO4 Remaining - November - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_eco4_original_remaining_revenue + ) + }, + { + ("", "", "", "HA Name"): "ECO4 Remaining - postcode list - #", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str( + headline_eco4_postcode_list_remaining + ) + }, + { + ("", "", "", "HA Name"): "ECO4 Remaining - postcode list - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_eco4_postcode_list_remaining_revenue + ) + }, + { + ("", "", "", "HA Name"): "ECO4 delta %", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(headline_eco4_delta) + "%" + }, + { + ("", "", "", "HA Name"): "GBIS Remaining - November - #", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str( + headline_gbis_original_remaining + ) + }, + { + ("", "", "", "HA Name"): "GBIS Remaining - November - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_gbis_original_remaining_revenue + ) + }, + { + ("", "", "", "HA Name"): "GBIS Remaining - post code list - #", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str( + headline_gbis_postcode_list_remaining + ) + }, + { + ("", "", "", "HA Name"): "GBIS Remaining - post code list - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_gbis_postcode_list_remaining_revenue + ) + }, + { + ("", "", "", "HA Name"): "GBIS delta %", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(headline_gbis_delta) + "%" + }, + # Total revenue + { + ("", "", "", "HA Name"): "Total Remaining - November - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_original_total_revenue_remaining + ) + }, + { + ("", "", "", "HA Name"): "Total Remaining - post code list - £", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): "£" + str( + headline_postcode_list_total_revenue_remaining + ) + }, + { + ("", "", "", "HA Name"): "Total Remaining delta %", + ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): str(headline_total_delta) + "%" + }, + ] + assumptions = [ { ("", "", "", "HA Name"): "Assumptions", @@ -3065,7 +3185,9 @@ def forecast_remaining_sales(loader): { ("", "", "", "HA Name"): "Maximum allowed CIGA pass rate", ("ECO4 original", "", "Total - £", ""): str(round(maximum_ciga_conversion * 100, 1)) + "%", - ("ECO4 original", "", "Remaining - £", ""): "- Maximum allowed CIGA conversion for HAs without CIGA checks" + ("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", @@ -3082,7 +3204,8 @@ def forecast_remaining_sales(loader): ] results = pd.concat( - [results, pd.DataFrame([totals_row]), blank_row, blank_row, pd.DataFrame(assumptions)] + [results, pd.DataFrame([headlines]), pd.DataFrame([totals_row]), blank_row, blank_row, + pd.DataFrame(assumptions)] )