Storing related documents together

50 views
Skip to first unread message

Andrzej

unread,
Apr 9, 2019, 5:37:00 PM4/9/19
to Beancount
I want to make my past tax returns visible to beancount via document directive. My problem is that I like to store all documents relevant to taxation year in one directory. I'm wondering if someone already had similar issue?
I'm fine with implementing it myself, I just have no idea what is right abstraction here.

Problem statement
My current structure looks like this:
documents/Expenses/Taxes$ find

2016/taxform1.pdf
2016/taxform2.pdf
2016/signed.jpg

2017/taxform3.pdf
2017/signed.jpg
2017/calculations.xlsx
2017/notes.txt

Each tax year has 3-10 files inside (structure differs year by year)

I would like to add all contents of a directory as a document, something along the lines:
2017-04-10 document Expenses:Taxes "documents/Expenses/Taxes/2016"
2018-04-05 document Expenses:Taxes "documents/Expenses/Taxes/2017"

It's fine to change directory name to some other name (such as 2017-04-10.filing/)
I'd like to keep filenames without dates to make manual navigation easier (I do read those files later).

Possible solutions
0. Support directory documents - right now I can see that no one expected this, it chokes fava :)

1. Add tar files for each such directory
Issues:
- it makes files harder to find something in those files
- Reading them requires extra step

2. Just add all files manually:
2017-04-10 document Expenses:Taxes "documents/Expenses/Taxes/2016/taxform1.pdf"
2017-04-10 document Expenses:Taxes "documents/Expenses/Taxes/2016/taxform2.pdf"
2017-04-10 document Expenses:Taxes "documents/Expenses/Taxes/2016/signed.jpg"
...

Issues
a: I may forget to add some files (for example ones created later)
b: Quite verbose, it requires me to list all files (probably fine, there are not so many of them)

2a. Write plugin to check that all files in a directory structure are added as documents.
It only leaves issue b (which is not big deal)

3. Write plugin that navigates the path
PATH/TO/ACCOUNT/<DATE>.<TAG>/file
and creates document entry for each file, it could use directory naming scheme like "2017-04-10.tax_16" to know the date. Then file path would look like this:
  documents/Expenses/Taxes/2017-04-10.tax_16/taxform1.pdf

and plugin would generate entry like so:
  2017-04-10 Expenses:Taxes "documents/Expenses/Taxes/2017-04-10.tax_16/taxform1.pdf" #tax_16

Martin Blais

unread,
Apr 9, 2019, 10:03:50 PM4/9/19
to Beancount
I think the most straightforward way to handle this is to write your own plugin that adds the relevant directives.
Should be very simple to do.


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/2ecc25b3-7fdf-42a9-94df-7c0a326b2a4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages