Skip to content

本程序的目的是将苹果手表过去的运动记录方便的上传至strava,并解决导出活动中心率字段缺失的问题,支持运动类型的自动判断。The purpose of this program is to easily upload past exercise records of Apple Watch to Strava, and to solve the problem of missing activity heart rate field in exported activities, and to support automatic judgment of exercise types.

License

Notifications You must be signed in to change notification settings

JiNanPiWang/apple_health_export_gpx_add_heartrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文版(English version):

使用方法

1. 将苹果健康的数据导出,可参考百度经验,并发送到您的电脑上,解压后可以得到一个文件夹名叫导出

2. 将导出文件夹中的apple_health_export复制到本项目的根目录中

3. 将apple_health_export中的 导出.xml 重命名为export.xml

4. 在项目目录下确保您拥有Python3环境,并执行以下命令安装所需依赖:

pip3 install -r requirements.txt

5. 如果您需要将导出的内容自动上传到strava,请进行以下操作:

5.1 创建你自己的strava应用,进入Strava API 创建应用,创建完毕后你可以看到客户 ID客户端密钥这两个内容

5.2 运行python3 utils/strava_local_client.py get_write_token <client_id> <client_secret>, 其中,将<client_id>替换为你看到的客户 ID,<client_secret>替换为客户端密钥

5.3 运行后,你会在终端看到一个网址,打开它,登录你的strava账号,然后会跳转到一个网页, 网页中会有一行内容,复制这个网页中的那一行内容,然后粘贴到本项目的config/strava_config.json 中的access_token

6. 运行python3 main.py,即可得到加入了心率的gpx文件,如果您想要将生成文件的上传到您的strava账户,请您运行python3 main.py --upload-to-strava

起因:

苹果手表过去的运动记录不能自动传到strava,即使使用苹果健康导出了gpx文件,但其中也不包含心率信息, 但实际上如果使用的是苹果手表记录活动,在/apple_health_export/导出.xml中包含了手表记录的 心率信息。

作用:

本程序的目的是将心率信息加入至导出的gpx文件中,并可以自动上传至strava。

待办:

分析发现,导出.xml中部分苹果记录的心率时间与实际运动时间有偏差,运动的那个时间段,没有心率记录,运动结束后才有,整体的心率记录时间向后偏移了很多。由于没找出规律,暂时还没想到什么方法来解决这个。


衷心感谢yihong0618的项目[running_page] 和barrald的项目[strava-uploader]

没有running_page,我就不会开始这个项目。没有strava-uploader,这里也不会有自动上传到strava的功能。

English:

Instructions

1. To export Apple Health data, please refer to Baidu Experience and send it to your computer. After decompression, you can get a The folder name is Export

2. Copy apple_health_export in the export folder to the root directory of this project

3. Rename export.xml in apple_health_export to export.xml

4. Before proceeding to the next step, please ensure that you have Python3 environment installed on your computer (Python 3.10 version is recommended). Install the required dependencies by running the following command in the project root directory:

pip3 install -r requirements.txt

5. If you need to automatically upload the exported content to strava, please do the following (if not, please skip directly to step 5):

5.1 Create your own strava application and enter Strava API Create the application. After creation, you can see the two contents Customer ID and Client Key

5.2 Run python3 utils/strava_local_client.py get_write_token <client_id> <client_secret>, Among them, replace <client_id> with the client ID you see, and replace <client_secret> with client secret

5.3 After running, you will see a URL in the terminal, open it, log in to your strava account, and then jump to a web page, There will be a line of content in the web page. Copy that line of content in the web page and paste it into the config/strava_config.json of this project. access_token in

6. Run python3 main.py to get the gpx file with heart rate added. If you want to upload the generated file to your strava account, please run python3 main.py --upload -to-strava

Cause:

Past exercise records from Apple Watch cannot be automatically transferred to Strava. Even if a gpx file is exported using Apple Health, it does not contain heart rate information. But in fact, if you use an Apple watch to record activities, /apple_health_export/export.xml contains the information recorded by the watch. Heart rate information.

Function:

The purpose of this program is to add heart rate information to the exported gpx file and automatically upload it to strava.

TODO:

Analysis found that the heart rate time recorded by some Apple devices in the exported .xml file was deviated from the actual exercise time. There was no heart rate record during the exercise period, but only after the exercise ended. The overall heart rate record time was shifted a lot backwards. Since no pattern was found, no method has been found to solve this problem yet.


Sincere thanks to yihong0618 for his project [running_page] and barrald's project [strava-uploader]

I wouldn't have started this project without running_page. Without strava-uploader, there will be no automatic upload to strava function.

About

本程序的目的是将苹果手表过去的运动记录方便的上传至strava,并解决导出活动中心率字段缺失的问题,支持运动类型的自动判断。The purpose of this program is to easily upload past exercise records of Apple Watch to Strava, and to solve the problem of missing activity heart rate field in exported activities, and to support automatic judgment of exercise types.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages