siddhantgoel / beancount-dkb

Beancount Importers for DKB (Deutsche Kredit Bank) CSV Exports
MIT License
36 stars 13 forks source link

[Feature Request] Support `description_patterns` for `ECImporter` #108

Closed putzwasser closed 1 year ago

putzwasser commented 1 year ago

Thanks for the great work.

It would be very useful, if you'd add support for the description_patterns to the ECImporter as well. If you send money for different purposes to the same receiver (e.g. rent and costs for utilities in separate transactions), then you can't distinguish the transactions. Same holds true if send money to yourself (transfering money to different saving accounts, etc).

Using the more unique transaction description could help here.

As this might add ambiguity for the importer how to categorize I'd suggest that the order is: if description_pattern and payee_pattern matches, then payee_pattern gets disregarded as it is more general.

siddhantgoel commented 1 year ago

Great suggestion! I'll try to have a look in the next days!

momu commented 1 year ago

Thanks a lot for the importer.

From me +1 for the feature request. Another nice to have option would be a third optional argument for the payee_pattern: the amount. I've multiple transactions from the same person, but they differ in description and amount.

As mentioned above evaluating the description_pattern would also work in this case. But it would be easier in some cases with repeating transactions to differentiate the transactions by the transaction amount.

siddhantgoel commented 1 year ago

Just published v0.15.0 which allows for pattern-matching transactions in ECImporter against description strings.

Regarding the case when both payee and description strings match, I decided to go with payee pattern as I've noticed that it's usually more specific than the description. The importer should also log a warning to the console for such cases so the user knows about it when running bean-extract.

@momu could you please open a new issue with the suggestion for amount? I can see the use case for that suggestion but as the matching logic might become slightly more complex with it, maybe we could have that discussion on the newer issue. Thanks!

momu commented 1 year ago

@siddhantgoel Done. Sorry for the delay, but I bought a book about plaintext accounting with python and had to immediately read it ;)