(20251122) Reformatted the muster roll data to return only unique combinations to reduce the load on the frontend.
This commit is contained in:
+15
-5
@@ -47,6 +47,7 @@ import datetime
|
||||
import pandas as pd
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import json
|
||||
from utils_v2.system import files
|
||||
from utils_v2.system import pfinfo
|
||||
|
||||
@@ -1247,17 +1248,26 @@ if __name__ == "__main__":
|
||||
# )
|
||||
#
|
||||
# Convert the Muster Roll to a Pandas DF:
|
||||
muster_roll_path = r"D:\kps\PycharmProjects\cosec\downloads\Monthly_Details.xls"
|
||||
muster_roll_path = r"D:\kps\PycharmProjects\cosec\cosec_web\sample_files\muster_roll.xls"
|
||||
muster_roll_df = CosecWeb.read_muster_roll_xls(muster_roll_path)
|
||||
muster_roll_df = muster_roll_df[[
|
||||
"User ID", "User Name", "Category Name",
|
||||
"Grade Name", "Branch Name", "Department Name",
|
||||
"Direct Reporting", "Level-1"
|
||||
]]
|
||||
muster_roll_df = muster_roll_df[:35]
|
||||
print(muster_roll_df.to_string())
|
||||
print("\n\n---\n\n")
|
||||
print(muster_roll_df.info())
|
||||
muster_roll_df = muster_roll_df[:20]
|
||||
# print(muster_roll_df.to_string())
|
||||
# print("\n\n---\n\n")
|
||||
# print(muster_roll_df.info())
|
||||
unique_branches = muster_roll_df["Branch Name"].unique().tolist()
|
||||
unique_depts = muster_roll_df[["Branch Name", "Department Name"]].drop_duplicates().to_dict(orient = "records")
|
||||
unique_reportees = muster_roll_df[["Branch Name", "Department Name", "Direct Reporting"]].drop_duplicates().to_dict(orient = "records")
|
||||
unique_combos = {
|
||||
"Branch Name": unique_branches,
|
||||
"Department Name": unique_depts,
|
||||
"Direct Reporting": unique_reportees
|
||||
}
|
||||
print("UNIQUE COMBOS:", json.to_string(unique_combos))
|
||||
|
||||
# # Log out to end the cycle:
|
||||
# cosec.logout()
|
||||
|
||||
Reference in New Issue
Block a user