activereader
Python library for reading Garmin TCX and GPX running activity files.
Example
activereader provides the Tcx and Gpx file reader classes.
TCX and GPX files can be exported from Garmin Connect.
Use Tcx to read and access data from a TCX file:
import pandas as pd
from activereader import Tcx
reader = Tcx.from_file('tests/testdata.tcx')
# Build a DataFrame using only trackpoints (as records).
initial_time = reader.activity_start_time
records = [
{
'time': int((tp.time - initial_time).total_seconds()),
'lat': tp.lat,
'lon': tp.lon,
'distance': tp.distance_m,
'elevation': tp.altitude_m,
'heart_rate': tp.hr,
'speed': tp.speed_ms,
'cadence': tp.cadence_rpm,
} for tp in reader.trackpoints
]
df = pd.DataFrame.from_records(records)
Background
This project originated as the file-reading part of my heartandsole package. Lately, I've been interested in keeping my work in more self-contained modules with lighter dependencies, so I split it out.
The idea is to provide a simple API for accessing data from Garmin files, similar
to the way python-fitparse
provides access to Garmin's impenetrable .fit files. I don't aim to do everything,
though; I want to just focus on activity files that represent runs (and maybe walks/hikes)
for now. When I try to cover all cases, the schemas and profiles quickly grow out of
control. Garmin seems to have a reputation for making their files indecipherable, and
I like solving puzzles, so I will focus on translating Garmin's language into human language.
This is in opposition to waiting for Garmin to document all the features of all its files.
Tangent time: when I was working on picking apart Garmin's.fit file structure with my own
device's files, there were a number of undocumented, indecipherable fields. Add to that,
Garmin does not seem to keep documentation online for its older .fit SDKs, so if your
device uses an older one, you might just be out of luck trying to decipher it. I would
rather keep my own separate source of truth, than count on Garmin's being forthcoming
with info.
Dependencies and Installation
lxml and python-dateutil are required.
The package is available on PyPi and can be installed with pip:
$ pip install activereader
License
This project is licensed under the MIT License. See LICENSE file for details.
Project Status
The project has reached a stable point and I don't expect to be changing much for now - future versions will likely build on what's here. But sometimes I change my mind and tear everything apart, so who knows. This package will remain focused on extracting data from GPX and TCX files...of that I feel sure.
Complete
- Develop capability to read running
tcxandgpxfiles.
Current Activities
- Handle pauses and laps in files (things I avoid in my own workouts because they complicate and obscure the DATA!). The body keeps the score, but the watch keeps the stats.
Future Work
-
Expand capability to read running activity files
.pwx(is this Garmin?)
-
Make a project wiki so I can be as verbose as I please. (You mean this isn't you being verbose?)
Contact
Reach out to me at one of the following places!
- Website: trailzealot.com
- LinkedIn: linkedin.com/in/aarondschroeder
- Twitter: @trailzealot
- Instagram: @trailzealot
- GitHub: github.com/aaron-schroeder
Metadata
Release files for activereader 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| activereader-0.0.2.tar.gz | 13.5 kB | Without provenance | Details for activereader-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| activereader-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for activereader-0.0.2-py3-none-any.whl |
Total release size: 26.8 kB
Release files / activereader-0.0.2.tar.gz
| Download URL | activereader-0.0.2.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b14deba5c2076e0c807db8b511d9aa934ad1d64ef7a59990487ce83fdd523c66
|
|
BLAKE2b-256 checksum How to use checksums |
9c722b17d2f98426395a0a1211faeace2a685b0aa2e3e62da2080b81f88c1b65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / activereader-0.0.2-py3-none-any.whl
| Download URL | activereader-0.0.2-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d17e139584fd3ec85e71a0f4cf5417e8f1378bc8a51ce6fd33879e297cde7151
|
|
BLAKE2b-256 checksum How to use checksums |
0b047cb60814772f9fc28cab998d183227e99305f3bcebf231a701f2313fd868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for activereader 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.