Hi, I've been lurking here for a bit, hope what I want to bring up will be of interest.
I've been playing with a read-only ledger viewer. I wrote a blog post with more details here (hope a bit of self-promotion can be forgiven).
I think this kind of viewer could be shared with other PTA tools quite easily. The interface to the viewer is really just the domain model of the imported JSON data. If we could come up with some general agreement on that schema then the viewer would work for anything that can spit out that JSON. If you ignore JSON marshaling it is barely a page of code to assemble the final HTML page with the data and the viewer code (and Go is not known for brevity). It would probably be rather trivial to implement in most PTA tools.
The viewer is read-only, no match for something like Fava in capability and scope, but it could do a fair bit on the browsing and reporting side in what I think would be a more convenient/universal form.
Thoughts? (whether on this viewer specifically or the approach in general)
So cool! I've been looking for a simple and light-weight way to explore my journal file. Unfortunately, existing web server options have proven to be burdensome to setup. I'm not interested in modifying the journal, only exploring the data in a graphic way. I've settled with rendering a bare-bones static HTML file of a balance and budget report with a bash script that I run after a bookkeeping session. The HTML file lives on a file server that can be accessed from personal devices. Coin2html takes this idea a step further and more!
I think the layout/design is very simple yet very legible and easy to understand. Kudos!
How would one play with making this compatible with Hledger? I explored the source files but alas could not understand where to start.
The JS part is a fully self contained project coin/cmd/coin2html/js at master · mkobetic/coin · GitHub, completely independent from the Go project around it. If there is interest to collaborate I'm definitely open to pulling it out of coin altogether.
If you have npm installed then if you go to that directory and run
npm install && npm run build
you should end up with two new files in a dist/ subdirectory, head.html and body.html. They contain the basic html structure, style sheet and all the JS code. I could also just commit these into the project if futzing with npm is too much friction.
I'd expect most of the work to be to get hledger to spit out the JSON that the viewer expects. Looking at what's in the examples/yearly in browser tools should give you a good idea of what that is (these are the script tags with ID importedCommodites, importedPrices, ...). This is the part that I was proposing to collaborate on to make it more suitable for everyone. The viewer expects all the commodities and accounts to be defined, there's no inference of anything. If you have multiple commodities there should also be at least one price point for each so that the conversions can work at all.
Hopefully that can get you started, happy to help more if needed. I'll beef up the README in the JS project to give more of these details.
There is definitely a lot more to do on both the functionality and visual side. I suspect mobile would require a completely different structural approach to the UI, which probably could also be embedded and auto-selected based on the device characteristics. Although it may make more sense to just have separate files for UIs that are completely different, instead of bundling them all together just to keep the file sizes down.
Not being a frontend guy at all (it undoubtedly shows :), mobile would likely be a heavy lift for me. I would probably want guidance of someone more experienced on that front.
I looked at hledger-web, and it is way more than what I was after with the viewer. It seems to be a full-fledged web UI of the same scope as Fava.
I should also clarify that I'm using "ledger" as a term for the data (journal seems to be another term used commonly), not as a reference to "ledger-cli" the program. I should probably adjust, it's just that I got started with ledger-cli and its docs and so inherited a lot of the terminology from there.
Yes, exactly. Thank you for clarifying that. I've been playing with coin for probably a bit over a decade now (on and off), but 2019 was when I published it on GitHub. The plaintextaccounting.org's tool list clued me in recently that most will probably not be too keen to mess around with Go to compile the project, so I've recently added the binary Releases as well. Fortunately Go is really nice for producing pretty self-sufficient executables easily.
I don't expect that coin itself will be all that attractive, the 3 leaders are just so much more capable and established, makes a lot more sense to go with those for most. But the viewer seemed like something that could offer something new, so that's why I brought it up.
Yeah, the JS is a fair chunk of text and likely to grow if more capabilities/reports are added. I just checked my ~20 years of personal books with almost 20k transactions come out at about 15Mb all combined. That does feel a bit gross, and could likely be compressed effectively, but then again that's basically size of a single high resolution photo, so maybe it doesn't matter?
As far as use goes, I now commit the viewer along with my ledger/journal even though it is redundant. It's kinda nice that it's just there and in all its versions as the time goes. I haven't done this, but it may make sense to just add the command to regenerate it into the pre-commit hook. That's my primary use case.
My other motivation for building this was to give my wife a way to look at the books easily, whenever she feels like. She's not inclined to play with the command line, but if I add a shortcut in her browser bookmarks and she gets a page where she can click around, that's a much more appealing proposition.
I'd love to, but I'm not sure how. I can see beancount and hledger tags on some of the other topics but I don't see how to update this one. If you can fix it for me, or give me a hint, I'd be grateful.