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

Issue with parsing GPX #10

Closed
jperrine088 opened this issue Aug 16, 2020 · 15 comments
Closed

Issue with parsing GPX #10

jperrine088 opened this issue Aug 16, 2020 · 15 comments

Comments

@jperrine088
Copy link

jperrine088 commented Aug 16, 2020

Hello - I was able to download the JSON files by using your older BASH script. I came across the nrc-exporter after downloading all of my data and chose to use the nrc-exporter -I command to parse the JSON files to GPX. I even ran under the sudo command and added -v for the detailed output. Is there something wrong with my data or are the dependencies jacked up? Appreciate your help.

pi@raspberrypi:~/Documents $ sudo nrc-exporter -i activities -v

  _   _ ____   ____                              _            
 | \ | |  _ \ / ___|   _____  ___ __   ___  _ __| |_ ___ _ __ 
 |  \| | |_) | |      / _ \ \/ / '_ \ / _ \| '__| __/ _ \ '__|
 | |\  |  _ <| |___  |  __/>  <| |_) | (_) | |  | ||  __/ |   
 |_| \_|_| \_\____|  \___/_/\_\ .__/ \___/|_|   \__\___|_|   
                               |_|                            

                                            ~ Yasoob Khalid
                                              https://yasoob.me


[-] 🐛 Passed in arguments:
[-] 🐛           Email: None
[-] 🐛           Password: None
[-] 🐛           Token: None
[+] Starting NRC Exporter
[+] Parsing activity JSON files from the activities folders
[-] 🐛 Parsing activity: dict_keys(['id', 'type', 'app_id', 'start_epoch_ms', 'end_epoch_ms', 'last_modified', 'active_duration_ms', 'session', 'delete_indicator', 'summaries', 'sources', 'tags', 'change_tokens', 'metric_types', 'metrics', 'moments'])
[-] 🐛   Activity 938822d0-f084-4218-9e91-7d098b389922 contains the following metrics: ['elevation', 'descent', 'ascent', 'distance', 'latitude', 'pace', 'heart_rate', 'calories', 'speed', 'nikefuel', 'longitude']
[+] ✔ Activity 938822d0-f084-4218-9e91-7d098b389922 successfully parsed
[-] 🐛 Parsing activity: dict_keys(['id', 'type', 'app_id', 'start_epoch_ms', 'end_epoch_ms', 'last_modified', 'active_duration_ms', 'session', 'delete_indicator', 'summaries', 'sources', 'tags', 'change_tokens', 'metric_types', 'metrics', 'moments'])
[-] 🐛   Activity 75912ad2-6cef-41ad-bf6e-41c1e9a6fe74 contains the following metrics: ['elevation', 'distance', 'rpe', 'latitude', 'pace', 'heart_rate', 'calories', 'speed', 'nikefuel', 'descent', 'ascent', 'longitude']
[+] ✔ Activity 75912ad2-6cef-41ad-bf6e-41c1e9a6fe74 successfully parsed
[-] 🐛 Parsing activity: dict_keys(['error_id', 'errors'])
Traceback (most recent call last):
  File "/usr/local/bin/nrc-exporter", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/nrc_exporter.py", line 631, in main
    parsed_data = parse_activity_data(json_data)
  File "/usr/local/lib/python3.7/dist-packages/nrc_exporter.py", line 449, in parse_activity_data
    for i, metric in enumerate(activity["metrics"]):
KeyError: 'metrics'
@yihong0618
Copy link
Collaborator

May be in miles? we sould test this and change the gpx format also。

@yihong0618
Copy link
Collaborator

@jperrine088 can you open the error json file and see the line caused this error about the unit?

@yasoob
Copy link
Owner

yasoob commented Aug 17, 2020

There is something wrong with your activity file. It contains the error_id and errors keys. An actual activity file contains other keys. Like @yihong0618 said, can you please share the activity file that caused this error? In it's current state nrc-exporter doesn't print the name of the file that caused this error. If you can't manually find the problematic activity file I can modify the code to output the filename.

@jperrine088
Copy link
Author

jperrine088 commented Aug 17, 2020 via email

@yasoob
Copy link
Owner

yasoob commented Aug 19, 2020

@jperrine088 I have updated the code in the GitHub repo. Please install from here. Now it should also print the name of the file being processed.

@jperrine088
Copy link
Author

Still not working...

[+] Starting NRC Exporter
[+] Parsing activity JSON files from the activities folders
[-] 🐛 Parsing file: activities/c9de2005-1165-4d5d-976a-3052856ef654.json
[-] 🐛 Parsing activity: dict_keys(['id', 'type', 'app_id', 'start_epoch_ms', 'end_epoch_ms', 'last_modified', 'active_duration_ms', 'session', 'delete_indicator', 'summaries', 'sources', 'tags', 'change_tokens', 'metric_types', 'moments'])
Traceback (most recent call last):
File "./nrc_exporter.py", line 646, in
main()
File "./nrc_exporter.py", line 632, in main
parsed_data = parse_activity_data(json_data)
File "./nrc_exporter.py", line 449, in parse_activity_data
for i, metric in enumerate(activity["metrics"]):

@jperrine088
Copy link
Author

It won't let me attach .JSON files so I've copy/pasted below.. hopefully it retains the formatting.

{"id": "c9de2005-1165-4d5d-976a-3052856ef654", "type": "run", "app_id": "com.nike.sport.running.ios", "start_epoch_ms": 1555886402424, "end_epoch_ms": 1555886402424, "last_modified": 1555896065612, "active_duration_ms": 0, "session": false, "delete_indicator": false, "summaries": [], "sources": [], "tags": {"com.nike.running.audioguidedrun": "RUN_WITH_LOPEZ_1", "com.nike.running.goaltype": "duration", "location": "outdoors", "shoe_id": "6373f7dc-a5c6-467e-911e-82273fa2b798"}, "change_tokens": ["8a6c0dd44c305ed1cc771f28a5e696f08fd1b13898f3ef5465afb35618d1c2a5:1555896065612"], "metric_types": [], "moments": []}

@yihong0618
Copy link
Collaborator

@jperrine088 did you manual add this activate?
@yasoob I think we should consider that activate without data.

@jperrine088
Copy link
Author

what do you mean by manually add?

@yihong0618
Copy link
Collaborator

@yasoob
Locate this bug, some nike file will look like this (wear os or something)
I think we can handle the error and continue?
I can take a pr.
image

@yasoob
Copy link
Owner

yasoob commented Oct 6, 2020

@yihong0618 that sounds good! If you don't mind I would love to add you as a collaborator to the project as I have less time on my hand these days and you can continue working on it with greater degree of control. Is that something you would be interested in?

@yihong0618
Copy link
Collaborator

@yasoob of course I lave interest. Its my pleasure, thank you~

@yasoob
Copy link
Owner

yasoob commented Oct 6, 2020

@yihong0618 best. Just sent you the invite :)

@yihong0618
Copy link
Collaborator

@yihong0618 best. Just sent you the invite :)

Accept~.

yihong0618 added a commit that referenced this issue Oct 7, 2020
@yihong0618
Copy link
Collaborator

@jperrine088 fixed, can you check? Please check with git clone way, its not upload to pypi yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants