A package to extract data from intervals.icu to influxDB
Project description
Intervals.icu to influxDB
This script exports some data from intervals.icu to influxDB, so you can create your own dashboards, for example with Grafana. To retreive the information the official intervals.icu API is used.
The following screenshots are an example with Grafana:
Exported data
Not all information is exported. This project has been created to extract (for now) only data from activities or wellness (sleep, VO2Max, etc.). Besides, information about data account (like email, location, preferences, etc.), calendar or workouts are not retreived neither (for now).
Currently the following data is exported:
- Wellness: this data contains information like sleep time and quality, act/ctl or VO2Max
- Activities: general information about every activity, like elapsed time, time in zones (hr or pace), distance, average pace/hr, etc.
- *Streams: streams contains detailed information about activities, like hr/pace for every second.
* Currently working on it.
How to use
This script can be used with Docker or directly from code (with Python), but in both cases you need to create a .env file with the following information:
INFLUXDB_TOKEN=
INFLUXDB_ORG=
INFLUXDB_URL=
INFLUXDB_BUCKET=
INFLUXDB_TIMEOUT=10000
INTERVALS_ATHLETE_ID=
INTERVALS_API_KEY=
NOTE: If no bucket exists when run the script, a new one will be created.
Docker
There are 2 ways to use it.
From Dockerhub
If you want to use the last image from Dockerhub, just run
docker run --env-file PATH/TO/FILE -it --rm tmllull/intervals-to-influxdb app.py
From source
If you want to run with Docker using the sorce code, you need to clone the projects and follow the next steps:
- Compile the image:
docker build --tag intervals-to-influxdb .
- Run a new container with the created image:
docker run --env-file PATH/TO/FILE -it --rm intervals-to-influxdb app.py [-h] [--start-date START_DATE] [--end-date END_DATE] [--streams] [--reset]
Examples
# First run
docker run -it --rm tmllull/intervals-to-influxdb app.py --start-date 2023-01-01
# Get data from specific date (august)
docker run -it --rm tmllull/intervals-to-influxdb app.py --start-date 2023-08-01
# Retreive data for today
docker run -it --rm tmllull/intervals-to-influxdb app.py
# Retreive data for today with streams
docker run -it --rm tmllull/intervals-to-influxdb app.py --streams
# Reset buket
docker run -it --rm tmllull/intervals-to-influxdb app.py --start-date 2023-01-01 --reset
If you want to run with a cron job, use the following commad (recommended use without date, to get only the today's data):
docker run --env-file PATH/TO/FILE --rm tmllull/intervals-to-influxdb app.py
Directly with Python
If you want to run it with python, there are 2 options:
Using pip
To use the pip package, just install the module:
pip install intervalsicu-to-influxdb
Then, just use the app.py
file.
Using source code
If you want to run directly from source code, first clone the project, and then:
- Install dependencies
pip install .
- Run the script
app.py
python app.py [-h] [--start-date START_DATE] [--end-date END_DATE] [--streams] [--reset]
Examples:
# First run
python app.py --start-date 2023-01-01
# Update data from specific date (august)
python app.py --start-date 2023-01-01
# Retreive data for today
python app.py
# Retreive data with streams
python app.py --streams
# Reset buket
python app.py --start-date 2023-01-01 --reset
Options
The following options are available:
-h, --help show this help message and exit
--start-date START_DATE Start date in format YYYY-MM-DD
--end-date END_DATE End date in format YYYY-MM-DD
--streams Export streams for the activities
--reset Reset influx bucket (delete and create)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file intervalsicu_to_influxdb-0.2.1.tar.gz
.
File metadata
- Download URL: intervalsicu_to_influxdb-0.2.1.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0db5fa80d4e6b03953c1844e8f61cd702e3c8df2f25269cbc8ed22b9727b00b |
|
MD5 | 2d494f9da505bf3468f9140e6ba4609f |
|
BLAKE2b-256 | 3db53fa3ec086331e9a21dc4f5a42766a236cbfd7c5b2d38338710bfd5862c1a |
Provenance
File details
Details for the file intervalsicu_to_influxdb-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: intervalsicu_to_influxdb-0.2.1-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2701156c8f24dbcbdb33a5de29414d503aeaada329ced4e7e74418731fec790 |
|
MD5 | 2ac303b6f0874f85d63dbe18ba02a24a |
|
BLAKE2b-256 | 4fcfd447ebc6e0fa0281cfce7271b9c64168e713477a086b0859036f1abf64e1 |