add CE category as metadata

This commit is contained in:
Antoine Martin 2022-11-10 19:27:58 +01:00
parent 0d3db7811b
commit 6d6e281b0a

View file

@ -17,6 +17,8 @@ COL_DEBIT = "Debit"
COL_CREDIT = "Credit"
COL_DETAIL = "Informations complementaires"
COL_DATE_OP = "Date operation"
COL_CATEGORY = "Categorie"
COL_SUBCATEGORY = "Sous categorie"
END_DATE_REGEX = "Date de fin de téléchargement : ([0-3][0-9]/[0-1][0-9]/[0-9]{4})"
START_DATE_REGEX = "Date de début de téléchargement : ([0-3][0-9]/[0-1][0-9]/[0-9]{4})"
@ -75,6 +77,8 @@ class CDEImporter(importer.ImporterProtocol):
transaction_date: date = datetime.strptime(row[COL_DATE], "%d/%m/%Y").date()
op_date: date = datetime.strptime(row[COL_DATE_OP], "%d/%m/%Y").date()
category: str = row[COL_CATEGORY]
subcategory: str = row[COL_SUBCATEGORY]
label: str = row[COL_LABEL]
debit: str = row[COL_DEBIT]
credit: str = row[COL_CREDIT]
@ -109,6 +113,7 @@ class CDEImporter(importer.ImporterProtocol):
)
meta["op_date"] = op_date
meta["ce_category"] = f"{category} - {subcategory}"
directives.append(
data.Transaction(