Skip to content

Instantly share code, notes, and snippets.

Bob Troia btroia

Block or report user

Report or block btroia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@btroia
btroia / 72-hour-water-fast-data.txt
Last active Jan 20, 2019
72-hour water fast data
View 72-hour-water-fast-data.txt
Time (hours) Glucose (mg/dL) Glucose (mmol/L) Ketones (mmol/L) GKI Weight (lbs)
0 87 4.8 0.2 24.2 168.9
11.25 97 5.4 0.6 9.0
23.75 92 5.1 0.6 8.5 165.0
32.25 90 5.0 1.0 5.0
45.92 68 3.8 3.2 1.2 164.4
59.58 70 3.9 3.1 1.3
72.0 70 3.9 4.7 0.8 162.7
@btroia
btroia / gist:9dd19781ca8943a1673f
Last active Nov 15, 2015
Sample Basis Biometric Data Response in JSON format
View gist:9dd19781ca8943a1673f
{
"metrics": {
"air_temp": {
"values": [
82.8,
82.8,
82.8,
82.8,
82.8,
82.8,
@btroia
btroia / gist:bb3002a9d26750c2602b
Created Nov 13, 2015
Sample Basis Activity Data Response in JSON format
View gist:bb3002a9d26750c2602b
{
"content": {
"activities": [
{
"heart_rate": {
"max": null,
"avg": null,
"min": null
},
"start_time": {
View sleep-analysis.py
import json
import datetime as dt
from pprint import pprint
# change this to the JSON file you want to analyze
json_data = open('data/basis-data-2014-09-15-sleep.json')
data = json.load(json_data)
json_data.close()
@btroia
btroia / gist:df1e6454f296ba6173b2
Created Mar 10, 2015
mongoexport that will dump Basis sleep data from MongoDB normalized collection into a .csv for import into Excel
View gist:df1e6454f296ba6173b2
mongoexport \
--collection sleepexport --type=csv --fields _id,start_time,offset,light_minutes,rem_minutes,deep_minutes,interruption_minutes,unknown_minutes \
--out mysleepdata.csv --db mydb
@btroia
btroia / gist:48368b0ab2b260559bf4
Created Mar 10, 2015
MongoDB aggregation query that returns summarized Basis sleep data for each day
View gist:48368b0ab2b260559bf4
db.sleeps.aggregate( [
{ $unwind : "$content.activities" },
{ $project :
{
"content.activities.date" : 1 ,
"content.activities.sleep" : 1,
"content.activities.start_time" : 1
}
},
{ "$group": {
@btroia
btroia / basis-sleep-mongodb-import.py
Created Mar 10, 2015
Script that processes a directory of Basis sleep data in JSON format (one file per day) and inserts records into a MongoDB collection
View basis-sleep-mongodb-import.py
from __future__ import print_function
import pymongo
import glob
import os
import json
# Define mongoDB database and collection to store sleep data
db_name = "mydb"
collection_name = "mysleeps"
@btroia
btroia / gist:31d54b9785bb0750e8d0
Created Mar 10, 2015
Sample Basis Sleep Data Response in JSON format
View gist:31d54b9785bb0750e8d0
{
"content": {
"activities": [
{
"heart_rate": {
"max": null,
"avg": 47.91773778920309,
"min": null
},
"start_time": {
You can’t perform that action at this time.