Adding HA2, data load done

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-07 20:58:47 +00:00
parent c84be65e8d
commit c3fd2ae902

View file

@ -167,6 +167,7 @@ class DataLoader:
} }
UNMATCHED_CIGA = { UNMATCHED_CIGA = {
"HA2": 0,
"HA6": 117, "HA6": 117,
"HA14": 3, "HA14": 3,
"HA15": 3, "HA15": 3,
@ -202,6 +203,12 @@ class DataLoader:
asset_list["matching_postcode"] = asset_list[ asset_list["matching_postcode"] = asset_list[
self.COLUMN_CONFIG[ha_name]["postcode"] self.COLUMN_CONFIG[ha_name]["postcode"]
].astype(str).str.lower().str.strip() ].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": elif ha_name == "HA7":
# Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode # 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() + ", " + \ asset_list["matching_address"] = asset_list["Address"].astype(str).str.lower().str.strip() + ", " + \
@ -3794,7 +3801,6 @@ def forecast_remaining_sales(loader):
results = [] results = []
for ha_name, input_data in loader.data.items(): for ha_name, input_data in loader.data.items():
# Original warmfront figures - ECO4 # Original warmfront figures - ECO4
original_warmfront_estimates = december_figures[december_figures["HA Name"] == ha_name] 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, ("", "Original Warmfront estimate", "Total - #", "ECO4 - November"): original_warmfront_eco4,
("ECO4 original", "", "Remaining - #", ""): original_warmfront_remaining_eco4, ("ECO4 original", "", "Remaining - #", ""): original_warmfront_remaining_eco4,
("ECO4 original", "", "Total - £", ""): original_warmfront_eco4_revenue, ("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, ("ECO4 original", "", "Remaining - £", ""): original_warmfront_remaining_eco4_revenue,
# GBIS - original warmfront figures # GBIS - original warmfront figures
("", "Original Warmfront estimate", "Total - #", "GBIS - November"): original_warmfront_gbis, ("", "Original Warmfront estimate", "Total - #", "GBIS - November"): original_warmfront_gbis,
("GBIS original", "", "Remaining - #", ""): original_warmfront_gbis, ("GBIS original", "", "Remaining - #", ""): original_warmfront_gbis,
("GBIS original", "", "Total - £", ""): original_warmfront_gbis_revenue, ("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, ("GBIS original", "", "Remaining - £", ""): original_warmfront_remaining_gbis_revenue,
# ECO4 - asset list, pre-ciga # ECO4 - asset list, pre-ciga
("", "Warmfront post code list", "Total #", "ECO4 total (pre-ciga)"): eco4_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_total_delta = round(headline_total_delta, 1)
headline_eco4_sold_since_november = ( 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 = ( headline_gbis_sold_since_november = (
totals_row[("GBIS Postcode list", "Warmfront post code list", "Sold - £", "GBIS total")] - totals_row[("GBIS Postcode list", "Warmfront post code list", "Sold - £", "GBIS total")] +
totals_row[('GBIS original', '', 'Sold - £', '')] 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 = [ headlines = [
@ -4261,7 +4272,7 @@ def forecast_remaining_sales(loader):
"ECO4 - November"): headline_eco4_original_remaining_revenue "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 - #", "", "Original Warmfront estimate", "Total - #",
"ECO4 - November"): headline_eco4_sold_since_november "ECO4 - November"): headline_eco4_sold_since_november
@ -4290,7 +4301,7 @@ def forecast_remaining_sales(loader):
"ECO4 - November"): headline_gbis_original_remaining_revenue "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 - #", "", "Original Warmfront estimate", "Total - #",
"ECO4 - November"): headline_gbis_sold_since_november "ECO4 - November"): headline_gbis_sold_since_november
@ -4399,21 +4410,18 @@ def app():
rebuild_inputs = False rebuild_inputs = False
# List all of the data in the folder # List all of the data in the folder
directories = [str(file) for entry in DATA_FOLDER.iterdir() if entry.is_dir() directories = [str(file) for entry in DATA_FOLDER.iterdir() if entry.is_dir()
for file in entry.iterdir() if file.suffix == '.xlsx'] for file in entry.iterdir() if file.suffix == '.xlsx']
# Grab the December HA figures filepath # Grab the December HA figures filepath
december_figures_filepath = "local_data/ha_data/HA_December_figures.csv" december_figures_filepath = "local_data/ha_data/HA_December_figures.csv"
# Add in: # Add in:
# TODO: Remove ECO3 sales from HA25
priority_has = [ 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", "HA50", "HA107",
] ]
# Next HAs to do: 14 [DONE], 15[DONE], 32 [DONE], 33 [Input format is 4 parts and no eco4 jobs identified - come # 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], # back on this], 28 [DONE], 41 [DONE], 50 [DONE], 48 [DONE],
# 48 [WIP],
# Consider for ECO4: 2, 63, 12, 13, 136, 117 # Consider for ECO4: 2, 63, 12, 13, 136, 117
# COnsider for GBIS: 56, 35, 34 # COnsider for GBIS: 56, 35, 34
# Ignore for now: # Ignore for now: