Skip to content

Instantly share code, notes, and snippets.

View scottleibrand's full-sized avatar

Scott Leibrand scottleibrand

View GitHub Profile
{
"basal": 0.9,
"carbratio": 10,
"carbs_hr": 30,
"dia": 3,
"sens": 40
}
@scottleibrand
scottleibrand / output.md
Last active August 29, 2015 14:10
523 latest
find records since 2014-11-28T15:58:01
response: ReadHistoryData:size[1024]:[page][0]:data[1024]:
hexdump:
```python
0000   0x07 0x00 0x00 0x07 0x5e 0xba 0x8e 0x00    ....^...
0008   0x00 0x00 0x6e 0xba 0x8e 0x05 0x00 0x00    ..n.....
0010   0x00 0x00 0x00 0x00 0x00 0x07 0x5e 0x03    ......^.
0018   0x8a 0x30 0x03 0xd4 0x34 0x00 0x00 0x00    .0..4...
0020 0x00 0x00 0x00 0x00 0x00 0x03 0xd4 0x00 ........
[
{
"date": 1416967408000.0,
"timestamp": "2014-11-25T18:03:28",
"_type": "TempBasalDuration",
"duration (min)": 0,
"_description": "TempBasalDuration 2014-11-25T18:03:28 head[2], body[0] op[0x16]"
},
{
"_type": "BasalProfileStart",
@scottleibrand
scottleibrand / install.sh
Last active August 29, 2015 14:20 — forked from bewest/install.sh
#!/bin/bash
git clone -b bewest/dev https://github.com/bewest/decoding-carelink.git
git clone https://github.com/bewest/dexcom_reader.git
git clone https://github.com/openaps/openaps.git
(cd decoding-carelink
sudo python setup.py develop
)
diff --git a/env.js b/env.js
index c063c22..9e2c0eb 100644
--- a/env.js
+++ b/env.js
@@ -43,6 +43,7 @@ function config ( ) {
env.treatments_collection = readENV('MONGO_TREATMENTS_COLLECTION', 'treatments');
env.profile_collection = readENV('MONGO_PROFILE_COLLECTION', 'profile');
env.devicestatus_collection = readENV('MONGO_DEVICESTATUS_COLLECTION', 'devicestatus');
+ env.pumphistory_collection = readENV('MONGO_PUMPHISTORY_COLLECTION', 'pump');
@scottleibrand
scottleibrand / gist:da84b4bf799592d19214
Created October 18, 2015 21:41
required non-zero non-null fields in output of decocare commands
read_bg_targets: units, targets: { high, low }
read_carb_ratios: units: "grams", schedule: { ratio }
read_insulin_sensitivies: action_type, sensitivities: { sensitivity }
read_selected_basal_profile: { rate }
read_settings: maxBasal, insulin_action_curve
read_temp_basal: temp

#Proposed oref0 Meal Assist algorithm

Currently the oref0 OpenAPS implementation is designed to completely ignore carbs, on the assumption that carb entry will not be reliable, either in frequency or accuracy. However, when carb information is available from Bolus Wizard entries or from Nightscout, it seems we can do better than that, by using carb information as just one signal to decide whether it's safe to high-temp when the oref0 bolus snooze algorithm would otherwise choose to do nothing (and require the user to manually administer the remainder of their meal bolus as needed.

Below are some design goals and a proposed algorithm that should accomplish this. Feedback welcome!

#Design goals:

  • Assist with partial meal boluses if user enters carb amount
  • High-temp early but safely while BG is still rising
  • Do not require any assumptions about carb absorption profile
@scottleibrand
scottleibrand / advanced-meal-assist.json
Created March 23, 2016 19:18
Example of openaps devices, reports, and aliases you'll need to modify to run the advanced-meal-assist branch of oref0.
[
{
"extra": {
"fields": "pumphistory profile clock carbs glucose basal",
"cmd": "oref0",
"args": "meal"
},
"type": "device",
"name": "meal",
"meal": {
@scottleibrand
scottleibrand / meal-assist-setup.sh
Last active April 18, 2016 02:09
Meal Assist Setup
cd && test -d src/oref0 && cd src/oref0 && git pull && git checkout dev && git pull
npm install && sudo npm install -g && sudo npm link && sudo npm link oref0
openaps device add meal process --require "pumphistory profile clock" oref0 meal
openaps device remove get-profile
openaps device add get-profile process --require "settings bg_targets isf basal_profile max_iob carb_ratios" oref0 get-profile
openaps device remove determine-basal
openaps device add determine-basal process --require "iob temp_basal glucose profile offline meal" oref0 determine-basal
openaps report add monitor/meal.json text meal shell monitor/pumphistory-zoned.json settings/profile.json monitor/clock-zoned.json
openaps report remove settings/carb_ratios.json
openaps report add settings/carb_ratios.json JSON pump read_carb_ratios
@scottleibrand
scottleibrand / pumpprofile-1u-50-10.json
Created August 13, 2018 21:31
Generic autotune pumpprofile.json
{
"carb_ratios": {
"schedule": [
{
"x": 0,
"i": 0,
"offset": 0,
"ratio": 10,
"r": 10,
"start": "00:00:00"