From c3fd2ae902bd96250bc5ca376a424ebc8cbc3335 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 7 Mar 2024 20:58:47 +0000 Subject: [PATCH] Adding HA2, data load done --- .../ha_15_32/ha_analysis_batch_3.py | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 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 56867ef7..74c6d3f5 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -167,6 +167,7 @@ class DataLoader: } UNMATCHED_CIGA = { + "HA2": 0, "HA6": 117, "HA14": 3, "HA15": 3, @@ -202,6 +203,12 @@ class DataLoader: asset_list["matching_postcode"] = asset_list[ self.COLUMN_CONFIG[ha_name]["postcode"] ].astype(str).str.lower().str.strip() + elif ha_name == "HA2": + # Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode + asset_list["matching_address"] = asset_list["Address Line 1"].astype(str).str.lower().str.strip() + ", " + \ + asset_list["Address Line 2"].astype(str).str.lower().str.strip() + ", " + \ + asset_list["Postcode"].astype(str).str.lower().str.strip() + asset_list["matching_postcode"] = asset_list["Postcode"].astype(str).str.lower().str.strip() elif ha_name == "HA7": # Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode asset_list["matching_address"] = asset_list["Address"].astype(str).str.lower().str.strip() + ", " + \ @@ -3794,7 +3801,6 @@ def forecast_remaining_sales(loader): results = [] for ha_name, input_data in loader.data.items(): - # Original warmfront figures - ECO4 original_warmfront_estimates = december_figures[december_figures["HA Name"] == ha_name] @@ -4074,13 +4080,13 @@ def forecast_remaining_sales(loader): ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): original_warmfront_eco4, ("ECO4 original", "", "Remaining - #", ""): original_warmfront_remaining_eco4, ("ECO4 original", "", "Total - £", ""): original_warmfront_eco4_revenue, - ("ECO4 original", "", "Sold - £", ""): original_warmfront_sold_eco4, + ("ECO4 original", "", "Sold or cancelled - £", ""): original_warmfront_sold_eco4, ("ECO4 original", "", "Remaining - £", ""): original_warmfront_remaining_eco4_revenue, # GBIS - original warmfront figures ("", "Original Warmfront estimate", "Total - #", "GBIS - November"): original_warmfront_gbis, ("GBIS original", "", "Remaining - #", ""): original_warmfront_gbis, ("GBIS original", "", "Total - £", ""): original_warmfront_gbis_revenue, - ("GBIS original", "", "Sold - £", ""): original_warmfront_sold_gbis, + ("GBIS original", "", "Sold or cancelled - £", ""): original_warmfront_sold_gbis, ("GBIS original", "", "Remaining - £", ""): original_warmfront_remaining_gbis_revenue, # ECO4 - asset list, pre-ciga ("", "Warmfront post code list", "Total #", "ECO4 total (pre-ciga)"): eco4_pre_ciga, @@ -4237,12 +4243,17 @@ def forecast_remaining_sales(loader): headline_total_delta = round(headline_total_delta, 1) headline_eco4_sold_since_november = ( - totals_row[('ECO4 pre-ciga', '', 'Sold - £', '')] - totals_row[('ECO4 original', '', 'Sold - £', '')] + totals_row[('ECO4 pre-ciga', '', 'Sold - £', '')] + + totals_row[('ECO4 pre-ciga', '', 'Confirmed cancellations - £', '')] + # confirmed canclleations + totals_row[('ECO4 pre-ciga', '', 'Unconfirmed cancellations - £', '')] - # expected cancellations + totals_row[('ECO4 original', '', 'Sold or cancelled - £', '')] ) headline_gbis_sold_since_november = ( - totals_row[("GBIS Postcode list", "Warmfront post code list", "Sold - £", "GBIS total")] - - totals_row[('GBIS original', '', 'Sold - £', '')] + totals_row[("GBIS Postcode list", "Warmfront post code list", "Sold - £", "GBIS total")] + + totals_row[("GBIS Postcode list", "", "Confirmed cancellations - £", "")] + # confirmed cancellations + totals_row[("GBIS Postcode list", "", "Unconfirmed cancellations - £", "")] - # expected cancellations + totals_row[('GBIS original', '', 'Sold or cancelled - £', '')] ) headlines = [ @@ -4261,7 +4272,7 @@ def forecast_remaining_sales(loader): "ECO4 - November"): headline_eco4_original_remaining_revenue }, { - ("", "", "", "HA Name"): "ECO4 Sold since November - £", + ("", "", "", "HA Name"): "ECO4 Sold or cancelled since November - £", ( "", "Original Warmfront estimate", "Total - #", "ECO4 - November"): headline_eco4_sold_since_november @@ -4290,7 +4301,7 @@ def forecast_remaining_sales(loader): "ECO4 - November"): headline_gbis_original_remaining_revenue }, { - ("", "", "", "HA Name"): "GBIS Sold since November - £", + ("", "", "", "HA Name"): "GBIS Sold or cancelled since November - £", ( "", "Original Warmfront estimate", "Total - #", "ECO4 - November"): headline_gbis_sold_since_november @@ -4399,21 +4410,18 @@ def app(): rebuild_inputs = False # List all of the data in the folder - directories = [str(file) for entry in DATA_FOLDER.iterdir() if entry.is_dir() for file in entry.iterdir() if file.suffix == '.xlsx'] # Grab the December HA figures filepath december_figures_filepath = "local_data/ha_data/HA_December_figures.csv" # Add in: - # TODO: Remove ECO3 sales from HA25 priority_has = [ - "HA1", "HA6", "HA7", "HA14", "HA15", "HA16", "HA24", "HA25", "HA28", "HA32", "HA39", "HA41", "HA48", + "HA1", "HA2", "HA6", "HA7", "HA14", "HA15", "HA16", "HA24", "HA25", "HA28", "HA32", "HA39", "HA41", "HA48", "HA50", "HA107", ] # Next HAs to do: 14 [DONE], 15[DONE], 32 [DONE], 33 [Input format is 4 parts and no eco4 jobs identified - come - # back on this], 28 [DONE], 41 [DONE], 50 [DONE], - # 48 [WIP], + # back on this], 28 [DONE], 41 [DONE], 50 [DONE], 48 [DONE], # Consider for ECO4: 2, 63, 12, 13, 136, 117 # COnsider for GBIS: 56, 35, 34 # Ignore for now: