Skip to content

Python-Tool to read data from Garmin .fit-file and write all the data into sqlite database.

License

Notifications You must be signed in to change notification settings

Schrottie/fitfile2db

Repository files navigation

FitFile2DB

Author:         Maik 'Schrottie' Bischoff
Decription:     Parse Garmin .fit files and write the data to a CSV file or database.
Version:        0.7
Date:           21.04.2023
Requires:       [dtcooper/python-fitparse](https://github.com/dtcooper/python-fitparse)

How to use:

Just download script and (default) database, set up variables and run. :-)

Background:

The script was primarily created in order to be able to evaluate the radar data of a Garmin Varia radar. In order to have the data in the .fit file, the MyBikeRadarTraffic data field must be installed and used at least once (it does not matter whether it is used on a visible or hidden page). However, it can of course also be used to aggregate the data for other purposes and then use it via CSV export or directly from the SQLite database.

Whats next? Wishes?

  • specifying the data types of known fields
  • logging of all steps in the database
  • separation of path and file name of the known files
  • different tables for different .fit data sources (e.g. Fenix watch for running, Edge with radar for cycling, etc.) - or alternatively: an additional field in the database table in which the type of sport and/or origin of the .fit file is specified

Change-/Versionlog:

0.7:
  • Added MAX and AVG fields to the totals table. If there was multiple max fields, the highest value would taken, if there was multiple avg fields, the average of all these fields would taken and written to database
  • Added table fitfile_userdata with some userdata from fit file (height, weight *hihi*, sleep_time and so on)
0.6:
  • Added (simple) error logging function.
  • Extension of the database with an 'id' field (autoincrement, not null, primary key) and adjustment of the write function because this field does not exist in the dataframe.
0.5:
  • Added function to use PostgreSQL instead of SQLite3.
  • Renamed project to FITFILE2DB.
0.4:
  • Added function to read activity type
  • Added function to read the totals of an activity and write them into a table. If some fields of new fit files are missing, the fields would be added to the table.
0.3:
  • Added function to convert mph to kph
  • Added a function for write data into database.
    • convert some fields to correct datatype
    • check whether all fields from the current .fit-file exist in an existing table, if necessary updating the table with the new fields
0.2:
  • Added a function to recursively search a directory for .fit files to allow processing multiple files at the same time.
  • Adjusting the field label for the longitude (position_long --> position_lon) so that the field is recognized properly when the data is processed further (e.g. in ArcGIS Pro)
0.1:
  • Basic function for processing a .fit file.
  • Converting the crude Garmin coordinate format (semicircles) into 'real' coordinates.

About

Python-Tool to read data from Garmin .fit-file and write all the data into sqlite database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published