531 lines
14 KiB
Python
531 lines
14 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',
|
|
# 'bike':'Bike',
|
|
'other':'Other',
|
|
}
|
|
)
|
|
|
|
workouttypes_icons = collections.OrderedDict({
|
|
'water':'far fa-water',
|
|
'rower':'far fa-tire',
|
|
'skierg':'far fa-tire',
|
|
'bikeerg':'far fa-biking',
|
|
'dynamic':'far fa-tire',
|
|
'slides':'far fa-tire',
|
|
'paddle':'far fa-utensil-spoon',
|
|
'snow':'far fa-snowflakes',
|
|
'coastal':'far fa-water',
|
|
'c-boat':'far fa-water',
|
|
'churchboat':'far fa-water',
|
|
'Ride':'far fa-biking',
|
|
'bike':'far fa-biking',
|
|
'Run':'far fa-running',
|
|
'NordicSki':'far fa-skiing-nordic',
|
|
'Swim':'far fa-swimmer',
|
|
'Hike':'far fa-hiking',
|
|
'Walk':'far fa-walking',
|
|
'Canoeing':'far fa-blind',
|
|
'Crossfit':'far fa-dumbbell',
|
|
'StandUpPaddling':'far fa-blind',
|
|
'IceSkate':'far fa-skating',
|
|
'WeightTraining':'far fa-dumbbell',
|
|
'InlineSkate':'far fa-skating',
|
|
'Kayaking':'far fa-water',
|
|
'Workout':'far fa-dumbbell',
|
|
'Yoga':'far fa-pray',
|
|
# 'bike':'Bike',
|
|
'other':'far fa-biking',
|
|
}
|
|
)
|
|
|
|
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)}
|
|
|
|
|
|
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}
|
|
|
|
|
|
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_ordered.items()]
|
|
|
|
from bokeh.palettes import Category10,Category20, Category20c
|
|
|
|
|
|
#colors = Category10[9]
|
|
colors = list(set(Category10[9]))+list(set(Category20[19]+Category20c[19]))
|
|
color_map = {checktypes[i]:colors[i] for i in range(len(checktypes))}
|
|
|
|
color_map = {
|
|
'water': 'blue', #'#2ca02c',
|
|
'rower': 'red', #'#ff7f0e',
|
|
'skierg': 'ghostwhite', #'#8c564b',
|
|
'bikeerg': 'pink', #'#d62728',
|
|
'dynamic': 'darkred', #'#e377c2',
|
|
'slides': 'salmon', #'#9467bd',
|
|
'paddle': 'cyan', #'#7f7f7f',
|
|
'snow': 'snow',#'#1f77b4',
|
|
'coastal': 'navy', #'#bcbd22',
|
|
'c-boat': 'lightsteelblue', #'#ffbb78',
|
|
'churchboat': 'midnightblue', #'#17becf',
|
|
'Ride': 'hotpink', #'#3182bd',
|
|
'Bike': 'deeppink',
|
|
'bike': 'deeppink', #'#e6550d',
|
|
'Run': 'green', #'#ff9896',
|
|
'NordicSki': 'lightgray', #'#74c476',
|
|
'Swim': 'aqua', #'#fd8d3c',
|
|
'Hike': 'lime', #'#fdae6b',
|
|
'Walk': 'lawngreen', #'#756bb1',
|
|
'Canoeing': 'turquoise', #'#fdd0a2',
|
|
'Crossfit': 'yellow', #'#c5b0d5',
|
|
'StandUpPaddling': 'lightseagreen', #'#dadaeb',
|
|
'IceSkate': 'gray', #'#9ecae1',
|
|
'WeightTraining': 'khaki', #'#e377c2',
|
|
'InlineSkate': 'slategray', #'#98df8a',
|
|
'Kayaking': 'teal', #'#31a354',
|
|
'Workout': 'gold',#' #''#f7b6d2',
|
|
'Yoga': 'hotpink', #'#1f77b4',
|
|
'other': 'indigo', #'#bcbd22'
|
|
}
|
|
|
|
|
|
workoutsources = (
|
|
('strava','strava'),
|
|
('concept2','concept2'),
|
|
('sporttracks','sporttracks'),
|
|
('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'),
|
|
)
|
|
|
|
boatbrands = (
|
|
('other','Other'),
|
|
('alden','Alden Rowing'),
|
|
('averowing','AveRowing Boats'),
|
|
('aylings','Aylings'),
|
|
('bbg','BBG'),
|
|
('burgashell','Burgashell'),
|
|
('burton','Burton Water Sports'),
|
|
('douglas','Carl Douglas Racing Shells'),
|
|
('carbocraft','Carbocraft'),
|
|
('colley','Colley'),
|
|
('cucchietti','Cucchietti'),
|
|
('dirigo','Dirigo'),
|
|
('drew','Drew Harrison Racing'),
|
|
('echo','Echo Rowing'),
|
|
('edon','Edon TS515 Sculling Boats'),
|
|
('edwin','Edwin Phelps'),
|
|
('empacher','Empacher'),
|
|
('eton','Eton Racing Boats (ERB)'),
|
|
('euro','Euro Diffusions'),
|
|
('filippi','Filippi Boats'),
|
|
('fluidesign','Fluidesign'),
|
|
('dragon','Flying Dragon Boat Co (Huangzhou, China)'),
|
|
('gig','Gig Harbor Boat Works'),
|
|
('sharrow','George Sharrow Racing Shells'),
|
|
('harris','Harris'),
|
|
('hitech','Hi-Tech'),
|
|
('hudson','Hudson Boatworks'),
|
|
('janousek','Janousek Racing Boats'),
|
|
('waugh','John Waugh Racing Boats'),
|
|
('laszlo','Laszlo Boats NZ'),
|
|
('leo','Leo Coastal Rowing'),
|
|
('levator','Levator Boatworks'),
|
|
('liangjin','Liangjin Boat'),
|
|
('liteboat','LiteBoat'),
|
|
('littleriver','Little River Marine'),
|
|
('kaschper','Kaschper Racing Shells'),
|
|
('kanghua','Kanghua'),
|
|
('king','King Racing Shells'),
|
|
('kiwi','Kiwi International Rowing Skiffs (KIRS)'),
|
|
('lola','Lola Aylings'),
|
|
('maas','Maas Rowing Shells'),
|
|
('maas','Maas Boat (coastal)'),
|
|
('nelo','Nelo Rowing'),
|
|
('owen','Owen'),
|
|
('peinert','Peinert'),
|
|
('pocock','Pocock Racing Shells'),
|
|
('race1','Race 1 Australia'),
|
|
('radley','Radley'),
|
|
('resolute','Resolute Racing Shells'),
|
|
('salani','Salani'),
|
|
('schoenbrod','Helmut Schoenbrod'),
|
|
('salterbros','Salter Bros'),
|
|
('sims','Ray Sims'),
|
|
('slracing','SL Racing'),
|
|
('stampfli','Stämpfli Racing Boats'),
|
|
('sutton','Sutton'),
|
|
('swastik','Swastik fibchem industry'),
|
|
('swift','Swift Racing'),
|
|
('sykes','Sykes Racing'),
|
|
('vandusen','Van Dusen'),
|
|
('vega','Vega'),
|
|
('vespoli','Vespoli'),
|
|
('vicente','Vicente Dors'),
|
|
('virus','Virus'),
|
|
('whitehall','Whitehall Rowing'),
|
|
('wiersma','Roeiwerf Wiersma'),
|
|
('wintech','WinTech Racing'),
|
|
('worcester','Worcester Oar & Paddle (Joe Garafolo)'),
|
|
('swastik','Swastik Boats'),
|
|
)
|