UPDATE: As of 01/30/2022, I've archived my Notion page, and data is no longer being collected. As such, the program no longer has access to the data from the workspace and will not be able to generate figures and display them. The code will still work as described if you customize the setup with the instructions below.
I was inspired to visualize the data that I've been collecting for the past month with my Habit Tracker in Notion. I use Notion daily to track deadlines, plan out obligations, manage finances and spending, and more. I recently started logging personal habits using Notion's tables and checkboxes function. Though Notion's interface is very powerful, I wanted to graphically view the data that I'd been collecting without having to stare at a table full of checkboxes.
Note: The code for this project was based on how my Notion page was set up (see here). Results may vary based on how each user configures their pages within Notion.
Notion's API is the primary driver behind this. Thanks to their easy access with databases and integration tokens, I could gather and visualize the data quite easily. After connecting to the Notion Page, the dates, subjects/topics, and checkbox info were all taken from the table. Next, the data was organized, and eventually plotted. Finally, the results were made accessible in a simple web app using Streamlit's open-source app framework.
Go to Notion's API page here and follow the step-by-step instructions to create a new integration and find the secret API key. Store this!
First, go to your Notion Page. Then, click on the "Share" button, and invite the integration that you've created with your account so that it has access to the page where your table/board is located.
Since each Notion Page is different, you'll have to set your database's ID and integration tokens within the code.
integrationtoken = .......
DATABASE_ID = .......
Information on finding the database ID can be found here.
To clone this repository, run the following line in your command line or Terminal.
git clone https://github.com/reeteshsudhakar/productivity-tracker
Once the integration token and database ID are changed and the code is run, a locally hosted web app will open with the visualized data.
- Exceptions and Error Handling - errors, warnings, etc.
- Plotly figure generation
- Streamlit integration