isaacharrisholt / quiffen

Quiffen is a Python package for parsing QIF (Quicken Interchange Format) files.
MIT License
33 stars 28 forks source link

Handle unknown accounts and split transfers #97

Open lcmcninch opened 2 days ago

lcmcninch commented 2 days ago

This PR addresses two issues:

Split Transfers

Issue #95 is fairly straightforward. We just need to detect and handle transfers in split transactions. This means that when a split transaction category is in brackets (e.g. [Savings]), this value should be assigned to Split.to_account rather than Split.category. See the associated issue for more detail.

Unknown Account Types

Issue #94 is a bit more tricky. I think this situation relates to the !Option:AutoSwitch section of the QIF file that isn't well defined. The associated issue has more detail, but in summary: sometimes accounts have types that aren't defined in the AccountType enum. To handle this situation, a fallback mechanism is implemented that assigns these accounts an 'unknown' type, ensuring the parser remains functional when this situation is encountered. It doesn't seem ideal, and perhaps we'll find a better solution in the future. But this addresses pydantic failures when reading files with these unknown account types. It is left to the user to detect and fix the unknown types on their end if they desire.