Beancount used to render little ASCII trees for the account balances
hierarchy, very similar to the UNIX tool "tree."

I've been thinking about the bit of sadness I would experience losing this
if I write my reports in a more boring tabular format, such as those I
could generate using the query syntax I'm envisioning. Then I imagined:
"Wouldn't it be possible to just convert a list of account names into a
tree, just by processing the text itself, auto-detecting such hierarchies?"

For example, cat'ing this input into the tool:

          2014-12-25 Assets:US:BofA:Checking
5,545.01 USD          2014-11-11 Assets:US:Federal:PreTax401k
2014-10-04 Assets:US:Hooli:Vacation                         332.64
VACHR          2014-11-07 Assets:US:Investment:Cash
 26,500.00 USD          2014-12-15 Assets:US:Vanguard:Cash
              -0.07 USD          2014-12-10 Assets:US:Vanguard:RGAGX
                      174.22 RGAGX          2014-10-19
Assets:US:Vanguard:VBMPX                         189.03 VBMPX
2014-10-17 Equity:Opening-Balances                       -3,188.28 USD
         2014-12-12 Expenses:Food:Groceries
6,483.71 USD          2014-12-06 Expenses:Food:Restaurant
        10,990.74 USD          2014-11-30
Expenses:Health:Dental:Insurance                 208.80 USD
2014-11-09 Expenses:Health:Life:GroupTermLife             1,751.04 USD
         2014-12-07 Expenses:Health:Medical:Insurance
1,971.36 USD          2014-10-12 Expenses:Health:Vision:Insurance
         3,045.60 USD          2014-12-28 Expenses:Home:Electricity
                  2,080.00 USD          2014-10-22
Expenses:Home:Internet                         2,560.22 USD


It would automatically generate this, without any knowledge of the columns
nor the structure of the text before or after:

                     |-- Assets                     |   `-- US
            |       |-- BofA          2014-12-25 |       |   `--
Checking                  5,545.01 USD                     |       |--
Federal          2014-11-11 |       |   `-- PreTax401k
    |       |-- Hooli          2014-10-04 |       |   `-- Vacation
               332.64 VACHR                     |       |-- Investment
         2014-11-07 |       |   `-- Cash                     26,500.00
USD                     |       `-- Vanguard          2014-12-15 |
      |-- Cash                         -0.07 USD          2014-12-10 |
          |-- RGAGX                       174.22 RGAGX
2014-10-19 |           `-- VBMPX                       189.03 VBMPX
                 |-- Equity          2014-10-17 |   `--
Opening-Balances                 -3,188.28 USD                     `--
Expenses                         |-- Food          2014-12-12     |
|-- Groceries                     6,483.71 USD          2014-12-06
|   `-- Restaurant                   10,990.74 USD
    |-- Health                         |   |-- Dental
2014-11-30     |   |   `-- Insurance                   208.80 USD
                   |   |-- Life          2014-11-09     |   |   `--
GroupTermLife             1,751.04 USD                         |   |--
Medical          2014-12-07     |   |   `-- Insurance
1,971.36 USD                         |   `-- Vision
2014-10-12     |       `-- Insurance                 3,045.60 USD
                   `-- Home          2014-12-28         |--
Electricity                   2,080.00 USD          2014-10-22
`-- Internet                      2,560.22 USD



So I coded it, and it works:
https://bitbucket.org/blais/beancount/src/ece3ade0cf095e5e814573ca659757704a412043/experiments/utils/

The resulting tool is a general-purpose text processing utility that has no
relation to Beancount.
It's part of the Beancount source tree right now, I might move it out later
to a more generic place.
I suspect this might be useful to other peeps on this list rendering lists
of account names.

Check out the test file for more examples of what it does.
Note that it also works for filenames... thus replacing "tree" to some
extent.

If you find this useful or even just fun, let me know,

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to