Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for dev to master in prep for 0.5.0 release #424

Merged
merged 891 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
891 commits
Select commit Hold shift + click to select a range
3f8e3db
Merge branch 'autosens-site-change' into floating-carbs
scottleibrand Apr 27, 2017
79f36f3
only do padding in autosens mode, not COB calc mode
scottleibrand Apr 27, 2017
23e908a
Merge branch 'autosens-site-change' into floating-carbs
scottleibrand Apr 27, 2017
e5dbef4
cap all minPredBGs at 39 to avoid biasing averages
scottleibrand Apr 27, 2017
721853e
differentiate autosens adjustments from adjust_targets_when_high ones
scottleibrand Apr 28, 2017
1ee9533
Merge branch 'adj-target-when-high' into floating-carbs
scottleibrand Apr 28, 2017
f186f88
allow temp rate within 0.025U/hr for decocare floating point math
scottleibrand Apr 28, 2017
c05097c
profile.adjust_targets_when_high renamed to adv_target_adjustments
scottleibrand Apr 28, 2017
5883356
log when not Adjusting targets for high BG
scottleibrand Apr 28, 2017
2e9d7fd
Merge branch 'adj-target-when-high' into floating-carbs
scottleibrand Apr 28, 2017
7b3bdbe
whitespace
scottleibrand Apr 28, 2017
f7d4a02
Merge branch 'adj-target-when-high' into floating-carbs
scottleibrand Apr 28, 2017
c7feaa4
without COB, use max of minIOBPredBG,minUAMPredBG
scottleibrand Apr 29, 2017
3433fdb
if carb_ratio is null buy we have a valid carb_ratios object, use that
scottleibrand Apr 29, 2017
692cf06
move carb_ratio null check to oref0-autotune-prep.js
scottleibrand Apr 29, 2017
fcbc7ab
variable name
scottleibrand Apr 29, 2017
35d506e
if carb_ratio is null buy we have a valid carb_ratios object, use that
scottleibrand Apr 29, 2017
687edb8
if carb_ratio is null buy we have a valid carb_ratios object, use that
scottleibrand Apr 29, 2017
1dec29d
Merge branch 'carb_ratio_null' into floating-carbs
scottleibrand Apr 29, 2017
54c9b73
if profile.json contains null carb_ratio use profile.pump.json
scottleibrand Apr 29, 2017
ace6639
Merge branch 'carb_ratio_null' of github.com:openaps/oref0 into carb_…
scottleibrand Apr 29, 2017
1d31ee7
Revert "if carb_ratio is null buy we have a valid carb_ratios object,…
scottleibrand Apr 29, 2017
a008358
Revert "if carb_ratio is null buy we have a valid carb_ratios object,…
scottleibrand Apr 29, 2017
873709c
Merge branch 'carb_ratio_null' into floating-carbs
scottleibrand Apr 29, 2017
90f9aa1
check for carb_ratio==null if oref0-autotune-core fails
scottleibrand Apr 29, 2017
9f3f0d0
Merge branch 'carb_ratio_null' into floating-carbs
scottleibrand Apr 29, 2017
8569ed0
don't do lastSiteChange stuff for oref0-meal
scottleibrand Apr 29, 2017
f2ba220
wait for a full 30s silence before mmtuning
scottleibrand Apr 29, 2017
6171582
grammar
scottleibrand Apr 29, 2017
0562440
wait for a full 30s silence before mmtuning
scottleibrand Apr 29, 2017
2c887f3
Reset autosens on site change (#451)
scottleibrand Apr 29, 2017
2c512ee
fix logic to do cgm-loop stuff for g4-upload, not g4-local (#449)
scottleibrand Apr 29, 2017
ea03e7f
Merge branch 'dev' into floating-carbs
scottleibrand Apr 29, 2017
3f79421
adv_target_adjustments comment
scottleibrand Apr 29, 2017
c343094
allow setting of adjustmentFraction via preferences.json
scottleibrand Apr 29, 2017
b0f8ed0
add remainingCarbsCap to preferences.json, defaulting to zero
scottleibrand Apr 30, 2017
8c6b9c5
always run mocha in color mode
scottleibrand Apr 30, 2017
9612e7b
don't set snoozeBG if minPredBG >= 400
scottleibrand Apr 30, 2017
23147b2
fix some tests; disable others
scottleibrand Apr 30, 2017
9272ded
Adjust target when high (#441)
scottleibrand May 1, 2017
3fa06fb
Merge branch 'dev' into floating-carbs
scottleibrand May 1, 2017
0c0cbf2
use average of naive_eventualBG and minIOBPredBG to calculate worstCa…
scottleibrand May 1, 2017
7134baf
autotune carb_ratio null check (#450)
scottleibrand May 1, 2017
b871eee
only mmtune 20% of the time now that we're waiting longer
scottleibrand May 1, 2017
bac0fed
set zero temps long enough to eventually correct back up to target
scottleibrand May 1, 2017
1e803f3
grammar
scottleibrand May 1, 2017
bb0e8b2
increase default min_5m_carbimpact to help avoid overestimating COB
scottleibrand May 1, 2017
332c2c2
increase default min_5m_carbimpact to help avoid overestimating COB
scottleibrand May 1, 2017
fbdbc53
grammar
scottleibrand May 1, 2017
0fc8151
workaround for hanging rig-pump communication (with WW pump) (#445)
PieterGit May 1, 2017
4b6e031
initial notification daemon
PieterGit May 1, 2017
4ceb4e4
Merge remote-tracking branch 'refs/remotes/openaps/dev' into notify
PieterGit May 1, 2017
3858b43
support 515/715 for SMB as well
scottleibrand May 1, 2017
53c47f3
support 515/715 for SMB as well
scottleibrand May 1, 2017
da3af29
use lower of minUAMPredBG or avgPredBG instead of avgMinPredBG in mix…
scottleibrand May 2, 2017
a08db28
Merge branch 'pushover' into uam-cob
scottleibrand May 2, 2017
9dd6bac
add minPredBG to reason field
scottleibrand May 2, 2017
87f5a96
grammar
scottleibrand May 2, 2017
5df106a
use higher of minIOBPredBG, minUAMPredBG
scottleibrand May 2, 2017
25bdf0a
if we have COB, use max(minCOBPredBG,blendedMinPredBG), or avgPredBG …
scottleibrand May 2, 2017
c0903b8
grammar
scottleibrand May 2, 2017
a9cc306
grammar
scottleibrand May 2, 2017
9fddb76
grammar
scottleibrand May 2, 2017
c5d2edf
ordering
scottleibrand May 2, 2017
d4a2dc1
fix --ww_ti_usb_reset=yes again
PieterGit May 2, 2017
1904759
define IOBpredBG to make tests happier
scottleibrand May 2, 2017
1d68e85
improve CGM information line
PieterGit May 2, 2017
0c01ac0
default IOBpredBG to eventualBG for tests
scottleibrand May 2, 2017
b9a547f
comment out overly prescriptive text regex checks
scottleibrand May 2, 2017
d64ee28
use echo -e to show newlines
PieterGit May 2, 2017
42c104f
more CGM line improvements
PieterGit May 2, 2017
97c3f22
add missing then
PieterGit May 2, 2017
59ee7f8
small fixes
PieterGit May 2, 2017
143879f
Floating carbs / UAM (#452)
scottleibrand May 3, 2017
93c241a
calcualte and display carbsReq
scottleibrand May 3, 2017
15c1943
debug and fix carbsReq calculation
scottleibrand May 3, 2017
3f15567
grammar
scottleibrand May 3, 2017
0df5332
grammar
scottleibrand May 3, 2017
1962a56
grammar
scottleibrand May 3, 2017
9f4a4c4
use only naive_eventualBG to avoid overreacting to downticks
scottleibrand May 4, 2017
d2a61e6
grammar
scottleibrand May 4, 2017
40f929a
grammar
scottleibrand May 4, 2017
8e80ce3
add maxBolus to reason when it's active
scottleibrand May 4, 2017
8560ac0
populate rT.carbsReq too
scottleibrand May 4, 2017
dc4d1a7
script to send pushover alerts for carbsReq/insulinReq (w/ maxBolus)
scottleibrand May 4, 2017
9f6bde2
usage
scottleibrand May 4, 2017
43ceac2
syntax
scottleibrand May 4, 2017
653b66c
exit
scottleibrand May 4, 2017
0662cd6
syntax, and output when no action required
scottleibrand May 4, 2017
b9da7b1
add oref0-pushover
scottleibrand May 4, 2017
5ed4ce2
don't use old suggested.json files
scottleibrand May 4, 2017
c65b8a1
debugging
scottleibrand May 4, 2017
b371449
debugging
scottleibrand May 4, 2017
5b3eac9
print date for logs
scottleibrand May 4, 2017
6f9a493
add pushover to oref0-setup
scottleibrand May 4, 2017
e72cb6c
cd $directory
scottleibrand May 4, 2017
ed7ea10
carbsReq for low glucose suspend mode
scottleibrand May 4, 2017
b7bbaa0
don't display Eventual BG 68 >= 80 in SMB mode
scottleibrand May 4, 2017
6b90fb9
fix maxBolus check
scottleibrand May 4, 2017
94ecbe6
compare maxBolus to microBolus, not insulinReq
scottleibrand May 4, 2017
f9a2946
move add'l carbs req up before first return
scottleibrand May 5, 2017
5b86694
remove second now-duplicate carbsReq stanza
scottleibrand May 5, 2017
5ab3392
clarify action = temp, not SMB
scottleibrand May 5, 2017
ca12616
round maxBolus
scottleibrand May 5, 2017
1c4e750
Merge remote-tracking branch 'refs/remotes/openaps/dev' into notify
PieterGit May 5, 2017
b43cb50
Update oref0-setup.sh (#457)
tim2000s May 5, 2017
87f5d6a
only recommend carbsReq if really needed
scottleibrand May 6, 2017
b784964
add hostname to message
scottleibrand May 6, 2017
376d1b4
enact long temps even if a > 20m one is running
scottleibrand May 6, 2017
ecc7b84
don't mmtune if Pump suspended
scottleibrand May 6, 2017
64a801e
logic is hard
scottleibrand May 6, 2017
bc5178e
only pushover for microBolus >= maxBolus
scottleibrand May 6, 2017
92b29e8
actually set durationReq m zero temp.
scottleibrand May 6, 2017
4dfe1cd
Merge remote-tracking branch 'refs/remotes/openaps/dev' into notify
PieterGit May 6, 2017
639aa56
fix out of the box working of cli commands with Nightscout interactions
PieterGit May 6, 2017
fc8e1f7
re-check pump status if suspended
scottleibrand May 7, 2017
89fff77
Blend UAM and COB properly (#455)
scottleibrand May 7, 2017
905bcc1
Merge branch 'dev' into pushover
scottleibrand May 7, 2017
54008c9
Merge remote-tracking branch 'refs/remotes/openaps/dev' into notify
PieterGit May 7, 2017
f656a6a
don't set 0-minute temps (cancels)
scottleibrand May 8, 2017
5bafc3a
a zero temp request gets misinterpreted as 1270m - don't allow that
scottleibrand May 8, 2017
964fbc7
oref0-set-system-clock for smb_enact_temp too
scottleibrand May 8, 2017
24b5dc9
Merge branch 'set-system-clock' into pushover
scottleibrand May 8, 2017
573299e
move "incorrectly" check to smb_verify_suggested above deliverAt check
scottleibrand May 8, 2017
41c6dec
Merge branch 'set-system-clock' into pushover
scottleibrand May 8, 2017
b856920
that's smb-suggested.json
scottleibrand May 8, 2017
42407f0
update tests to allow >30m temps
scottleibrand May 8, 2017
fe54440
Set system clock if "clock set incorrectly" (#460)
scottleibrand May 9, 2017
5f9f738
Adding more aliases (#463)
Kdisimone May 12, 2017
139e794
disconnect any previous connection attempts before connecting
scottleibrand May 13, 2017
656c323
disable networking restart dhclient kill to see if that's more stable
scottleibrand May 13, 2017
c2da25a
deal with icanhazip.com proxy format (172.19.131.138, 10.36.65.138,12…
scottleibrand May 14, 2017
a64f878
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit May 15, 2017
b3affb6
upgrade bluez from 5.44 to 5.45
PieterGit May 15, 2017
46e53e3
don't print minCOBPredBG or minUAMPredBG if they're 999
scottleibrand May 16, 2017
002a122
only microbolus if 0.1U SMB represents 20m or less of basal (0.3U/hr …
scottleibrand May 16, 2017
ff75867
enable bolus snooze when COB will eventually get BG above target
scottleibrand May 16, 2017
2dbbc4a
if no microBolus required, and lastCOBpredBG > target_bg, don't set a…
scottleibrand May 16, 2017
0da35d6
if no microBolus required, snoozeBG > target_bg, and lastCOBpredBG > …
scottleibrand May 16, 2017
ea1d66f
inital commit of token based authentication
PieterGit May 16, 2017
148668f
add ns-get.sh change
PieterGit May 16, 2017
173e83d
one missing parentheses is enought to break the script
PieterGit May 16, 2017
9a16cc0
add python3-pip package
PieterGit May 16, 2017
29a27f3
add .py extension
PieterGit May 16, 2017
0658338
print wlan0 SSID properly
scottleibrand May 17, 2017
a334af4
renew wlan0 IP if wifi is connected w/o an IP
scottleibrand May 17, 2017
3847107
don't print SSID when checking it
scottleibrand May 17, 2017
25b8b59
comment
scottleibrand May 17, 2017
3411d69
allow high temps or SMBs when bg < threshold if IOB is highly negative
scottleibrand May 17, 2017
48a114c
if pump clock is more than 1m off, attempt to reset it
scottleibrand May 17, 2017
a666d0f
don't renew wlan0 if it has no SSID
scottleibrand May 17, 2017
afd4b67
sleep 120 after releasing wifi IP
scottleibrand May 17, 2017
feb673b
update tests
scottleibrand May 17, 2017
4ee4ec8
newline
scottleibrand May 17, 2017
236749b
install jq with SMB to fix #469
scottleibrand May 17, 2017
119a99b
Add MDT Enlite CGM support to oref0-pump-loop for SMB (#462)
scottleibrand May 17, 2017
c709613
add implementation stuff
PieterGit May 18, 2017
cfe4a9e
first working proxy get result for openaps latest-ns-treatment-time
PieterGit May 18, 2017
84703a3
capture stderr too
scottleibrand May 19, 2017
ab05f97
regex update; if we still can't get online, try cycling networking as…
scottleibrand May 19, 2017
ee04900
adding 554 and 754 pump models (#473)
Kdisimone May 19, 2017
bed90db
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit May 19, 2017
80ccba2
revert most of the changes of nightscout.sh
PieterGit May 19, 2017
b0068ef
make reports for last 6h
PieterGit May 19, 2017
58b3456
fix issue in report.json and log to stdout by default
PieterGit May 19, 2017
d61a8c2
Merge remote-tracking branch 'refs/remotes/openaps/pushover' into 201…
PieterGit May 19, 2017
df10a2d
remove ns-upload --config, add token authentication to ns-get and ns-…
PieterGit May 19, 2017
dd06e80
add token authentication support to ns-upload-entries.sh
PieterGit May 19, 2017
5831ded
note re: using dir name other than myopenaps (#471)
Kdisimone May 20, 2017
76ff214
Pushover support for carbsReq and insulinReq notifications (#458)
scottleibrand May 21, 2017
b3bfe9a
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit May 21, 2017
647a35f
Fix low glucose suspend (#476)
scottleibrand May 23, 2017
53b5854
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit May 23, 2017
b86a52b
remove uneeded files for nightscout token authentication, and remove …
PieterGit May 23, 2017
d6bbf86
remove oref0_check_nightscout from oref0-setup
PieterGit May 23, 2017
7cce6c5
store API_SECRET and NIGHTSCOUT_HOST to .bash_profile (once) and supp…
PieterGit May 23, 2017
133d1d1
add some documentation on shell preferences
PieterGit May 23, 2017
181a3c7
see if oref0_init_pump_comms.py does what it should
PieterGit May 23, 2017
c619fd0
Remove call to ns-get-token in ns-get. Not needed.
PieterGit May 24, 2017
dcb08e7
restore cp of newprofile (#484)
tynbendad May 31, 2017
1cb069d
Re-working oref0-setup.sh (#486)
danamlewis Jun 1, 2017
d691fe0
remainingCarbsFraction into dev (#489)
danamlewis Jun 1, 2017
ac54d66
improvements to the pump loop
PieterGit Jun 1, 2017
d4465af
Merge branch 'dev' into 201705_fixes
PieterGit Jun 1, 2017
164cedd
Fix for MDT Divide by Zero Error (#478)
Bender1061 Jun 2, 2017
738b8f1
fix merging oref0-setup.sh
PieterGit Jun 2, 2017
5d8865a
remove extra ;;, change azurewebsites.net to herokuapp.com
PieterGit Jun 2, 2017
ad5a222
remove maybe_mmtune if pump is not suspended
PieterGit Jun 2, 2017
70a215a
add oref0_nightscout_check to see if nightscout permissions are ok
PieterGit Jun 3, 2017
1b8638f
fix typo in API_HASHED_SECRET
PieterGit Jun 3, 2017
fbe032f
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit Jun 3, 2017
317ceb9
move oref0-log-shortcuts a bit up to make sure that ~/.bash_profile e…
PieterGit Jun 3, 2017
b7937a7
fix merge error, delete API_SECRET and NIGHTSCOUT_HOST from ~/.profil…
PieterGit Jun 3, 2017
7c515a4
set neutral temp when snoozeBG > target_bg, and lastCOBpredBG > targe…
scottleibrand Jun 5, 2017
7d38f76
Merge branch 'refs/heads/master' into 201705_fixes
PieterGit Jun 5, 2017
72e7e9f
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit Jun 5, 2017
ce4e650
Adding a check for existing autotune folder. If it does not exist, wa…
danamlewis Jun 7, 2017
c3a1cf2
Add check so this only shows if microbolus is enabled (+ spacing/form…
danamlewis Jun 7, 2017
ac79451
Fixing radio reboots that happen in oref0-setup.sh
danamlewis Jun 7, 2017
b073f66
Merge pull request #491 from openaps/autotune-check
scottleibrand Jun 9, 2017
8a66092
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit Jun 9, 2017
bca160f
fix maybe_mmtune
PieterGit Jun 9, 2017
9a6493d
consistent grep -q'ing
PieterGit Jun 9, 2017
19f11f2
fix typo in string
PieterGit Jun 9, 2017
59cf4b3
proper indents
PieterGit Jun 10, 2017
be5ff14
fixed maybe_mmtune and add quotes around strings
PieterGit Jun 10, 2017
e08bcda
add full path to .bash_profile
PieterGit Jun 10, 2017
0bd350a
add bin/__pycache__ to .gitignore
PieterGit Jun 10, 2017
eea59a1
rewrite RANDOM line in maybe_mmtune
PieterGit Jun 10, 2017
68bcc25
Smarter carbsReq (#494)
scottleibrand Jun 18, 2017
305dc60
Change icanhazip.com to checkip.amazonaws.com (#497)
jonahtaxt Jun 20, 2017
786f7ee
mmtune alias fix (#498)
Kdisimone Jun 20, 2017
3a769d0
Mraa fix for dev (#505)
PieterGit Jun 24, 2017
b058ebf
remove unneccessary ~ that looks like a -
scottleibrand Jun 25, 2017
9183670
reduce debugging slightly
scottleibrand Jun 26, 2017
d610222
reduce debugging slightly
scottleibrand Jun 26, 2017
0290c95
use mraa master on oref0 dev branch (#507)
PieterGit Jun 28, 2017
bb85801
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit Jun 28, 2017
185492e
Merge remote-tracking branch 'refs/remotes/openaps/dev' into 201705_f…
PieterGit Jun 28, 2017
3a18e2b
temporay re-add the until loop
PieterGit Jun 28, 2017
2fb0fb2
unsuspend pump automatically if temp basal duration is zero (#496)
scottleibrand Jun 29, 2017
0437b4f
check pump clock after pumphistory to alleviate #477 race condition (…
scottleibrand Jun 29, 2017
4939b9f
Merge branch '201705_fixes' of https://github.com/PieterGit/oref0 int…
scottleibrand Jul 1, 2017
2a86667
re-add maybe_mmtune if not suspended
scottleibrand Jul 1, 2017
70a900a
Merge branch 'PieterGit-201705_fixes' into dev
scottleibrand Jul 1, 2017
f223b9e
remove end-of-line whitespace
scottleibrand Jul 1, 2017
729eb80
fix broken non-token-auth ns-uploads
scottleibrand Jul 2, 2017
fecb087
you can't let an expired temp run
scottleibrand Jul 2, 2017
b1eb2df
Merge branch 'dev' of github.com:openaps/oref0 into dev
scottleibrand Jul 2, 2017
9fff312
Safety gate oref1 stuff in oref0-setup (#516)
scottleibrand Jul 3, 2017
1d87676
per #419, ignore bolus wizard carb entries without a bolus (#512)
scottleibrand Jul 3, 2017
05a6190
merge_pumphistory to fix zombie carbs (#513)
scottleibrand Jul 3, 2017
5d3cb6b
Update default preferences (#515)
scottleibrand Jul 3, 2017
4ba5e90
Add MDT to pump-loop.sh (#514)
Bender1061 Jul 3, 2017
028001b
log autosens ratio in pump-loop.log; better rounding (#519)
scottleibrand Jul 3, 2017
69a4882
treat max_iob as string to support fp (#517)
tynbendad Jul 4, 2017
640552f
Fix color and spacing around token auth in setup script (#520)
danamlewis Jul 4, 2017
ff901fc
find last BG from before a meal, and interpolate any gaps (#518)
scottleibrand Jul 4, 2017
13e8101
mmtune 25% of the time; remove unless() loop (#523)
scottleibrand Jul 5, 2017
b03dfbf
Update oref0-pump-loop.sh (#525)
Bender1061 Jul 6, 2017
0f3abe0
switch back to latest stable mraa release for oref0 release to master…
scottleibrand Jul 6, 2017
f5d071d
upload carb-only bolus wizard entries to NS again (#526)
scottleibrand Jul 9, 2017
d154d64
only pull 2h of pumphistory now that we merge it with pumphistory-24h…
scottleibrand Jul 9, 2017
b9e713b
Fix ns-meal-carbs argument order (#532)
scottleibrand Jul 9, 2017
7690b51
oref0-setup tweaks (#536)
scottleibrand Jul 11, 2017
6050c24
switch non-SMB users over to oref0-pump-loop (#537)
scottleibrand Jul 11, 2017
647cf40
various oref0-pump-loop fixes affecting COB calculation (#540)
scottleibrand Jul 11, 2017
4719c41
don't use profile.target_bg, just min_bg and max_bg (#541)
scottleibrand Jul 12, 2017
ace821f
Fix unsuspend (#542)
scottleibrand Jul 12, 2017
02418ac
Merge branch 'master' into dev
scottleibrand Jul 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ static/bower_components/
coverage/

npm-debug.log
bin/__pycache__
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all: test
report:
# report results to community
test:
./node_modules/.bin/mocha ${TESTS}
./node_modules/.bin/mocha -c ${TESTS}

travis:
${ISTANBUL} cover ${MOCHA} --include-all-sources true --report lcovonly -- -R tap ${TESTS}
Expand Down
9 changes: 4 additions & 5 deletions bin/mm-format-ns-pump-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ OUTPUT=${2-/dev/fd/1}
#TZ=${3-$(date +%z)}

cat $HISTORY | \
json -e "this.medtronic = this._type;" | \
#json -e "this.dateString = this.timestamp + '$(TZ=TZ date +%z)'" | \
json -e "this.dateString = this.timestamp + '$(date +%z)'" | \
json -e "this.type = 'medtronic'" | \
json -e "this.date = this.date ? this.date : new Date(Date.parse(this.dateString)).getTime( )" \
json -e "this.medtronic = this._type;" \
-e "this.dateString = this.timestamp + '$(date +%z)'" \
-e "this.type = 'medtronic'" \
-e "this.date = this.date ? this.date : new Date(Date.parse(this.dateString)).getTime( )" \
> $OUTPUT


15 changes: 7 additions & 8 deletions bin/mm-format-ns-treatments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ model=$(json -f $MODEL)

oref0-normalize-temps $HISTORY \
| json -e "this.medtronic = 'mm://openaps/$self/' + (this._type || this.eventType);" \
| json -e "this.created_at = this.created_at ? this.created_at : this.timestamp" \
| json -e "this.enteredBy = 'openaps://medtronic/$model'" \
| json -e "if (this.glucose && !this.glucoseType && this.glucose > 0) { this.glucoseType = this.enteredBy }" \
| json -e "this.eventType = (this.eventType ? this.eventType : 'Note')" \
| json -e "if (this._type == 'AlarmSensor' && this.alarm_description) {this.notes = this.alarm_description}" \
| json -e "if (this.eventType == 'Note' && !this.alarm_description) { this.notes = this._type + ' $model ' + (this.notes ? this.notes : '')}" \
| json > $OUTPUT

-e "this.created_at = this.created_at ? this.created_at : this.timestamp" \
-e "this.enteredBy = 'openaps://medtronic/$model'" \
-e "if (this.glucose && !this.glucoseType && this.glucose > 0) { this.glucoseType = this.enteredBy }" \
-e "this.eventType = (this.eventType ? this.eventType : 'Note')" \
-e "if (this._type == 'AlarmSensor' && this.alarm_description) {this.notes = this.alarm_description}" \
-e "if (this.eventType == 'Note' && !this.alarm_description) { this.notes = this._type + ' $model ' + (this.notes ? this.notes : '')}" \
> $OUTPUT

12 changes: 8 additions & 4 deletions bin/nightscout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ hash-api-secret)
autoconfigure-device-crud)
NIGHTSCOUT_HOST=$1
PLAIN_NS_SECRET=$2
API_SECRET=$($self hash-api-secret $2)
if [[ "${PLAIN_NS_SECRET,,}" =~ "token=" ]]; then
API_SECRET=$2 # store token as API_SECRET
else
API_SECRET=$($self hash-api-secret $2)
fi
case $1 in
help|-h|--help)
setup_help
Expand All @@ -331,8 +335,8 @@ autoconfigure-device-crud)
test -z "$API_SECRET" && setup_help && exit 1;
openaps device add ns process --require "oper" nightscout ns "NIGHTSCOUT_HOST" "API_SECRET"
openaps device show ns --json | json \
| json -e "this.extra.args = this.extra.args.replace(' NIGHTSCOUT_HOST ', ' $NIGHTSCOUT_HOST ')" \
| json -e "this.extra.args = this.extra.args.replace(' API_SECRET', ' $API_SECRET')" \
-e "this.extra.args = this.extra.args.replace(' NIGHTSCOUT_HOST ', ' $NIGHTSCOUT_HOST ')" \
-e "this.extra.args = this.extra.args.replace(' API_SECRET', ' $API_SECRET')" \
| openaps import
;;
cull-latest-openaps-treatments)
Expand All @@ -348,4 +352,4 @@ help|--help|-h)
*)
test -n "$COMMAND" && exec $COMMAND $*
;;
esac
esac
8 changes: 4 additions & 4 deletions bin/ns-dedupe-treatments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EOF
}

function fetch ( ) {
curl -s -g $ENDPOINT.json
curl --compressed -s -g $ENDPOINT.json
}

function flatten ( ) {
Expand All @@ -22,7 +22,7 @@ function flatten ( ) {
function find_dupes_on ( ) {
count=$1
date=$2
test $count -gt 1 && curl -g -s ${ENDPOINT}.json"?count=$(($count-1))&find[created_at]=$date"
test $count -gt 1 && curl --compressed -g -s ${ENDPOINT}.json"?count=$(($count-1))&find[created_at]=$date"
}
function debug_cmd ( ) {
tid=$1
Expand All @@ -45,8 +45,8 @@ export NIGHTSCOUT_HOST ENDPOINT
fetch | flatten | while read count date; do
test $count -gt 1 && echo "{}" \
| json -e "this.count = $count" \
| json -e "this.date = '$date'" \
| json -e "this.created_at = '$date'"
-e "this.date = '$date'" \
-e "this.created_at = '$date'"
done | json -g
}

Expand Down
43 changes: 24 additions & 19 deletions bin/ns-get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NIGHTSCOUT_HOST=${NIGHTSCOUT_HOST-${2-localhost:1337}}
QUERY=${3}
OUTPUT=${4-/dev/fd/1}

CURL_FLAGS="-g -s"
CURL_FLAGS="--compressed -g -s"
NIGHTSCOUT_FORMAT=${NIGHTSCOUT_FORMAT-json}
test "$NIGHTSCOUT_DEBUG" = "1" && CURL_FLAGS="${CURL_FLAGS} -iv"
test "$NIGHTSCOUT_DEBUG" = "1" && set -x
Expand All @@ -20,42 +20,47 @@ Usage: $self <entries.json> [NIGHTSCOUT_HOST|localhost:1337] [QUERY] [stdout|-]
$self type <entries.json> <NIGHTSCOUT_HOST|localhost:1337] [QUERY] [stdout|-]
$self host <NIGHTSCOUT_HOST|localhost:1337> <entries.json> [QUERY] [stdout|-]

$self --config <device> <entries.json> <NIGHTSCOUT_HOST> <monitor/entries.json>
EOF
}

REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${QUERY}
# use token authentication if the user has a token set in their API_SECRET environment variable
if [[ "${API_SECRET,,}" =~ "token=" ]]; then
if [[ -z ${QUERY} ]]; then
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${API_SECRET}
else
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${API_SECRET}'&'${QUERY}
fi
else
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${QUERY}
fi

case $1 in
--config)
test -z $2 && echo "Device name missing." && usage && exit 1;
devicename=${2-${self}}
test -z $3 && echo "Type is missing" && usage && exit 1;
# echo openaps device add $2 process $self $3
cat <<EOF
openaps device add $devicename process $self $3 $self-NIGHTSCOUT_HOST
sed -i -e "s/$self-NIGHTSCOUT_HOST/$4/g" $devicename.ini
openaps report add $5 text $devicename shell
EOF
exit 0;
;;
host)
# $self
NIGHTSCOUT_HOST=${NIGHTSCOUT_HOST-${2-localhost:1337}}
REPORT=${3-entries.json}
QUERY=${4}
OUTPUT=${5-/dev/fd/1}
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${QUERY}

# use token authentication if the user has a token set in their API_SECRET environment variable
if [[ "${API_SECRET,,}" =~ "token=" ]]; then
if [[ -z ${QUERY} ]]; then
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${API_SECRET}
else
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${API_SECRET}'&'${QUERY}
fi
else
REPORT_ENDPOINT=$NIGHTSCOUT_HOST/api/v1/${REPORT}'?'${QUERY}
fi
test -z "$NIGHTSCOUT_HOST" && usage && exit 1;

curl ${CURL_FLAGS} $REPORT_ENDPOINT | $NIGHTSCOUT_FORMAT

;;
type)
shift
exec $self $*
;;
--noop)
echo "curl -s $REPORT_ENDPOINT | json"
;;
help|--help|-h)
usage
;;
Expand Down
21 changes: 15 additions & 6 deletions bin/ns-upload-entries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
self=$(basename $0)
ENTRIES=${1-entries.json}
NIGHTSCOUT_HOST=${NIGHTSCOUT_HOST-localhost:1337}
#TZ=${3-$(date +%z)}
OUTPUT=${2}

function usage ( ) {
Expand All @@ -24,11 +23,21 @@ case "$1" in
esac

export ENTRIES API_SECRET NIGHTSCOUT_HOST

# use token authentication if the user has a token set in their API_SECRET environment variable
if [[ "${API_SECRET,,}" =~ "token=" ]]; then
API_SECRET_HEADER=""
REST_ENDPOINT="${NIGHTSCOUT_HOST}/api/v1/entries.json?${API_SECRET}"
else
REST_ENDPOINT="${NIGHTSCOUT_HOST}/api/v1/entries.json"
API_SECRET_HEADER='-H "API-SECRET: ${API_SECRET}"'
fi


# requires API_SECRET and NIGHTSCOUT_HOST to be set in calling environment (i.e. in crontab)
(
curl -m 30 -s -X POST --data-binary @$ENTRIES \
-H "API-SECRET: $API_SECRET" \
-H "content-type: application/json" \
$NIGHTSCOUT_HOST/api/v1/entries.json
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || logger "Unable to upload to $NIGHTSCOUT_HOST"
curl -m 30 -s -X POST --data-binary @${ENTRIES} \
${API_SECRET_HEADER} -H "content-type: application/json" \
${REST_ENDPOINT}
) && ( test -n "${OUTPUT}" && touch ${OUTPUT} ; logger "Uploaded ${ENTRIES} to ${NIGHTSCOUT_HOST}" ) || logger "Unable to upload to ${NIGHTSCOUT_HOST}"

40 changes: 18 additions & 22 deletions bin/ns-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ NIGHTSCOUT_HOST=${NIGHTSCOUT_HOST-${1-localhost:1337}}
API_SECRET=${2-${API_SECRET}}
TYPE=${3-entries.json}
ENTRIES=${4-entries.json}
#TZ=${3-$(date +%z)}
OUTPUT=${5}

REST_ENDPOINT="${NIGHTSCOUT_HOST}/api/v1/${TYPE}"
Expand All @@ -16,32 +15,19 @@ function usage ( ) {
cat <<EOF
Usage: $self <NIGHTSCOUT_HOST|localhost:1337> <API_SECRET> [API-TYPE|entries.json] <monitor/entries-to-upload.json> [stdout|-]

$self --config <NIGHTSCOUT_HOST> <PLAIN_API_SECRET> <API-TYPE|entries.json> <monitor/entries-to-upload.json> output-report.json

$self help - This message.
EOF
}

case $1 in
--config)
test -z $3 && usage && exit 1;
# echo openaps device add $2 process $self $3
API_SECRET=$(echo -n $3 | sha1sum | cut -d ' ' -f 1 | tr -d "\n")
cat <<EOF
openaps device add $self process --require "type report" $self "$self-NIGHTSCOUT" "$self-APIKEY"
sed -i -e "s/$self-NIGHTSCOUT/$2/g" $self.ini
sed -i -e "s/$self-APIKEY/$API_SECRET/g" $self.ini
openaps report add $6 text $self shell "$4" "$5"
EOF
exit 0;
;;
help)
usage
;;
*)
# curl -s $REPORT_ENDPOINT | json
# curl -s ${REPORT_ENDPOINT} | json
;;
esac

export ENTRIES API_SECRET NIGHTSCOUT_HOST REST_ENDPOINT
if [[ -z $API_SECRET ]] ; then
echo "$self: missing API_SECRET"
Expand All @@ -60,10 +46,20 @@ if [[ "$ENTRIES" != "-" ]] ; then
exit 1;
fi
fi
(test "$ENTRIES" != "-" && cat $ENTRIES || cat )| (
curl -m 30 -s -X POST --data-binary @- \
-H "API-SECRET: $API_SECRET" \
-H "content-type: application/json" \
$REST_ENDPOINT
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || logger "Unable to upload to $NIGHTSCOUT_HOST"

# use token authentication if the user has a token set in their API_SECRET environment variable
if [[ "${API_SECRET,,}" =~ "token=" ]]; then
REST_ENDPOINT="${REST_ENDPOINT}?${API_SECRET}"
(test "$ENTRIES" != "-" && cat $ENTRIES || cat )| (
curl -m 30 -s -X POST --data-binary @- \
-H "content-type: application/json" \
$REST_ENDPOINT
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || logger "Unable to upload to $NIGHTSCOUT_HOST"
else
(test "$ENTRIES" != "-" && cat $ENTRIES || cat )| (
curl -m 30 -s -X POST --data-binary @- \
-H "API-SECRET: $API_SECRET" \
-H "content-type: application/json" \
$REST_ENDPOINT
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || logger "Unable to upload to $NIGHTSCOUT_HOST"
fi
Empty file modified bin/oref0-autotune.py
100644 → 100755
Empty file.
34 changes: 28 additions & 6 deletions bin/oref0-autotune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ die() {
}

# defaults
CURL_FLAGS="--compressed"
DIR=""
NIGHTSCOUT_HOST=""
START_DATE=""
Expand All @@ -44,6 +45,10 @@ TERMINAL_LOGGING=true
RECOMMENDS_REPORT=true
UNKNOWN_OPTION=""

if [ -n "${API_SECRET_READ}" ]; then
HASHED_API_SECRET_READ=`echo -n ${API_SECRET_READ}|sha1sum|cut -f1 -d '-'|cut -f1 -d ' '`
fi

# If we are running OS X, we need to use a different version
# of the 'date' command; the built-in 'date' is BSD, which
# has fewer options than the linux version. So the user
Expand Down Expand Up @@ -153,7 +158,11 @@ echo "Grabbing NIGHTSCOUT treatments.json for date range..."
# Get Nightscout carb and insulin Treatments
url="$NIGHTSCOUT_HOST/api/v1/treatments.json?find\[created_at\]\[\$gte\]=`date --date="$START_DATE -4 hours" -Iminutes`&find\[created_at\]\[\$lte\]=`date --date="$END_DATE +1 days" -Iminutes`"
echo $url
curl -s $url > ns-treatments.json || die "Couldn't download ns-treatments.json"
if [ -n "${HASHED_API_SECRET_READ}" ]; then
curl ${CURL_FLAGS} -H "api-secret: ${HASHED_API_SECRET_READ}" -s $url > ns-treatments.json || die "Couldn't download ns-treatments.json"
else
curl ${CURL_FLAGS} -s $url > ns-treatments.json || die "Couldn't download ns-treatments.json"
fi
ls -la ns-treatments.json || die "No ns-treatments.json downloaded"

# Build date list for autotune iteration
Expand All @@ -176,7 +185,12 @@ for i in "${date_list[@]}"
do
url="$NIGHTSCOUT_HOST/api/v1/entries/sgv.json?find\[date\]\[\$gte\]=`(date -d $i +%s | tr -d '\n'; echo 000)`&find\[date\]\[\$lte\]=`(date --date="$i +1 days" +%s | tr -d '\n'; echo 000)`&count=1000"
echo $url
curl -s $url > ns-entries.$i.json || die "Couldn't download ns-entries.$i.json"
if [ -n "${HASHED_API_SECRET_READ}" ]; then
curl ${CURL_FLAGS} -H "api-secret: ${HASHED_API_SECRET_READ}" -s $url > ns-entries.$i.json || die "Couldn't download ns-entries.$i.json"
else
curl ${CURL_FLAGS} -s $url > ns-entries.$i.json || die "Couldn't download ns-entries.$i.json"
fi

ls -la ns-entries.$i.json || die "No ns-entries.$i.json downloaded"
done

Expand All @@ -201,10 +215,18 @@ do
# Autotune (required args, <autotune/glucose.json> <autotune/autotune.json> <settings/profile.json>),
# output autotuned profile or what will be used as <autotune/autotune.json> in the next iteration
echo "oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json"
oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json || die "Could not run oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json"

# Copy tuned profile produced by autotune to profile.json for use with next day of data
cp newprofile.$run_number.$i.json profile.json
if ! oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json; then
if cat profile.json | jq --exit-status .carb_ratio==null; then
echo "ERROR: profile.json contains null carb_ratio: using profile.pump.json"
cp profile.pump.json profile.json
exit
else
die "Could not run oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json"
fi
else
# Copy tuned profile produced by autotune to profile.json for use with next day of data
cp newprofile.$run_number.$i.json profile.json
fi

done # End Date Range Iteration
done # End Number of Runs Loop
Expand Down
Empty file modified bin/oref0-delete-future-entries.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions bin/oref0-detect-sensitivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if (!module.parent) {
try {
var cwd = process.cwd();
var glucose_data = require(cwd + '/' + glucose_input);
// require 6 hours of data to run autosens
if (glucose_data.length < 72) {
console.error("Optional feature autosens disabled: not enough glucose data to calculate sensitivity");
return console.log('{ "ratio": 1, "reason": "not enough glucose data to calculate autosens" }');
Expand Down
Loading