--- /dev/null
+package gfit
+
+var Activities = map[string]int64{
+ "Aerobics": 9,
+ "Archery": 119,
+ "Awake (during sleep cycle)": 112,
+ "Back-country skiing": 66,
+ "Badminton": 10,
+ "Baseball": 11,
+ "Basketball": 12,
+ "Biathlon": 13,
+ "Biking": 1,
+ "Boxing": 20,
+ "Calisthenics": 21,
+ "Circuit training": 22,
+ "Cricket": 23,
+ "Cross-country skiing": 67,
+ "Crossfit": 113,
+ "Cross skating": 63,
+ "Curling": 106,
+ "Dancing": 24,
+ "Deep sleep": 110,
+ "Diving": 102,
+ "Downhill skiing": 68,
+ "Elevator": 117,
+ "Elliptical": 25,
+ "Ergometer": 103,
+ "Escalator": 118,
+ "Fencing": 26,
+ "Football (American)": 27,
+ "Football (Australian)": 28,
+ "Football (Soccer)": 29,
+ "Frisbee": 30,
+ "Gardening": 31,
+ "Golf": 32,
+ "Gymnastics": 33,
+ "Handball": 34,
+ "Handbiking": 14,
+ "HIIT": 114,
+ "Hiking": 35,
+ "Hockey": 36,
+ "Horseback riding": 37,
+ "Housework": 38,
+ "Ice skating": 104,
+ "Indoor skating": 105,
+ "Inline skating (rollerblading)": 64,
+ "Interval Training": 115,
+ "In vehicle": 0,
+ "Jogging": 56,
+ "Jumping rope": 39,
+ "Kayaking": 40,
+ "Kettlebell training": 41,
+ "Kickboxing": 42,
+ "Kite skiing": 69,
+ "Kitesurfing": 43,
+ "Light sleep": 109,
+ "Martial arts": 44,
+ "Meditation": 45,
+ "Mixed martial arts": 46,
+ "Mountain biking": 15,
+ "Nording walking": 94,
+ "On foot": 2,
+ "Other (unclassified fitness activity)": 108,
+ "P90X exercises": 47,
+ "Paragliding": 48,
+ "Pilates": 49,
+ "Polo": 50,
+ "Racquetball": 51,
+ "REM sleep": 111,
+ "Road biking": 16,
+ "Rock climbing": 52,
+ "Roller skiing": 70,
+ "Rowing": 53,
+ "Rowing machine": 54,
+ "Rugby": 55,
+ "Running": 8,
+ "Running on sand": 57,
+ "Running (treadmill)": 58,
+ "Sailing": 59,
+ "Scuba diving": 60,
+ "Skateboarding": 61,
+ "Skating": 62,
+ "Skiing": 65,
+ "Sledding": 71,
+ "Sleeping": 72,
+ "Snowboarding": 73,
+ "Snowmobile": 74,
+ "Snowshoeing": 75,
+ "Softball": 120,
+ "Spinning": 17,
+ "Squash": 76,
+ "Stair climbing": 77,
+ "Stair-climbing machine": 78,
+ "Stand-up paddleboarding": 79,
+ "Stationary biking": 18,
+ "Still (not moving)": 3,
+ "Strength training": 80,
+ "Surfing": 81,
+ "Swimming": 82,
+ "Swimming (open water)": 84,
+ "Swimming (swimming pool)": 83,
+ "Table tennis (ping pong)": 85,
+ "Team sports": 86,
+ "Tennis": 87,
+ "Tilting (sudden device gravity change)": 5,
+ "Treadmill (walking or running)": 88,
+ "Unknown (unable to detect activity)": 4,
+ "Utility biking": 19,
+ "Volleyball": 89,
+ "Volleyball (beach)": 90,
+ "Volleyball (indoor)": 91,
+ "Wakeboarding": 92,
+ "Walking": 7,
+ "Walking (fitness)": 93,
+ "Walking (stroller)": 116,
+ "Walking (treadmill)": 95,
+ "Waterpolo": 96,
+ "Weightlifting": 97,
+ "Wheelchair": 98,
+ "Windsurfing": 99,
+ "Yoga": 100,
+ "Zumba": 101,
+}
+
+var fitbitMapping = map[string]string{
+ "Bike": "Biking",
+ "Cross Country Skiing": "Cross-country skiing",
+ "Football": "Football (Soccer)",
+ "Hike": "Hiking",
+ "Mountain Bike": "Mountain biking",
+ "Run": "Running",
+ "Sport": "Other (unclassified fitness activity)",
+ "Swim": "Swimming",
+ "Treadmill": "Treadmill (walking or running)",
+ "Ultimate frisbee": "Frisbee",
+ "Walk": "Walking",
+ "Weights": "Weightlifting",
+ "Workout": "Other (unclassified fitness activity)",
+}
+
+func ParseFitbitActivity(s string) int64 {
+ if a, ok := Activities[s]; ok {
+ return a
+ }
+ if name, ok := fitbitMapping[s]; ok {
+ return Activities[name]
+ }
+
+ return Activities["Unknown (unable to detect activity)"]
+}