Leaderboard for routesegments

238 views
Skip to first unread message

Joachim Kohlhammer

unread,
Jan 14, 2023, 8:55:45 AM1/14/23
to golden-cheetah-users
Dear all,

attached you can find a python script I use in an activity chart to show a leaderboard for routesegments. The leaderboard is always related to the currently selected season.

Please be aware that the script has dependencies beyond the recommendations for Golden Cheetah and requires jinja2. Additionally it loads bootstrap and leaflet whenever the resulting HTML is rendered.

I hope anyone find this useful, feedback is welcome.
Since I use a self compiled version of Golden Cheetah, I am unable to upload it to CloudDB myself.

Regards
 Joachim
leaderboard.py
Screenshot_20230114_145125.png
Screenshot_20230114_145147.png

Guillaume TOFFOLI

unread,
Jan 14, 2023, 3:34:09 PM1/14/23
to golden-cheetah-users
Hello,

Your work looks great.

I tried to run you code but I get the following error (see attached screenshot). I'm not expert in debugging python code (I'm more familiar to R). Do you know where the errror comes from?

Thank you.
Guillaume
Capture d’écran 2023-01-14 213345.png

Joachim Kohlhammer

unread,
Jan 14, 2023, 4:03:42 PM1/14/23
to golden-cheetah-users
You seem to be missing the property "Route" - I use this to name my activities. The updated code is now more forgiving if it is not present (fallback ''). If you want to read the name of your activity from any other property, you can change line 154 to your choice: am.get('Route', '')
However the code should go at least one step further before failing - or (even better) succeed
leaderboard.py

Peret

unread,
Jan 15, 2023, 4:39:02 AM1/15/23
to golden-cheetah-users
Great script! Thanks a lot for the contribution and sharing it. I wonder what I have to do to have segments. Maybe a stupid question, but all my activities seem not to have any segment, I always see the message "No route segments found for..."
I have tried creating laps, but no way. Also, with some repeated paths, just to check whether repeating paths are considered segments....
Thanks again

Fe

unread,
Jan 15, 2023, 5:20:31 AM1/15/23
to golden-cheetah-users
Hi, Peret you can change 'typeName=GC.intervalType(type=6)'

1='USER'
2='ALL'
3='PEAK POWER'
4='PEAK PACE'
5='EFFORTS'
6='SEGMENTS'   (type=6)
7='CLIMBING'
8='ALL'

Joachim Kohlhammer

unread,
Jan 15, 2023, 5:26:25 AM1/15/23
to golden-cheetah-users
Peret schrieb am Sonntag, 15. Januar 2023 um 10:39:02 UTC+1:
Great script! Thanks a lot for the contribution and sharing it. I wonder what I have to do to have segments. Maybe a stupid question, but all my activities seem not to have any segment, I always see the message "No route segments found for..."
I have tried creating laps, but no way. Also, with some repeated paths, just to check whether repeating paths are considered segments....
Thanks again

I usually start creating user intervals on the map (click on your track and drag to mark the section you want to use as a segment; sometimes this requires more than one attempt). You will be able to see your selection also on the activity-view (I use this especially to finetune climbs). Using a right click on the new segment (in english probably called "Selection #1") in the intervals sidepanel, you can reach the popup "Edit Interval", here you can edit the start- and end-time of your interval. Even more important: you can give a better name (e.g. "München - Starnberg") to your interval.
If you are happy with the interval (this is still local to your current activity), you have to create a route segment out of this user interval: Right-Click in the interval sidepanel, option "Create a Route segment". This will trigger a search for this segment over all of your activities and be available to the leaderboard-script.

Hope this helps,
 Joachim
Screenshot_20230115_111608.png
Screenshot_20230115_111647.png
Screenshot_20230115_111522.png
Screenshot_20230115_111733.png

Joachim Kohlhammer

unread,
Jan 15, 2023, 6:12:51 AM1/15/23
to golden-cheetah-users
Fe schrieb am Sonntag, 15. Januar 2023 um 11:20:31 UTC+1:
Hi, Peret you can change 'typeName=GC.intervalType(type=6)'

1='USER'
2='ALL'
3='PEAK POWER'
4='PEAK PACE'
5='EFFORTS'
6='SEGMENTS'   (type=6)
7='CLIMBING'
8='ALL'

My motivation in going for Segments (type=6) only was to allow to compare based on well defined GPS-Tracks only. If you go for example for ALL, only 1 segment will be found, the map will be wrong (showing the location data of the current activity only) and the list will show all your activities ordered by duration.

Fe

unread,
Jan 15, 2023, 7:43:24 AM1/15/23
to golden-cheetah-users
Hi Joachim , yes it was clear, just to indicate the types
Nice work
Thanks

Ale Martinez

unread,
Jan 15, 2023, 8:03:15 AM1/15/23
to golden-cheetah-users
It looks great Joachim, we may consider adding this and the missing dependency to included Python for greater reach, provided it doesn't increase the footprint and building time too much.

Peret

unread,
Jan 15, 2023, 8:20:20 AM1/15/23
to golden-cheetah-users
Thanks a lot for ypour explanations, Joachim and Fe. I will do some experiments with IntervalType and creating Route segments.

Ale Martinez

unread,
Jan 15, 2023, 9:34:50 AM1/15/23
to golden-cheetah-users
WRT route creation, v3.6 default layout includes the attached Map perspective in Analysis view with both Map and Performance charts stacked wich may help.
Analysis Map.gchartset
Reply all
Reply to author
Forward
0 new messages