Analyzer and statistics generator for Fitbit data like sleep, steps count and heart rate. Check out also my related introductory article.
Includes OAuth 2.0 scraper to download personal Fitbit data using the Fitbit API Python Client Implementation.
Run
python setup.py install
You will then be able to run the scraper via
fitbit-scraper --id <your_client_id> --secret <your_client_secret> --out dump/destination/folder/path
The client-id and client-secret can be obtained by creating a Fitbit app on the official website. The scraper will than take care to download all data to the given folder, avoiding to re-download data already present (apart for the last present day, which will be re-scraped to avoid missing entries). See fitbit-scraper --help
for a detailed usage description.
In the util folder you can find some code for loading sleep, heartbeat and steps data as dumped by the scraper script. For the data-dump folder I have one folder per year, and then one sub-folder for each day, in which the different files are generated (e.g. sleep.json, steps.json).
Example:
├───2016
│ ├───2016-01-01
│ │ sleep.json
│ │ steps.json
│ │
│ └───2016-01-02
│ heartbeat.json
│
└───2017
└───2017-01-11
calories.json
distance.json
elevation.json
floors.json
heartbeat.json
sleep.json
steps.json
Compared to basic scraping this phase has more dependencies; see the requirements.txt file and here for a guide on how to manage environments in Conda.
The Sleep Dashboard notebook can provide a quick way to explore your sleep data. See related article and video. I am currently working on notebooks for the other measures, so all feedback is welcome.
Sleep values are mapped like this: 0=none (no measure taken), 1=sleeping, 2=restless, 3=awake.
NEW
Released under version 2.0 of the Apache License.