Querying event status as of certain date (more automation, categorizing based on home/away status)?

36 views
Skip to first unread message

TRS-80

unread,
Jul 20, 2020, 10:49:44 AM7/20/20
to bean...@googlegroups.com
At the bottom of Events section of Docs [0] I noticed:

> reports on events have not yet been re-implemented in Beancount
> 2.0. They will be reintroduced again soon, as well as filtering.

I also did a quick text search in query_parser [1] and query_env [2]
for the word "event" and got no results, which would seem to support
this.

I suppose I just wanted to confirm this was the case?

In order not to get into XY Problem [3], I will state what I am
actually trying to accomplish.

I travel for my work a fair amount, and so when I am "on the road"
many of my expenses (eating out, etc.) are now tax write-offs and
should be categorized into different accounts than when I am home. I
wanted to extend my custom categorizer to account for this, by being
able to query a given date (transaction date) and return whether I am
"home" or "away" and then return the expense account based on that
criteria (in addition to simple text matching on payee that I am
already doing).

I am actually considering an alternative that is tied in through my
phone GPS and Home Automation system where I cross a certain radius
boundary and my "home" or "away" status is automatically logged to
some file (Graphite/Carbon perhaps) simply because I already have all
that infrastructure set up. I am already tracking GPS for "presence"
purposes for HA, so this would just be a matter of logging. Of
course, I could just as easily log this to some separate text file
within my Beancount files (or both, or whatever).

Anyway what I envision is a simple list of dates and status changes in
some file, which could then be queried. Beancount events could be
used for this, or I could implement my own solution. Looks like I
will be doing the latter for now, unless I have overlooked something?

Regards,
TRS-80

[0]
https://beancount.github.io/docs/beancount_language_syntax.html#events
[1]
https://github.com/beancount/beancount/blob/master/beancount/query/query_parser.py
[2]
https://github.com/beancount/beancount/blob/master/beancount/query/query_env.py
[3] http://xyproblem.info

Martin Blais

unread,
Jul 21, 2020, 9:21:43 PM7/21/20
to Beancount
In v3, the different directives will be exposed as separate data tables with corresponding fields.

I use Event directives to roughly track my location (event I name "location"), mainly for the purpose of immigration and other government eligibility stuff.
I use them for address changes, and a bunch of other stuff too.
I think you could use Event for all sorts of purposes.
You'll have to write a script to extract them, but that should be easy.


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/aa7a459fc876a59583f4ebdc77ceba5c%40isnotmyreal.name.

Justus Pendleton

unread,
Jul 22, 2020, 2:26:56 AM7/22/20
to Beancount
It's not a perfect fit but the tag stack is intended for this kind of use case. It isn't perfect because it relies on file position instead of a date. And you'd need a plugin to filter transactions with that tag and rewrite the accounts. There's a divert_expenses plugin that already does something like this but may not be exactly what you're looking for.
Reply all
Reply to author
Forward
0 new messages