Private
Public Access
1
0
Files
rowsandall/rowers/mytypes.py

677 lines
19 KiB
Python

from bokeh.palettes import Category10, Category20, Category20c
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': 'rowing.svg', # g
'rower': 'indoor_rower.svg', # g
'skierg': 'ski_erg.svg', # g
'bikeerg': 'bike_erg.svg', # g
'dynamic': 'indoor_rower.svg',
'slides': 'indoor_rower.svg',
'paddle': 'paddle.svg', # could be better
'snow': 'cross_country_ski.svg', # ok
'coastal': 'rowing.svg', # ok
'c-boat': 'rowing.svg', # ok
'churchboat': 'rowing.svg', # ok
'Ride': 'bike.svg', # ok
'bike': 'bike.svg', # ok
'Run': 'run.svg', # ok
'NordicSki': 'cross_country_ski.svg', # ok
'Swim': 'swim.svg', # ok
'Hike': 'hike.svg', # ok
'Walk': 'walk.svg', # o k
'Canoeing': 'canoeing.svg', # ok
'Crossfit': 'crossfit.svg', # ok
'StandUpPaddling': 'standup_paddling.svg', # ok
'IceSkate': 'ice_skating.svg', # ok
'WeightTraining': 'weight_training.svg', # ok
'InlineSkate': 'inline_skating.svg',
'Kayaking': 'kayaking.svg', # ok
'Workout': 'workout.svg',
'Yoga': 'yoga.svg',
# 'bike':'Bike',
'other': 'other.svg',
}
)
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'),
('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.lower(): 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',
)
rowtypes = (
'water',
'rower',
'dynamic',
'slides',
'coastal',
'c-boat',
'churchboat'
)
checktypes = [i[0] for i in workouttypes_ordered.items()]
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)'),
)
ergtypes = (
('static','Concept2 static'),
('dynamic','Concept2 dynamic'),
('slides', 'Concept2 slides'),
('rp3','RP3'),
('waterrower','Water Rower'),
('other','Other Indoor Rower'),
)
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'),
)
polaraccesslink_sports = {
'AEROBICS': 'Workout',
'AMERICAN_FOOTBALL': 'other',
'AQUATICS': 'other',
'BACKCOUNTRY_SKIING': 'snow',
'BADMINTON': 'other',
'BALLET_DANCING': 'other',
'BALLROOM_DANCING': 'other',
'BASEBALL': 'other',
'BASKETBALL': 'other',
'BEACH_VOLLEYBALL': 'other',
'BIATHLON': 'NordicSki',
'BODY_AND_MIND': 'Yoga',
'BOOTCAMP': 'Workout',
'BOXING': 'other',
'CIRCUIT_TRAINING': 'Workout',
'CORE': 'Workout',
'CRICKET': 'other',
'CROSS_TRAINER': 'other',
'CROSS-COUNTRY_SKIING': 'NordicSki',
'CYCLING': 'bike',
'DANCING': 'other',
'DOWNHILL_SKIING': 'snow',
'DUATHLON': 'other',
'DUATHLON_CYCLING': 'bike',
'DUATHLON_RUNNING': 'Run',
'FIELD_HOCKEY': 'other',
'FINNISH_BASEBALL': 'other',
'FITNESS_DANCING': 'other',
'FITNESS_MARTIAL_ARTS': 'other',
'FITNESS_STEP': 'Workout',
'FLOORBALL': 'other',
'FREE_MULTISPORT': 'other',
'FRISBEEGOLF': 'other',
'FUNCTIONAL_TRAINING': 'other',
'FUTSAL': 'other',
'GOLF': 'other',
'GROUP_EXERCISE': 'Workout',
'GYMNASTICS': 'other',
'HANDBALL': 'other',
'HIIT': 'Workout',
'HIKING': 'Hike',
'ICE_HOCKEY': 'other',
'ICE_SKATING': 'IceSkate',
'INDOOR_CYCLING': 'Ride',
'INDOOR_ROWING': 'rower',
'INLINE_SKATING': 'InlineSkate',
'JAZZ_DANCING': 'other',
'JOGGING': 'Run',
'JUDO_MARTIAL_ARTS': 'other',
'KICKBOXING_MARTIAL_ARTS': 'other',
'LATIN_DANCING': 'other',
'LES_MILLS_BARRE': 'other',
'LES_MILLS_BODYATTACK': 'other',
'LES_MILLS_BODYBALANCE': 'other',
'LES_MILLS_BODYCOMBAT': 'other',
'LES_MILLS_BODYJAM': 'other',
'LES_MILLS_BODYPUMP': 'other',
'LES_MILLS_BODYSTEP': 'other',
'LES_MILLS_CXWORKS': 'other',
'LES_MILLS_GRIT_ATHLETIC': 'other',
'LES_MILLS_GRIT_CARDIO': 'other',
'LES_MILLS_GRIT_STRENGTH': 'other',
'LES_MILLS_RPM': 'other',
'LES_MILLS_SHBAM': 'other',
'LES_MILLS_SPRINT': 'other',
'LES_MILLS_TONE': 'other',
'LES_MILLS_TRIP': 'other',
'MOBILITY_DYNAMIC': 'other',
'MOBILITY_STATIC': 'other',
'MODERN_DANCING': 'other',
'MOUNTAIN_BIKING': 'bike',
'NORDIC_WALKING': 'Hike',
'OFFROADDUATHLON': 'other',
'OFFROADDUATHLON_CYCLING': 'bike',
'OFFROADDUATHLON_RUNNING': 'Run',
'OFFROADTRIATHLON': 'other',
'OFFROADTRIATHLON_CYCLING': 'bike',
'OFFROADTRIATHLON_RUNNING': 'Run',
'OFFROADTRIATHLON_SWIMMING': 'Swim',
'OPEN_WATER_SWIMMING': 'Swim',
'ORIENTEERING': 'Run',
'ORIENTEERING_MTB': 'bike',
'ORIENTEERING_SKI': 'NordicSki',
'OTHER_INDOOR': 'Workout',
'OTHER_OUTDOOR': 'other',
'PARASPORTS_WHEELCHAIR': 'other',
'PILATES': 'Workout',
'POOL_SWIMMING': 'Swim',
'RIDING': 'Ride',
'ROAD_BIKING': 'bike',
'ROAD_RUNNING': 'Run',
'ROLLER_BLADING': 'InlineSkate',
'ROLLER_SKIING_CLASSIC': 'NordicSki',
'ROLLER_SKIING_FREESTYLE': 'NordicSki',
'ROWING': 'water',
'RUGBY': 'other',
'RUNNING': 'Run',
'SHOW_DANCING': 'other',
'SKATING': 'IceSkate',
'SNOWBOARDING': 'snow',
'SNOWSHOE_TREKKING': 'Hike',
'SOCCER': 'other',
'SPINNING': 'bikeerg',
'SQUASH': 'other',
'STREET_DANCING': 'other',
'STRENGTH_TRAINING': 'WeightTraining',
'STRETCHING': 'Workout',
'SWIMMING': 'Swim',
'TABLE_TENNIS': 'other',
'TELEMARK_SKIING': 'NordicSki',
'TENNIS': 'other',
'TRACK_AND_FIELD_RUNNING': 'Run',
'TRAIL_RUNNING': 'Run',
'TREADMILL_RUNNING': 'Run',
'TRIATHLON': 'bike',
'TRIATHLON_CYCLING': 'bike',
'TRIATHLON_RUNNING': 'Run',
'TRIATHLON_SWIMMING': 'Swim',
'TROTTING': 'other',
'ULTRARUNNING_RUNNING': 'Run',
'VERTICALSPORTS_WALLCLIMBING': 'other',
'VOLLEYBALL': 'other',
'WALKING': 'Walk',
'WATERSPORTS_CANOEING': 'Canoeing',
'WATERSPORTS_KAYAKING': 'Kayaking',
'WATERSPORTS_KITESURFING': 'other',
'WATERSPORTS_SAILING': 'other',
'WATERSPORTS_SURFING': 'other',
'WATERSPORTS_WAKEBOARDING': 'other',
'WATERSPORTS_WATERSKI': 'other',
'WATERSPORTS_WINDSURFING': 'other',
'XC_SKIING_CLASSIC': 'NordicSki',
'XC_SKIING_FREESTYLE': 'NordicSki',
'YOGA': 'Yoga'
}