tirsdag 22. mai 2012

Introducing "Extended data"

Composeg now has a new feature which I've dubbed "Extended data". This functionality makes it possible to view KOMS of composite segments filtered by year and month. I.e. Composeg now can answer interesting questions such has: Who was KOM in Oslo in 2011? Or April of 2012?

The feature needs to be enabled per composite segment, and this is something that I (for now) need to do behind the scenes. Currently extended data is enabled for these composites:

  • Oslos klatrekonge
  • Grusveier i Kroksskogen
  • Pioneer Valley

So, it works like this: You go to the Composite segment page and click on the composite you want. On the picture below, notice the button within the red rectangle; it indicates that this composite has extended data, and by clicking on it you will be redirected to the extended data page for the composite.


And below you can see this page. By clicking on the placement number for each athlete, you will get to see the individual times for the athlete on each segement in a pop-up. I hope that the rest of the functionality on this page is self-explanatory.



Delay

As mentioned, I have to do some things behind the scenes in order for this to work. This also is true for existing extended data composites - I need to pull down the latest efforts semi-manually, and so several days may pass before new efforts appear. This is in contrast to the "regular" viewer of composite segements, this view is always totally up-to-date.

Computing points

For regular composite segments you need to be amongst the top fifty in at least one of the individual segments in order to appear on the list. With extended data I have the ability to show everyone, but then the question is how to rank everybody. Of course, the main challenge here stems from the fact that not everybody has ridden every segment within the composite.
So I've done it like this:

  1. If you are among the top fifty in one or more of the segments, you get "real points".
  2. Everybody that has real points is automatically ranked before everyone who doesn't have any real points.
  3. For each segment the maximum time that anyone has used is located, and for each segment you haven't been on, you automatically receive this maximun time.
  4. All riders without real points are ranked according to their total time accross all segments.

tirsdag 15. mai 2012

Big in America!

I'm glad to note that the first overseas composite has been registered: The Pioneer Valley composite segment. This composite consists of several segments in the lovely state of Massachusetts. I have a special affinity with this state since I lived there for four years (1976-1980), in the small town of Mattapoisett. I've tried to locate segments in the vicinity of Mattapoisett with the useful Segment Explore feature, but apparently there aren't any.

I've been thinking of going back to Massachusetts (haven't been there for 32 years!), and now I have yet a couple of reasons to go: create a bunch of segments in and around Mattapoisett (so I can be KOM, of course), and visit Pioneer Valley to try out Mount Holyoke and the other segments there.

What's not so fun to note is what I already knew: that I suck at user experience design. It seems that the ui for creating new segments is a bit confusing, and hardly anybody manages to do it first time. As I've written about before, I haven't developed functionality for deleting or managing composites since I feel that I need to authenticate users before I can allow this.

I have now spent some time removing composites that looked like "false starts". Hope this helps.

I'm still hoping that I can release a new and improved version in the not so distant future.

mandag 14. mai 2012

Strava segment matching issues

Merckx-regler - TT. Hammeren - Skar - Hammeren 10K is a pretty busy segment in the Oslo area. It has been used as venue for the unofficial Norwegian championships for time trial Merckx-style(*). The problem with this segment is that it is an "out and back", i.e. a segment where you go back and forth on the same road. "Outs and backs" are, according to Strava, problematic for the segment matching algorithm.

On a ride last year I rode on parts of this segment (though I didn't know it existed), and behold: I set a pretty decent time on the segment. And only with 136 bpm! At the time I was top ten, but have since fallen to 38th. Hey, I even received kudos - not something that befalls me often.

The above picture shows the segment, and also reveals why I set the not-so-half-bad time: I turned around 1.25 km before a reached the real turn around point. So, in sum I only road 75% of the length of the segment (7.5 km of 10 km total). As I understand it the Strava segment matcher matches efforts that a) have the same start- and end point as the segment and b) follows at least 75% of the path of the segment (I was lucky there). And of course it also has to account for inaccuracies in the gps data received from the devices.

Btw, I'm not the only one - if you bother to take a look at the various rides, you'll uncover all kinds of rides that are not on the actual segment.

The people at Strava are working on improving the matching algorithm, and hopefully issues like this will eventually go away. In the meanetime I'm tempted to to all of these three things:
  • Create two seperate segments (in and out), and put together a composite segment on Composeg. This should yield the real leaderboard.
  • Try to write a "fraud detector" that can tell if an effort really is a real match. Mostly because it would be an interesting challenge - I have no idea how to do this.
  • Go up there tomorrow and ride all out, turning at "my special point". I think it's the only way I'll ever have the chance at being KOM on a not to marginal segment.


The moral of the story is of course to be careful with making segments that are out and backs or that are circuits.

* In short, a time trial competition where only regular rode bikes are allowed.

lørdag 12. mai 2012

Strava API for efforts per segment: Limitations and workarounds

The Strava API for downloading efforts per segment never returns more that 50 efforts. By including the option best=true, you get the 50 all time best efforts, i.e. the overall leaderboard from 1 to 50. However, this option does not work in combination with the startDate/endDate options. Thus, if you're interested in compiling leaderboards including athletes who are not among the top fifty, or if you want to show the best efforts from within a given timespan, you have to start doing a bit more work. Marc Durdin sums it up pretty good in this posting.

In essence what Marc is saying is that you have to call the API repeatedly, and whenever you get 50 efforts back, you split the time span in two halves and do two new calls. The lowest resolution available is per day, so what happens if you at the end are down to a day and you still get fifty efforts back? You're stuck. By combining this approach with a single call to the best=true, you're sure that you have the 50 all time best efforts + a substantial number of all efforts ever made. But for days when more than 50 efforts have been made, you are most certainly missing efforts.

Initially, I though this probably might not pose a problem, but I was wrong. A popular segment around here is Grefsenkollen, and on four occasions this spring 50 or more efforts have been made on this segment during a single day. The dates are:
  • 17th of April (Tuesday)
  • 19th of April (Thursday)
  • 24th of April (Tuesday)
  • 3rd of May (Thursday)

I thought these official numbers fra Strava HQ (posted December 2011) were interesting. One particulary interesting piece of information was that the fourth most active country in the world was Norway (Norway is of course not a very big country). So, this was 2011 - the numbers I'm seeing now indicate the usage has really risen for 2012, at least here in the Oslo area. I'll write a blog post about this sometime.

torsdag 10. mai 2012

The importance of identity

Take a look at the picture below. To me it's a nice image because it shows that other people have visited the site and made their own composite segments.

Hey! There's even a composite segment in the distant and exotic town of Trondheim! This thing is going viral!



But the image illustrates something else as well, and that is that currently it is not possible to alter or remove composite segments. Looks like the person who made "Trondheims Klatrekonge" started making the composite and then made the "grave" mistake of saving the composite without realizing that this action persists the composite and that it is now not possible to change it.

Of course, this is not what I want; I want people to be able to create, maintain and even delete the composites that they themselves have created. But a prerequisite for this is that Composeg needs to know who you are: we need to authenticate users.

I'm having a lot of fun developing this site, and I have a lot of ideas for features/improvements, but most of these don't make much sense until I know who the users are. So, developing some sort of authentication mechanism for the site is pretty high on my list of priorities. The general plan is to maintain a site where anonymous users are welcome to browse and have a look at the contents, but where you have to be authentiated in order to create or change data.

So, I have to decide on the mechanism. The easiest for me would be to roll my own username/password based authetication solution (because I've done it before), but I'm not sure if it's wise to force the users to remember yet another username/password combination. So, I'll probably go with OAuth, which will be a new development experience for me.

This means that you will be able to authenticate via your google-, twitter-, linked-in- or facebook account. Currently, I don't even know if it will be easy to integrate with all of these, or if I'll have to settle for one or two. We'll see.

onsdag 9. mai 2012

Who is "King of Mountain" in Oslo?

This deeply important question was posed by Martin on his blog in this posting. He continued by arguing that the best way to find the answer to this question would be to determine what the three most prestiguous segments in the Oslo area are. Of course, we are talking about segments on everybody´s favorite social training site: Strava.

And he landed on these three segments:

I realized that computing the list for "King of Mountain Oslo" is just a single instance of a general concept that could be interesting in many places and situations. Who is KOM in San Fransisco, New York or Ulan Bator? Who is king on the paths that I cycle in the woods where I live? etc. etc.

So the concept of "composite segment" was born, and the site Composeg was created. I hope that you will find this site of interest, and I am working on new features that hopefully will make the site even more interesting.

BTW, here's the page for the 100% up-to-date ranking of King of Moutain Oslo.

tirsdag 8. mai 2012

Hello, world!

I find myself spending a lot of time playing around on Strava, and when I discovered that there exists a REST-based API giving access to a lot of the interesting data that is stored in the Strava database, I thought it would be fun to do something with this API. And so the site Composeg was born.

This blog is the place where I can ramble on about bicycling, social training (Strava) and software development, and where nobody can stop me. I´ll also be using this blog as a vehicle for keeping the world informed about what´s going on with Composeg (implementation details, challenges, future plans).

The world´s got a right to know.