Initial income_calculator project
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
23
backend/parsers/base.py
Normal file
23
backend/parsers/base.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
|
||||
@dataclass
|
||||
class ParsedTransaction:
|
||||
operation_date: str # ISO date or datetime
|
||||
debit_date: str | None
|
||||
amount: float # signed: negative = expense
|
||||
amount_card_currency: float | None
|
||||
description: str
|
||||
card_tail: str # last 4 digits for account matching
|
||||
|
||||
|
||||
class BaseBankParser(ABC):
|
||||
@abstractmethod
|
||||
def can_parse(self, filename: str) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def parse(self, file_path: str) -> List[ParsedTransaction]:
|
||||
pass
|
||||
Reference in New Issue
Block a user