← All posts
· 5 min read

Automating Workout Tracking in Notion

A Notion workout tracker built around progressive overload, plus a Python Lambda that fills in each routine's exercises automatically.

Health & FitnessAutomationNotionPythonAWS Lambda

I have been going to the gym for a while, but I had been following a simple plan where I did the same routine 3 times a week. I would track the weight progression in my head each day and try and improve on it the next. While this was working initially, I wanted to try a different workout plan that consisted of 4 days a week with many different exercises. When I first switched over to this new routine, I couldn’t keep track of all of it in my head. This led me to need to figure out a way to track my workouts. I wanted to:

My Solution

The solution I came up with can be broken down into two components:

Notion Setup

In Notion, to store and update all the information for workouts, I created 4 databases and 1 dashboard page. These are the exercises database, routines database, routine log database, exercise log database, and Dashboard.

Exercise Database

This database stores a list of all possible exercises I could do. The information for each exercise are:

Routines Database

This database stores the lists of all the possible routines I can do and a table with all of the exercises that are part of the routine. The exercises in the routine need to specify:

Routine Log Database

This is where I keep track of all of my workouts. Every time I work out I create an entry in this database. This contains information about:

Exercise Log Database

This is the most important table for me! It keeps track of every set that I do for an exercise. I can use this to track progress and help make decisions for weight and reps during my current workout. I track:

Dashboard

This dashboard is the main page I view when working out. I can use it to create a workout, add information about exercises, and look at the past reps and weight of a previous lift. My workout flow is:

  1. Create a workout in the routine log section with a linked plan.
  2. Set the status to created. This allows the automation described next to create all the exercises for a routine. If you do not have the automation, you have to manually create each exercise log entry.
  3. Enter data in the exercise section as I go through the workout and use the individual exercise tab to look at past performances for certain exercises.

Automation

I was pretty happy with the original setup, but I found that adding each exercise to the exercise log for a routine before every workout became very time-consuming. I had just created a software service that syncs my WHOOP data to Notion, more information here, so I wanted to automate this process. Here is how I did it:

There are a couple of key things in my setup that allowed me to do this:

With this setup, I created a script using Python and the Notion API to check for any routines in the routine log with a created status. If it finds any entries, it grabs the data from the linked routine and creates all the exercises in the exercise log. Once this is done, it sets the routine log entry to ready status.

I didn’t want to have this run script manually, so I created an AWS lambda that would run every 5 minutes and check the table for new routines. I then used terraform to deploy the code, and voila, I can now add a routine to the routine log and within 5 minutes, all the exercises are created and the routine is set to ready. If you are interested in the code, I have uploaded the source code to GitHub here.

Conclusion

I really enjoyed taking the tools I have and creating something that adds value to my life. I know there are a lot of workout apps out there, but I found it so fulfilling to create my own implementation of it and maintain full control over my system!

If you are interested in creating a solution like this tailored to your needs, I can help out at gw3tech.com.

Also published on Medium. This page is the original.