What's the most niche topic that you can confidently talk about for 5 minutes?

#askFedi

@mayintoronto Probably the details of how ranking scores are calculated for the Highland Games

I know it’s niche because when I had to implement said scoring (rebuilding https://csaf.ca), the only complete info I could find was the code & database dump of the old site! Even the chairs of the organization don’t know all the nitty-gritty details…

CSAF

@jamesnvc I would LOVE to hear more about this.

@icecolbeveridge Well! The source is available if you dare look at how it's implemented 😅 (starts around here: https://github.com/jamesnvc/csaf-website/blob/main/src/csaf/server/db.clj#L1322)
The nub of it is that highland games uses "decathlon scoring" for official results, meaning the record for the event & category is worth 1000 points, anything else is a linear interpolation of that. Now "record for that event & category" seems straight-forward, but there are already edge-cases for classes that don't yet have records, when the record changes during a throwing season, and some of the new classes have set standards instead of using records, but let's set that aside for now...

So, I said the results are linearly interpolated from the "best result" for that event & class, but there are already some wrinkles. For one, the caber isn't scored by distance, but by a combination of the weight and length of the “stick” and the angle of the thrown result! Comparing these is difficult to the point that there isn't actually a record for caber (e.g. is a 11:45 on a 21’ 100lb caber better than 12:00 on a 19’ 125lb one?), so that one is purely calculated from the above factors, not based on the record. Then, the stone events (open & braemar) have variable weights (since it's literally just a neat rock the athletics director found), so there's a scaling based on the record distance and weight for those, except there's both a lower bounds for the weight (in which case it's worth zero) and an upper bound (in which case it just counts as the maximum weight).

So calculating the raw scores has lots of fiddly bits, but then we get to ranking! Now, lots of athletes compete in both Masters 1 (over 40) and Open, so when computing rankings for an athlete in a given class, their results throwing in a different class need to be re-scored as if they were thrown in that class as well and compared to see if they're better — keeping in mind that the classes have different weight standards for the events (so a throw might not count at all, or be scaled differently), as well as different records.

There are also some strange bugs that were ported from the old site (which was written in ColdFusion in the 90’s) that were kept in order to maintain consistency with historical results, but I think that's probably about five minutes now!

csaf-website/src/csaf/server/db.clj at main · jamesnvc/csaf-website

Website for Canadian Scottish Athletics Federation - jamesnvc/csaf-website

GitHub