This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metrics": { | |
| "air_temp": { | |
| "values": [ | |
| 82.8, | |
| 82.8, | |
| 82.8, | |
| 82.8, | |
| 82.8, | |
| 82.8, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "content": { | |
| "activities": [ | |
| { | |
| "heart_rate": { | |
| "max": null, | |
| "avg": null, | |
| "min": null | |
| }, | |
| "start_time": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.sleeps.aggregate( [ | |
| { $unwind : "$content.activities" }, | |
| { $project : | |
| { | |
| "content.activities.date" : 1 , | |
| "content.activities.sleep" : 1, | |
| "content.activities.start_time" : 1 | |
| } | |
| }, | |
| { "$group": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "content": { | |
| "activities": [ | |
| { | |
| "heart_rate": { | |
| "max": null, | |
| "avg": 47.91773778920309, | |
| "min": null | |
| }, | |
| "start_time": { |