-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ofx: support configurable destination directory per account #61
Conversation
Account numbers aren't a great identifier for humans; if one wants to be able to browse the data fetched by finance-dl, it's helpful to have mnemonic names for the directories holding data for a given account. Even failing this, some banks use account numbers that are not valid directory names, and users may prefer a different method to clean the generated name than the default of substituting all invalid characters with hyphens. This change allows the user to add an `acct_dir_map` entry to the finance-dl config for an ofx source. The map is a simple dict mapping account number (as given in the OFX output) to directory name. If a mapping is given, it is trusted blindly; if the user specifies a directory for an account that makes the path invalid, it's better to fail than silently do something different from what we were explicitly asked for.
Looks like some minor mypy issues with the type specification of acct_dir_map. |
otherwise `a.number in acct_dir_map` would fail when acct_dir_map was missing.
Whoops, that was a real bug actually D: Fixed now, and tox passes. |
Out of curiosity, what situations do you find yourself needing a human-convenient view of the data files? Beancount-import doesn't care too much about the location/hierarchy of most of the data, save for odd quirks like this one. I wonder if your needs point to something else? Perhaps b-i taking too long to start because you have a lot of historical data files in the same folder? |
I'm a control freak, perhaps ;) I do frequently end up looking at my ofx files directly (e.g. to debug beancount-import's handling of some way in which they don't match the OFX spec, or to munge it with one of the custom tools I've written to paper over ways in which some of my institutions yield broken OFX files). Similarly with e.g. Amazon receipts: I occasionally go and delete one by hand because I discover that it was broken and Amazon has since published a corrected one (silently, of course), and having fewer files per directory has advantages like letting me tab-complete their names; and sometimes I have another reason to go fetch an invoice and looking in the folder where I have them all conveniently downloaded is easier than fetching it manually from Amazon again... generally, I don't keep finance-dl's data around exclusively for use with beancount-import, so having the ability to organize it for myself is convenient for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it out. Works.
Account numbers aren't a great identifier for humans; if one wants to be able
to browse the data fetched by finance-dl, it's helpful to have mnemonic names
for the directories holding data for a given account. Even failing this, some
banks use account numbers that are not valid directory names, and users may
prefer a different method to clean the generated name than the default of
substituting all invalid characters with hyphens.
This change allows the user to add an
acct_dir_map
entry to the finance-dlconfig for an ofx source. The map is a simple dict mapping account number (as
given in the OFX output) to directory name.
If a mapping is given, it is trusted blindly; if the user specifies a
directory for an account that makes the path invalid, it's better to fail than
silently do something different from what we were explicitly asked for.