These are chat archives for nightscout/intend-to-bolus

20th
Oct 2015
Tim Howard
@tghoward
Oct 20 2015 00:38
thanks @danamlewis ! I think Monica was the first to clue me in to that view-from-20,000-feet. :smile:
Ben West
@bewest
Oct 20 2015 01:10
https://irc.gitter.im/, I've closed my browser tab and am using my normal chat client now :-D
Ben West
@bewest
Oct 20 2015 01:27
puzzling:
```
{"duration":0,"rate":0,"temp":"percent"}
{"iob":0,"activity":0,"bolusiob":0}
{"max_iob":2,"type":"current","dia":4,"current_basal":0.9,"max_daily_basal":1.1,"max_b
IOB: 0.00, Bolus IOB: 0.00
{"delta":0,"glucose":69,"avgdelta":-1}
asal":1.4,"min_bg":106,"max_bg":125,"carbratio":15,"sens":45}
BG: 69+0 -> 66-66 (Unadjusted: 69-69)
Avg. Delta: -1.0, BGI: 0.0
BG 69<76, delta 0>0; no high-temp to cancel
15m deviation: -3
{
reporting 02.diyps/diyps.json
"eventualBG": 66,
"tick": "+0",
"bg": 69,
"temp": "absolute",
```
No recommendation to send
"snoozeBG": 66,
}
"reason": "BG 69<76, delta 0>0; no high-temp to cancel"
Scott Leibrand
@scottleibrand
Oct 20 2015 01:27
heh, 2=1 too
Ben West
@bewest
Oct 20 2015 01:27
ah, interesting
let's try it with temp type set to absolute
yes, great
Scott Leibrand
@scottleibrand
Oct 20 2015 01:31
do we need a better error message when temp type is percent?
Dana Lewis
@danamlewis
Oct 20 2015 02:03
Woo first oref0 :) cheers @bewest
Peter Miller
@ochenmiller
Oct 20 2015 02:07
woot woot oref0!
On a completely different subject, I just confirmed that if I hang my RPi off a personal hotspot on iPhone, I can ssh to it by it's local IP - In fact all Personal Hotspot IPs can see each other. So, I set up a webserver on RPi, and now pebble can load data direct from it!
Will test tomorrow and see what that does to battery life!
Scott Leibrand
@scottleibrand
Oct 20 2015 02:13
We do that all the time. As long as it's not a cpu-intensive web server, shouldn't affect battery much.
Ben West
@bewest
Oct 20 2015 02:30
oref0 is now installable using sudo npm install -g oref0
John Males
@johnmales
Oct 20 2015 02:32
@bewest wow :)
Ben West
@bewest
Oct 20 2015 03:45
ok, everything's released
i'm using it on my system
Scott Leibrand
@scottleibrand
Oct 20 2015 03:50
is your calculate-iob working?
Ben West
@bewest
Oct 20 2015 03:51
it is now
Ben West
@bewest
Oct 20 2015 03:52
This message was deleted
This message was deleted
yes
openaps/oref0@82e6f59
it's in 0.0.10
Scott Leibrand
@scottleibrand
Oct 20 2015 03:53
@amazaheri ^^
Scott Leibrand
@scottleibrand
Oct 20 2015 04:09
@bewest what are you thinking for oref0 release velocity?
Ben West
@bewest
Oct 20 2015 04:16
as frequent as possible
using patch, minor, major semantics, preferably
want to release what you just did?
Ben West
@bewest
Oct 20 2015 04:27
nice, doing those releases feels great
Scott Leibrand
@scottleibrand
Oct 20 2015 04:34
sure, we can do a minor release of that stuff
or patch, or whatever
Ben West
@bewest
Oct 20 2015 04:40
for oref0, I just re-registered mine cleanly with openaps device add get-profile process --require settings --require bg-targets --require isf --require basals --require carb-ratios --require max-iob oref0 get-profile
Scott Leibrand
@scottleibrand
Oct 20 2015 04:41
short form would be: openaps device add get-profile process --require "settings bg_targets isf basal_profile max_iob" oref0 get-profile
Ben West
@bewest
Oct 20 2015 04:42
hmmmm does that work?
hmmmm
interesting
nice hack
Scott Leibrand
@scottleibrand
Oct 20 2015 04:42
yep. :)
Ben West
@bewest
Oct 20 2015 04:42
you can leave out the --require stuff
in this scenario.. it's telling openaps specifically not to run the tool without these args added somehow
Scott Leibrand
@scottleibrand
Oct 20 2015 04:43
just a question of which level it errors out at?
Ben West
@bewest
Oct 20 2015 04:43
with recent changes, we can leave it out here, oref0 will try to run it with any number of args
right
so we're naming it get-profile here, so it's super nice to have those --required
Scott Leibrand
@scottleibrand
Oct 20 2015 04:43
so I should at least remove max_iob, since that's optional
Ben West
@bewest
Oct 20 2015 04:43
but for prototyping a new tool...
openaps will also be more flexible now
so it's eg possible to use oref0 device mapped to just oref0 instead of get-profile
right, but providing it will help openaps error out earlier
oh, of course doing it also helps with tab complete
tab tab
Scott Leibrand
@scottleibrand
Oct 20 2015 04:47
;-)
Scott Leibrand
@scottleibrand
Oct 20 2015 04:52
why do you have to do gather-and-predict = ! bash -c "openaps gather-data && openaps analyze-and-predict"
why can't you just openaps alias gather-and-predict "gather-data analyze-and-predict"?
I know it doesn't work, just wondering if you don't want it to, it'd be too hard, or you just hadn't thought of it. :)
Jason Calabrese
@jasoncalabrese
Oct 20 2015 05:00
@bewest, wow looks like you had a fun birthday
Ben West
@bewest
Oct 20 2015 05:06
:-D
I've been thinking about that @scottleibrand, it's a subtle semantic change
Scott Leibrand
@scottleibrand
Oct 20 2015 05:07
I'm thinking of simply adding support for aliases of aliases
Ben West
@bewest
Oct 20 2015 05:07
for one thing, it means you can't call aliases with args
Scott Leibrand
@scottleibrand
Oct 20 2015 05:08
hmm
Ben West
@bewest
Oct 20 2015 05:08
or maybe you can
but there's subtle things like that to be aware of
maybe an oref0-loop can do something like that though
same way mm-stick does it
or maybe oref-shell or openaps-shell
it's worth thinking more about, I've definitely wanted to do that kind of thing
Scott Leibrand
@scottleibrand
Oct 20 2015 05:18
hold off on any release, I think I broke something with get-profile and max_iob
Ben West
@bewest
Oct 20 2015 05:19
I suspect if you install oref0, your symlinks won't work the way you thought
not sure if that's related to what you're seeing, but it's somehting to watch out for
Scott Leibrand
@scottleibrand
Oct 20 2015 05:20
true, although I'm not sure they need to
those are just for backwards compatibility. might be able to remove them completely at this point, since we left openaps-js alone
hmm, what the heck does a double ;; do?
  • var carbratio_data = require(cwd + '/' + carbratio_input);;
apparently that's necessary
Ben West
@bewest
Oct 20 2015 05:21
shouldn't be
nah
Scott Leibrand
@scottleibrand
Oct 20 2015 05:22
yeah, that didn't fix it
SyntaxError: /home/pi/openaps-dev/max_iob.json: Unexpected token m
(the m in { max_iob: 2 })
at Object.<anonymous> (/usr/local/lib/node_modules/oref0/bin/oref0-get-profile.js:47:23)
Ben West
@bewest
Oct 20 2015 05:24
is your maxiob data corrupt?
Scott Leibrand
@scottleibrand
Oct 20 2015 05:24
$ cat max_iob.json
{ max_iob: 2 }
Ben West
@bewest
Oct 20 2015 05:24
cat max_iob.json | json ;-)
that's bad json
Scott Leibrand
@scottleibrand
Oct 20 2015 05:24
no, it's programmatically generated the same way as before, and that simple
hmm
maybe it was never using it?
k
Ben West
@bewest
Oct 20 2015 05:25
should be { "max_iob": 2 }
Scott Leibrand
@scottleibrand
Oct 20 2015 05:25
didn't realize the "" were mandatory
Ben West
@bewest
Oct 20 2015 05:25
in strict json it is
js in general, nope
Scott Leibrand
@scottleibrand
Oct 20 2015 05:26
I hate escaping quotes. :)
Ben West
@bewest
Oct 20 2015 05:27
yeah..., there's ways to avoid it
I look for ways to avoid it since it's so error prone
Scott Leibrand
@scottleibrand
Oct 20 2015 05:27
echo "{ \"max_iob\": $max_iob }" > max_iob.json in bash
can't use ' or it doesn't expand $max_iob
Ben West
@bewest
Oct 20 2015 05:28
cat <<<EOF | tee max_iob.json
{ "max_iob": $max_iob }
EOF
oh
er
Scott Leibrand
@scottleibrand
Oct 20 2015 05:29
not sure that's any cleaner. :)
Ben West
@bewest
Oct 20 2015 05:29
no escapes :-)
in shell script, it can be useful to use that form
in interactive shell, yeah for that you can escape :-)
so it might be fun to have an oref0-create-max-iob that uses the "easy" form to assist with priming/starting
I'm using that form to generate the help output
Scott Leibrand
@scottleibrand
Oct 20 2015 05:32
looks like I can't use that form conditionally
( ! grep -q max_iob max_iob.json 2>/dev/null || [[ $max_iob != "0" ]] ) && cat <<<EOF | tee max_iob.json
{ "max_iob": $max_iob }
EOF
/home/pi/openaps-sh/setup.sh: line 87: syntax error: unexpected end of file
Ben West
@bewest
Oct 20 2015 05:32
true, need need extra parens ( ... ) sunshell that sucker
err
Scott Leibrand
@scottleibrand
Oct 20 2015 05:33
going back to my escaped "
Ben West
@bewest
Oct 20 2015 05:35
are you minting max_iob during loop?
Scott Leibrand
@scottleibrand
Oct 20 2015 05:35
this isn't loop
this is setup.sh
Ben West
@bewest
Oct 20 2015 05:36
ah
so this is a hybrid script attempting to "mesh" a new install to your stuff
Scott Leibrand
@scottleibrand
Oct 20 2015 05:36
max_iob is a command-line argument to setup.sh, which defaults to 0
Ben West
@bewest
Oct 20 2015 05:36
so in your hybrid mesh set up
Scott Leibrand
@scottleibrand
Oct 20 2015 05:36
maybe
Ben West
@bewest
Oct 20 2015 05:36
you want to ensure/create a max_iob
so if one doesn't exist mint a new one
with your preference
Scott Leibrand
@scottleibrand
Oct 20 2015 05:36
or I might end up with one big alias to replace loop.sh
Ben West
@bewest
Oct 20 2015 05:37
well, that's what I did
I have one alias that calls many other alias
so for setup/quickstart/install
Scott Leibrand
@scottleibrand
Oct 20 2015 05:37
yeah, i seem to be moving toward that, but not sure I can do everything with aliases or if I'll need a loop that just calls a couple aliases
should be dead-simple either way
Ben West
@bewest
Oct 20 2015 05:37
it'd be great to have oref0-mint-max_iob
that just creates the perfect json doc
Scott Leibrand
@scottleibrand
Oct 20 2015 05:38
that seems like excessive proliferation of devices
Ben West
@bewest
Oct 20 2015 05:38
then in your setup (or anyone's) you can call that with your pref
this isn't a device though, right?
this is just part of setup/mesh-install
I suppose you could make it a separate shell script, but seems unnecessary to break it out if you only ever use it during setup
and if all it does is produce a 1-line output. :)
Ben West
@bewest
Oct 20 2015 05:40
that's fine, I actually think it's important to capture in these scripts
that take $1, $2, whatever
that helps eliminate the hardcoded names
even if it's one-line output, we can have other scripts consume/generate it
Scott Leibrand
@scottleibrand
Oct 20 2015 05:40
when we have a need for that, easy enough
Ben West
@bewest
Oct 20 2015 05:41
creating max_iob json is going to be a very common step
and it's so error prone
Scott Leibrand
@scottleibrand
Oct 20 2015 05:41
good. :)
then it'll default to 0
;-)
Ben West
@bewest
Oct 20 2015 05:41
meh, not sure I want people stuck on obscure escaping rules
Scott Leibrand
@scottleibrand
Oct 20 2015 05:41
true
anyway, back to coding
Ben West
@bewest
Oct 20 2015 05:42
would be really nice to have oref0-mint-max-iob that prints nice json given argument
still up to user to use it to save it to file
Scott Leibrand
@scottleibrand
Oct 20 2015 05:51
just did 0.3U bolus on the test pump, and oref0-calculate-iob is giving me zero IOB
hmm, does oref0-calculate-iob depend on timezone match?
well, they do match, so that's not the problem
Ben West
@bewest
Oct 20 2015 06:01
openaps/oref0#5
Scott Leibrand
@scottleibrand
Oct 20 2015 06:02
nice. merged.
Ben West
@bewest
Oct 20 2015 06:02
:-D
Scott Leibrand
@scottleibrand
Oct 20 2015 06:02
can you check whether your oref0-calculate-iob is picking up boluses?
Ben West
@bewest
Oct 20 2015 06:02
yeah, I'm double checking few things
just noticed my own reports max_iob 0 which seems... well wrong
also
max daily basal seems weird
I don't quite understand that
it's *1000/ 1000
for indice 0
something lost in translation?
Scott Leibrand
@scottleibrand
Oct 20 2015 06:04
not following
Ben West
@bewest
Oct 20 2015 06:04
what is the max daily basal thing?
Scott Leibrand
@scottleibrand
Oct 20 2015 06:04
it's the highest basal rate in your schedule
it's used in calculating the max basal upper limit
Ben West
@bewest
Oct 20 2015 06:05
determine-basal://text/shell/02.diyps/diyps.json
{"delta":0,"glucose":246,"avgdelta":-0.3333333333333333}
{"duration":0,"rate":0,"temp":"absolute"}
{"iob":0,"activity":0,"bolusiob":0}
{"max_iob":0,"type":"current","dia":4,"current_basal":0.9,"max_daily_basal":1.1,"max_basal":1.4,"min_bg":106,"max_bg":125,"sens":45}
IOB: 0.00, Bolus IOB: 0.00
Avg. Delta: -0.3, BGI: 0.0
15m deviation: -1
BG: 246+0 -> 245-245 (Unadjusted: 246-246)
Eventual BG 245>106 but Delta +0 < BGI 0 / 2; no temp to cancel
reporting 02.diyps/diyps.json
max_basal is 1.4, but daily is less, 1.1
Scott Leibrand
@scottleibrand
Oct 20 2015 06:05
max_basal is the maximum openaps is allowed to give
one of the limits to that is a multiple (like 2x or 3x) of your max_daily_basal
Ben West
@bewest
Oct 20 2015 06:06
oh, interesting
hmmm
ok interesting
that's a knob to turn going forward
I want that as separate widget/knob
I've seen a lot of 1.4 temps
I want a bit more, I think
it's impossible to accrue your max_iob of 2 if 1.4 is max basal
Scott Leibrand
@scottleibrand
Oct 20 2015 06:07
    maxSafeBasal = Math.min(profile.max_basal, 3 * profile.max_daily_basal, 4 * profile.current_basal);
Ben West
@bewest
Oct 20 2015 06:08
hmm, interesting
I'd be interested in redefining that to not scale, simply report
Scott Leibrand
@scottleibrand
Oct 20 2015 06:08
max_basal comes from your pump
Ben West
@bewest
Oct 20 2015 06:08
right
Scott Leibrand
@scottleibrand
Oct 20 2015 06:09
is it 1.4 on your pump?
Ben West
@bewest
Oct 20 2015 06:09
but I want a "report" saying "we this is your max basal rate that openaps ref design will allow"
and then anothe report saying that the enact portion followed that constraint
this is determine basal monitoring and enacting at same time
Scott Leibrand
@scottleibrand
Oct 20 2015 06:10
yeah, lots we could do to make the debug output clearer
I wrote it for me, and I understand all the code. :)
Ben West
@bewest
Oct 20 2015 06:10
;-)
Scott Leibrand
@scottleibrand
Oct 20 2015 06:10
but back to your immediate problem: is your pump set with a max_basal of 1.4?
Basal, Max Basal Rate
or "maxBasal" in openaps use pump settings
fix that. :)
doesn't matter what openaps tries to do, your pump won't let it temp higher than 1.4 :)
Scott Leibrand
@scottleibrand
Oct 20 2015 06:15
pi@rpi3 ~/openaps-dev $ node ~/openaps-js/bin/iob.js monitor/pumphistory.json settings/profile.json monitor/clock.json
{"iob":0.3785393326666667,"activity":0.0007822222222222222,"bolusiob":0.15724399634567904}
pi@rpi3 ~/openaps-dev $ oref0-calculate-iob monitor/pumphistory.json settings/profile.json monitor/clock.json
{"iob":0,"activity":0,"bolusiob":0}
definitely a regression
This message was deleted
This message was deleted
Scott Leibrand
@scottleibrand
Oct 20 2015 06:21
This message was deleted
how do I run node ~/oref0/bin/oref0-calculate-iob.js without doing npm install?
Error: Cannot find module 'oref0/lib/iob'
Ben West
@bewest
Oct 20 2015 06:27
heh, all kinds of surprises from new pump
hmm
yeah, that's a downside
try:
sudo npm link in repo direcotry
similar to python's setup.py develop
Scott Leibrand
@scottleibrand
Oct 20 2015 06:29
that just propagated the problem:
$ oref0-calculate-iob monitor/pumphistory.json settings/profile.json monitor/clock.json

module.js:340
    throw err;
          ^
Error: Cannot find module 'oref0/lib/iob'
Ben West
@bewest
Oct 20 2015 06:31
yeah..., I had to install -g
is this a clean install free from openaps-js?
was fighting this on my system a bit
Scott Leibrand
@scottleibrand
Oct 20 2015 06:32
tempted to go back to monolithic iob.js until you figure out how to do this split-up thing without regression
Ben West
@bewest
Oct 20 2015 06:32
it needs to be split up to test/verify it
so this is par for course
Scott Leibrand
@scottleibrand
Oct 20 2015 06:33
yeah, but it's broken, and I can't debug without a painful npm install -g between every edit
Ben West
@bewest
Oct 20 2015 06:33
after few cycles, my environment stabilized
is this fresh install?
Scott Leibrand
@scottleibrand
Oct 20 2015 06:33
reasonably, but it does/did have openaps-js too
Ben West
@bewest
Oct 20 2015 06:33
I was unsure how much of old openaps-js was tainting new install workflow
i have several new rpi to play with though
Scott Leibrand
@scottleibrand
Oct 20 2015 06:34
I don't think that's it
the script names all changed, for one thing
Ben West
@bewest
Oct 20 2015 06:35
this is a major transition for existing installs
so, yeah, feeling better about oref0 as different name
Scott Leibrand
@scottleibrand
Oct 20 2015 06:35
yeah, not sure we'll be able to transition anyone
everyone will need to set up fresh on oref0 I think
Ben West
@bewest
Oct 20 2015 06:35
nah, just update docs ;-)
yeah
it's basically new thing
Scott Leibrand
@scottleibrand
Oct 20 2015 06:37
looks like I can't sudo npm install -g ./ from openaps-js anyway, as send-tempbasal-Azure has a naming conflict
so nevermind that
are you also getting IOB 0 with your setup?
Scott Leibrand
@scottleibrand
Oct 20 2015 06:48
ok, it's too late for me to do any more troubleshooting. created https://github.com/openaps/oref0/tree/old-iob with the old iob.js to get things working again
Ben West
@bewest
Oct 20 2015 19:01
wow, very interesting
Paul Andrel
@stavlor
Oct 20 2015 19:05
heh thats pretty neat looking
Ben West
@bewest
Oct 20 2015 19:07
@scottleibrand you could also fall back to openaps-js
I see what happened
Ben West
@bewest
Oct 20 2015 19:18
problem is the tool is generating non-json error messages on stdout
which means they get included in the report results, which means the report is invalid
openaps/oref0#6
Paul Andrel
@stavlor
Oct 20 2015 19:22
hmm fun
stderr is your friend
Scott Leibrand
@scottleibrand
Oct 20 2015 19:26
That error shouldn't be happening. If it is, the report probably should fail.
Ben West
@bewest
Oct 20 2015 19:26
you may be running into similar issue though
for me it only happened on bad/stale data
Scott Leibrand
@scottleibrand
Oct 20 2015 19:28
It would've still output the error to stdout though right?
Ben West
@bewest
Oct 20 2015 19:29
it probably did, openaps takes all stdout and shoves it into your report....
so you wouldn't see it on console or in log
it'd be in the report
if the error your seeing is related to bad import/require and it can't parse the json, it's probably because some error/notice message from stdout is also in there with the json
Paul Andrel
@stavlor
Oct 20 2015 19:33
unless you want to jsonify the error so that it would parse heh
Ben West
@bewest
Oct 20 2015 19:37
yeah, there's already a reason field for various messages in the json
can also add an ok: false field
Scott Leibrand
@scottleibrand
Oct 20 2015 19:40
In this case that's not what I was seeing: I was cating iob.json and it only had the valid json with all zeroes.
Don't disagree with fixing this, just don't think it was my and Ali's issue.
Ben West
@bewest
Oct 20 2015 19:41
sorry, not same, similar
Ben West
@bewest
Oct 20 2015 21:15
oy, facepalm
so my loop is not working... so I'm debugging and debugging
finally reach to check if my pump has bad battery or something and discovered I wasn't wearing it
it's in the other room :-(
Matthias Granberry
@mgranberry
Oct 20 2015 21:23
That's a hard problem to fix with code.
Ben West
@bewest
Oct 20 2015 21:59
probably going to release this today openaps/oref0#7
Ben West
@bewest
Oct 20 2015 22:05
we've taken over oref0 on google already, that was quick
Scott Leibrand
@scottleibrand
Oct 20 2015 22:37
:)
Ben West
@bewest
Oct 20 2015 22:39
I have sudo npm link working as expected, also now
same deal as setup.py develop