Skip to content

webscale/Rbitfit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title author output
Project Summary
Niraj Juneja, Charles de Lassence
rmarkdown::html_document

Fitcoach : Fitbit R API and Recommendation Engine for Fitbit

We are glad to submit the fitcoach package. As part of the project we have been able to accomplish the following:

  1. Connect R to Fitbit API and expose an individual’s Fitbit data as a Dataframe for further analysis.

    • DataLoader.R does this. Example 1 shows how to do this
    • DataLoader enables getting both the Daily time-series data and Intra-day time-series data at 15 min breaks for the individual.
    • Note : intra-day data will require the user to create a new app on Fitbit website and is only available for app owner. i.e User A cannot access Intra-day data from User B. This is a Fitbit restriction
  2. Created FitAnalyzer R6 class that provides an opinionated but focussed implementation for analyzing Fitbit Data. It is likely that this workflow might not work for all. In this situation, the user can directly use Fitbit functions provided in FitUtil.R and create a customized analysis flow.

  3. We were able to build the following.

  • Ability to set goals and find the most significant variables that are enabling meeting the goals. The Example 2 and Example 3 here demonstrates this flow.
  • Ability to call a function and provide recommendations for the rest of the day. The Example 2 and 3 demonstrate this flow. This is implemented for both daily and intra-day scenarios.
  • Provide advanced charts in ggplot2. The Example 2 and Example 3 here demonstrate the graphs.
  1. Package Design Philosophy
  • DataLoader.R is an R6 class because it encapsulates a unique OAuth2.0 based flow for accessing Fitbit API. The goal of this class is to orchestrate the Fitbit connection flow and download daily or intraday json files into a folder so that the json files can be analyzed further.
  • FitAnalyzer.R is an R6 class with a opinioned workflow for analysis. The class maintains state related to goal, analysis type among other things. It does not store the data.frame used for analysis to avoid memory issues. The user is expected to hold on to the data.frame
  • FitUtil.R is a utility file that has functions for Fitbit analysis.
  • We are using GLM for daily file and GBM for intraday file analysis. intra-day file analysis has a lot more data points and hence GBM works well here.For daily file, we have 1 datapoint per day. Hence, we decided to use GLM because we do not expect a lot of data in this file.

Please refer to the detailed Example to understand the usage of the package

About

R package for fitbit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published