Watson
Watson copied to clipboard
Make report aggregation more flexible (or allow for tag summaries)
Currently there is aggregate
to group information by day,project,tag
and report
to group information by project,tag
. For me, it would be useful to see an aggregation per tag to answer questions such as "how much time did I spend in meetings this week?" (similar to timewarrior's "totals" extension).
While thinking about preferred approach for adding this, I thought that instead of adding a new command or a flag to either report
or aggregate
, it could be better to reduce ambiguity and have a single command for all the grouping operations. So instead of having both of the similar aggregate
and report
command, you would just have report
and then a --by
flag for in which order to group/aggregate information by, e.g.
# Current behavior of `watson aggregate`
watson report --by day,project,tag
# Current behavior of `watson report`
watson report --by project,tag
# The tag summary I am interested in
watson report --by tag
This is conceptually similar to how groupby
works in pandas dataframes and would allow for more flexibility when generating reports. This would also be backwards compatible since watson report
could retain its current default behavior and watson aggregate
could be made an alias for --by day,project,tag
(possibly tagged for future deprecation).
If this is considered too big of an undertaking, I would still be interested in an option to just aggregate by tags. What do you think?
I am happy to submit a PR if there is interest in this feature. I think it could be quite useful so I might start working on it for myself anyhow. I am thinking that the already existing sorted_groupby
might be useful, but I will have to look into it more. If you have preferences for how this would be implemented, please let me know.
Note that this suggestion conflicts with the suggested use of --by
to order tags non-alphabetically as suggested in #362. Either that could become --order-by
or this could become --group-by
.
Aggregation by week, month and year would be awesome!