Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountered an unknown sport type? Need your help. #2

Open
CTHRU opened this issue Feb 1, 2020 · 18 comments
Open

Encountered an unknown sport type? Need your help. #2

CTHRU opened this issue Feb 1, 2020 · 18 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@CTHRU
Copy link
Owner

CTHRU commented Feb 1, 2020

I'm looking for people who have running, pool swimming or open water swimming activities in Huawei Health that use the ZIP or JSON conversion.

I'm in search of the HiTrack sport type codes for these types of activities in the HiTrack JSON data.
You can provide me with the information as follows:

  1. Run the program with the --json_export command line argument (this is the case when using the Run_Hitrava.cmd batch file).
  2. For any activity of one of the above mentioned sport types, open the corresponding .json file that was generated with your favorite text editor. You will see something like this;

[{"motionPathData": [{"sportType": ?,

  1. There will be a number where the question mark is. I would require the activity type and that number.

Thank you for helping out.

@CTHRU CTHRU added the help wanted Extra attention is needed label Feb 1, 2020
@CTHRU CTHRU self-assigned this Feb 1, 2020
@CTHRU CTHRU pinned this issue Feb 1, 2020
@markvanwijhe
Copy link

Hello coders,
First of all thanks for writing this program. I was so sad that my Huawei GT couldn't connect to Strava. So with you help at least I can upload my activities now (although very annoying to do still).
I'll send you some of my tracked swimming data.
I track my swimming/walking/running/cycling but all at the lowest possible level.

@markvanwijhe
Copy link

For pool swimming (mostly 25m pool, but there could be 50m in there too) I have the following number per activity:
4,5,3,4,3,3,3,3,3,5,4,3,3,3,3,103,3,3,5,3,102,102,4,102,4,5,4,102,102,4,4,102,102,4,102,102,102,102,102,4,4,4,4,4,4,3,4,5,5,5,3,5

Not sure why there's some numbers in the 100s. Hopefully you do.

@CTHRU
Copy link
Owner Author

CTHRU commented Apr 9, 2020

@markvanwijhe glad to hear you like Hitrava and thank you for your help. I'm afraid I don't understand the numbers your provided. Are these the sport types you found in the .json files for each single activity? The current program uses 5 = Walk and 3 = Cycle. Or did you find that your swimming activities have once 4, next time 103, next time 102? If you could shed some light on the situation, that would be great.

@markvanwijhe
Copy link

@CTHRU sorry I misunderstood the option [--sport Swim_Pool] I thought it would only convert the swimming. It's difficult for me to find the data of just one sport then.

The numbers are "sportType" numbers.

@CTHRU
Copy link
Owner Author

CTHRU commented Apr 9, 2020

@markvanwijhe No problem. I think you could still help me. I think the numbers you listed above could well be the sport types in the json files. I'm missing the values for swimming and running activity sport types. If I have these, Hitrava can automatically set the correct Strava sport type in the generated TCX file, thus allowing Strava to recognize it and you wouldn't need to change the sport type manually in the Upload Activities screen of Strava.

Just to make sure, if you run Hitrava with the --json_export command line argument (e.g. example below):

python Hitrava.py --zip _your_zip_file_name_here_ --json_export

It will generate both (converted) TCX files for Strava (with a .tcx file extension) and a copy of the (unconverted) JSON data from Huawei for the activity with the same name but with a .json file extension.

If you open the JSON file of any swimming or running activity in a text editor(e.g. notepad), you will see something like below:

[{"motionPathData": [{"sportType": ?,

I would need the number where the question mark is in the line above for pool/open water swimming and running activities (or any other unknown activity for that matter, e.g workout, ...)

As an example, a walking activity will look like this:

[{"motionPathData": [{"sportType": 5,

Whereas a cycling activity will look like this:

[{"motionPathData": [{"sportType": 3,

Look forward to hear from you.

@svenstucki
Copy link

I'm also quite happy that this script exists ;). Funnily I discovered the project and this issue just before @markvanwijhe commented.

I've just received my GDPR export and run it through the script. My running activities ("Outdoor run" on my GT-2) always come with sportType 4. My hiking activities ("Hike" on the watch) all have sportType 282 - it seems like it got correctly detected though. Haven't used anything else so far.

@CTHRU
Copy link
Owner Author

CTHRU commented Apr 11, 2020

@svenstucki Great, thanks for your help! Your observation is correct. If the sport type from the Huawei data is not known, Hitrava uses a small auto-detection algorithm to distinguish between walk/run/cycle/swim.

With your help, Hitrava will be able to auto set the correct sport type in Strava for running and hiking activities (luckily, this was also 1 of the supported types in Strava) in the near future.

CTHRU added a commit that referenced this issue Apr 11, 2020
New features and changes
- ZIP and JSON conversion: Running and hiking activity types are now directly detected from the Huawei data.
- Strava TCX: Hiking activities are generated with the corresponding Strava activity type. You don't need to 
manually adjust the activity type for hiking activities in Strava after upload. See also #2.
@stevellion
Copy link

SportType Activity
3 Outdoor Cycle
5 Walk
4 Outdoor Run
102 Indoor Swim
103 Indoor Cycle
111 Cross Trainer/Elyptical
117 Other

@CTHRU CTHRU changed the title Runners or Swimmers? Need your help. Encountered an unknown sport type? Need your help. May 15, 2020
@PrintTheUniverse
Copy link

Do you still need data for Inline skating? Inline Skating is also supported at Strava.
Will this amazing script also support it? I should receive my GT2 watch tomorrow, so i can test if needed.

I am unsure if you upload TCX files to Strava that you can change the activity ? Can anyone confirm?
Thanks for all the work you put into this. A shame that it is not supported out of the box.

@CTHRU
Copy link
Owner Author

CTHRU commented Jul 7, 2020

@PrintTheUniverse - It would be great if you could test conversion for inline skating (and provide me with the activity number). If it wouldn't work out of the box, I will be happy to look at it to get it supported. The TCX upload doesn't support the activity type directly (but I have plans to look into a different way to achieve this in the future).
You can change the activity type immediately after upload to Strava (when the uploaded activities are presented for review) or by opening the activity details on the Strava web page and clicking the 'Edit this activity' button (the one with the 'pencil' icon).

@dany123
Copy link

dany123 commented Jul 15, 2020

Hey, I have an unknown activity type number 2, this is called "Climb" in my watch and "Mountain hike" inside Huawei health app.

I see inside the python files, _JSON_SPORT_TYPES already contains hike with number 282, I don't know if it's a mistake or my watch is different. I manually added a new type
(2, HiActivity.TYPE_HIKE),
and this seems to parse ok.

Btw I'm using a huawei watch gt with software version 1.0.12.8, maybe on other watches hiking has other id?

@CTHRU
Copy link
Owner Author

CTHRU commented Jul 16, 2020

@dany123 Thanks for the find. I will add the sport type you found in a future release.

@PrintTheUniverse
Copy link

Rollerskating does not have an option to record GPS.

Typical Huawei.

On a side note, in the newest huawei health beta there is an option in the device settings page of the app to save GPS files.
The option however does not seem to work at this moment. Maybe on my end but i cannot find any GPS files at my phone.
But it's a good thing they are indeed working on it. Hopefully they also add GPS to different workout modes.

The beta version is huawei health beta 10.1.1.12 for those who are intrested.

@PrintTheUniverse
Copy link

https://aapks.com/apk/com-huawei-health/

Typical APK site, keep your adblocker on.

CTHRU added a commit that referenced this issue Jul 29, 2020
# New features and changes
- FILE and TAR conversion: the filenames of the converted TCX files are now more readable (i.e. the same as for the ones generated in ZIP or JSON mode: format _Hitrack_ISO timestamp_sequence.tcx_). If you want to retain the original  filename, you can use the new command line argument _--use_original_filename_. Closes #18.
- Added 'Mountain Hike' ('Climb') to the list of supported sport types. It will be converted in Strava as 'Hike'. See also #2.
@dan1967
Copy link

dan1967 commented Jan 10, 2021

Hello,
my list of SportType Activity
104 - open water swiming (you have -3 in _JSON_SPORT_TYPES (line 1133))
118 - outdoor run (cross - country run)

Huawei Watch GT, apk Huawei Health 11.0.3.512
export from Huawei Cloud 20210103

@lfer23
Copy link

lfer23 commented Jan 11, 2021

(Edited)
Hello,

Seems that Huawei has open health kit, with a lot of useful information for developers.
I found the list of sports with the correspondent ID:
https://developer.huawei.com/consumer/en/doc/development/connectivity-Guides/sport-status-0000001060093588

It does fit with many of the Hitrack files we use to parse the data.

I add here the list:

Workout Modes Workout Status
0 Unknown
1 Outdoor run
2 Outdoor walk
3 Outdoor cycle
4 Mountain hike
5 Indoor run
6 Pool swim
7 Indoor cycle
8 Open water swim
9 Other
10 Hike
11 Trail run
13 Rower
14 Elliptical
15 Indoor walk
18 Cross-country skiing
19 Skiing
20 Snowboarding
21 Driving range
101 Yoga
102 Aerobics
103 Strength
104 Spinning
105 Stepper
106 Air walker
107 HIIT
108 Group training
109 Pilates
110 Cross fit
111 Functional training
112 Physical training
113 Taekwondo
114 Boxing
115 Free sparring
116 Karate
117 Fencing
118 Belly dance
119 Jazz dance
120 Latin dance
121 Ballet
122 Core training
123 Body combat
124 Kendo
125 Single bar
126 Parallel bars
127 Street dance
128 Roller skating
129 Martial arts
130 Plaza dancing
131 Tai chi
132 Dance
133 Hula hoop
134 Frisbee
135 Darts
136 Archery
137 Horse riding
138 Laser tag
139 Kite flying
140 Tug of war
141 Swinging
142 Stair climbing
143 Obstacle race
144 Badminton
145 Table tennis
146 Tennis
147 Pool
148 Bowling
149 Volleyball
150 Shuttlecock
151 Handball
152 Baseball
153 Softball
154 Softball
155 Football
156 Beach soccer
157 Beach volleyball
158 Gateball
159 Hockey
160 Squash
161 Sepak takraw
162 Dodgeball
163 Sailing
164 Surfing
165 Fishing
166 Rafting
167 Dragon boating
168 Canoeing
169 Rowing
170 Water scooter
171 SUP
172 Ice skating
173 Ice hockey
174 Curling
175 Bobsleigh
176 Sledding
177 Biathlon
178 Skateboarding
179 Rock climbing
180 Bungee jumping
181 Parkour
182 BMX
183 Orienteering
184 Parachuting
185 Auto racing
0xFF Workout ends

@CTHRU
Copy link
Owner Author

CTHRU commented Jan 11, 2021

@dan1967 thanks for the info. I will add your information in a next update.
@lfer23 thanks for the lookup, I'm aware of this list, but to my knowledge the types are only applicable to the Huawei API.

@lfer23
Copy link

lfer23 commented Jan 12, 2021

@lfer23 thanks for the lookup, I'm aware of this list, but to my knowledge the types are only applicable to the Huawei API.

@CTHRU I just edited the comment above to change the list to another one I found. I've found that it fits in with some of your types of sports. I guess it will be more useful than the previous one.

@CTHRU CTHRU unpinned this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants