I use strava to register my rides where I mark my commutes. Once a year I need to identify the commuting ratio for tax reasons.
Strava has an api which is well documented, so please check that out here. The code below will get rides between two dates and calculates the ratio of commutes and private rides.
I’m going to update the code with generators to manage the paging, add some error handling on the requests and clean things up a little, as soon as I get round to it.
Find the code here.