Don’t want to miss new stories?

Join the gang and get the newsletter here!

You’ll never ever receive spam email and you can unsubscribe at any point.

Quantified Teesche

An Expedition into the World of Tracking a Life

29th of June, 2022

In order to improve anything, you first have to take measure of it.

I’ve long been interested in measuring parts of my life in order to gain knowledge about what works and what doesn’t, but also just out of basic curiosity without any specific goal in mind. One early example I came across was the mathematician Stephen Wolfram, who took this to new extremes. In addition to the basics like weight and sleep, he measures things like how many keystrokes he types in his life, or the time of day he’s most likely to be on the phone.

This type of collecting data is all good fun, but the interesting part is correlating it. That’s the part many of the so-called Big Data companies still don’t get quite right, apart from building the foundation for how their advertising clients could target their audiences. But that’s a different topic.

I’m talking about gaining insight into one’s own habits from these measured data points for one’s own benefit.

Our devices and apps already track so much information about us, but making it truly accessible to us is something that’s seemingly not worth developing for the companies who created the hardware and software.

So, how can we liberate our data?

Recently, a project by former Google and Twitter developer and Viennese guy Felix Krause went viral in my bubble of the internet. It’s aptly named “How is Felix today?” and took him three years to build after tracking data for an even longer period. Take a look at it, it’s hugely extensive and provides interesting correlations graphs. There are unsurprising results, for example, how his mood is generally better when the weather is nicer or when he spends less time on video calls. Other parts can be used to learn from, like his proneness to getting sick while doing excessive traveling. Or his macro nutrition intake compared to his weight development for building muscle mass. Or how his mood usually profited on days on which he walked more than 15,000 steps.

This inspired me to see if I can do something similar and put it up on my website. I wouldn’t be able to make it as extensive as Felix, but maybe, given some time, I will be able to learn from it as well. Thinking about this and building it is fun to me.

First things first, though, and that’s the collection of the data.

πŸ™ Becoming My Own Data Octopus

In German, the wonderful word “Datenkrake” is often used when speaking about companies which collect all sorts of private data about their users, often without clear consent from them. The octopus, representing the company, is using all its eight arms to grab and keep all the data simultaneously. Facebook/Meta and TikTok are good examples of Datenkraken.

But how to actually get the data which I want to see and save?

βš–οΈ Weight

Starting with the basics, I do own a digital scale which has bluetooth functionality. It connects to my phone, which is an iPhone and therefore has the Apple Health app installed. The data goes from the scale to the scale’s app on my phone, into the Apple Health app and is stored there.

πŸ‘Ÿ Steps

You might know that this Apple Health app also saves a lot of other data automatically, for example the amount of steps you’re making when carrying the phone or wearing an Apple Watch. I do carry my phone almost all the time, so that’s probably quite accurate already.

πŸ› Sleep

For a few years, I have been using an app on the phone, called Sleep Cycle, for tracking my sleep. It also works as a way more sophisticated alarm clock than the standard built-in one, so there’s no downside. In addition you gain some insights into your sleep patterns, helpful or not. This data also goes into Apple Health automatically.

πŸ–₯ Work

Thinking about other aspects I could measure, I landed on the time spent working. In this area, I have struggled with different apps over the years which could do my time tracking for me, but none of them stuck or felt good. The mentioned Felix Krause uses RescueTime, which I then just set up and now, a few weeks later, I’m very happy with is so far. The data looks accurate.

That data is kept on RescueTime’s servers, but can be accessed with basic coding from any other server. The interesting part about RescueTime is its ability to automatically measure the time you spend across different apps and websites and categorize that into productive and leisure activity time. You can make changes to that, but it does a pretty good job on its own as far as I can see. A focused browser window displaying YouTube is leisure while an active code editor is productive. Easy.

πŸƒ Sports

It’s a big and daily part of my life and since I track my running, biking, or swimming with the Strava app anyways, it’s already on the internet. Strava has Apple Health integration, too, so that data also goes right into it.

On and off again, and continuously since the beginning of 2022, I have been doing daily core strength workouts. I usually track those locally using the Notion app to make that habit stick, so I had to think about a way to log workouts in a different, web-accessible way. More on that later.

🎭 Mood

Mood tracking has been on the rise, lately. A contributing factor to that might have been the negative impact that the pandemic had on the mental health of many people. Actively seeking to become a happier person is something more people are doing, at least from where I can see. Felix Krause solved this by coding a Telegram messenger bot which would ask him a few times per day about how he felt. Smart solution, but takes quite some time to build for me since I have no prior experience with building Telegram bots, so I went for a simpler solution.

🀳 Photo

I thought a good addition would be a daily picture of myself. Since the beginning of 2022, I have been using an app called Close-Up which reminds me to daily take a photo of me and creates a video out of those afterwards, making the aging process very visible. It’s awesome but it doesn’t save the photos in a web-accessible way, either.

πŸ₯ž Filling my Own Database

So now I have a bunch of data points measured, but they come from different sources and must be copied, or better, synced over to a central point on my servers in order to allow publishing them and later correlating them in a meaningful way.

  1. Apple Health holds the weight, steps, sleep, and also the Strava workouts.
  2. RescueTime has the time spent on my desktop and that productive slice of it.
  3. And for my core workouts, mood, and daily photo, I need to build something myself.

Good thing there’s still some basic web development knowledge left somewhere in the back of my brain! While I can’t apply that in my company as all my developer employees are much more advanced than I am and I need to make sure the company is running well anyways, it’s still sometimes fun for me to tinker around with PHP, JavaScript and the related languages as  I did back in the old days.

Here’s the homemade result.

There I have it, a few hours later I had finished creating a little hidden website which allows me to easily take and upload a photo, save a current mood via an emoji picker, and log a recently completed core workout session. βœ…

All of those things will be saved into a newly created MySQL database as key to value pairs with a timestamp, and the photo additionally goes into the standard file base on that server.

To take care of the RescueTime productivity data, I put a simple JSON fetch into this little updater website. Whenever I open the page to log something, my code just checks if the RescueTime data from the last few days is already saved, and if not, attempts to fetch and store it right then. This works well and doesn’t require running a cronjob which could break some day.

The Tricky Part: Getting Apple Health Data Out of the Phone

Apple is one of those companies which treat private data with respect. This is contrary to almost all the other tech giants, and in this case that’s actually a hurdle. The data is protected and only stored on the device itself. This makes it impossible to access it via a script on my (or anyone’s) server and instead requires the phone to be manually unlocked every time you’d like to see or export anything.

Obviously, for personal health data, that’s a good call on Apple’s side.

Apple never really built the Health app with the intention to make exporting any data easy or even just a basic use case. It’s possible, yes, but not practical. (Somewhere hidden in the depths of the app, there’s a CSV sheet export button which takes several minutes to process and subsequently sends a file of all the massive amounts of historic health data it has acquired of your behavior thus far. That’s okay, but not quite helpful in this situation.)

Fortunately, other people had the idea of making that process easier before me. Some cool folks created an app called Health Auto Export. The idea is that this app will access the health data on your phone regularly and save a selective backup of it in some place of your choosing, for example in iCloud or Dropbox. And it provides the functionality of creating a sort of automation or webhook, which would periodically send the selected Apple Health data to a server of your choosing.

Jackpot! 🎰

I took some time to figure it out but got it to work. The way they made the app work is a little hacky, as it can’t really push all the health data in the background, but has to wait for you to unlock the phone at certain times. And, as I found out, you also have to open the app from time to time, because that tells iOS that this app is allowed to continue submitting data in the background. Weirdly, the transmission of the daily step count, sleep, and weight works rather well, while the workouts are only submitted when you actively open the app and a make few tabs in it first. Not ideal, but working for now.

In the case of logging a simple run, the chain looks like this:

  1. My COROS GPS watch tracks the running itself. I hit start when I start, stop when I stop. It measures distance, speed, location, heart rate, elevation, and a bunch more information.
  2. After completion, the watch syncs via Bluetooth to the COROS app on my iPhone.
  3. The COROS app then auto-exports that workout to the Strava servers.
  4. Strava on my phone receives the data, is connected to Apple Health and moves the workout over.
  5. Health Auto Export then takes that Apple Health entry at some point in time and sends it to my own server.
  6. My code captures it and saves it into my database.
  7. And lastly, my code of the front page accesses that database to display the data.

As you can see, the chain is quite long and therefore has multiple possible points of failure. But apart from said Health Auto Export weirdness, everything is working stable. My first date of entry was May 8th, and now at the end of June, it’s still running smoothly.

πŸ”— Correlating the Data

I’m rather pleased with the turn-out and even received some positive feedback from other developers for it.

Making it slightly appealing to the eyes is also part of it.

For now, it’s a fun little addition to the blog website, and once I have collected enough meaningful data, I’m looking forward to coming up with ideas to correlate the different data sets and answering questions like the following.

  • Does the length or distance of a workout have a positive or negative impact on the amount of productive time per day, for example?
  • Is my mood usually dependent on how much sleep I get or not so much?
  • Is the desk time vs. productive time ratio influenced by my mood and if so, how much?
  • Does anything change when I switch the core workouts from afternoons to mornings?

The list could go on, even though the number of different tracked areas isn’t huge as of yet. I’m thinking about expanding this.

πŸ“‘ The Future

πŸ“ Location

For that reason I have recently restarted to use the Swarm app. I think I must have been among its first users back when it was very new on the iPhone 3GS and was called Foursquare. But along with many others, I abandoned the app over the years. It’s for checking in to the places you visit and leaving tips for others, which is actually quite useful. And it has an API which Felix Krause accessed as well in his huge project. Should be fun to implement.

🌑️ Weather

This is rather easy to do as there are lots of public weather APIs, but it requires my code to have knowledge of my current position on the globe for it to make sense. So I’m going to need to build a Location / Swarm implementation first.

πŸ—Ί Transportation

Another idea would be the tracking of the distances traveled via foot, bike, car, bus, boat, train, and plane. Doing it manually is always possible to a certain degree, but I would like to automate it and never have to think about the collection of that data other than when I want to see it. Still looking for solutions for that, but I think our phones must already be capable of differentiating between some of the modes of transportation as of now.

🌳 Carbon emissions

The amount of CO2 emitted by me would be another interesting thing, although that’s still really hard to do. As of now, I’m using an app called klima, which asks you a bunch of specific questions regarding your emission heavy daily habits and comes up with a number of CO2 emitted per month – which you then get to offset from within the app. At the time of writing, the number for me personally is 12.67 tons of CO2e per year. The ’e’ stands for equivalent, because there are several other greenhouse gases impacting the climate, including methane.

πŸ’† Mood expansion

So far, as you’ve seen, I only track my mood via the input of a representative emoji. That list could be expanded, but that’s not what I have in mind. A few random notifications per day which I would have to answer would make this more useful, I think. I’m imagining that tool asking questions like “For what are you grateful at this moment?” or “How is your energy level right now from 0-10?”. Possibly, there are apps which offer automatic export, but I haven’t yet done the research. Let me know, if you know any!

πŸ₯— Food intake

Not entirely sure I want to do this. From a nutritional and health perspective, this would definitely have a positive impact on my eating habits, I’m sure, but I’m shying back from it due to the amount of work it requires to input every single piece of food I consume throughout every day. Seems like lots of work. On the other hand, the apps for tracking it are great and several offer easy exporting.

πŸ’° Money

It would be good to include some money related tracking, too. I wouldn’t make all of it public, but maybe a ratio of monthly expenses between food, housing, utilities, transport, fun and other categories could be interesting. And the development of that ratio over time as well.

πŸ€” What to Make of This?

Felix’ main conclusion after building his huge project and doing the correlation after a bunch of years was that it’s not worth the time and effort put into it to build a solution like this yourself.

I disagree, though. The reason being, that it’s fun to do. It makes me happy to think about these topics and aspects of my life, do the research on how to solve tracking them, and look at the results later. The time invested in itself is a fulfilling activity. Yes, the destination of that journey might be underwhelming – some data points might not provide us with any meaningful insights, maybe even overall the results will return a sort of “meh” feeling, but I doubt it.

That being said, I do not enjoy the daily manual entry part that much. I’m hopeful that the Apple Health solution will improve over time, and I’m looking into making mood entry more fun and easier for myself. Other than that, the collection of data happens without any effort on my side and could go on for ever or until the database breaks for some reason, for all I know.

Looking over years upon years of that data surely is a satisfying thing for me and will definitely provide me with some ideas about how to improve some aspects. And that’s probably worth it.

What do you think? Which areas of your life would you like to quantify and why? Let me know by just replying to this email!

Until then, thanks for reading and have a great day!

Back to all Newsletters