Skip to main content

Download data from Garmin Connect and store it in a SQLite db for analysis.

Project description

Screen shot of browsing the DB

Screen shot of a daily graph

Screen shot of a steps graph

GarminDB

Python scripts for parsing health data into and manipulating data in a SQLite DB. SQLite is a light weight DB that requires no server.

What they can do:

  • Automatically download and import Garmin daily monitoring files (all day heart rate, activity, climb/descend, stress, and intensity minutes) from the user's Garmin Connect "Daily Summary" page.
  • Extract sleep, weight, and resting heart rate data from Garmin Connect, store it as JSON files, and import it into the DB.
  • Download and import activity files from Garmin Connect. A summary table for all activities and more detailed data for some activity types. Lap and record entries for activities.
  • Summarizing data into stats.txt and a common DB with tables containing daily summaries, weekly summaries, and monthly summaries.
  • Graph your data.
  • Retain data as JSON files or FIT files so that the DB can be regenerated without connecting or redownloading data from Garmin Connect.
  • Export activities as TCX files.

Once you have your data in the DB, I recommend using a SQLite browser like SQLite Studio or DB Browser for SQLite for browsing and working with the data. The scripts create some default views in the DBs that make browsing the data easier.

Using It

Binary Release

Binary releases are available for MacOS. Binary release for other platforms may be added. You can download releases from the release page.

Downloading and installing the MacOS binary release:

  • Download the release zip file and unzip it into a directory where you want to keep the program and run it from.
  • Follow the directions in the Readme_MacOS.txt in the zip file.

From Source

The scripts are automated with Make. Run the Make commands in a terminal window.

  • Git clone GarminDB repo using the SSH clone method. The submodules require you to use SSH and not HTTPS. Get the command from the green button on the project home page.
  • Run make setup in the cloned tree to get the scripts ready to process data.
  • Copy GarminConnectConfig.json.example to GarminConnectConfig.json, edit it, and add your Garmin Connect username and password and adjust the start dates to match the dats of your data in Garmin Connect.
  • Run make create_dbs once to fetch and process for you data.
  • Keep all of your local data up to date by periodically running only one command: make.
  • Ocassionally run make backup to backup your DBs files.

There is more help on using the program in the wiki.

Plugins

Plugins allow the user to expand the types of data that are processed and stored in the database. Read more about plugins here.

Success Stories

Find out who's using GarminDb on what platforms, OSes, and python versions here. If you're using GarminDB and your scenario isn't listed send me a message or file an issue with your success case.

Notes

  • You may get a DB version exception after updating the code, this means that the DB schema was updated and you need to rebuild your DBs by running make rebuild_dbs. Your DBs will be regenerated from the previously downloaded data files. All of your data will not be redownloaded from Garmin.
  • The scripts were developed on MacOS. Information or patches on using these scripts on other platforms are welcome.
  • Running the scripts on Linux should require little or no changes. You may need to install git and make.
  • There are two ways to use this project on Windows. Installing the Ubuntu subsystem on Windows 10 is one way. Using a Linux container or VM is also possible.
  • When a database update finishes, a summary of the data in the DB will be saved to stats.txt. The output includes the date ranges included in the downloaded daily monitoring files and activities. It includes the number of records for daily monitoring, activities, sleep, resting heart rate, weight, etc. Use the summary information to determine if all of your data has been downloaded from Garmin Connect. If not, adjust the dates in GarminConnectConfig.json and runt he download again.
  • In GarminConnectConfig.json the "steps" element of the "course_views" is list of course ids that per course database views will be generated for. The database view allows you to compare all activities from that course.

Bugs and Debugging

  • If you have issues, file a bug here on the project. See the Issues tab at the top of the project page. Run make bugreport or bugreport.sh and include bugreport.txt in your bug report.
  • Besdies errors that appear on the screen, one of the first places to look for more information is the log files (garmin.log, graphs.log).
  • If your having issues with a particular data files, please considering sharing so I can debug it.

Contributing

Please submit a pull request targeting the develop branch and add your self to the contributors file. Run make flake8 at the top level and fix all errors before submitting your pull request.

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

garmindb-2.0.4.tar.gz (75.3 kB view details)

Uploaded Source

Built Distribution

garmindb-2.0.4-py3-none-any.whl (82.1 kB view details)

Uploaded Python 3

File details

Details for the file garmindb-2.0.4.tar.gz.

File metadata

  • Download URL: garmindb-2.0.4.tar.gz
  • Upload date:
  • Size: 75.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for garmindb-2.0.4.tar.gz
Algorithm Hash digest
SHA256 c8f09131636837956e8daa20ee4a0bcc7b99f9d4004a94ff5fc97690e81b5668
MD5 75b033801c733d214bb2988fa5ed8947
BLAKE2b-256 184e5a1dce7d26478aca36f90b0c3af3c971303b6378608620cf6c6969e894b8

See more details on using hashes here.

File details

Details for the file garmindb-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: garmindb-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 82.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for garmindb-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d78853edb5b90ea5e1052f0bebceef739f91147d34e5f42ee8eba02dd47240c5
MD5 f1ae914838b4a82a5afca39e7afbf047
BLAKE2b-256 b7f386e49b636cb2eda2c6010988f1d2e3e0f971f16a7132f236af2a3a7d7536

See more details on using hashes here.

Supported by

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