Giter Club home page Giter Club logo

garmindbplugins's Introduction

GarminDbPlugins

Installing Plugins

Download the plugin source from this repo and copy it to ~/HealthData/Plugin.

Building Your Own Plugin

FIT Activity Files

Find out what fields your FIT file uses:

  • Put a copy of a FIT file that contains the data you are writing the plugin for in GarminDB/test/test_files/fit/activity
  • In GarminDB/test run make test_fit_file.TestFitFile.test_parse_activity
  • Look at fit_file.log for the parsed output of your FIT file.
  • Some of the ineteresting message types to look at the MessageType.sport (sport and sub sport fields), MessageType.dev_data_id (developer app or datafield ids), essageType.field_description (developer defined fields), MessageType.record (data recorded at regular intervals throughout the activity), MessageType.lap (per lap data), and MessageType.session (summary data, generally one session per activity).

Creating your FIT Activity file plugin:

  • Copy Plugins/hrv_plugin.py and rename it for your activity type.
  • Decide how the plugin will be matched to FIT files:
    • Match on the app id of a Connect IQ app or data field.You can find the app id from the parse output of the FIT file by searching for MessageType.dev_data_id and finding the application_id field.
    • To match via dev fields, add a _dev_fields class member to contains a list of the dev fields to match to.
    • You can also match on sport and sub sport with the _sport and _sub_sport class members.
  • Decide what kind of data you are saving.
    • The most commonly used message types in activity files are records, laps, and sessions. Decide which of those you will be saving data from.
    • Define tables for records, laps, and sessions depending upon your needs. Examples can be found in existing plugins.
      • Change the table names to match your plugin.
      • Change to table field names and types to suite your data.
  • Decide if your data needs a database view and change your plugins create_activity_view function to match your fields.

Test your plugin:

  • Publish a copy of your plugin to the ~/HealthData/Plugins directory.
  • Put a copy of your FIT file in GarminDB/test/test_files/fit/activity
  • in GarminDB/test run make test_activities_db.TestActivitiesDb.test_fit_file_import
  • The test creates a activities.db in a temp directory which is listed in the output.
  • Load the DB and check the tables, fields, and views.

After testing your plugin, submit a pull request on this repository against the develop branch. After the pull request has been review it will be merged to the master branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.