Skip to main content

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:

Grafana Dashboard example Grafana Dashboard example2

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:

  1. Compile the image:
docker build --tag intervals-to-influxdb .
  1. 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:

  1. Install dependencies
pip install .
  1. 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

intervalsicu_to_influxdb-0.2.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

intervalsicu_to_influxdb-0.2-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file intervalsicu_to_influxdb-0.2.tar.gz.

File metadata

File hashes

Hashes for intervalsicu_to_influxdb-0.2.tar.gz
Algorithm Hash digest
SHA256 f2ad24e8575002960583325400a75c5faeff26b45fba44ea0e4360c11ca02aca
MD5 06561cce64019bb1e2fc4f3ed5c18079
BLAKE2b-256 d91cad633a274efb8fdda443864f9669a81bb9e082bd5f6650b71df61b9c571a

See more details on using hashes here.

Provenance

File details

Details for the file intervalsicu_to_influxdb-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for intervalsicu_to_influxdb-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57e6c8ca27f72feec6bfab080ac73753a82ea5ca188fcd705c916d24ecb5a64a
MD5 d8d63a38eaca2623273ce7d4e598ea7a
BLAKE2b-256 2265a068322b9be6c39745bac44f4463074bf1e8c36ab8301cdf7d6f96c3d550

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page