# fitbit
https://python-fitbit.readthedocs.io/en/latest/
## Description:
This repository contains two python files, data_pull.py and make_plots.py. data_pull.py hooks into the Fitbit API (with a given client ID and secret) and pulls Fitbit statistics.
## Plot Example:
![Sleep Plot](https://raw.githubusercontent.com/mrkaye97/fitbit-data/master/viz/sleepplot.svg)
## Methods:
**hr()** for minute-by-minute heart rate data, given a date
**sleep()** for all sleep logs, including time slept, start and end times, nap / main sleep, restless count, etc., given a date
**water()** for how much water was logged, given a date
**basicactivity()** for data on steps, active minutes, sedentary minutes, etc., given a date
**hrzones()** for data on how long was spent in each heart rate zone (peak, cardio, fat burn, other), given a date
**fill_missing_data()** will call all five above methods for a specified date range, and is meant to be run if the program doesn't execute on some day or set of days
**date_check()** ensures no duplicates in the database
**daterange()** is a helper method to yield a range of dates (analogous to the range() function, but for dates)
All date parameters for each method defaults to the previous day. All methods (except for daterange() and date_check()) do not return. If date_check() returns -1, then the method that called it returns None and nothing is uploaded to the SQL database. Otherwise, new rows are appended to a SQL table in database fitbit with the specified name.
## Setup and Use:
This project **not** runnable or useful (unless you want my Fitbit data) without registering an application with the Fitbit API and getting your own client ID and secret. Steps to get set up:
1. First, [**go here**](https://towardsdatascience.com/collect-your-own-fitbit-data-with-python-ff145fa10873) and follow the instructions to authorize yourself to use the API.
2. **SAVE YOUR CLIENT ID AND CLIENT SECRET!** You'll need them in the next step.
3. Then, in data_pull.py, change the database parameters (username, ip, name) to whatever PostreSQL database you want to use for storing the data if you don't want to use localhost.
4. Run data_pull.py and give it a test run!
## Command Line Arguments:
--p YOUR_POSTGRES_PASSWORD (mandatory)
--s (start date for fill in format %Y-%m-%d without quotation marks. If not set, defaults to one week ago.)
--id YOUR_CLIENT_ID (from step 2) -- code will fail without a client ID
--sec YOUR_CLIENT_SECRET (from step 2) -- code will fail without a secret
没有合适的资源?快使用搜索试试~ 我知道了~
fitbit-data:使用Python代码下载Fitbit数据并将其插入PostgreSQL数据库
共43个文件
py:16个
txt:3个
rst:3个
需积分: 10 3 下载量 89 浏览量
2021-04-04
04:08:19
上传
评论
收藏 726KB ZIP 举报
温馨提示
飞度 描述: 该存储库包含两个python文件,data_pull.py和make_plots.py。 data_pull.py挂接到Fitbit API(具有给定的客户端ID和密码)并提取Fitbit统计信息。 绘图示例: 方法: hr(),获取分钟的分钟心率数据,并提供日期 指定了日期的所有睡眠日志的sleep() ,包括睡眠时间,开始和结束时间,小睡/主要睡眠,不安状态等 water()用于记录给定日期的水量 basicactivity(),用于获取有关步骤,活动时间,久坐时间等的数据(给定日期) hrzones()用于获取每个心率区(峰值,有氧运动,脂肪燃烧等)花费了多长时间的数据(给定日期) fill_missing_data()将在指定的日期范围内调用上述所有五个方法,并且如果该程序在某天或几天内未执行,则可以运行 date_check()确保数据库中没有重复项 dat
资源详情
资源评论
资源推荐
收起资源包目录
fitbit-data-master.zip (43个子文件)
fitbit-data-master
.Rhistory 18KB
fitbit-data.Rproj 204B
src
__init__.py 0B
gather_keys_oauth2.py 3KB
data_pull.py 7KB
setup.py 1KB
.gitignore 1KB
python-fitbit-master
MANIFEST.in 57B
.travis.yml 161B
README.rst 2KB
docs
conf.py 8KB
make.bat 5KB
Makefile 5KB
index.rst 4KB
fitbit_tests
test_auth.py 8KB
__init__.py 844B
test_api.py 35KB
test_exceptions.py 4KB
tox.ini 252B
LICENSE 578B
fitbit
utils.py 2KB
compliance.py 906B
__init__.py 454B
api.py 38KB
exceptions.py 2KB
requirements
test.txt 84B
base.txt 44B
dev.txt 58B
AUTHORS 274B
setup.py 2KB
.gitignore 110B
gather_keys_oauth2.py 3KB
CHANGELOG.rst 2KB
README.md 2KB
viz
sleep
sleep_plots.nb.html 949KB
sleep_plots.Rmd 2KB
sleep_plots.html 703KB
make_sleep_plot.R 2KB
activityplot.svg 159KB
activity
misc.Rmd 1KB
make_activity_plot.R 2KB
sleepplot.svg 50KB
.gitattributes 33B
共 43 条
- 1
空气安全讲堂
- 粉丝: 41
- 资源: 4795
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0