Roll-your-own importer?

108 views
Skip to first unread message

TF

unread,
Nov 30, 2018, 8:50:49 PM11/30/18
to Beancount
I have to admit, bean-import and accompanying modules have me a little flummoxed. If I'm not mistaken, the idea is to take CSV and translate it into beancount ledger entries. 

I'm pretty sure I could write a python script of my own to import and convert entries and append them to my .beancount file. It wouldn't do any of the math, but beancount does that; if I get errors, I'll fix them by hand and/or adjust my importer. I could also have my importer move the original documents to the correct directory to file it away.

But am I missing something that I'd get from the usual approach? (Other than unit testing -- I'd definitely lose that, but I don't fully understand unit testing anyway; I'm a self-taught coder.)

Thanks!

Martin Blais

unread,
Nov 30, 2018, 10:49:25 PM11/30/18
to bean...@googlegroups.com
On Fri, Nov 30, 2018 at 8:50 PM TF <theof...@gmail.com> wrote:
I have to admit, bean-import and accompanying modules have me a little flummoxed. If I'm not mistaken, the idea is to take CSV and translate it into beancount ledger entries. 

Any input file, not just CSV


I'm pretty sure I could write a python script of my own to import and convert entries and append them to my .beancount file. It wouldn't do any of the math, but beancount does that; if I get errors, I'll fix them by hand and/or adjust my importer. I could also have my importer move the original documents to the correct directory to file it away.

But am I missing something that I'd get from the usual approach? (Other than unit testing -- I'd definitely lose that, but I don't fully understand unit testing anyway; I'm a self-taught coder.)

Yes, you could do all that from scratch.
The ingest framework helps in providing a little bit of structure and automation to these tasks, where you only have to implement a few functions and has some functions to setup regression tests.
Basically, you want to do four things when you import:
- download the files
- identify: automatically identify a file to link it with an associated importer configuration (e.g. which accounts to output)
- extract: extract transactions using this configuration
- file: move the file to a structured directory hierarchy
The ingest framework helps you do the last three.




Thanks!

--
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/c9c015f4-2741-41bc-8505-174e338661fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Maitin-Shepard

unread,
Dec 1, 2018, 12:14:52 AM12/1/18
to bean...@googlegroups.com
Note: I also created an alternative importing framework (https://github.com/jbms/beancount-import) which operates under a somewhat different model and provides additional functionality, like a web interface, automatic prediction of the account, and matching against other transactions.

--

Patrick Ruckstuhl

unread,
Dec 1, 2018, 2:20:34 AM12/1/18
to bean...@googlegroups.com


Probably also worth pointing out is that using the ingest framework allows to further share and reuse functionality.
E.g. smart predictions
https://github.com/beancount/smart_importer

Or using importers through fava
https://github.com/beancount/fava
><https://groups.google.com/d/msgid/beancount/c9c015f4-2741-41bc-8505-174e338661fe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
Reply all
Reply to author
Forward
0 new messages