Article Tags

Generating Running Statistics

By William Jeffrey Rankin, Tue Jan 30 2024


For the past several years, I've been recording my running data in a simple spreadsheet. Previously, I'd used services like Dailymile (now long defunct) and Strava (which moved many of its features to the premium version). Wanting to do something useful with the data, I wrote a set of scripts to answer the following questions:

  • For a given month or year, what do my running stats look like? For example, total number of runs, distance, time, as well as average time per run, distance, pace, etc.
  • What does the distance profile look like for the period, i.e., how many short runs? medium-length runs? long runs?
  • Were there any notable events (e.g., poor weather, injury, etc.)
  • How many miles do I have on my current shoes?
  • What's my best time for a particular route?

The data look like this:

22-Jan-24,Rest day
23-Jan-24,Run,River Road,32.38,Saucony Cohesion TR15,3,Icy!
24-Jan-24,Run,River Road,58.53,Saucony Cohesion TR15,6
25-Jan-24,Run,River Road,38.83,Saucony Cohesion TR15,4

With fields consisting of:

date, activity, route title, time, shoes, distance, notes

The scripts were written in the Rexx programming language. Initially, I was only going to prototype using that language, but I was so pleased with some of its text formatting capabilities that I stuck with it.

Usage & Sample Output

The script produces a report that includes basic statistics, distance profile, and notes. In the example below, a report is generated for January 2024 based upon data in data.csv. To output data for the entire year, pass - rather than a three-letter month name.

jeffr@CALLISTO: D:\Documents\wo-data $ regina .\rs.rex .\data.csv 24 Jan

----------------------------Running Statistics-----------------------------

Total entries:  31
Total runs:     22
Total time:     14.33 hours
Avg. time:      39.09 minutes
Total distance: 87 miles
Avg. distance:  3.95 miles
Avg. pace:      9.89 minutes per mile
Min. distance:  3 miles
Max. distance:  6 miles

-----------------------------Distance Profile------------------------------

3 to <6  *****************19
6 to <9  **3
9 to <12


02-Jan-24: First run of 2024!
06-Jan-24: Snow run.
19-Jan-24: Snow run.
23-Jan-24: Icy!

eq.rex outputs the number of miles on a pair of shoes:

jeffr@CALLISTO: D:\Documents\wo-data $ regina .\eq.rex .\data.csv saucony cohesion tr15

saucony cohesion tr15: 75 miles

bt.rex shows the best time for a given route (in this case, route is a combination of route title and distance):

jeffr@CALLISTO: D:\Documents\wo-data $ regina .\bt.rex .\data.csv 6 River Road

17-Oct-21, Time: 48.00, 8.00 minutes per mile

gd.rex outputs planned runned data (an empty dataset) so you aren't required to key in a new month manually. Route title, shoes, and rest day are configurable.

jeffr@CALLISTO: D:\Documents\wo-data $ regina .\gd.rex 24 Feb 29
01-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,
02-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,
03-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,

Download, 11K

Future Plans

  • Standard deviation for time period (may require moving the scripts to PowerShell or Python)
  • HTML/Markdown output