Before we start, the problem I’m trying to solve here is being able to store some text information associated with a date and time. Now the obvious way to do this is to just open a notepad or an excel and just start writing entries into it. However, we will see later on that this method provides more convenient data entry, syncs in the cloud and leaves room for further data analysis (go nerds!)
For the purposes of this post lets say we want to log our calorie intake and our current weight. I’m using this as an example because it benefits from the quick and easy data entry this method provides.
Using dictation into your phone provides a very convenient data entry method. Most people have their phone on them at all times and for my native english tongue, the error rates of the Google’s speech detection are now low enough that its easier than manually typing in the information. This is especially true when you’re out and about as you can enter the data one handed.
On my Samsung S20 you can setup the home button so when you hold it down it activates the assistant. You should be able to do something similar on most modern smartphones either using built-in OS support or downloading the Google Assistant app from the store.
If This Then That
This is where things start getting cool. IFTTT is a free web service that lets you link together other web services based on a trigger and an action. Our trigger in this case will be saying “log weight 100” into Google Assistant and the action will be adding an event to our Google calendar.
There will be good tutorials online on the exact steps required to set this up but here are the main steps:
- Go to https://ifttt.com/ and create an account
- Give IFTTT permission to access Google Assistant and Calendar
- Create an applet linking the two together. Click the image below to see an example of the applet I used.
The applet above makes it so that whenever I say “Log X” into my Google Assistant, it will create an event that starts and ends at the current time in my Google Calendar with the title “X”. I have also made it use specific calendar to keep things separated. This command is very flexible and allows you to log whatever information you want. For weights you could say “Log weight 60 kg” and for calories you could say “Log calories 500 chicken”. It’s really up to you to decide on what format you want to use.
At this point you can use the process as is. All your logs are stored in Google Calendar so you can view and edit them as you would any other events. However, what if we wanted to take this a step further and for example, plot our weights over time?
Creating a Report with Jupyter Notebook
Jupyter is a web application which allows you to run python code interactively. The power of popular Python data science libraries such as Pandas, Numpy and Matplotlib coupled with rapid feedback and a rich display system make this is very powerful tool. Once you have created a notebook it can also be exported in a variety of formats and due to the cell-based nature of the interface it makes laying out the cause and effect of the code much clearer to the reader. The button below links to an example notebook which I exported to a PDF.