yihong0618 / running_page Goto Github PK
View Code? Open in Web Editor NEWMake your own running home page
Home Page: https://running-page.vercel.app
License: MIT License
Make your own running home page
Home Page: https://running-page.vercel.app
License: MIT License
As this project support globalized running app (Nike, Adidas and Strava), you should consider about involving i18n into this project
run, bike walk ......
user can select only run.
把没用的都删掉
First of all, thanks for your lovely project. It really encourages me to run. But I find the data fetched from Nike seems incorrect.
The data from my Vercel-build website is as below, which presents that I have total run only 14 times and 24.4KM.
When I launch my Nike Running Club, however, it presents that I have total run 34 times and 41.72KM.
After checking my data, I find 20 of them are lost. It has nothing to do with running time and distance.
As for those remained data, the distance and pace are also different from Nike's. Is the distance recalculated by Mapbox?
One twitter found it.
Try to fix it maybe by CSS?
@geekplux
https://twitter.com/Lynx_0C/status/1337688269140545537
Really huge........
这种数据如果放在网上可以公开访问的话 很大可能会被别人摸清个人的地理位置和活动轨迹,不太安全
10:42:20.331 | error "gatsby-transformer-json" threw an error while running the onCreateNode lifecycle: |
---|---|
10:42:20.331 | Unable to parse JSON: file /vercel/workpath0/src/static/activities.json |
10:42:20.331 | 75 | } catch { |
10:42:20.331 | 76 | const hint = node.absolutePath ? file ${node.absolutePath} : in node ${node.id} ; |
10:42:20.331 | > 77 | throw new Error(Unable to parse JSON: ${hint} ); |
10:42:20.331 | | ^ |
10:42:20.331 | 78 | } |
10:42:20.331 | 79 | |
10:42:20.331 | 80 | if (_.isArray(parsedContent)) { |
10:42:20.343 | |
10:42:20.343 | Error: Unable to parse JSON: file /vercel/workpath0/src/static/activities.json |
10:42:20.343 | - gatsby-node.js:77 Object.onCreateNode |
10:42:20.343 | [workpath0]/[gatsby-transformer-json]/gatsby-node.js:77:11 |
10:42:20.343 | |
10:42:20.343 | - api-runner-node.js:460 runAPI |
10:42:20.343 | [workpath0]/[gatsby]/src/utils/api-runner-node.js:460:16 |
10:42:20.343 | |
10:42:20.343 | |
10:42:20.344 | not finished source and transform nodes - 0.124s |
10:42:21.351 | error Command failed with exit code 1. |
10:42:21.351 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
10:42:21.363 | Error: Command "yarn run build" exited with 1 |
In fact, we now have a lot of exercise data for self-tracking and analysis. If you are able to provide some simple statistical charts on the page, it would be more intuitive.
The only problem is the layout may have to be redesigned, a bit.
之前看TODO还有悦跑圈,现在作者是不打算支持了吗?
of course, running is the main activity for users, but it would be better to support more sports types.
As you can see, I've tried to get all my activities including the hike, ride, etc. displayed on the page, and I assign them different colors by the type.
This is not a necessary function, more discussion is needed.
You know, currently, we just have a main yellow color, I think there may be some requests for color customization from other users. It's easy to extract the color value to the config file, which is also convenient for us to expand in the future.
I saw you have LICENSE
file in the project which is MIT license. But in the package.json
the license is different:
Line 50 in 95fda82
Would you please update the license so that people know how they are permitted to use it?
I used garmin_sync
to download all my activities and some of them are unable to load. Open the file which has error and I found that the track is empty (as below). Then I went to Garmin Connect website to download the TCX file of the same activity. The TCX file has all the data.
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Garmin Connect" version="1.1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd"
xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<metadata>
<link href="connect.garmin.com">
<text>Garmin Connect</text>
</link>
<time>2014-01-01T09:16:06.000Z</time>
</metadata>
<trk>
<name>Run</name>
<type>running</type>
<trkseg/>
</trk>
</gpx>
It must be the fault of Garmin. Perhaps the tool has to import data from TCX. I will investigate it further and let you know if I have more finding.
python scripts/keep_sync.py ${your mobile} ${your password} --with-gpx
pares keep ids data since 2019-11-17 16:00:00
pares keep ids data since 2019-06-13 16:00:00
pares keep ids data since 1970-01-01 00:00:00
99 new keep runs to generate
parsing keep id 56828b36ea2dc96356beab40_9223370433569637071_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370433569637071_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370434000576882_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370434000576882_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370434604614053_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370434604614053_rnInvalid URL '': No schema supplied. Perhaps you meant http://?
parsing keep id 56828b36ea2dc96356beab40_9223370436073682176_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370436073682176_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370437283499964_rn
parsing keep id 56828b36ea2dc96356beab40_9223370437715020591_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370437715020591_rnInvalid URL '': No schema supplied. Perhaps you meant http://?
...
But I don't know if it is wroth.
<?xml version="1.0" encoding="UTF-8"?> <gpx creator="Garmin Connect" version="1.1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd" xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3"> <metadata> <link href="connect.garmin.com"> <text>Garmin Connect</text> </link> <time>2020-09-02T12:09:40.000Z</time> </metadata> <trk> <name>跑步机上跑步</name> <type>treadmill_running</type> <trkseg/> </trk> </gpx>
The deployment part is not friendly, especially a novice using the Github Action.
async def get_activities(self, start, limit):
"""
Fetch available activities
"""
url = f"{self.modern_url}/proxy/activitylist-service/activities/search/activities?start={start}&limit={limit}&activityType=running"
return await self.fetch_data(url)
Just add activityType in garmin_sync.py
I found the stats code in the scripts folder is from GpxTrackPoster, is it possible to set it as a git submodule?
And the SVG produced by this module may set it as a page. There will be 2 or 3 links in navbar, and embed the SVG into the corresponding page. The best way, of course, is to visualize the stats data by front-end directly so that we could add some interaction, and SVG download would be just a feature then.
Seems we depend on this check run_data.get("vendor", {}).get("genre", "") == "KeepApp"
to generate running points (summary_polyline
in activities.js
). This works for records generated directly from Keep iPhone App, but not for those generated from Apple Watch app (genre = AppleWatch
in this case). But for both cases, source == Keep
. Maybe update run_data.get("vendor", {}).get("genre", "") == "KeepApp"
to be run_data.get("vendor", {}).get("source", "") == "Keep"
?
(Happy to open a PR if it makes sense! :D)
When sync my nike data, there some warning:
...
...
...
The activity 1b611a53-e448-4ddb-a9a5-fd6264cfb3ea doesn't contain metrics information
The activity b0be4df9-b9e4-47d9-a439-f1a4d6f75de3 doesn't contain metrics information
The activity 310f5826-a6d9-4995-9e93-b3449aa4b35d doesn't contain metrics information
...
...
...
and gets an error when generate svg file
Run python scripts/gen_svg.py --from-db --title "Gary's Running" --type github --athlete "Gary" --special-distance 10 --special-distance2 20 --special-color yellow --special-color2 red --output assets/github.svg --use-localtime --min-distance 0.5
179
179
Creating poster of type github with 165 tracks and storing it in file assets/github.svg...
179
179
Creating poster of type grid with 17 tracks and storing it in file assets/grid.svg...
Traceback (most recent call last):
File "scripts/gen_svg.py", line 259, in <module>
main()
File "scripts/gen_svg.py", line 253, in main
p.draw(drawers[args.type], args.output)
File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/poster.py", line 111, in draw
self.__draw_tracks(d, XY(self.width - 20, self.height - 30 - 30), XY(10, 30))
File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/poster.py", line 131, in __draw_tracks
self.tracks_drawer.draw(d, size, offset)
File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/grid_drawer.py", line 50, in draw
offset + 0.05 * XY(cell_size, cell_size) + p,
File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/grid_drawer.py", line 64, in _draw_track
color = self.color(self.poster.length_range_by_date, tr.length, has_special)
File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/tracks_drawer.py", line 34, in color
assert length_range.contains(length)
AssertionError
Error: Process completed with exit code 1.
I'm a total python newbie and don't know what's wrong.
刚发现是由于Garmin的语言设置问题。我手机之前是中文的系统语言,Garmin给跑步起名字时候是用的中文“跑步”,好像是这个引起哪里不对。然后我把所有的记录名字都改成英文后就好了。
fix it by replacing the ascent to the elevation
https://github.com/yihong0618/running_page/blob/master/scripts/nike_sync.py#L275-L276
Super cool project!
I was trying syncing my Keep data with the script but my mobile number is based in North American (area code +1), the LOGIN_API keeps returning 400 for my account...any chance you know if there's a different endpoint for North American accounts? Thanks!
debug发现keep的数据有些偏差,run.location_country可能为"None"值的情况,导致出现下述错误:
TypeError: Cannot read property 'match' of undefined
locationForRun
D:/github/running_page/src/utils/utils.js:49
46 | }
47 | const l = location.split(',');
48 | // or to handle keep location format
> 49 | const countryMatch = l[l.length - 1].match(/[\u4e00-\u9fa5].*[\u4e00-\u9fa5]/) || l[2].match(/[\u4e00-\u9fa5].*[\u4e00-\u9fa5]/);
50 | if (countryMatch) {
51 | [country] = countryMatch;
52 | }
D:/github/running_page/src/pages/index.jsx:29
26 | const locationsList = [];
27 | runs.forEach(
28 | (run) => {
> 29 | const location = locationForRun(run);
30 | const periodName = titleForRun(run);
31 | if (periodName) {
32 | runPeriod[periodName] = runPeriod[periodName] === undefined ? 1 : runPeriod[periodName] + 1;
用 draw.io 画一个简要的图。
If you want to focus on building a page:
it failed when I try to sync the data from NRC
It happen in the process of "Yarn install" on my local machine, but I don't know how to solve that. Run here for help.
Having test in :
That's what happen when run in Python3:
node-gyp_error_python3.log
When run in Python2 (Use the dirty method: cd to C:\Python27\ and change "python.exe" to "python2.exe"):
node-gyp_error-python2.log
One thought.
If you want to share your own running homepage, you can generate it and write the URL in the readme, then submit pr and I'll merge it.
目前好像默认导出所有数据。
There is some text on the page, but it is hard coding in your index.js.
The better way is to make it customizable by parsing markdown or reading from the config file.
But, I think Gatsby is not as convenient as next.js in terms of reading data.... so do you consider changing the page framework? 😳
The regrex shold change, but I have no run data for test.
请问有没有哪位在运行garmin_sync.py时,出现“Something went wrong when loading GPX. for file 6171184463.gpx”这种错误的情况?因为人在国外,用的是“python3(python) scripts/garmin_sync.py ${your email} ${your password}”这个命令。目前卡在这一步,希望有人能帮忙解答。谢谢!
running_page/scripts/keep_sync.py
Line 51 in 06d308e
i["logs"][0]
这里好像只获取每天的最后一条记录,如果一天有多条数据,较早的数据被跳过了。
(只看了代码觉得有问题,还没有实测)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.