Release 0.5.1 support to Nike Run Club app tracking files
New release of runpandas comes with the modules to read and handle one or multiple activity files from Nike Run Club tracking social app.
This current state of the project is
early beta
, which means that features can be added, removed or changed in backwards incompatible ways.
We published this minor release with one more social tracking app reading data support: Nike Run Club. In this release of RunPandas 0.5.1, we include:
- Reader module support to Nike Run Club app
runpandas.read_nikerun
. Reading and handling the JSON tracking file from the Nike Run API into arunpandas.Activity` Reader module support to Nike Run Club app. Reading and handling the JSON tracking file from the Nike Run API into a
runpandas.Activity` - Read and traverse a directory of Nike Run JSON activities by combining them into a single Activity by the function
runpandas.read_dir_nikerun
.
Runpandas is a python package based on pandas
data analysis library, that makes it easier to perform data analysis from your running sessions stored at tracking files from cellphones and GPS smartwatches or social sports applications such as Strava, MapMyRUn, NikeRunClub, etc. It is designed to enable reading, transforming and running metrics analytics from several tracking files and apps.
Nike Run Club is one of the most popular free fitness apps that tracks users' runs, capturing time, distance, pace, heart rate (with a fitness tracker), and route with an impressively precise GPS. It is available on Android and IOS platforms.
Nike Run Club doesn't offer a official method to export your historical fitness data, unfortunately. However there are several third-party tools available to overcome this issue. One of them is use the open-source tool NRC-Exporter, written in Python, that makes possible by commandline to export all your runs which have associated GPS data and converts them into the GPX format.
Screenshot from the NRC-Exporter Official Repository Website
The NRC exporter makes available the activity JSON files, which after are converted to GPX format. You can work with both of these formats: GPX or JSON. In this post we will show how to load the JSON files. After running the extractor you will have a directory of all JSON files. It should look something like this:
$ tree activities
activities
├── 0019f189-d32f-437f-a4d4-ef4f15304324.json
├── 0069911c-2cc8-489b-8335-8e613a81124s.json
├── 01a09869-0a95-49f2-bd84-75065b701c33.json
└── 07e1fa42-a9a9-4626-bbef-60269dc4a111.json
Now you can load these JSON files into our runpandas
reading package.
Let's load an exported run from Nike Run using the method runpandas.read_nikerun
. This method was specially built for loading the exported JSON Nike Run activities, with all the handling data included.
#Disable Warnings for a better visualization
import warnings
warnings.filterwarnings('ignore')
#!pip install runpandas
import runpandas as rpd
activity = rpd.read_nikerun('./data/nikerun-sample.json')
activity
As shown above, the activity now after loaded can be analysed as any other activity in runpandas!
#compute the common metrics for the running activity such as distance per position, speed, pace, etc.
activity['distpos'] = activity.compute.distance()
activity['speed'] = activity.compute.speed(from_distances=True)
activity_only_moving = activity.only_moving()
activity_only_moving.summary()
We also provides the method runpandas.read_dir_nikerun
, which allows the user to read all the tracking files in JSON format in a directory and combined them into a runpandas.Actvity
split by sessions based on the timestamp of each activity. Does it sound familiar to you? Exactly, it works as same as the runpandas.read_directory_aggregate
, but it is specific for the Nike Run JSON output files.
To illustrate this in action, let's load a session of 6 activities of a single runner exported from he Nike Run account:
#!pip install runpandas
import runpandas as rpd
session = rpd.read_dir_nikerun('./data/nikerun_session')
session
print('There are ', session.session.count(), 'activities')
#In this example we compute the distance and the distance per position across all workouts
session = session.session.distance()
#comput the speed for each activity
session = session.session.speed(from_distances=True)
#compute the pace for each activity
session = session.session.pace()
#compute the inactivity periods for each activity
session = session.session.only_moving()
summary = session.session.summarize()
summary
print('Session Interval:', (summary.index.to_series().max() - summary.index.to_series().min()).days, 'days')
print('Total Workouts:', len(summary), 'runnings')
print('Tota KM Distance:', summary['total_distance'].sum() / 1000)
print('Average Pace (all runs):', summary.mean_pace.mean())
print('Average Moving Pace (all runs):', summary.mean_moving_pace.mean())
print('Average KM Distance (all runs):', round(summary.total_distance.mean()/ 1000,2))
As we illustrated above, we can extract several statistics from the session workouts using the same methods and acessors available from runpandas.
The next releases will focus on supporting marathon results. It will be awesome, keep tunned!
We are constantly developing Runpandas improving its existing features and adding new ones. We will be glad to hear from you about what you like or don’t like, what features you may wish to see in upcoming releases. Please feel free to contact us.