How I improved my travel adventures with the Google Maps Nearby API
On May 28, 2019, I left my old life behind, boarded a train, and started my world traveling adventure.
Being the data person I am, I thought that besides documenting my travels through beautiful and colorful pictures, I could also record it and relive my experiences through data.
Here are the initial values.
For this first installment, written from the mountains of Tyrol in Austria, I have collected data about my Fitbit and Spotify activity, plus the atmospheric pressure and light intensity values (recorded through an app) of the places I have been to study and plot them.
My favorite thing about owning an activity tracker such as the Fitbit is not the device itself, but the data it provides. Having such a small and easy-to-use tool stuck in your arm, collecting data 24/7, grants us the opportunity of performing longitudinal studies with the information it provides. To create the visualizations I'll present in this section, I gathered Fitbit data about my activity (active and non-active minutes) and movement (number of steps, kilometers walked, and meters climbed) from the last couple of days. To get this data, I used the Fitbit API and the Python library "python-fitbit" to interface with it.
I'll start with some basic and standard Fitbit stats, that's it, the steps and distance walked.
This graph displays my steps taken, and distance traveled – in log scale – from May 28, 2019, until June 5, 2019. By looking at it, we can see that I had a vigorous and active start that didn't last long. During the first three days, I walked over 10000 steps (blue line), and almost 10km (red line). Then, for reasons unknown... wait, let me rephrase that. Then because I decided to finish some of my projects (and starting others, such as this blog), the numbers went down, except on June 4, because on that day I visited a city named Innsbruck and did a bit of walking. Besides these findings, a not-so-surprising-insight I noticed in these numbers is that, as expected, my number of steps taken and distance traversed are highly correlated (
r=0.98), showing that the tempo of my steps rarely varies. Nonetheless, it would be interesting to see how this correlation value evolves during the next weeks.
The second graph I want to present shows what Fitbit calls the elevation, a value that describes the distance I have walked vertically. For example, going upstairs, or my particular case, hiking. As previously stated, at the time of writing, I am in Tyrol, a mountainous region in the north of Austria, so it is unavoidable to find some literal up and downs.
The highest peaks of the graph are on May 30 (161m) and June 5 (106m), these are days on which I went hiking. Besides that, the other values seem to lie between 40 and 80 meters. Also, in case you were wondering, the median is 33.
The last visualizations I want to show in this section concerns my activity levels, which is Fitbit's way of categorizing – into one of four categories –how active a person is. These categories are "sedentary," "lightly active," "fairly active," and "very active." During these days, I achieved a total of 6510 (wow) sedentary minutes, 1957 lightly active minutes, 277 fairly active minutes, and only 183 very active minutes (I'll try to do better next week, I promise). On the following graph, we can see the breakdown of minutes spent at each level.
Now, the same data, but in a boxplot, so we can better see which observations are outliers, a term used to describe values that diverge from those that are considered normal.
Aha! The day with 1118 sedentary minutes is an outlier...but, so is the one with the most active minutes.
Atmospheric Pressure and Light Intensity values
Storytime: A few months ago, I had a problem. The issue was that I wanted to log the atmospheric pressure (for one of my experiments) of my current location using my mobile device (Android), and since I was aware that the phone (and yours too probably) had a barometer sensor, I went to Google Play Store looking for an app that does this. And sure, I found many apps that read sensor data and displays it on the screen. However, unfortunately, none of the apps offered the option to export the sensor data to an external file while the app itself is running in the background. So, I wrote (and published) my own app, and thanks to it, now I can continuously log and export the data from the various sensors my phone has.
In this section, I will present the atmospheric pressure data, measured in hPa, or hectopascal of the locations I have been, and the light intensity value, measure in lx or lux.
Now you might be asking: "why is this important?" or "Why are you calculating this?" Good question. First, I am a data person, so I like to collect data (pretty sure you already deducted this). Second, and most importantly, I believe that this data can tell a bit more about the current conditions of the places I have been, adding a bit of "spice" to the story I'm telling. Good? Cool. Now, back at it.
I'll open this segment with a scatterplot that visualizes the atmospheric pressure (in hPa) registered by the app. To give some context and contrast to what the conditions were previous to my trip, I extended the graph with data of the days prior to the start of my travels (May 28). Also, I added a smoothed line to the chart for better interpretability.
The main takeaway from this image is that the atmospheric pressure has decreased. This outcome was totally expected, since (as you should know by now), I'm currently at some mountain with an elevation of around 1000m above sea level (in case anyone is confused by this pressure-altitude relationship, I'll say in layman's terms that the atmospheric pressure decreases at high altitudes). Moreover, we can see that on June 4, the day when I went to Innsbruck, the pressure increased since this city is situated at 574m above sea level.
Now, let's head down the mountain and turn our eyes to the sky because I'll be talking about light intensity.
The second kind of data I want to introduce in this segment is light intensity data. This information, which is read by the phone's light meter, measures the illuminance of a place; its unit is lux or lx. The motivation behind why I wanted to capture this data was to obviously know the amount of light in my current location because that's pretty cool, but also because I wanted to find another way of estimating the time I spent outdoors. However, getting the correct readings is a bit of an issue because most of the times my phone is resting inside my pocket (or is it?). As a result, most of the readings are zero, or values close to zero. Nonetheless, during those moments in which I am walking playing Pokemon Go, or trying to find my way out of the woods with Google Maps, the phone should be able to get a couple of readings, which in most cases is more than enough.
Let's take a look at the values I collected through the last days. Again, I left some values of the previous days to see how they differ from the recent ones.
What the graph is telling us is that luckily, most of my days have been very sunny. Especially June 1, that day was awfully bright.
The background feature of my app is capable of performing one reading per minute, making it suitable for analysis in which a greater granularity is needed. Thus, I used the same light intensity data, grouped it by the hour, and calculated its average. The result is a graph (seen below) that reflects the daytime and nighttime period of the region I currently am.
To double check and corroborate my findings, here's today's sun graph of my actual location (taken from timeanddate.com)
For those interested in the app, this is the link to it: Background Sensors
Wait, Spotify data? Yep, that's right. While Spotify is not directly linked to anything "wander-ish" or "outdoor-ish," its data can tell a lot about my daily activities. To give a bit of background, for more than two years I have been heavily analyzing (and collecting through a service I wrote) my Spotify data and have discovered information such as my preferred style of music, favorite artists and even the times in which I don't listen to music. Therefore, I'm well aware of my musical patterns, and for this reason, I wanted to keep studying this data and see how it evolves during my journey.
Since this is my first week and I don't have much data (yet), I'll keep this section simple and will only show the number of songs I listened in these past days, and my top artist and songs of the week.
Self-explanatory, right? June 31 was the day with the most musical activity, while, June 28 was the one with the least. For a future article, I will breakdown these numbers by the hour and try to correlate them with another piece of data.
But, what exactly was a listening? The next tables present my top artist and the 10 most heard songs from May 28, to June 6.
|1||Tyler, The Creator||103||100|
|3||RUNNING OUT OF TIME||11||10.7|
|4||NEW MAGIC WAND||10||9.71|
|5||ARE WE STILL FRIENDS?||9||8.74|
|6||A BOY IS A GUN*||8||7.77|
|8||GONE, GONE / THANK YOU||7||6.80|
|9||I DON'T LOVE YOU ANYMORE||7||6.80|
Yes. Don't be surprised. 100% of the songs I listened to these past days were from Tyler, the Creator (I mean, have you heard his new album "IGOR"?!?!).
These have been the first days of my adventure, and my first shot at analyzing the data I have collected on them to present it in this series and experiment, which I titled "Wander Data." In this occasion, I introduced data from Fitbit and realized that I should get more active, sensor data to remind me to carry my sunglasses and Spotify numbers that validate my obsession with Tyler, The Creator.
The code I used for this report is available at the wanderdata-scripts repo, available here: wanderdata-scripts. Currently, it is somehow messy, but I'm planning on improving it.
Thanks for reading.