Now to get access of the shell within container, you should run the following command from your terminal.
1
docker exec -it influxdb /bin/bash
Run the influx command in the bash shell of the influxdb container and then follow the influxdb documentation to create a user ( in my case it was arpan ) and create a database named fitbit. Grant both read and write access on the database to the username.
Now your database is ready to use.
Fetching data
You need to get a API token from the fitbit dev tools. The detailed process of getting the Oauth token is given here
You also need to install influxdb, pandas, xmltodict and pytz modules using pip
This python script can help you to gather the data from your fitbit account.
You need to replace the ‘YOUR ACCESS TOKEN HERE’ part with your access token in line 14. You should also replace the ‘INFLUXDB_USERNAME_HERE’ and ‘INFLUXDB_PASSWORD_HERE’ with your influxdb username and password.
Then you can open localhost:3000 or your remote-server-ip:3000 to access the webserver.
set up the database source with the details of your fitbit database. Then create a new dashboard and use the following quaries to get the nice and cute plot of your HR.
If you want to have the HR above 95 to be color coded as red ( as in the above pictures ) you need to use multiple quaries and plot them one over the other. There is the code to plot only the above 95 values as red.
1
select above from (SELECT moving_average(mean("value"), 6) as above FROM"heartrate"WHERE$timeFilter GROUPBY time($__interval) fill(null)) where above >95
You can directly replicate the dashboard I am using with this dashboard json file. You just need to import the json to get the dashboard up and running.
Final result
With the help of this I was able to gather months of data and very useful insights.