[Beginner question] After import with .rules-file: How to handle expenses:unkown efficiently?

Hi all,

I just started using PTA for my private finances (using hledger).

I plan to do the accounting monthly with an ever growing set of rules. Everything that is not coverd by a rules is categorised as "expenses:unkown".

To clean those unkowns I search through the ledger-file after import and replace them with a category (or "misc"). This is a rather tedious process and I was wandering if you have any tips for me, how I can process those entries more efficiently.

I am an Emacs-User, so I already leverage some of it's capabilities, but not yet the functionalities of ledger-mode, and I also know about hledger add and iadd, but I don't know if they are appropriate tools for my need.

I am looking forward to your suggestions. :slight_smile:

Best
Jonas

Welcome @jonas!
Some ideas for you:
before import,

hledger print -f foo.csv unknown

or

watchexec -- hledger print -f foo.csv unknown

or

watchexec -- hledger import *.csv --dry-run | hledger -f- -I print unknown

or after import,

C-c C-f unknown in ledger-mode

or

account checking with flycheck-hledger

...
(flycheck-hledger-checks '("accounts" ...))
...

C-x C-` might jump to the next unknown.

Thanks for the suggestions. I'll try them out. :slight_smile:

Just for the record, in my workflow I treat the csv as raw data that is not processed but imported into a hledger-"journal" with something like this hledger import Data/bank.rules -f 2024.ledger.

So the unkowns live only in the journal... the Emacs-related suggestions look already like nice improvements.

I am also wandering if hledger add or hledger iadd can be used interactively, with only expenses:unknown shown, asking for proper categories. :thinking:

I see plenty to learn and explore everywhere.... :slight_smile:

Me too. I use the third technique most (catching and fixing unknowns before doing the import).

if hledger add or hledger iadd can be used interactively, with only expenses:unknown shown, asking for proper categories

Sounds like a nice thing to explore. It's currently hard for tools to rewrite an already recorded entry (except for line-based editors like sed.). But I seem to remember hledger-edit might be good for this.

Ah, good to know, so it seems to be the right path. Do you have any particular reasons to prefer flycheck-hledger over flymake-hledger?

I am always intrigued to keep external packages to a minimum, so flymake-hledger would be my first choice...

Yes: inertia, familiarity, and when I check (including recently) it seems flycheck is the more complete, better supported and less likely to cost time.

I have contributed to flycheck-hledger recently and it's working for me; I don't know the status of flymake-hledger, but let us know if you try it.

1 Like

This together with M-% expsenses:unkown RET expenses:misc gives me already most that I wanted... I can "fly" through the postings I am not that interested in with y, and skip the interesting ones (for manual entries with a rule or not) for later with n....

This is great! Thank you!

1 Like

You're welcome! I use it a lot. Just be careful, it's easy to lose data accidentally by editing at the boundaries of the narrowed regions. Use version control.

1 Like