Friday, November 22, 2013

Low-Key hillclimbs consolidated results pages


I am a firm believer that old event results matter, and am always dismayed when I check for results of some past event or race and can't find them. The half-life for old results tends to be around 2 years: typically you can find last year, but go back two years, and it's 50-50. Since a big motivation behind Low-Key Hillclimbs was to show how things can be done better, I've made an effort to keep old results easy to find.

With this in mind, I've long had a vision that results should be in some sort of queryable data base. For example, want to find the best scores for women in the 20+ category? No problem. I can do that: I have command-line tools which allow me to quickly search a CSV file of scores from the entire series history. But to provide an on-line access to that would be nice.

But that would be a lot of work. As an intermediate step, I decided to write Perl code which would generate static HTML of the consolidated results for every climb Low-Key has done. Many climbs have been done only once, for example 5 of this year's climbs were new. Others have a rich history, most notably Mt Hamilton and Montebello, which are ridden every year (except in 1998 when Hamilton was ridden twice, Montebello skipped).

My code was similar, but far simpler, than the code I use to score the series. The increased simplicity was due to the scoring scheme and the lack of the need to calculate team rankings, overall score, most improved rider, etc: just calculate a score for each rider for each week. The scheme I used was a relatively simple one which I've used before: adjust women's time by a factor, find the median adjusted time for all men and women, calculate everyone's scores using that median as a reference for 100 points. This is simple and robust.

Then for each climb I just made a ranking. It's mostly fair, our start lines and finish lines haven't changed much with the notable exceptions of Quimby, which shifted due to sprawl, and Kings Mt Road. For Quimby I assigned the two start lines as separate climbs, but for Kings Mt Rd, the start lines were closer, and 1995 times thus have an advantage versus subsequent years.

A lot of this work was done during a 4 hour 20 minute Caltrain commute where the train was halted due to a down power line. It was a nice focused time to get it done. "A bad commute on the train is better than a good commute in the car", assuming you don't have a deadline.

Then I indulged in a little Javascript to randomize the banner for the page. This took a lot more time than I expected, but it's good to dust off my limited Javascript skills. Here's the result. Low-Key started way before Strava and part of the motivation was to document good times for various climbs. Finally, with results indexed by climb name, mission accomplished. But with Strava's exponential growth, that largely serves that function now.

Next would be cool to make pages for each rider, or better yet, to provide a PHP form which will do the same rather than maintaining static HTML.

No comments: