Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add daily streak report with calendar heatmap #743

Closed
alichtman opened this issue Nov 14, 2019 · 12 comments · Fixed by #1146 or #1759
Closed

Add daily streak report with calendar heatmap #743

alichtman opened this issue Nov 14, 2019 · 12 comments · Fixed by #1146 or #1759
Labels
enhancement New feature or request 📌 This can't go stale

Comments

@alichtman
Copy link
Contributor

It'd be cool to be able to see how often you're journaling. Extracted from #591.

I'm thinking that the calendar heatmap option in termgraph.py is a good choice.

@alichtman alichtman added the enhancement New feature or request label Nov 14, 2019
@eshrh
Copy link
Contributor

eshrh commented Jan 5, 2020

I'm interested in attempting to implement this. What would be a good way to invoke the heatmap?
I was thinking something like jrnl --calendar just like how termgraph does it.

Termgraph renders the calendar by density of entries on a day of the week cumulatively for the entire month, would this really be the best idea when a user just wants to see how many days in the past week they've written something?

Termgraph is very convenient because it's easy to just copy the single file into the project. It's ideal but harder to hack together some system to generate data in a form that can be easily fed to calendar_heatmap() but this seems pretty difficult from what I've tried(not much). The easiest solution would be to create a file that termgraph can read(just lines of yyyy-mm-dd,number) and then call main which would do all the label-generation, data formatting and normalization automatically. Of course, this adds an extra file, and I'm not sure if this is desirable(where would the file be stored anyway?)

I haven't looked into how to count entries yet, but I assume that it should be fairly straightforward given that functions like reading from and until a certain date work. Streak calculation is also easy once the distribution of entries can be obtained.

@wren
Copy link
Member

wren commented Jan 10, 2020

@eshrh Thanks for volunteering to work on a feature! I think this should be an exporter plugin (much like our current markdown, json, yaml, etc exporters). These are run by something along the lines of jrnl --export markdown and you can see examples of how to implement them in the jrnl/plugins directory in the repo.

Let us know if you have more questions along your way to work on this.

@UtahDave
Copy link

@eshrh I thought that was an interesting idea. Maybe this only needs to be added as a recipe in the documentation. What do you think of this?

jrnl --short | awk '{print $1 " 1"}' | termgraph --calendar

     Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan
Mon:
Tue:
Wed:
Thu:                                                  █
Fri:       █
Sat:
Sun:                                                 █

@alichtman
Copy link
Contributor Author

alichtman commented Jan 23, 2020

If they are using colorized titles and dates, they'll need this:

$ jrnl --short | awk '{print $1 " 1"}' | cut -c 10- | termgraph --calendar

This is a good suggestion, I think. I'm in favor of keeping this as a recipe (provided that we can get a real heatmap instead of a binary "jrnl / no jrnl" indicator).

@UtahDave
Copy link

@alichtman I need to create a longer history, but I chose 1 as the output because if we have multiple entries on a specific day, like a Friday, then the heatmap should heat up more. I believe that's how termgraph works

@alichtman
Copy link
Contributor Author

I tested that and wasn't able to get a real heatmap out of it. It's possible that termgraph doesn't support this but I haven't had time to look into it yet.

@marylein
Copy link

jrnl --short | awk '{print $1}' | sort | uniq -c | awk '{printf("%s %s\n", $2, $1)} | termgraph --calendar

this works for me to really show the "heat" on each day.

@alichtman
Copy link
Contributor Author

alichtman commented Jan 24, 2020

$ jrnl --short | awk '{print $1}' | cut -c 10- | sort | uniq -c | awk '{printf("%s %s\n", $2, $1)}' | termgraph --calendar

This is the version that works if you're using colored titles. Nice work, @marylein.

@wren
Copy link
Member

wren commented Jan 26, 2020

I think these all are promising, but have the downside of only working with certain date formats (since the date customizable in the config file). Why don't we implement a general export (like the tags) of dates and counts that can be piped to termgraph to get a heatmap? It might look something like jrnl --export datecount | termgraph.

@stale
Copy link

stale bot commented Mar 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Inactive issue: will be closed soon if no activity label Mar 26, 2020
@alichtman
Copy link
Contributor Author

Bump.

@stale stale bot removed the stale Inactive issue: will be closed soon if no activity label Mar 26, 2020
@stale stale bot closed this as completed Apr 2, 2020
@wren wren reopened this Apr 4, 2020
@wren wren added the 📌 This can't go stale label Apr 4, 2020
alichtman added a commit to alichtman/jrnl that referenced this issue Jun 21, 2023
alichtman added a commit to alichtman/jrnl that referenced this issue Jun 21, 2023
@micahellison
Copy link
Member

Re-opening to get the attention of the changelog generator when #1759 closes this.

@micahellison micahellison reopened this Oct 2, 2024
@micahellison micahellison changed the title Daily streak report (maybe heatmap) Add daily streak report with calendar heatmap Oct 2, 2024
@micahellison micahellison linked a pull request Oct 2, 2024 that will close this issue
4 tasks
edoardob90 added a commit to edoardob90/jrnl that referenced this issue Nov 16, 2024
* Update dependency ruff to v0.6.8 (jrnl-org#1900)

* Update dependency ruff to v0.6.8

* Run `ruff check .` instead of `ruff .` due to ruff error

* Preface ruff lint keys with .lint to address ruff deprecation warning

* Changes to appease ruff linter

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

* Update changelog [ci skip]

* Update dependency cryptography to v42.0.8 (jrnl-org#1904)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency requests to v2.32.3 (jrnl-org#1899)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency mkdocs to v1.6.1 (jrnl-org#1895)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency jinja2 to v3.1.4 (jrnl-org#1892)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency python-dateutil to v2.9.0 (jrnl-org#1898)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update dependency pytest-bdd to v7.3.0 (jrnl-org#1896)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency black to v24.8.0 (jrnl-org#1923)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency keyring to v25.4.1 (jrnl-org#1924)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency parse-type to v0.6.3 (jrnl-org#1922)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency pytest-xdist to v3.6.1 (jrnl-org#1897)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency poethepoet to v0.29.0 (jrnl-org#1925)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency rich to v13.8.1 (jrnl-org#1926)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Add calendar heatmap display format (jrnl-org#1759)

* Add calendar heatmap exporter

Fix jrnl-org#743

* Lint fixes

* More lint fixes

* Surface total number of entries per month in heatmap

* Refactoring

* More refactoring

* Resolve last lint error

* Unbump version

* Add calendar export test scaffolding

* WIP: Test debugging + scaffolding

* Remove broken tests

* Remove args from .vscode/launch.json

* Discard changes to tests/bdd/features/format.feature

* Remove extraneous vscode files

* move NestedDict to utils file

* run formatter

* fix import error

* Address lints

---------

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>

* Update dependency cryptography to v43 (jrnl-org#1928)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency rich to v13.9.1 (jrnl-org#1931)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency tox to v4.21.0 (jrnl-org#1927)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Add config to pa11y to workaround github actions issue (jrnl-org#1933)

fixes jrnl-org#1932

* Add Python 3.13 support (jrnl-org#1930)

* Allow Python 3.13 in pyproject

* Add Python 3.13 to GitHub actions

* Run `poetry update`

* fix failing test

* update poetry.lock

* update poetry.lock again

---------

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>

* Update changelog [ci skip]

* Update dependency cryptography to v43.0.3 (jrnl-org#1942)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency black to v24.10.0 (jrnl-org#1939)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency tox to v4.23.0 (jrnl-org#1935)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update dependency rich to v13.9.2 (jrnl-org#1937)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency ruff to v0.7.0 (jrnl-org#1938)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update dependency parse-type to v0.6.4 (jrnl-org#1936)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update dependency xmltodict to v0.14.2 (jrnl-org#1940)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update dependency typed.js to v2.1.0 (jrnl-org#1861)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update changelog [ci skip]

* Update peter-evans/create-pull-request action to v7 (jrnl-org#1929)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Force brighter color with XML syntax highlighting (jrnl-org#1943)

* Update changelog [ci skip]

* Changelog cleanup (jrnl-org#1944)

* Sort packages and and remove extraneous entries

* Move docs accessibility issues to docs section

* Increment version to v4.2-beta

* Update changelog [ci skip]

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Jrnl Bot <bot@jrnl.sh>
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 📌 This can't go stale
Projects
None yet
6 participants