Habit tracker table and section summary generator from daily notes

Hi guys, not sure if this would be useful to anyone else but I wrote a python script to generate summary pages from historical daily notes by entries under each header, including a table to summarise e.g. tracked habits.

Demo: If your daily entries are generated from a template with set headers and look something like this:

The scripts generate summary reports like the following:

This might be useful if you have a template with set sections for your daily entries or use it “bullet journal” style and would like to see all the entries you made for each section.

There’s an option to use full transclusion if you want to edit in the summary page (e.g. check to-dos) and have it reflected back on the original daily note, or just want easy backlink navigation which is always handy. You can turn this off if you just want a summarised diary entry for a prettier view.

You do have to run the python file to generate these summaries and won’t update automatically with new daily entries, but there are ways to automate the scripts to run every day (e.g. using crontab on mac), I’ve added an example bash script I use to do everything in one go.

I wrote this script for fun but maybe this functionality already exists and I just don’t know about it - I only found out about Obsidian recently (loving it so far!) and don’t know the full extent of the functionalities it offers. So if there is an “official” way to look at summaries by header please do let me know since using that is probably better haha.

Some limitations:

  • I haven’t tested this extensively (tested on URL and [[page links]]), feel free to play around and send PRs

  • Habit tracking only works for check boxes for now (but the code should be able to eventually adapt to habits tracked with numbers as well)

  • Code could definitely be refactored e.g. some hard-coding going on with string partitioning etc. (I’m not experienced in handling html and markdown in python…) :slight_smile:

  • Known bugs (20/2/21): non-translusion display doesn’t work properly if you have a # tag right after a bullet point.

Here’s the code: GitHub - risaueno/obsidian_scripts

20 Likes

hi i am a complete beginner in obsidian and python but i find this code interesting ! could you kindly tell me how can i apply it to my obsidian ?

Hey just found this post! Super helpful thank you for sharing!

Hi I’m new in Obsidian and Python but I was able to run the script, it’s amazing thank you so much for sharing!

I have a suggestion/request: in the mood tracker is there a way to show the emoticon in each day cell instead of the tick mark? I use colours instead of emojis for my mood tracker so it would be cool to have in the summary a table that is completely coloured.
Hope I was clear. In the summary table instead of the tick, show the emoji for that day.

Thank you so much!

Hey! This is exactly what I’m looking for. However, I have no idea about python and how to get this working - is there somewhere I can learn please? Thanks for your work.

I am not the OP but you should be able to get it running something like this:

  • Go to the Python website to get a Python installer. Install Python on your computer.
  • Python is a command-line program. You’ll need to follow the instructions at the OP’s linked github to run the python script. You’ll mostly be typing the commands they specify into a console program (such as “Command Line” on a Windows PC; you can run Command Line from your Start Menu; you can type “cmd” to find and open it).

I haven’t tried running this myself (though I’m interested); I just know that this is generally what you’ll need to do.

1 Like