Skip to content
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

csv: use existing journal entries as a source of implicit rules #2172

Open
simonmichael opened this issue Feb 15, 2024 · 0 comments
Open

csv: use existing journal entries as a source of implicit rules #2172

simonmichael opened this issue Feb 15, 2024 · 0 comments
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. csv The csv file format, csv output format, or generally CSV-related.

Comments

@simonmichael
Copy link
Owner

simonmichael commented Feb 15, 2024

As discussed at https://www.reddit.com/r/plaintextaccounting/comments/1arkzfg/can_hledger_import_use_account_mappings_from/ :

hledger's CSV conversion rules look at each record in isolation, with no memory (except what you have encoded in the static rules).
...
I agree this (inferring accounts, perhaps other characteristics, from similar-looking existing journal entries) is an interesting idea and could potentially work well, though it would also make conversion less predictable. Here is Ledger's https://ledger-cli.org/doc/ledger3.html#The-convert-command , which I assume you're referring to ?
I can imagine feeling that you must write a rule for every description/payee is a bit unpleasant. I have never done that myself, it has been a more incremental process of adding a few rules each time, according to the latest transactions and my motivation for detailed categories, clean descriptions, etc.
If someone is bulk converting a huge backlog of CSV, with high goals for categorising and cleaning, I can see it's a bigger job. Though in such cases, past journal entries might be nonexistent, or too different to help much. hledger's if table rules, possibly programmatically generated, might be some help.

Apparently Ledger does this and it's useful, so we should try it. I guess ideally it means you just write minimal CSV rules, then manually fix the uncategorised transactions each time you import, pretty soon you don't have to do that much any more, you're always doing that one thing and not switching context to edit rules, and the results are good and sufficiently reliable, at least for straightforward categorising cases.

Details to be clarified:

  • What to infer and how. The most useful thing would be to at least identify a good other account for simple two-posting transactions, by looking for recent journal transactions with similar description or payee. add does this (and also works for >2 postings).

  • Interaction with rules. Apply rules first, and when an account is left uncategorised, try to infer it from the journal transactions ? Assigning a special value to an account field activates it ?

@simonmichael simonmichael added A-WISH Some kind of improvement request, hare-brained proposal, or plea. csv The csv file format, csv output format, or generally CSV-related. labels Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. csv The csv file format, csv output format, or generally CSV-related.
Projects
None yet
Development

No branches or pull requests

1 participant