426 lines
10 KiB
Python
426 lines
10 KiB
Python
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
from six import iteritems
|
|
import collections
|
|
|
|
|
|
|
|
|
|
workouttypes_ordered = collections.OrderedDict({
|
|
'water':'Standard Racing Shell',
|
|
'rower':'Indoor Rower',
|
|
'skierg':'Ski Erg',
|
|
'bikeerg':'Bike Erg',
|
|
'dynamic':'Dynamic Indoor Rower',
|
|
'slides':'Indoor Rower on Slides',
|
|
'paddle':'Paddle Adapter',
|
|
'snow':'On-snow',
|
|
'coastal':'Coastal',
|
|
'c-boat':'Dutch C boat',
|
|
'churchboat':'Finnish Church boat',
|
|
'Ride':'Ride',
|
|
'Bike':'Bike',
|
|
'Run':'Run',
|
|
'NordicSki':'NordicSki',
|
|
'Swim':'Swim',
|
|
'Hike':'Hike',
|
|
'Walk':'Walk',
|
|
'Canoeing':'Canoeing',
|
|
'Crossfit':'Crossfit',
|
|
'StandUpPaddling':'StandUpPaddling',
|
|
'IceSkate':'IceSkate',
|
|
'WeightTraining':'WeightTraining',
|
|
'InlineSkate':'InlineSkate',
|
|
'Kayaking':'Kayaking',
|
|
'Workout':'Workout',
|
|
'Yoga':'Yoga',
|
|
'other':'Other',
|
|
}
|
|
)
|
|
|
|
workouttypes = tuple((key, value) for key, value in workouttypes_ordered.items())
|
|
|
|
def Reverse(tuples):
|
|
new_tup = tuples[::-1]
|
|
return new_tup
|
|
|
|
stravacollection = (
|
|
('water','Rowing'),
|
|
('rower','Rowing'),
|
|
('skierg','NordicSki'),
|
|
('Bike','Ride'),
|
|
('bikeerg','Ride'),
|
|
('dynamic','Rowing'),
|
|
('slides','Rowing'),
|
|
('paddle','StandUpPaddling'),
|
|
('snow','NordicSki'),
|
|
('coastal','Rowing'),
|
|
('c-boat','Rowing'),
|
|
('churchboat','Rowing'),
|
|
('Ride','Ride'),
|
|
('Run','Run'),
|
|
('NordicSki','NordicSki'),
|
|
('Swim','Swim'),
|
|
('Hike','Hike'),
|
|
('Walk','Walk'),
|
|
('Canoeing','Canoeing'),
|
|
('Crossfit','Crossfit'),
|
|
('StandUpPaddling','StandUpPaddling'),
|
|
('IceSkate','IceSkate'),
|
|
('WeightTraining','WeightTraining'),
|
|
('InlineSkate','InlineSkate'),
|
|
('Kayaking','Kayaking'),
|
|
('Workout','Workout'),
|
|
('Yoga','Yoga'),
|
|
('other','Workout'),
|
|
)
|
|
|
|
stravamapping = {key:value for key,value in Reverse(stravacollection)}
|
|
|
|
garmincollection = (
|
|
('water','ROWING'),
|
|
('rower','INDOOR_ROWING'),
|
|
('skierg','CROSS_COUNTRY_SKIING'),
|
|
('Bike','ROAD_BIKING'),
|
|
('bikeerg','INDOOR_CYCLING'),
|
|
('dynamic','INDOOR_ROWING'),
|
|
('slides','INDOOR_ROWING'),
|
|
('paddle','PADDLING'),
|
|
('snow','CROSS_COUNTRY_SKIING'),
|
|
('coastal','ROWING'),
|
|
('c-boat','ROWING'),
|
|
('churchboat','ROWING'),
|
|
('Ride','ROAD_BIKING'),
|
|
('Run','RUNNING'),
|
|
('NordicSki','CROSS_COUNTRY_SKIING'),
|
|
('Swim','SWIMMING'),
|
|
('Hike','HIKING'),
|
|
('Walk','WALKING'),
|
|
('Canoeing','PADDLING'),
|
|
('Crossfit','FITNESS_EQUIPMENT'),
|
|
('StandUpPaddling','STAND_UP_PADDLEBOARDING'),
|
|
('IceSkate','SKATING'),
|
|
('WeightTraining','STRENGTH_TRAINING'),
|
|
('InlineSkate','INLINE_SKATING'),
|
|
('Kayaking','PADDLING'),
|
|
('Workout','OTHER'),
|
|
('Yoga','OTHER'),
|
|
('other','OTHER'),
|
|
)
|
|
|
|
garminmapping = {key:value for key,value in Reverse(garmincollection)}
|
|
|
|
fitcollection = (
|
|
('water','rowing'),
|
|
('rower','rowing'),
|
|
('skierg','cross_country_skiing'),
|
|
('Bike','cycling'),
|
|
('bikeerg','cycling'),
|
|
('dynamic','rowing'),
|
|
('slides','rowing'),
|
|
('paddle','paddling'),
|
|
('snow','cross_country_skiing'),
|
|
('coastal','rowing'),
|
|
('c-boat','rowing'),
|
|
('churchboat','rowing'),
|
|
('Ride','cycling'),
|
|
('Run','running'),
|
|
('NordicSki','cross_country_skiing'),
|
|
('Swim','swimming'),
|
|
('Hike','hiking'),
|
|
('RollerSki','cross_country_skiing'),
|
|
('Walk','walking'),
|
|
('Canoeing','boating'),
|
|
('Crossfit','fitness_equipment'),
|
|
('StandUpPaddling','stand_up_paddle_boarding'),
|
|
('IceSkate','ice_skating'),
|
|
('WeightTraining','training'),
|
|
('InlineSkate','inline_skating'),
|
|
('Kayaking','kayaking'),
|
|
('Workout','generic'),
|
|
('Yoga','generic'),
|
|
('other','generic'),
|
|
)
|
|
|
|
|
|
|
|
fitmapping = {key:value for key,value in Reverse(fitcollection)}
|
|
|
|
stcollection = (
|
|
('water','Rowing'),
|
|
('rower','Rowing'),
|
|
('skierg','Skiing:Nordic'),
|
|
('Bike','Cycling'),
|
|
('bikeerg','Cycling'),
|
|
('dynamic','Rowing'),
|
|
('slides','Rowing'),
|
|
('paddle','Other:Paddling'),
|
|
('snow','Skiing:Nordic'),
|
|
('coastal','Rowing'),
|
|
('c-boat','Rowing'),
|
|
('churchboat','Rowing'),
|
|
('Ride','Cycling'),
|
|
('Run','Running'),
|
|
('NordicSki','Skiing:Nordic'),
|
|
('Swim','Swimming'),
|
|
('Hike','Hiking'),
|
|
('RollerSki','Other:RollerSki'),
|
|
('Walk','Other:Walk'),
|
|
('Canoeing','Other:Canoeing'),
|
|
('Crossfit','Other:Crossfit'),
|
|
('StandUpPaddling','Other:StandUpPaddling'),
|
|
('IceSkate','Skating'),
|
|
('WeightTraining','Other:WeightTraining'),
|
|
('InlineSkate','Skating:InlineSkate'),
|
|
('Kayaking','Other:Kayaking'),
|
|
('Workout','Other:Workout'),
|
|
('Yoga','Other'),
|
|
('other','Other'),
|
|
)
|
|
|
|
stmapping = {key:value for key,value in Reverse(stcollection)}
|
|
|
|
rkcollection = (
|
|
('water','Rowing'),
|
|
('rower','Rowing'),
|
|
('skierg','Cross-Country Skiing'),
|
|
('Bike','Cycling'),
|
|
('bikeerg','Cycling'),
|
|
('dynamic','Rowing'),
|
|
('slides','Rowing'),
|
|
('paddle','Other:Paddling'),
|
|
('snow','Cross-Country Skiing'),
|
|
('coastal','Rowing'),
|
|
('c-boat','Rowing'),
|
|
('churchboat','Rowing'),
|
|
('Ride','Cycling'),
|
|
('Run','Running'),
|
|
('NordicSki','Cross-Country Skiing'),
|
|
('Swim','Swimming'),
|
|
('Hike','Hiking'),
|
|
('Walk','Walking'),
|
|
('Canoeing','Other'),
|
|
('Crossfit','CrossFit'),
|
|
('StandUpPaddling','Other'),
|
|
('IceSkate','Skating'),
|
|
('WeightTraining','Other'),
|
|
('InlineSkate','Skating'),
|
|
('Kayaking','Other'),
|
|
('Workout','Other'),
|
|
('other','Other'),
|
|
('Yoga','Other'),
|
|
)
|
|
|
|
rkmapping = {key:value for key,value in Reverse(rkcollection)}
|
|
|
|
polarcollection = (
|
|
('water','Rowing'),
|
|
('rower','Rowing'),
|
|
('skierg','Skiing'),
|
|
('Bike','Cycling'),
|
|
('bikeerg','Cycling'),
|
|
('dynamic','Rowing'),
|
|
('slides','Rowing'),
|
|
('paddle','Other Outdoor'),
|
|
('snow','Skiing'),
|
|
('coastal','Rowing'),
|
|
('c-boat','Rowing'),
|
|
('churchboat','Rowing'),
|
|
('Ride','Cycling'),
|
|
('Run','Running'),
|
|
('NordicSki','Skiing'),
|
|
('Swim','Swimming'),
|
|
('Hike','Hiking'),
|
|
('Walk','Walking'),
|
|
('Canoeing','Canoeing'),
|
|
('Crossfit','Crossfit'),
|
|
('StandUpPaddling','Other Outdoor'),
|
|
('IceSkate','Skating'),
|
|
('WeightTraining','Strength training'),
|
|
('InlineSkate','Skating'),
|
|
('Kayaking','Kayaking'),
|
|
('Workout','Other Indoor'),
|
|
('other','Other Indoor'),
|
|
('Yoga','Yoga'),
|
|
)
|
|
|
|
polarmapping = {key:value for key,value in Reverse(polarcollection)}
|
|
|
|
tpcollection = (
|
|
('water','rowing'),
|
|
('rower','rowing'),
|
|
('skierg','xc-ski'),
|
|
('Bike','bike'),
|
|
('Bikeerg','bike'),
|
|
('dynamic','rowing'),
|
|
('slides','rowing'),
|
|
('paddle','other'),
|
|
('snow','xc-ski'),
|
|
('coastal','rowing'),
|
|
('c-boat','rowing'),
|
|
('churchboat','rowing'),
|
|
('Ride','cycling'),
|
|
('Run','run'),
|
|
('NordicSki','xc-ski'),
|
|
('Swim','swim'),
|
|
('Hike','other'),
|
|
('Walk','walk'),
|
|
('Canoeing','other'),
|
|
('Crossfit','other'),
|
|
('StandUpPaddling','other'),
|
|
('IceSkate','other'),
|
|
('WeightTraining','strength'),
|
|
('InlineSkate','other'),
|
|
('Kayaking','other'),
|
|
('Workout','other'),
|
|
('other','other'),
|
|
('Yoga','other'),
|
|
)
|
|
|
|
tpmapping = {key:value for key,value in Reverse(tpcollection)}
|
|
|
|
c2collection = (
|
|
('water','water'),
|
|
('rower','rower'),
|
|
('skierg','skierg'),
|
|
('Bike','bike'),
|
|
('bikeerg','bike'),
|
|
('dynamic','dynamic'),
|
|
('slides','slides'),
|
|
('paddle','paddle'),
|
|
('snow','snow'),
|
|
('coastal','water'),
|
|
('c-boat','water'),
|
|
('churchboat','water'),
|
|
('Ride','bike'),
|
|
('Run',None),
|
|
('NordicSki','snow'),
|
|
('Swim',None),
|
|
('Hike',None),
|
|
('Walk',None),
|
|
('Canoeing','paddle'),
|
|
('Crossfit',None),
|
|
('StandUpPaddling',None),
|
|
('IceSkate',None),
|
|
('WeightTraining',None),
|
|
('InlineSkate',None),
|
|
('Kayaking',None),
|
|
('Workout',None),
|
|
('other',None),
|
|
('Yoga',None),
|
|
)
|
|
|
|
c2mapping = {key:value for key,value in Reverse(c2collection)}
|
|
c2mappinginv = {value:key for key,value in Reverse(c2collection) if value is not None}
|
|
|
|
stravamappinginv = {value:key for key,value in Reverse(stravacollection) if value is not None}
|
|
|
|
stmappinginv = {value:key for key,value in Reverse(stcollection) if value is not None}
|
|
|
|
rkmappinginv = {value:key for key,value in Reverse(rkcollection) if value is not None}
|
|
|
|
polarmappinginv = {value:key for key,value in Reverse(polarcollection) if value is not None}
|
|
|
|
garminmappinginv = {value:key for key, value in Reverse(garmincollection) if value is not None}
|
|
|
|
fitmappinginv = {value:key for key,value in Reverse(fitcollection) if value is not None}
|
|
|
|
otwtypes = (
|
|
'water',
|
|
'coastal',
|
|
'c-boat',
|
|
'churchboat'
|
|
)
|
|
|
|
otetypes = (
|
|
'rower',
|
|
'dynamic',
|
|
'slides'
|
|
)
|
|
|
|
rowtypes = (
|
|
'water',
|
|
'rower',
|
|
'dynamic',
|
|
'slides',
|
|
'coastal',
|
|
'c-boat',
|
|
'churchboat'
|
|
)
|
|
|
|
|
|
checktypes = [i[0] for i in workouttypes]
|
|
|
|
from bokeh.palettes import Category10,Category20, Category20c
|
|
|
|
|
|
#colors = Category10[9]
|
|
colors = Category10[9]+list(set(Category20[19]+Category20c[19]))
|
|
color_map = {checktypes[i]:colors[i] for i in range(len(checktypes))}
|
|
|
|
workoutsources = (
|
|
('strava','strava'),
|
|
('concept2','concept2'),
|
|
('sporttracks','sporttracks'),
|
|
('runkeeper','runkeeper'),
|
|
('mapmyfitness','mapmyfitness'),
|
|
('csv','painsled'),
|
|
('tcx','tcx'),
|
|
('rp','rowperfect'),
|
|
('mystery','mystery'),
|
|
# ('tcxnohr','tcx (no HR)'),
|
|
('rowperfect3','rowperfect3'),
|
|
('ergdata','ergdata'),
|
|
('boatcoach','boatcoach'),
|
|
('boatcoachotw','boatcoachotw'),
|
|
# ('bcmike','boatcoach (develop)'),
|
|
('painsleddesktop','painsleddesktop'),
|
|
('speedcoach','speedcoach'),
|
|
('speedcoach2','speedcoach2'),
|
|
('ergstick','ergstick'),
|
|
('fit','fit'),
|
|
('unknown','unknown'))
|
|
|
|
boattypes = (
|
|
('1x', '1x (single)'),
|
|
('2x', '2x (double)'),
|
|
('2x+', '2x+ (coxed double)'),
|
|
('2-', '2- (pair)'),
|
|
('2+', '2+ (coxed pair)'),
|
|
('3x+','3x+ (coxed triple)'),
|
|
('3x-','3x- (triple)'),
|
|
('4x', '4x (quad)'),
|
|
('4x+', '4x+ (coxed quad)'),
|
|
('4-', '4- (four)'),
|
|
('4+', '4+ (coxed four)'),
|
|
('8+', '8+ (eight)'),
|
|
('8x+', '8x+ (octuple scull)'),
|
|
)
|
|
|
|
adaptivetypes = (
|
|
('None','Open'),
|
|
('PR1', 'PR1 (Arms and Shoulders)'),
|
|
('PR2', 'PR2 (Trunk and Arms)'),
|
|
('PR3', 'PR3 (Leg Trunk and Arms)'),
|
|
('FES', 'FES (Functional Electrical Stimulation)'),
|
|
)
|
|
|
|
weightcategories = (
|
|
('hwt','open-weight'),
|
|
('lwt','light-weight'),
|
|
)
|
|
|
|
sexcategories = (
|
|
('male','Open'),
|
|
('female','Female'),
|
|
)
|
|
|
|
waterboattype = [i[0] for i in boattypes]
|
|
|
|
privacychoices = (
|
|
('private','Private'),
|
|
('visible','Visible'),
|
|
)
|