updated and cleaned

This commit is contained in:
2025-03-24 13:36:14 +03:00
parent 713730420c
commit 22876d250d
26 changed files with 161 additions and 98 deletions

View File

@@ -18,7 +18,9 @@ def collect_excel_files_from_mongo_database(mongo_provider) -> list:
return mongo_provider.find_many(filter_query={"stage": "read"})
def update_parsed_data_to_mongo_database(mongo_provider, collected_data_dict: dict, filename: str) -> None:
def update_parsed_data_to_mongo_database(
mongo_provider, collected_data_dict: dict, filename: str
) -> None:
if collected_data_dict:
payload = collected_data_dict[filename]
if payload:
@@ -43,9 +45,9 @@ def parse_excel_file(excel_frame: DataFrame, excel_name: str) -> dict:
if len(str(row[1]).split("/")) > 2:
data_dict[excel_name] = dict(
iban=str(iban),
bank_date=arrow.get(datetime.datetime.strptime(
str(row[1]), "%d/%m/%Y-%H:%M:%S"
)).__str__(),
bank_date=arrow.get(
datetime.datetime.strptime(str(row[1]), "%d/%m/%Y-%H:%M:%S")
).__str__(),
channel_branch=unidecode(str(row[3])),
currency_value=(
float(str(row[4]).replace(",", "")) if row[4] else 0
@@ -83,7 +85,9 @@ def app():
# Extract IBAN and root info from the xl file
collected_data_dict = parse_excel_file(excel_frame, filename)
update_parsed_data_to_mongo_database(
mongo_provider=mongo_provider, collected_data_dict=collected_data_dict, filename=filename
mongo_provider=mongo_provider,
collected_data_dict=collected_data_dict,
filename=filename,
)