Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.0
hooks:
- id: ruff
args: [--fix]
2 changes: 1 addition & 1 deletion credit_card_abacus_da/abacus_cc_loader_from_centaur.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def load(is_service):
return AbacusCCLoaderFromCentaur.clean_and_load_cc(centaur, abacus, is_service)
else:
return AbacusCCLoaderFromCentaur.LoadStatus.FINISHED
except Exception as ex:
except Exception:
# abacus.write_cc_log_file(start, pd.Timestamp.now(), "0", 0, str(ex))
return AbacusCCLoaderFromCentaur.LoadStatus.ERROR

Expand Down
22 changes: 11 additions & 11 deletions credit_card_abacus_da/cc_abacus_da.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def do_atmp_abacus_cc_job(self, dt_atmp_t17, is_service):

return True

except Exception as ex:
except Exception:
if is_service:
self.update_load_log_cc('1', self.WorkingDay.strftime("%d/%m/%Y")) # set load to true
# self.write_cc_log(self.start, datetime.now(), '0', 0, str(ex))
Expand Down Expand Up @@ -212,12 +212,12 @@ def build_data_table_atmp_t18_for_single_product(self, atmp_t18, t18rows, atmp_t
# Update ATMP_t17_row's "DATE_SINCE_PAST_DUE" field
atmp_t17_row["DATE_SINCE_PAST_DUE"] = self.WorkingDay - pd.to_timedelta(int(atmp_t17_row["DAYS_PAST_DUE"]), unit='d')

last_payment_amount = 0.0
last_minimum_payment = 0.0
last_sum_of_payment = 0.0
last_period = 30000101
#last_payment_amount = 0.0
#last_minimum_payment = 0.0
#last_sum_of_payment = 0.0
#last_period = 30000101
nr_payments_past_due = 0
last_due_date_dlq = pd.NaT # Pandas equivalent of DateTime.MinValue
#last_due_date_dlq = pd.NaT # Pandas equivalent of DateTime.MinValue

# Check if there are rows in t18rows
if not t18rows.empty:
Expand All @@ -242,7 +242,7 @@ def build_data_table_atmp_t18_for_single_product(self, atmp_t18, t18rows, atmp_t
# Compare PERIOD values to decide further logic
if int(t18row["PERIOD"]) == int(atmp_t17_row["PERIOD"]):
atmp_t18_row["LAST_SUM_OF_PAYMENT"] = atmp_t17_row["SUM_OF_PAYMENTS"]
last_payment_amount = float(atmp_t17_row["SUM_OF_PAYMENTS"]) - float(t18row["LAST_SUM_OF_PAYMENT"])
#last_payment_amount = float(atmp_t17_row["SUM_OF_PAYMENTS"]) - float(t18row["LAST_SUM_OF_PAYMENT"])

if self.WorkingDay > pd.to_datetime(atmp_t18_row["PRINCIPAL_PAYMENT_DATE"]):
atmp_t18_row["IS_PASTDUE"] = "1"
Expand All @@ -255,10 +255,10 @@ def build_data_table_atmp_t18_for_single_product(self, atmp_t18, t18rows, atmp_t
nr_payments_past_due += 1

# Convert fields to the appropriate types and store the values
last_minimum_payment = float(atmp_t18_row.get("MINIMUM_PAYMENT", 0))
last_period = int(atmp_t18_row.get("PERIOD", 30000101))
last_due_date_dlq = pd.to_datetime(atmp_t18_row.get("DUE_DATE_DLQ", pd.NaT))
last_sum_of_payment = float(atmp_t18_row.get("LAST_SUM_OF_PAYMENT", 0))
#last_minimum_payment = float(atmp_t18_row.get("MINIMUM_PAYMENT", 0))
#last_period = int(atmp_t18_row.get("PERIOD", 30000101))
#last_due_date_dlq = pd.to_datetime(atmp_t18_row.get("DUE_DATE_DLQ", pd.NaT))
#last_sum_of_payment = float(atmp_t18_row.get("LAST_SUM_OF_PAYMENT", 0))

# Append the new row to ATMP_T18 DataFrame
atmp_t18 = atmp_t18.append(atmp_t18_row, ignore_index=True)
Expand Down
2 changes: 1 addition & 1 deletion credit_card_abacus_da/cc_centaur_da.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ def parse_crown_date(self, value):
month = int(value[4:6])
day = int(value[6:8])
return datetime(year, month, day)
except Exception as ex:
except Exception:
# If parsing fails, return a default date or handle error appropriately
return datetime.min
2 changes: 0 additions & 2 deletions credit_card_abacus_da/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import psycopg2
import pandas as pd
from datetime import datetime

class Log:
def __init__(self):
Expand Down
1 change: 0 additions & 1 deletion credit_card_abacus_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.exceptions import Timeout
from credit_card_abacus_da.abacus_cc_loader_from_centaur import AbacusCCLoaderFromCentaur

class CreditCardAbacusService:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ requests-file = "2.1.0"
requests-toolbelt = "1.0.0"
pandas = "2.2.3"
numpy = "2.1.2"
pre-commit = "^4.0.1"
ruff = "^0.7.2"

[build-system]
requires = ["poetry-core"]
Expand Down