ConnectStats setup for multiple services

From version 1.8, ConnectStats can source its activities data from different services. This was mainly done such that there is a future for the app, even if Garmin decide to close its data to 3rd parties.

In the first release, ConnectStats will support extracting data from Strava. At this point, getting the data from Garmin is still the only way to get running dynamics data for the new garmin devices (Forerunner 620), or some advance statistics like Normalized Power, etc. But Strava provide a good alternative for everything else.

We will go over in this post how to set up services. Please note it can be quite useful to maintain different profiles when using multiple services. You can also have several services enabled for one profile and it will combine the activities.

You access the setup from the settings page as below. The green arrow 1 points to the services setup, and 2 to the profiles setup.
To enable a service for activities download, turn on the Download Activities toggle.

ServiceAndProfiles

Services Setup

The service setup screen will initial shows the list of service with the setup for Garmin expanded. After all, at this point this app is still focused on the Garmin service… Simply tap on the service name, pointed with the blue arrow, to expand or collapse the setup information for a given service.

ServiceDefault

Garmin Setup

For garmin, once you enable the service, your main choice is the log in method.

  • With the direct method you enter your name and password, and ConnectStats will handle the login directly.
  • With the Web method you need to enter your name and password manually when required in the Garmin login screen. The direct method is much better, but unfortunately the Garmin service seems a bit capricious and sometimes returns an Access Denied, in which car using the web method can usually help.

Note that from the experience of users so far the Access Denied error usually is transient and after a day or so the connection may work again. Needless to say that Garmin has so far not helped providing any info how to avoid the problem. If they charge the fee they mentioned, one can only hope they will provide better support and a more reliable 3rd party access process.

There is also a Manual Login option. This is a last resort tool if all fails to see via a browser what happens during the login process. Try to login and once the Garmin Connect Dashboard appear, you can press either the List button or One to manually query some of the API the app is using.

Strava Setup

You can use Strava service in two ways:

  • As the source for your activities, when the Download Activities toggle is on.
  • To upload the activities you look at, when the Auto Sync on Download toggle is on.

There is no entry for the username and password in Strava, as the service rely on authentication via Strava website directly. What that mean is that, when you will try to use the service, the Strava website login will pop up. You will then need to enter your credential and the first time, authorise ConnectStats to access your data. Once you have connected once, usually the login won’t be presented again, unless you change profile.

Withings Setup

You can use Withings data to enrich your analysis with history of your weight or other measurement from a Withings scale.
To Enable, you need to enter your name and password in the setup, and Tap the Press to login line.

If your credentials were entered correctly, the screen should show the following

WithingsOk

If you have several user in your Withings accounts, you can select the correct one to use.

If you select the Auto Refresh option, every time you update your activities, ConnectStats will query the Withings service for new measures.

When the service is enabled, you will see in each activity details the latest weight corresponding to a given activity and in the Stats section you’ll be able to use the weight series.

Comparing activities in ConnectStats

My activities are often on the same paths, so I wanted a way to compare activities. Of course segment in Strava are really useful in finding out how fast you can run or bike certain route, but I wanted a bit more control in what I was comparing. I also wanted a way that is not over complicated within the UI flow of connectstats. Here is what I came up with.

To compare an activity you need to first mark the activity that will compared to any other activity you will then look at. For that, you slide an activity in the list to the left, which reveals the Mark button.

Markactivity 6

After you press the button and the activity is then marked, note the mark icon on top of the activity icon.

Markedactivity 4

You can then look at any other activity and the graphs of the marked activity will then appear in the background of the current activity. Here I am looking at activities where I skied up the same slope with skins. It’s clear the first one my heart rate was much higher than the compared one. It was pretty much the same path up, so really just show how I adapted to the altitude over the course of the week, I think… Look at the HR histogram

SkiupHRHistogram 3

Or the rolling best plot

Skiupbestrolling 3

Now of course I claim I took the same path up, or did I? Hit the map and the two paths will appear. The compared path is slightly less opaque

Comparepaths 2

Here you see though large part of the ski up was the same, I didn’t start from the same exact same place, but arrived at the same destination.

Data and smoothing used in connectstats

ConnectStats let us apply basics statistics technics to analyse our fitness data. We use these techniques to answer questions about the activities. How well did I do on this run? Is my stamina improving? Did I push myself more today that last week?

Raw Data

Before doing any analyses, let’s review the raw data we have access to. ConnectStats relies on the collection of the data is done with a garmin device and a collection of sensors.

The raw data varies by activity type and device.
For outdoor activities, the raw data will be gps coordinates, a timestamp, speed and values from different sensors: Heart Rate beat per minutes, cadence (legs or pedal), Power delivered on the bike, and sometimes more advance running dynamics like Vertical Oscillation, ground contact time. For swimming the data collected will be the time for each length and the number of stroke.

Here is an example of what the raw data looks like Blog txt

Depending on the activity or the device the raw data will be collected at fixed intervals or at different intervals trying to reduce the amount of data saved. If you move in a straight line for 5s at constant speed, it isn’t necessary to collect the points every seconds as they can easily be interpolated.

From this raw data, there are two main directions for the analysis we can do. The first is analysing a single activities and the second is analysing summary of each activities over time.

Focus on a single activity

The summary statistics are quite simple. Mostly we will want to look at the average of the different measure, maximum and minimum. Where it gets more interesting is to look at the series of data. As for most statistics analysis a first phase will be cleaning the data.

Data Cleaning

Let’s look at the graph of the data collected by the gps. You can see it is quite noisy, there is also large part of the data that is not really interesting to look at to. Some is gps noise, area with bad reception, pause due to stop lights,

Rawdatabad

To clean the data, we can first use assumption on expected constraints on the data. For example, define a minimum speed considered valid running speed, or a minimum valid heart rate to remove unreasonable spikes. Another technique used by connectstats is to filter points that have unrealistics acceleration.

FilterBadValues

The last smoothing technic we can apply is a moving average of a few points. Usually the app will use 5 points moving average for data, but it can be controlled in the sliding left settings window.

Filterbadnormalsmoothing

In the case below the graph start to be more readable now, especially with the 2 minutes moving average overlay, which shows the two short faster run intervals around 30min and 40min.

Best Rolling Plots

Critical Power Plots

I discovered recently the concept of Critical Power Plot, after a user left a comment on the site. Critical Power is the maximum power you can maintain for a given period of time. The concept seems mostly used by cyclists. But it felt to me it could be extended to other data: What is the best pace I maintained for any given period of time? What is the maximum heart rate I maintained for a given period of time?

So I decided to give it a go and implement it in ConnectStats. All I had to do was maintain a rolling average every X seconds and keep track of its maximum. It’s quite an expensive computation: for N points, I need to do NxN computations, and the devices processing power is a bit low, so I chose 5 seconds for X, which seems to work well in practice even on my old iPhone 4.

Of course, the original data in the file produce by the watch isn’t nicely produced every 5 seconds and for the algorithm to work efficiently, I have to resample the original data at the average on that exact interval, which can result in a bit of loss from the original file. But in practice it didn’t appear too bad on most of the ride I looked at.

I end up with a new time serie evenly spaced every 5 seconds: the maximum average heart rate over 5 seconds, over 10 seconds, over 15 seconds, etc, etc.

Just had to come up with a name, cyclist refer to it for the power field as Critical Power, but “Critical Power” or “Critical Pace” felt a bit confusing to me, so I named it “Best Rolling Heart Rate” or “Best Rolling Pace”

Here is the example from my best 10k race for the heart rate.

doc-detail-bestrolling-hrplot

 

This is quite nice and works also for power or pace.

Best Rolling Laps

Of course the plots are nice, but the next thing I wanted to know was for that best HR what were my others statistics for each of that given period of time where I reached that maximum?

So I enhanced the auto lap feature to show the best rolling lap corresponding to a few arbitrary periods of the plot. Below you can see the details for the Best Rolling Power or Critical Power of a friend, along with the distance, speed, HR for each of the correspond section of the ride.

doc-detail-bestrolling-lapsdoc-detail-bestrolling-lapchoices

 

 

 

The last missing piece was to plot on the map and highlight on the plot of another statistic where that best average was reached as below

doc-detail-bestrolling-lapdetail