Sunday 29 March 2020

Strava Data Tool Update March 2020 - V3.1 - Released

As posted a few weeks ago I havce now "released" V3.1 of my Strava Forms App

Updates include:
  1. Segments.
  2. Continuous Updating consdering the Strava Rate Limit
The code can be downloaded here (its a Windows installer)

1. Segments
This version sees download and processing of Segment data. It will display a table of all Segments ridden by the Athlete. It will also display the segments ridden during a particular Activity. Double clicking on the row header for a segment will show all the ride times for that segment vs. date

Here's some screen shots to show this

First the Segments for the Athlete:




Here you can see that I have ridden 1683 Activities (Rides) and furing those rides I have ridden 16232 UNIQUE segments. This table will show how many times each segment has been ridden



The table show the segments by name but can be sorted in the normal way by double clicking on a column header. I.e. :



These are segments on my commute hence the high number of times they have been ridden.

Note that some segments seem to be uploaded to Strava with no name (i.e. the name is 0 characters length). These are identified in Strava with unique IDs, but at the moment this application renames them to "** Unnamed **" and groups them together:




Then the Segments for an individual Activity are displayed when an Activity (individual Ride) is selected (double click an activity row header:



Finally the history of a segment can be seen by double clicking on the row header for a segment selected (Uniion Road in this example):



The segment data is downloaded when the the data for an individual activity is requested - i.e. when you either use the menu option "Tools / Download all Activity Data" or an individual activity is selected by clicking on the row header for an activity (as normal). Therefore when starting the Application for the first time there wil be no segments displayed until some activity data has been selected. The Segment tab should update when segments are updated but I have seen inconsistent behaviour here. Closing and restarting the application will force the data to be shown

2. Rate Limits
Strava imposes rate limits for downloading data. This is 600 calls every 15 minutes and 30000 every day

For this application the daily 30000 limit is not an issue it would seem - even heavy use sees not many more than 5-6000 calls per day. However the 15 minute limit is a limiting factor. When using the "Tools / Download all Activity Data" option it will keep making calls until all the data is downloaded. On my system it is not unusual to use this low limit up in 10-12 minutes. The repsonse once this happen is to call an exception which stops the downloads. 

This has now been addressed. The limit is continuously monitored. When it is exceeded the download code loops every 20 secs waiting for the limit to be reset (it happens exactly on the 1/4 hour) and then continues untill all data is acquired.

The balance of calls remaining is displayed in the toolbar:


You can leave the download running  quite happily and it will continue until complete - ihave downloaded all 1630+ activities that I have uploaded several times without issue. It uses 2 calls per activity to download.

Other comments
  1. When the application starts first it checks whether or not it needs to authenticate, and does so if required
  2. It then loads all the data which can take 10-15 seconds
  3. Whne first looking at the Activity (Ride) list it may seem to freeze as it is identifying whcih activities have downloaded data and painting them blue This can take 5-10 seconds

Other changes:
  1. Many more small code "improvements" and tidying
  2. Some changes to make the GUI a little more responsive in a few areas
  3. Some other small improvements and minor error checks
  4. Previously there  has been no check if using a later version of code with an older database version. There are occasionally changes to the database. It now checks if the database is the correct version and aborts if not. In this case you need to delete the .ini file and start again as there is as yet no database upgrade tool

Next Steps
  1. Update the database table creation code for the last 2-3 tables (make sit easier to create the database tables and create DataTables to load data to and from the database
  2. Add Di2 data (from a .fit file)
  3. Continuous small improvements

Sunday 15 March 2020

Strava Data Tool Update March 2020 - V3.1 - Segments Added

Just a quick teaser for a soon to be future release - the application now reads the segments ridden during an activity, and is able to plot out the riders time performance over all occurences that the segment has been ridden

First the Segment list for an activity:


Note that the elevation gain is the maximum less the minimum gradient (so does not account for dips in the segment) - but Strava does not give this data in the segment summary (may be better able to be calculated from the segment stream data when I get to that point)

And here is my historical performance over all the occasions I have ridden the segment (in a time period):


There is more data that I will add here - statistics of the time,a histogram perhaps etc.

The biggest issue though is that the additional Strava Request traffic to get the segments now means that I can only read about 200 activities before the 600 Requests limit per 15 minutes is exceeded

This means that I have not yet been able to read all my 1700 activities into the database with the segment data, so I am going to need to take some other approaches in the workflow to work within the limit. When this is fixed I will release this next version.



The good news is that given all the work over the past few months I spent "improving" the code, this was actually only ~5-6 hours work to get this into a pretty robust state

Saturday 7 March 2020

Cycling in Spain on Costa del Sol near Fuengerola

We had a family holiday in Fuengerola on the Costa Del Sol over the February 2020 Half Term

My son and I hired a couple of bikes for part of the week and did two rides

The first was over to Mijas Pueblo with my son - here:



This ride was warm - but drizzly weather and poor visibility. At the end of the final climb - "Repetidor" my son took a video of me struggling to the top/finish line:




The second was a long climb to Puerto de LagoAbejas (I think):


I did this without my son - he'd planned a loop that was about 85 miles and I knew that I didnt have the legs for that. The ride was basically out the to the highest point and back the same way. It came out to 65 miles and 6500ft of ascent - I was utterly done in by the end

What was great though was - the week before in the UK a ride was full winter gear - these 2 rides were shorts and short sleeves

We hired from Bikestardo - I'd recommend them. Quality bikes delivered and collected. We hired a Felt VR Performance Ultegra 105. The only real issue was that the brakes are reverse to UK - i.e. the right brake - the front in the UK operates the rear on this bike, and vice versa.:

FTP as Calculated by Garmin

I have a Smart Trainer and also a couple of 4iii Power Meters (left side only)

When I bought a Garmin 1030 last year it forced me to use the Garmin Android App (before I just plugged my 800 into my laptop and let it sync to Strava

With the Garmin App you get all sorts of other data that I started to look at - one of which is FTP. I am not sure how it calculates it given I have never gone out to do a FTP test either on the turbo or on the ride - hence I don't think I really believe it. However it gives me a relative benchmark from ride to ride (when measuring power).


I find that it's actually quite demotivating how it seemingly varies relatively easily

Here's a screeenshot of my last 6 months:


My "Garmin FTP" rises during the summer, then drops away over the winter - I peaked at 216W in 2019 before it bled away. I managed to push it back up from about 195W in December 2019 up to 210W in late February by putting some big efforts in on the turbo when riding using the RGT trainer application. I found that the "hilly" Pienza, Paterberg and Ca de Formentor routes suited me to push the power. The flat routes - 8 Bar, Canary Wharf and Borrego Springs don't quite do it for me.

I don't believe the real value and if I did a proper test I am certain it would be lower that this - but it gives a benckmark to compare myself to and equate how I felt on a ride vs. what the numbers say

It also gives a VO2 Max value - I believe this does need a proper test so how this is achieved I don't know. I guess I need to read and see if they publish information in line. However whilst the FTP number is not that great, the VO2 number rates me as between 49-50, which for my age (let's just say it's 50+) rates me as having a Fitness Age of 20 - the top 5% for my age and gender - I'll take that.



Unfortunate Text Cropping

On my Android phone I get various items of "interest" suggested by Google

Obviously the screen is quite small and the descriptive text gets cropped sometimes

This item is somewhat unfortunate in where it was cropped...


What sort of data science are they doing?

Friday 6 March 2020

Strava Data Tool Update March 2020 - V3


There's been a lack of visible progress on this application for 6-8months

This is partly because:
  • the weather was good over the summer and I'd much rather be outside
  • I've written the Di2 decoder application for a change of programming focus ("a change is as a good as a rest")
  • and I have also been making significant changes to the Strava Data Tool "under the bonnet" based on learning from the TCXConverter and Di2 Decoder apps that I wrote and could see benefits in making it easier to mainatin the Strava Tool
  • The Strava tool grew organically making it a nightmare to edit and change the code - this is because I wrote it learning as I went and adding feature ad-hoc and hence there is no design to the code
However the dark winter weather meant that I have been back on this with quite a lot of effort over late 2019/early 2020

I also thought ready to release back in February 2020 but some last minute tetsing showed a major issue when creating a new database. It took me a long time to work out the change that caused this, which was in fact trivial and related to changing to a static SQL class and getting confused with the constructor behaviour

Although the app looks almost identical there is a big change list which includes the following (not-exhaustive) list
  1. Only raw data stored in the database (~60% reduction in database size and improved performance)
  2. Use of SQL_BLOCKCOPY to load data to database tables)
  3. Consistent use of DataTables throughout the app, and programmatic creation of these rather than predifined. Also the Datatable definition are used to programmatically create the Database tables menaing a much greater level of consistency and alignment
  4. Conversion to static for a number of common classes
  5. Introduction of a static Global_Constants class to improve maintainability and readability across the application
  6. A lot of code tidying up
  7. Removal of redundant methods- so the code base is now smaller

  
There's still a lot of improvements to be made:
  1. The most major issues seems to be a change with the authentication process that is less seamless than it was a few months ago - I have yet to resolve this. When you start the application for the first time it will open a web page asking you to approve access to (your) data. This is as designed. However if you then close the application or don't use it for a further 6 hours the application needs to re-authenticate - this is as required by Strava. In theory th eapplication should use one of the tokens set in the first initialisation and silentrly re-authenticate. However it doesn't and it throws an exception "Error #3000 during Web POST, Authentication_Web_POST/Get_Tokens". However if you select OK it will then open a web page and re-authenticate. I need to look at this more
  2. Some database tables still need "re-formatting" to the new process
  3. Lost the ability to export the graph as an image (as I changed how the export feature worked)
  4. Better logging format and verbosity - although its better, it's still a mess
  5. More testing and error trapping - again it's a lot better but still not exhasutive
  6. The redraw code still does not function correctly
  7. Further code general improvements- readability, structure, style etc.
Some features to be added include:
  1. Adding the ability to (manually) load di2 data from a .fit file and asscoiate with existing down loaded data, inluding the statistics and graphical displays (i.e. incorporate my Di2 Decoder application into this application
  2. Adding segments data
  3. Refining the statistics - I think allowing a level of user query building would be good (to an extent). Also getting data per bike and ride type for example - i.e. how many miles in 2019 on Bike X on a trainer
  4. Fixing some of the things athat are still broken

Anyway here are the links to the program
  1. The standalone .exe file is uploaded to here:Link to V3 standalone exe Zip file
  2. The installer package is uploaded to here:  Link to V3 Full installer - Recommended


I strongly recommend using the installer - its been tested and works as I expect it to

As far as I can tell there are no viruses in the zip and there is  no spyware - it just reads your Strava data

Best Help page is here: Notes from release 2.0.0.0