From c297a87776a9ca1c87a47a8247200f5a72b9585c Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Tue, 29 Jul 2025 11:41:55 +0000 Subject: [PATCH] next board --- etl/month_end_automation_wave_2_layout.py | 12 ++-- etl/month_end_automation_wave_2_no_16.py | 68 ++++++++++++++++------- 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/etl/month_end_automation_wave_2_layout.py b/etl/month_end_automation_wave_2_layout.py index f93f8f3..5d208e2 100644 --- a/etl/month_end_automation_wave_2_layout.py +++ b/etl/month_end_automation_wave_2_layout.py @@ -16,13 +16,13 @@ rate_card_data = { "job_type": [ "RA", "ATT", "Coordination Stage 1 v1", "Coordination Stage 1 v2 remodel", "Coordination Stage 1 v3 remodel", "Design Archetype", "Design Repetitive", "Coordination Stage 2", "Lodgement phase 1", "Full lodgement phase 2", - "Post EPC", "Post ATT", "retrofit evaluation", + "Post EPR", "Post EPC", "Post ATT", "retrofit evaluation", "RA no show", "ATT no show", "post EPC no show" ], "rate": [ 207.65, 101, 186.4, 98, 98, 450, 150, 163, 135, 120, - 45, 90.5, 40, + "Mariaane Please tell me", 45, 90.5, 40, 25, 25, 25 ] } @@ -122,8 +122,8 @@ filtered_dfs.append(v3) # Coordination stage 2 Please complete cors2 = df[ - df["rc stg. 2"].str.lower().isin(["to invoice", "completed"]) -] + df["rc stg. 2"].str.lower().isin(["to invoice"]) +].copy() cors2["joby_type"] = "Coordination Stage 2" filtered_dfs.append(cors2) @@ -174,7 +174,7 @@ filtered_dfs.append(post_epc) post_epr = df[ df["post-epc status"].str.lower().isin(["post epr completed"]) ].copy() -post_epr["job_type"] = "Post ATT" +post_epr["job_type"] = "Post EPR" filtered_dfs.append(post_epr) @@ -233,4 +233,4 @@ import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_csv(f'NCHA SHDF Westville Wave 1 & 2_{timestamp}.csv', index=False) +combined_with_rates[attribute].to_excel(f'NCHA SHDF Westville Wave 1 & 2_{timestamp}.xlsx', index=False) \ No newline at end of file diff --git a/etl/month_end_automation_wave_2_no_16.py b/etl/month_end_automation_wave_2_no_16.py index 8b83fe9..be52ffd 100644 --- a/etl/month_end_automation_wave_2_no_16.py +++ b/etl/month_end_automation_wave_2_no_16.py @@ -11,6 +11,23 @@ monday = MondayClient(monday_key) # NCHA SHDF Wave 3 On Hold board_ids = ["6946967610"] +rate_card_data = { + "job_type": [ + "RA", "ATT", "Coordination Stage 1 v1", "Coordination Stage 1 v2 remodel", "Coordination Stage 1 v3 remodel", + "Design Archetype", "Design Repetitive", "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" + ], + "rate": [ + 207.65, 101, 186.4, 98, 98, + 450, 150, 163, 135, 120, + "Marianne EPR Please", 45, 90.5, 40, + 25, 25, 25 + ] +} + +rate_card_df = pd.DataFrame(rate_card_data) + for board in tqdm(board_ids): board_data = monday.boards.fetch_boards_by_id(board) columns = board_data["data"]["boards"][0]["columns"] @@ -85,32 +102,35 @@ filtered_dfs.append(att) # V1 Coordination v1 = get_df(df, "coordination status".lower(), [ "rc complete", -], "V1 Coordination") +], "Coordination Stage 1 v1") filtered_dfs.append(v1) # V2 Coordination -# v2 = get_df(df, "mtp v2 status", ["rc v2 complete"], "V2 Coordination") +# v2 = get_df(df, "mtp v2 status", ["rc v2 complete"], "Coordination Stage 1 v2 remodel") # filtered_dfs.append(v2) # # V3 Coordination -# v3 = get_df(df, "v3 rc status", ["uploaded"], "V3 Coordination") +# v3 = get_df(df, "v3 rc status", ["uploaded"], "Coordination Stage 1 v3 remode") # filtered_dfs.append(v3) # v3 = get_df(df, "v3 invoice status", ["to be invoice"], "V3 Coordination") # filtered_dfs.append(v3) # Coordination stage 2 Please complete -# cors2 = df[ -# df["rc stg. 2"].str.lower().isin(["to invoice", "completed"]) -# ] -# cors2["joby_type"] = "Coordination Stage 2" -# filtered_dfs.append(cors2) +cors2 = df[ + df["rc stg. 2"].str.lower().isin(["to invoice"]) +] +cors2["joby_type"] = "Coordination Stage 2" +filtered_dfs.append(cors2) -# Design stage 1 +# Design Archetype # design1 = get_df(df, "design invoice status", ["to invoice"], "Design") # filtered_dfs.append(design1) -# Design revision + +# Design Repetitive + +# Design Revision # design2 = get_df(df, "design revision invoice", [ # "Rev. A to invoice".lower(), # "Rev. B to invoice".lower(), @@ -125,20 +145,20 @@ filtered_dfs.append(lodg1) # Full Lodgement Phase -full_lodgement = get_df(df, "full lodgement invoice status".lower(), ["to invoice"], "Full Lodgement") +full_lodgement = get_df(df, "full lodgement invoice status".lower(), ["to invoice"], "Full lodgement phase 2") filtered_dfs.append(full_lodgement) # POST EPC -post_epc = get_df(df, "lodged epc", ["complete", "complete & lodged",], "POST EPC") +post_epc = get_df(df, "lodged epc", ["complete", "complete & lodged",], "Post EPC") filtered_dfs.append(post_epc) -# # POST EPR -# post_epr = df[ -# df["post-epc status"].str.lower().isin(["post epr completed"]) -# ].copy() -# post_epr["job_type"] = "POST ATT" -# filtered_dfs.append(post_epr) +# POST EPR +post_epr = df[ + df["lodged epc"].str.lower().isin(["post epr completed"]) +].copy() +post_epr["job_type"] = "POST EPR" +filtered_dfs.append(post_epr) # Post ATT post_att = get_df(df, "post att", ["done", "post att complete"], "POST ATT") @@ -175,4 +195,14 @@ filtered_dfs.append(att_ns) final_df = pd.concat(filtered_dfs).reset_index(drop=True) -final_df[['address', 'client', 'job_type']] \ No newline at end of file + +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') + +attribute = ['address', 'client', 'job_type', 'rate'] +combined_with_rates[attribute].to_excel(f'NCHA SHDF Wave 3 On Hold_{timestamp}.xlsx', index=False) \ No newline at end of file