diff --git a/etl/month_end_automation_wave_3_layout.py b/etl/month_end_automation_wave_3_layout.py index 4db67a5..e698961 100644 --- a/etl/month_end_automation_wave_3_layout.py +++ b/etl/month_end_automation_wave_3_layout.py @@ -21,6 +21,7 @@ class BoardID(Enum): _9660895490 = "NORTHUMBERLAND_COUNTY_SHDF_WAVE3" _9641491000 = "WATFORD_WARM_HOMES" _9671463094 = "SEDDON" + _9929454382 = "NCHA SHDF Wave 3 Main Operation Board" board_ids = [ @@ -30,6 +31,7 @@ board_ids = [ "9660895490", # Northumberland County SHDF Wave 3 "9641491000", # Watford Warm Homes "9671463094", # Seddon + "9929454382", # NCHA SHDF Wave 3 Main Operation Board ] empty = "Rate card info missing" @@ -53,6 +55,22 @@ rate_card_data_watford_warm_homes = { } rate_cards.update({"9641491000": pd.DataFrame(rate_card_data_watford_warm_homes)}) +rate_card_data_ncha_wave_3 = { + "job_type": [ + "RA", "ATT", "Coordination Stage 1 v1", "Coordination Stage 1 v2 remodel", "Coordination Stage 1 v3 remodel", + "Design Archetype Complex", "Design Archetype Simple", "Design Repetitive Simple", "Coordination Stage 2", "Lodgement phase 1", "Full lodgement phase 2", + "Post EPR", "Post EPC", "Post ATT", "retrofit evaluation", + "RA no show", "ATT no show", "post EPC no show", "Full cost MTP", "measure modelling", "design type not specified" + ], + "rate": [ + empty, empty, empty, empty, empty, + empty, empty, empty, empty, empty, + empty, empty, empty, empty, empty, + empty, empty, empty, empty, empty, check_with_andres + ] +} +rate_cards.update({"9929454382": pd.DataFrame(rate_card_data_ncha_wave_3)}) + rate_card_data_l_and_q_london = { diff --git a/etl/month_end_automation_wave_accent_housing.py b/etl/month_end_automation_wave_accent_housing.py index 6541a9b..9e8819f 100644 --- a/etl/month_end_automation_wave_accent_housing.py +++ b/etl/month_end_automation_wave_accent_housing.py @@ -172,27 +172,26 @@ final_df = None if filtered_dfs: final_df = pd.concat(filtered_dfs).reset_index(drop=True) + if final_df: + final_df["job_type"] = final_df["job_type"].str.lower() + rate_card_df["job_type"] = rate_card_df["job_type"].str.lower() -if final_df: - final_df["job_type"] = final_df["job_type"].str.lower() - rate_card_df["job_type"] = rate_card_df["job_type"].str.lower() + # Now perform the merge + combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") + import datetime + timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') - # Now perform the merge - combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") - import datetime - timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') + # Upload to sharepoint + attribute = ['address', 'client', 'job_type', 'rate'] + master_folder_name = "2501 Accent housing" + file_name = f"{master_folder_name}_{timestamp}.xlsx" + combined_with_rates[attribute].to_excel(file_name, index=False) - # Upload to sharepoint - attribute = ['address', 'client', 'job_type', 'rate'] - master_folder_name = "2501 Accent housing" - file_name = f"{master_folder_name}_{timestamp}.xlsx" - combined_with_rates[attribute].to_excel(file_name, index=False) + file_path = os.path.abspath(file_name) - file_path = os.path.abspath(file_name) + upload_to_month_end_folder(file_name, file_path, master_folder_name) - upload_to_month_end_folder(file_name, file_path, master_folder_name) - - invoice_name = "rate_card.xlsx" - file_path = os.path.abspath(invoice_name) - rate_card_df.to_excel(invoice_name, index=False) - upload_to_month_end_folder(invoice_name, file_path, master_folder_name) + invoice_name = "rate_card.xlsx" + file_path = os.path.abspath(invoice_name) + rate_card_df.to_excel(invoice_name, index=False) + upload_to_month_end_folder(invoice_name, file_path, master_folder_name)