Skip to content

Instantly share code, notes, and snippets.

@bewest
bewest / README.md
Last active October 18, 2018 17:51
community, MDR, FDA oversight

Community and MDR

The FDA enforces science and data driven standards to promote and protect public health and safety. One of the ways they perform their job is by providing oversight of all products available to the public. One way they acheive "oversight" is through "post market surveillance," in other words monitoring how devices perform, with a special focus on potential or actual harms or injuries. In other words, FDA is deeply committed to the idea that "vendors" who create a device should know and report performance, safety and effectiveness data even when a vendor ceases to make or sell a device.

https://www.fda.gov/downloads/medicaldevices/deviceregulationandguidance/guidancedocuments/ucm359566.pdf

@bewest
bewest / README.md
Created July 29, 2018 18:02
Getting one day data out of Nightscout

Get one day data out of Nightscout

Here's how to get one day of data out of Nightscout. The trick is in realizing that the field used to define the date is different between different data types, and that different data types are stored in different places. In addition, the API itself has interesting behaviors, for example to switch between tsv, csv, and json outputs, to perform regex based searches, and in some cases bugs to work around.

Mechanics of the search syntax. The API endpoints support a query string syntax used to compose queries.

@bewest
bewest / oh.js
Last active August 27, 2016 18:46
proof of concept, gets data from Nightscout, sends it to OpenHumans
/*
openhumans upload API
TOKEN=example_token
URL=http://www.openhumans.org/api/project/upload/?access_token=$TOKEN
METADATA='{"tags": ["survey", "diet", "csv"], "description": "Diet survey questions and responses", "md5": "156da7fc980988c51682374436849943"}'
http --verbose --form POST $URL \
2016-08-24T22:22:01-07:00,1472102521000,171,SingleUp,openaps://cgm
2016-08-24T22:17:01-07:00,1472102221000,159,FortyFiveUp,openaps://cgm
2016-08-24T22:12:01-07:00,1472101921000,147,FortyFiveUp,openaps://cgm
2016-08-24T22:07:02-07:00,1472101622000,145,FortyFiveUp,openaps://cgm
2016-08-24T22:02:01-07:00,1472101321000,140,FortyFiveUp,openaps://cgm
2016-08-24T21:57:01-07:00,1472101021000,131,FortyFiveUp,openaps://cgm
2016-08-24T21:52:01-07:00,1472100721000,124,Flat,openaps://cgm
2016-08-24T21:47:01-07:00,1472100421000,119,Flat,openaps://cgm
2016-08-24T21:42:01-07:00,1472100121000,118,Flat,openaps://cgm
2016-08-24T21:37:01-07:00,1472099821000,116,Flat,openaps://cgm
@bewest
bewest / new-defaults.json
Created August 7, 2016 21:54
nightscout defaults experiment
{
"units": "mg/dL",
"timeFormat": 12,
"nightMode": false,
"editMode": true,
"showRawbg": "always",
"customTitle": "Nightscout",
"theme": "default",
"alarmUrgentHigh": false,
"alarmUrgentHighMins": [
@bewest
bewest / README.md
Created July 10, 2016 22:06
prepping data by rewinding history

rewind history, extracting data and observations for openai

 2315  ./mk-time-series monitor/glucose.json | tee mega-log-glucose.json
 2316  head mega-log-glucose.json 
 2327  cat mega-log-glucose.json | json -a hash
 2328  cat mega-log-glucose.json | json -a hash | wc -l
@bewest
bewest / new-predict-reports.json
Created July 10, 2016 06:38
reports with loudnates stuff set up
[
{
"type": "alias",
"name": "rm-warmup",
"rm-warmup": {
"command": "! bash -c \"rm -f model.json monitor/clock.json > /dev/null\""
}
},
{
"type": "alias",
@bewest
bewest / diabetes.py
Created July 10, 2016 01:32
openai gym environment
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from openapscontrib.predict import predict
class DiabetesEnv(gym.Env):
metadata = {
{"type": "alias", "preflight": {"command": "! bash -c \"(echo PREFLIGHT ) && openaps mmtune && openaps warmup 2>&1 >/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || openaps fail-warmup\""}, "name": "preflight"}
@bewest
bewest / mk-time-series
Last active June 18, 2016 22:49
mk-time-series from openaps git logs
#!/bin/bash
# oref0-predict/oref0.json
INPUT=$1
TEST_EXEC="if (Array.isArray(this)) { process.exit(1); }"
git log \
--format="format:%h %aI %s" \
-n 100 --follow -- $INPUT \
| while read hash iso subject ; do
spec=$hash:$INPUT