matt-kruse / MyOpenLeaderboard.com

Custom Leaderboard for the Crossfit Open
7 stars 2 forks source link

Feature Request: Add cities #4

Open raybellwaves opened 6 years ago

raybellwaves commented 6 years ago

I created this file: https://github.com/raybellwaves/cfanalytics/blob/master/Data/Affiliate_list.csv from https://map.crossfit.com/

It associates every Affiliate ID with a city.

You could use the file as a look up table and when people query a city you could create a link to the affiliates.

For example, I live in Miami. I may type a url like http://myopenleaderboard.com/?Miami. Looking at the Affiliate_list and finding all the affiliates in Miami (column 5)(635,708,801,1432,1563,1602,1706,1964,2083,2425,2437,2509,2620,2812,3447,3559,3704,4367,4437,5515,5958,7460,7587,9529,9881,10459,13790,14132,14265,14303,16159,16219,16316,16675,16983,17268,19882,20086)

Which for your leaderboard would look like http://myopenleaderboard.com/?635,708,801,1432,1563,1602,1706,1964,2083,2425,2437,2509,2620,2812,3447,3559,3704,4367,4437,5515,5958,7460,7587,9529,9881,10459,13790,14132,14265,14303,16159,16219,16316,16675,16983,17268,19882,20086 (I realized Miami was not a small example to start with!). As a side notes these percentiles look slightly off with similar values for different scores. Here's how I calculate my percentiles https://github.com/raybellwaves/cfanalytics/blob/master/cfanalytics/core/clean.py#L344L388

You can now see who is king/queen of your city! It may also be good for marketing for the competitive boxes and good for gym goers if they want to get good they can see where is the most competitive box.

You also do the same for state and country. Goes a step further than crossfit.com which only provide regional analyses

matt-kruse commented 6 years ago

I love this idea, but I am again concerned about performance and load. Hitting that many affiliates for a city like Miami would be huge. For each affiliate, I fire off at least 12 requests to the crossfit servers - usually even more.

To load Miami, that would be at least 38*12=456 simultaneous http requests to their servers. I suspect I would be flagged quite quickly and shut down as a DoS attack.

In theory, I could load data once a night and provide daily stats, which would probably be reasonable. I'm not sure I have enough time to work on that though!

Thank you for the affiliate list! I was actually looking for a list just like that. Is it current for 2018? Using this I could let people query their affiliate rather than entering an id. Hmm....

raybellwaves commented 6 years ago

Ah I see your issue.

Yes it is update (as of yesterday). Here's the code for it: https://github.com/raybellwaves/cfanalytics/blob/master/cfanalytics/core/affiliatelist.py I'm hoping to use it for some spatial stats.

Good idea. Welcome to point people to the file if they want to query their affiliate ID.