Hi,I would like to contribute to beancount by helping to rewriting bean-web,
in order to- make the navigation between different views (balance sheet, income statement, etc.) and filters easier
- make the UI (and UX) a bit prettier and make different features like filters (component, tag, year, ...) easily accessible via JavaScript (popovers, AJAX, etc.)- update the Python framework (to Flask maybe?) to make use of HTML templates (making changes easier)
- and decouple bean-web from bean-report (no more HTML coming out of bean-report, moving all HTML templates to bean-web)
Is there a need for a contribution like this?
Do you, Martin Blais, have any plans to change bean-web? And do you have opinions about the points mentioned above?
I would really like to get involved with this, but need some hints as where to start and a discussion about where to take this contribution to bean-web/beancount.
--Best regards,- Dominik
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/5b5e4e2d-a744-4696-9d0a-27497194cc26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To quickly show where I want to take the web interface for beancount I created a quick-and-dirty web application:
https://github.com/aumayr/beancount-web
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/BF372C66-45F1-4728-B7F4-5D29320C2491%40aumayr.name.
Haha I used this, manually patching my local beancount-installation with this diff, with bean-web for the last months :-D Thanks for that!
Can you elaborate on those two ideas a little bit? What exactly do you want to see?
There are the "Monthly totals"-graphs for each account and for the Income Statement (Income, Expenses). Do those make sense to you?
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/0B8FC9E0-DDD0-418B-A50F-21FC4C76475C%40aumayr.name.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/FEC6AE41-B60E-46F2-8D9E-A6CA9CA82575%40aumayr.name.
>> • Sums displayed not only for the leaf of the table but also for all parent.
>
> I did not yet figure out how to get these numbers, only the numbers for the leafs. Do you have any experience how to convince beancount to go give you all the numbers for an account tree?
>
>> • Ability to expend minimize the tree.
>
> I am on it. The client-side code (JavaScript, styling, ...) is not the issue here, as I already have these working. What is still missing are the sums for non-leafs, as mentioned above. Once I can get those from beancount I can finish implementing the tree.
I figured out how to get those numbers, and just merged the "collapsable tree"-feature, as well as the "sums for all parents"-feature into master.
>> Treemaps:
>> ---------
>> To generalize "drill-downs," a hierarchical chart ([1]) is among the most helpful for personal accounting, especially for Expense accounts. Some way to display this would be nice.
>> [1] https://en.wikipedia.org/wiki/Treemapping
>
> Excellent idea! I use treemaps to analyze my file system (http://www.derlien.com/), and it is very helpful! I will look for a JavaScript-library that does implement treemaps, and will implement it if I can find a good one.
Just merged the treemap-graphs into master, and am pretty happy with the treemaps!
One problem that I encountered: What about subaccounts that have a negative balance? Right now the treemap ignores negative balances (I invert the balances for Income- an Equity-subaccounts), but that is not a good solution…
One thing that did become apparent, though, in the course of fixing these things is that it might not be ideal for beancount-web to live in a separate repository from beancount, because it tends to be useful to redactor the existing report and ops code in beancount when implementing new functionality in beancount-web, and this is very hard to manage with separate repositories.
Lots to add on this exciting thread, but swamped at work and cannot mix oss & work time, will catch up on the weekend with comments. But quickly, the main issue if dependency management. You're moving much faster right now in a separate repo and that's a great thing. You could create a branch in Beancount repo with the changes to reporting to support your app and integration into the mainline code can come later , that's one idea.
Have to run,
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/3E2D151F-3E04-46FF-A02D-6FFBCF581794%40aumayr.name.
Yes, having beancount-web developed in a separate repository from Martin's main beancount repository definitely makes sense. Whether to include the beancount code in that repository or to use a separate beancount branch associated with beancount-web is less clear. I guess separate repositories is simpler, even though it may mean that a lot of pull requests have to be in the form of two pull requests.
--
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/49f9635e-166c-411f-98fb-247544913f29%40googlegroups.com.
You can also create custom reports in the separate repo, that's also not a problem.I could integrate them later if they're generic enough and I can maintain them.Or if you need something for a specific problem, you can ask. Reports are easy to build IMO.
I determined the source of the slowness with large files, and fixed it. I'll send a pull request soon. Essentially it came down to the fact that the monthly reports were requiring a full pass through all entries for each month, leading to quadratic scaling. The problem is that clamp processes all entries, including ones before the start date, in order to compute starting balances, even though this information wasn't actually needed. For net worth calculation, the holdings were being recomputed fresh for each end date, rather than just adding to the holdings from the previous end date.
I submitted a pull request with these changes (rebased). This fixes the speed issues with the monthly reports, at least for journals the size of mine / example.beancount.
I tried to implement the suggestions here:
https://github.com/aumayr/beancount-web/commit/34dc11b12caee21437bd4a43fe57f0529a8cb010
- Hide balance and change in journal for all accounts
- Update _inventory_to_json to only show currencies that have changed
Do the code-changes look correct?
> The remaining 8 seconds was spent actually rendering the page; eliminating that might be harder/require some sort of lazy generation.
Any ideas how to implement that?
> As I have more experience with web programming than with working with beancount I will focus on that aspect of the performace-issues ;-)
> The server-side rendering of the journal looks like the biggest slowdown, so I will try to generate the HTML on the client with JavaScript.
I commited many changes to master today, including the client-side rendering of Journal entries. How do these changes affect the performace for you?
Thanks Martin!
To quickly show where I want to take the web interface for beancount I created a quick-and-dirty web application:
https://github.com/aumayr/beancount-web
(can also be installed via "pip install git+ssh://g...@github.com/aumayr/beancount-web.git" for quick testing)
It is a separate package which uses an artificial API (api.py) to make calls into beancount and extract the data needed for the HTML templates. The API simply returns dicts with the data; this could be built into beancount itself: As a new format besides text, CSV and HTML bean-report could also return the data as JSON-dicts (this is what api.py tries to emulate). The web frontend, now somewhat detached from beancount itself, can now render the data as it wishes.
This decoupling also means that beancount itself can be as dependency-independent as you mentioned it should be, while the web frontend can be built using its own requirements (Flask, and a custom beancount-pygments-lexer, in the sample code above).
Some notable features:
- New template/styling with sidebar
- Filters in header (they do not really work that well at the moment)
- Syntax highlighting of the beancount-file (Source file)
- Charts to show some examples how they could be utilized (Balance Sheet, Income Statement, individual Accounts/Journals)
Some notable drawbacks at the moment:
- Absolutely no error handling
- No edge-cases tested nor handled
- Just tested with my own beancount-file (very simple and only half a year old) and with bean-example output
- No automated tests
- Slow for very large files (> 5 years in case of bean-example files)
- Filters (Tag, Year) not working properly (Tag better than Year), and Component-filter missing (Componets-links link to individual accounts)
- Source code highlighting works well enough for the moment, but the Lexer is far form complete (just a quick hack)
Can you test it in your browser? What do you think about it in terms of visual appeal, features and the decoupling via JSON/dicts that beancount.report emmits?
PS: I will collect your feature-ideas in a TODO-file in the beancount-web-repository so they do not get lost.
> Am 01.12.2015 um 06:54 schrieb Martin Blais <bl...@furius.ca>:
>
> On Mon, Nov 30, 2015 at 2:08 PM, Dominik Aumayr <dom...@aumayr.name> wrote:
> Hi,
>
> I would like to contribute to beancount by helping to rewriting bean-web,
>
> Sounds like a great idea to me! :-)
> bean-web needs some love and attention. It's aging.
> Or a new version.
>
>
> in order to
>
> - make the navigation between different views (balance sheet, income statement, etc.) and filters easier
> - make the UI (and UX) a bit prettier and make different features like filters (component, tag, year, ...) easily accessible via JavaScript (popovers, AJAX, etc.)
> - update the Python framework (to Flask maybe?) to make use of HTML templates (making changes easier)
> - and decouple bean-web from bean-report (no more HTML coming out of bean-report, moving all HTML templates to bean-web)
>
> Here are some aging thoughts for bean-web:
>
> - I've been meaning to remove the rendering of all the postings in journals; I think this detail is only needed on-demand, for specific transactions when debugging, akin to getting the "bean-doctor context" or "bean-doctor linked" invoked from Emacs/Vi. For a while I thought I could implement a client-side cursor that would allow one to "expand" a journal row to render its transaction, but that would still require rendering all of them in the HTML output, which is a bit overkill (it's slow for very long journals). Ideally, rendering a transaction's full detail should only be done on-demand. So maybe that's done in a request from a popup or via a link. Not sure how to do it, but the default journal shouldn't have to render all this detail.
>
> - In a journal, it would be nice to be able to toggle the visibility of (a) balance assertion rows, and (b) everything else than transactions. I'm thinking of some hotkeys, perhaps with a help menu.
>
> - In the balance renderings, it would be nice to have collapsible trees (I used to have them in a Beancount v1) that when you collapse, the total amount of the subaccounts appear. If you expand, they would disappear and the detail amounts on the subtree items replace them. I've been meaning to add that for a while, just no time for writing FE code.
>
> - About the framework: I'm specifically using the most simple framework out there in order to minimize the number dependencies. Bottle is literally one file of Python, and it doesn't change very much, which I like. If you'd like to use something that introduces more external installs, it would probably be best to do the reimplementation in a separate package (which I encourage you to do, there's no problem with that). I'm really trying hard to limit the amount of stuff Beancount itself depends on, so very sensitive about adding any new dependencies, I really don't want to introduce breakage because of external packages. I don't even depend on Pandas in it, for that reason, though it might have been useful for it.
>
> - An idea: One idea I've been having for a rewrite is to remove the hard-coded views and replace them instead with a FROM expression that would dynamically generate them. This way, all available reports any subset of transactions could be inspected easily. I imagined a textarea from the root page where the user could type an expression that would link to the view page (probably starting a balsheet). There would still be links to commonly used views (e.g. the last few years) but there would be no need to litter that root page with all the possibilities, e.g., for all tags. It's a bit of a mess right now.
>
> - About decoupling bean-web from bean-report: This would be going in the reverse direction of where I've started to move this. I've been meaning for bean-web to reduce more and more to being just a thin shell around common reporting code that just happens to render those to HTML. The point of doing this is that the very same code used to produce CSV or text reports should be used to render HTML as well, so that those reports' data don't differ at all. Of course, you're always welcome to write another UI that doesn't use those reports if that turns out being a limitation (and I can imagine it might be for some things, and certainly makes creating new reports slower).
>
>
> Is there a need for a contribution like this?
>
> Absolutely. And thanks for asking!
> While I have been shifting my own focus to using the shell more and more in order to support it better, I think it would be awesome to have a tool that provides new reports and visualizations (e.g., a treemap of assets, like this toy experiment I did but better: https://bitbucket.org/blais/beancount/src/9d56d5bfcf9310c3cd9a5fff0df4bf5a915dd911/experiments/treemap/bean-treemap?at=default&fileviewer=file-view-default).
>
> Tables of monthly aggregates seem to be a recurring topic.
>
>
> Do you, Martin Blais, have any plans to change bean-web? And do you have opinions about the points mentioned above?
>
> (See my brain dump above.)
>
>
> I would really like to get involved with this, but need some hints as where to start and a discussion about where to take this contribution to bean-web/beancount.
>
> I think the best way to proceed is to drive this from the perspective of what you would really want to see for yourself. What are you itching to have? I'd suggest maybe writing a very short doc on what you'd like to achieve just to organize your ideas, maybe share it with us, and then start to implement the features that aren't already available in bean-web and make that project public so we can kick the tires on it. I'd love to see how others would like to render their data.
>
> If you'd like to make some incremental improvements to good old bean-web, some initial thoughts above (I'll admit it's not very ambitious), happy to discuss more. I'm enclined towards avoiding killing bean-web... I think a very simple UI like bean-web should always be provided along with Beancount and it doesn't have to be the best, it should just be good enough and always work; I see bean-web as a baseline, not so much as "the best we could do," but something stable and simple we can always rely on and that implements much of what we can do that can work across everyone's input files. That's an inherent limitation right there. IMO more elaborate presentations should probably be borne in a separate codebase, at least at first, until they mature (there's no disadvantage to that BTW, that shouldn't be a problem at all). That's probably a more exciting way to build something new. If you want to improve it in place, I'd recommend starting slow and small, and writing unit tests if it involves new Python code, trying to keep with its current style as much as possible.
>
> I think in general the challenge is making presentations "generic" enough to work for many other users. I'm finding this in writing code for new Beancount features, for example: If I had to just write the scripts for myself as one-offs -- that's often how they start, BTW - it would take about 1/50th of the time it takes to bring them into Beancount and make sure all the corners are ironed and polished perfectly so that others can use them. In other words, I end up spending the bulk of my time coding specifically so that the tools are reusable and defined in the most general and simplest way (case in point: the recent price script I just release took forever to complete because I wasn't happy with it, it wasn't simple enough for others to use and depended on things that appeared only in my input file, I had to clean that up, and in the process I had to introduce some concepts, and ended up spending several weekends working on it... not all entirely fun; I ended up having to clean up how export code works to avoid crosstalk between the feature and so I had document those new semantics, I didn't really feel like doing that at all but it was the right thing to do in the end and the end result is much nicer and less confusing... I find joy in "finishing things" which is probably unwise in the bigger picture of my life, anyhow). And oftentimes, users will point out things that make me realize some things I hadn't thought about. It's really time-consuming. That's mainly why I'm trying to keep things really simple in the core, so that it's manageable, so that we end up with something that works with not too many pending bugs.
>
> (Final note: For contributions to the Beancount code itself beyond two-line patches and bug fixes we'd have to sign a contributor agreement like most other OSS projects, e.g. something like this: https://github.com/fourier/ztree#copyright-issues or like http://clojure.org/contributing. In case you're not familiar with this process, this is pretty common, not something nefarious, for the integrity of copyright and ensuring the code remains squarely in GNU GPL domain regardless who committed to it.)
>
>
>
> Best regards,
> - Dominik
>
> --
> 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/5b5e4e2d-a744-4696-9d0a-27497194cc26%40googlegroups.com.
> --
> 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/CAK21%2BhOWuUYpqjLmV%2BSM9jSp0vy8OP2mai4KYXDEo11%3DjB-_sA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
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/FCEA5F2C-E5AC-41FF-8EE4-B38FECEA4697%40aumayr.name.
At the risk of inundating this thread with my own wishlist, let me write a few more ideas out. These are perhaps not related to what you're doing at the moment with graphs, but here they are anyway.Data up-to-date indication:---------------------------When displaying the balance sheet, for Assets and Liabilities, I typically always compare my current balance to what the bank/credit-card/financial institution currently shows. Once they compare correctly, I put in a 'balance' directive for that account.It would be immensely helpful if account names were optionally color coded in the balance sheet display to help with this process, like so:Show account in:- green: if the latest posting is a balance check that passed (i.e., known-good)- red: if the latest posting is a balance check that failed (i.e., known-bad)- yellow: if the latest posting is not a balance check (i.e., unknown)
> When I click on an account in bean-web, it shows all postings under that
> account, including all children, and gives a total for the
> parent+children. But I don't know how you can get this total in the backend.
>
> Hmm, Martin might be the best person to ask.
I figured it out on my own, altough the solution is not the finest (the numbers are correct, but the code is ugly). The api.py file is not meant to be a production-ready file anyway, just a quick way to get what a hypothetical beancount-JSON-api might look like. New code can be found in HEAD.
> >> Barcharts for drilled-down expense categories:
> >> ----------------------------------------------
> >> It would be very helpful to compare any account in the hierarchy by month. Eg: Monthly expenditure in the Expense:Groceries account.
> >
> >This is already possible: Simply click on an account name to open the Account view. There should be a table chart with monthly balances. Is this what you are looking for? (Note: This does currently not work for some accounts, and I don't know why. But it should work for most.)
>
> Hmm, I see the "Monthly totals" link, but when I click on it, I get a blank
> graph. I updated from the repo a minute ago. Is this what I should be clicking
> on?
The graph is broken for some Accounts, and I still have to figure out why.
But in master there is a new menu item which shows a big table with monthly aggregations of each account (full tree like Trial Balance). Does this work for you?
> >> Data up-to-date indication:
> >> ---------------------------
> >> When displaying the balance sheet, for Assets and Liabilities, I typically always compare my current balance to what the bank/credit-card/financial institution currently shows. Once they compare correctly, I put in a 'balance' directive for that account.
> >>
> >> It would be immensely helpful if account names were optionally color coded in the balance sheet display to help with this process, like so:
> >>
> >> Show account in:
> >> - green: if the latest posting is a balance check that passed (i.e., known-good)
> >> - red: if the latest posting is a balance check that failed (i.e., known-bad)
> >> - yellow: if the latest posting is not a balance check (i.e., unknown)
> >
> >Is this a best/common practice?
>
> This is an idea that I've had for a while. I'm not aware of where this would
> be a best/common practice apart from personal finance software that attempts
> to sync with institutions. The closest I can think of are these: Gnucash has
> the "reconcile" functionality and indication. Yodlee has an indicator showing
> when the last refresh was. My idea came from the fact that this is the first
> thing I do after importing, to figure out the "health" of my latest data
> update. Currently, I'm forced to go through this process manually, and it's
> exhausting.
This should be implemented in beancount first, as beancount-web tries to have no application logic whatsoever (except for api.py, which should eventually be implemented in beancount as well).
@Martin, what do you think about this feature?
> Would you like feedback, bug reports etc. via github? It seems to me like github's infrastructure for these would make it easier, but if you can state your preference, I'll post accordingly.
Thanks for giving it a try, and giving feedback!
We can kick off general discussions about features of beancount-web (and it's relation to beancount) here, and if you find a bug or have direct feedback about a component I would be happy if you directly open an issue on Github (https://github.com/aumayr/beancount-web/issues/new). Also, if a discussion about a specific feature results in a decision ("we should implement that", etc.) we can use Github issues as a TODO-list (tag "enhancement").
On Wednesday, December 9, 2015 at 6:35:11 AM UTC-8, Dominik Aumayr wrote:>> Treemaps:
>> ---------
>> To generalize "drill-downs," a hierarchical chart ([1]) is among the most helpful for personal accounting, especially for Expense accounts. Some way to display this would be nice.
>> [1] https://en.wikipedia.org/wiki/Treemapping
>
> Excellent idea! I use treemaps to analyze my file system (http://www.derlien.com/), and it is very helpful! I will look for a JavaScript-library that does implement treemaps, and will implement it if I can find a good one.
Just merged the treemap-graphs into master, and am pretty happy with the treemaps!Yes, it looks great! I like the clean, short labels and mouseover.I assume that you're thinking of putting something in like arbitrary start and end dates, or better yet, allowing for an arbitrary query? For eg, I typically want to see my expenses minus taxes.
Any ideas how to implement that?Unfortunately I don't have much experience with web programming, so it is hard for me to know what would be fast, and I also don't know what the options and tradeoffs are as far as lazy-loading a scrollable list. If the slowness is due to python generating the HTML, maybe there is a way to optimize the template code. We could also just send the json to the client and generate the html using javascript.
A strange behavior I noted is that starting with 'beancount-web JOURNAL'
give an 'Internal Server Error', however starting with '--debug' works
normally wihtout debug/error output then I can't file a bug report.
I spent some time and tuned the interface to my own taste, if someone is
interested in the "skin" I can share the CSS.
Screenshots are attached.
--
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/20151217174422.GE22276%40mordomo.mordomo.local.
<bean-01.png>
<bean-02.png>
<bean-03.png>
<bean-04.png>