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

18th
Oct 2015
Ben West
@bewest
Oct 18 2015 00:19
now the code for iob, profile stuff can be re-used/tested much much more easily
Ben West
@bewest
Oct 18 2015 00:27
repo looks like this now:
  130 bin/oref0-pebble.js
   98 bin/oref0-ifttt-notify
  329 bin/oref0-determine-basal.js
   18 bin/mm-format-ns-pump-history.sh
   33 bin/reset-usb.sh
   49 bin/oref0-calculate-iob.js
   32 bin/clockset.sh
   45 bin/oref0.sh
   76 bin/send-tempbasal-Azure.js
  119 bin/mm-stick.sh
   18 bin/mm-format-ns-glucose.sh
   19 bin/ns-upload-entries.sh
   58 bin/pumpsettings.sh
   64 bin/oref0-get-profile.js
   32 bin/pebble.sh
   12 lib/medtronic-clock.js
   71 lib/iob/history.js
   24 lib/iob/index.js
   38 lib/iob/total.js
   45 lib/iob/calculate.js
   39 lib/profile/targets.js
   36 lib/profile/basal.js
   43 lib/profile/index.js
   21 lib/profile/isf.js
   21 lib/profile/carbs.js
 1486 total
Ben West
@bewest
Oct 18 2015 01:10
would anyone care to add http://contributor-covenant.org/ to some of our repos?
Chris Oattes
@cjo20
Oct 18 2015 01:21
I hate that it's necessary to state something like that
Chris Oattes
@cjo20
Oct 18 2015 01:34
@bewest I'd hope that most of the things on the list would be common sense, and wouldn't be tolerated by the people running the project anyway. And with things like "personal attacks" on the list, some people consider "I disagree with you" to be a personal attack, especially for topics that they care a lot about, and you do run the risk of "I'm going to use the contributor covenant to try and make problems for people that disagree with me"
Ben West
@bewest
Oct 18 2015 01:35
yeah, that happens anyway
we've seen people in NS support do that kind of thing, makes sense to document expectations as early as possible
Chris Oattes
@cjo20
Oct 18 2015 01:37
I think that by writing it down in a document you give people something to try and weasel round or abuse in one way or another. I saw the most ridiculous complains etc. while I was active in the Ubuntu community because of their Code of Conduct
Jason Calabrese
@jasoncalabrese
Oct 18 2015 01:39
that's my concern
Chris Oattes
@cjo20
Oct 18 2015 01:46
Or, worse, when you get people trying to implement the covenant being accused of violating the covenant by doing so. That one is fun to try and fix :P
Peter Miller
@ochenmiller
Oct 18 2015 02:25
I like the idea of a value statement, but don't have the same experience with opensource communities as many of you. I certainly cringe at the idea of anyone making a personal attack, or making statements that demean or degrade a person or group. Other kinds of offense are often dependent on world view - which in a healthy community are varied, listened to, and respected. That said, I have no issue with what I've read in the link Ben posted.
I'm about to start up a second aps instance - one to stay by the bedside, one to travel. I've read posts that say there's little risk of crosstalk. I'm going to run the crons at a slight offset just to be sure. Any other things I should be concerned about?
Scott Leibrand
@scottleibrand
Oct 18 2015 02:36
Make sure you're validating outputs: checking for sensitivity of zero and other nonsense.
Ben West
@bewest
Oct 18 2015 03:39
wincing...
@scottleibrand openaps/openaps-js#40 had errors in it
it doesn't run
oh oh
nm
all is well
might check out openaps/openaps-js#42
it should be no-op
would love to get that into dev also, especially since it'a no-op
Scott Leibrand
@scottleibrand
Oct 18 2015 03:43
Sorry. Guess we should probably be explicit in pull requests as to when we want them merged or not, or how much testing we need first.
Ben West
@bewest
Oct 18 2015 03:43
no, it's fine, you got the other branch too
yeah, and there was a lot of ambiguity there
I'm fine with it though; you got the one with fixes
Scott Leibrand
@scottleibrand
Oct 18 2015 03:43
Will look at #42 next. LMK if you need me to run it first, as I'm just mobile and eyeballing them.
Ben West
@bewest
Oct 18 2015 03:44
I'm very confident in it, but it needs testing before master
if you can test it this/next week it's fine to put in dev
I don't want to wait much longer for release though
want to do one soon
maybe tomorrow
basic gist is just splitting it up into lots of smaller js files
I'm running it, so :D
Scott Leibrand
@scottleibrand
Oct 18 2015 03:50
K, that one needs a bigger screen. Should have time tomorrow to be able to get mostly up and running on dev.
Ben West
@bewest
Oct 18 2015 04:14
cool, heading to dinner
Ed Raskin
@msrcgm
Oct 18 2015 04:43
@bewest or @amazaheri or @scottleibrand or @danamlewis or anyone else -- I can't seem to follow the instructions for how to set up the cron or output. I have read and experimented with @bewest's post above, but I just can't get there. Even using crontab -h to help, I'm not seeing where and what to enter in order to set up the crontab or what to do to make it run after I set it up. Also not following how to get an output that I can analyze. Is anyone around willing to help?
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:07
I use crontab -e
That will open an editor
Then you can add something like Ben's example
Ed Raskin
@msrcgm
Oct 18 2015 05:10
Thanks @jasoncalabrese I'm in crontab -e. I've typed out SHELL=bin/bash but I am stuck as to what my PATH should look like
my terminal command line for openaps looks like this:
pi@raspberrypi ~/myopenaps
not sure if that helps
Scott Leibrand
@scottleibrand
Oct 18 2015 05:13
First things first: what is the series of commands you type to run your loop?
Ed Raskin
@msrcgm
Oct 18 2015 05:13
openaps magic_2
Scott Leibrand
@scottleibrand
Oct 18 2015 05:14
and that does the whole thing end to end?
Ed Raskin
@msrcgm
Oct 18 2015 05:14
I think so ... when I run it, it certainly gives me data that makes sense
Scott Leibrand
@scottleibrand
Oct 18 2015 05:14
test that manually first. Pretend you're the cron daemon. :-)
And type exactly what you'll want it to type, and see if it does the right thing.
Ed Raskin
@msrcgm
Oct 18 2015 05:14
Ha, yes, I can confidently say that.
Scott Leibrand
@scottleibrand
Oct 18 2015 05:16
Also, think about everything you type, including any cd statements, to get openaps magic_2 to run.
Ed Raskin
@msrcgm
Oct 18 2015 05:16
I'm running it now, then I cat determine-basal.son and I'm seeing a temp basal that does make sense, with correct job, etc.
Scott Leibrand
@scottleibrand
Oct 18 2015 05:16
Does magic_2 enact that temp?
does your test pump now have that temp running?
Ed Raskin
@msrcgm
Oct 18 2015 05:17
No, it does not actually send the command, my loop ends with determine basal because I am not yet connecting
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:19
In your console type pwd for print working directory
Scott Leibrand
@scottleibrand
Oct 18 2015 05:19
ok. And you're wanting to automate just that part (determining the suggested basal) to run in cron?
Ed Raskin
@msrcgm
Oct 18 2015 05:23
Well, I suppose I would like to validate the whole system. I suppose sending the final command to enact the temp basal and cancel as recommended is critical. At this point, I was focused only on the actual basal recommendation ... but you raise a good point. Perhaps I should add set_temp_basal to the loop now? looking for a recommendation in that regard for validation
Scott Leibrand
@scottleibrand
Oct 18 2015 05:24
Is the pump connected to a pump site?
Ed Raskin
@msrcgm
Oct 18 2015 05:24
No, everything is disconnected, water in pump sitting on a nightstand. T:Slim connected to PWD ... ;)
Scott Leibrand
@scottleibrand
Oct 18 2015 05:25
cool. I would set the temps then.
That way you can see them show up in IOB and see the loop react to that.
Then run that manually every few data points and watch what it does.
If you get bored retyping the same thing over and over, you can automate it. :-)
but it should be interesting the first few dozen times at least. :-)
Ed Raskin
@msrcgm
Oct 18 2015 05:27
yes, that makes sense. So, not sure how to set up that command based on current state of instructions. when I openaps use pump set_temp_basal -h all I get is input conditional statement .... not sure how to tell openaps to take the determine-basal data and convert that into a use command
can you help
Scott Leibrand
@scottleibrand
Oct 18 2015 05:28
I'm headed to bed, but what you're trying to do is set up a report that runs enact_temp using the output json you've been looking at, and then either add that to one of your magic aliases, or invoke that report afterward.
Sorry, set_temp_basal, not enact.
The input it wants is the name of that json file with the temp to set.
So something like openaps use pump set_temp_basal determine-basal.json should work.
Ed Raskin
@msrcgm
Oct 18 2015 05:31
Oh -- I was trying to validate set_temp_basal with an actual command of some sort like 1.5/hr, but couldn't figure out what input it was looking for. So, it should be openaps use pump set_temp_basal invoke determine-basal.son?
haha! I was close! no "invoke" necessary
Scott Leibrand
@scottleibrand
Oct 18 2015 05:31
Skip the invoke, and it should be .json instead of .son. Ya.
Play with that, and someone else should be able to help if you get stuck.
Ed Raskin
@msrcgm
Oct 18 2015 05:32
Right -- and before you go ... to crontab that? it would like like ....?
Scott Leibrand
@scottleibrand
Oct 18 2015 05:33
cron tan lines look like */5 * * * * cd myopenaps; openaps myalias
the *'s are the schedule.
Ed Raskin
@msrcgm
Oct 18 2015 05:33
got it, on the PATH= line, yes?
gnite, thanks as always @scottleibrand
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:34
cron tan lines :)
Ed Raskin
@msrcgm
Oct 18 2015 05:34
get your mind out of the gutter @jasoncalabrese
lol
Scott Leibrand
@scottleibrand
Oct 18 2015 05:37
Yay autocorrect. ;-)
No, ditch the PATH= stuff.
It's probably need to be cd /home/pi/myopenaps or whatever the output of Jason's pwd command is.
Night.
Ed Raskin
@msrcgm
Oct 18 2015 05:47
yeah, stuck. I'll take any help. I tried to code that in using the nano editor and when I type crontab into terminal after that, it gets stuck. I'm clearly not understanding something ...
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:47
is the editor up?
Ed Raskin
@msrcgm
Oct 18 2015 05:54
yes, in nano editor I have */5 * * * * cd/home/pi/ myopenaps; openaps magic2
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:56
that doesn't look right
Ed Raskin
@msrcgm
Oct 18 2015 05:56
Any sense as to what I am missing?
Jason Calabrese
@jasoncalabrese
Oct 18 2015 05:57
should look more like :point_up: October 17, 2015 12:59 PM
Ed Raskin
@msrcgm
Oct 18 2015 06:03
Ok, I think I adjusted, but when I type crontab in terminal, it just gets stuck again. Still looks like I don't have it. Any ideas?
Jason Calabrese
@jasoncalabrese
Oct 18 2015 06:05
you don't type crontab to see it run
just tail a log
tail -fn100 /var/log/messages
should see lots of stuff, not just you're test loop
Ed Raskin
@msrcgm
Oct 18 2015 06:11
Ok, saw lots of stuff after running the above, not the loop though .. not really sure what just happened.
Jason Calabrese
@jasoncalabrese
Oct 18 2015 06:15
everything running on the pi logs there
when mine is running I see stuff like
Oct 18 06:15:48 raspberrypi openaps-loop: {"delta":8,"glucose":125,"avgdelta":1}
Oct 18 06:15:48 raspberrypi openaps-loop: {"duration":0,"rate":0,"temp":"absolute"}
Oct 18 06:15:48 raspberrypi openaps-loop: {"iob":0.1165535993135085,"activity":-0.004094876455026454,"bolusiob":0}
Oct 18 06:15:48 raspberrypi openaps-loop: {"carbs_hr":28,"max_iob":2,"dia":3,"type":"current","current_basal":0.5,"max_daily_basal":0.5,"max_basal":1.5,"max_bg":120,"min_bg":100,"carbratio":16,"sens":90}
Oct 18 06:15:48 raspberrypi openaps-loop: IOB: 0.12, Bolus IOB: 0.00
Oct 18 06:15:48 raspberrypi openaps-loop: Avg. Delta: 1.0, BGI: 1.8
Oct 18 06:15:48 raspberrypi openaps-loop: 15m deviation: -3
Oct 18 06:15:48 raspberrypi openaps-loop: BG: 125+8 -> 112-112 (Unadjusted: 115-115)
Oct 18 06:15:48 raspberrypi openaps-loop: 112 is in range. No temp required
Ed Raskin
@msrcgm
Oct 18 2015 07:04
problem with set_temp_basal:
pi@raspberrypi ~/myopenaps $ openaps use pump set_temp_basal determine-basal-suggestion.json 
Traceback (most recent call last):
  File "/usr/local/bin/openaps-use", line 5, in <module>
    pkg_resources.run_script('openaps==0.0.6', 'openaps-use')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/EGG-INFO/scripts/openaps-use", line 63, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/EGG-INFO/scripts/openaps-use", line 57, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/__init__.py", line 92, in __call__
    return self.method.selected(args)(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/__init__.py", line 31, in __call__
    return self.method(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/use.py", line 26, in __call__
    output = self.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/vendors/medtronic.py", line 279, in main
    results = self.upload_program(program)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/vendors/medtronic.py", line 288, in upload_program
    return self.pump.model.set_temp_basal(**program)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/models/__init__.py", line 182, in set_temp_basal
    result = self._set_temp_basal(**basals)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/models/__init__.py", line 22, in __call__
    self.response = inst.session.query(self.msg, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/session.py", line 109, in query
    command = Command(serial=self.serial, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/commands.py", line 252, in Program
    assert duration % 30 is 0, "duration {0} is not a whole multiple of 30".format(duration)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'
Ben West
@bewest
Oct 18 2015 07:32
ok, so what's happening:
most of the time, (optimally), openaps has nothing to do
eg, due to IOB, current bg, there is actually no recommendation
eg, "if we started doing stuff already, nullify new recommendations unless there is some excess"
I have a thing to guard against "error" when the calculation indicates nothing to do
Ben West
@bewest
Oct 18 2015 07:38
as-is, with your scenario, that's essentially a false error, where there is nothing "to do"(and that's ok) bu nothing to guard against "no-op" as a normal condition
number of ways to fix
I broke up my aliases, such that checking against a"things to enact" checks that there's something to enact before trying to "enact" it
timomer
@timomer
Oct 18 2015 09:20
@LadyViktoria @oschumac I have created a new gitter room to discuss HAPP only items, anyone else are welcome to join https://gitter.im/timomer/HAPP
Jason Calabrese
@jasoncalabrese
Oct 18 2015 14:40
@msrcgm your pump is set to absolute temp basal mode? Think the default is percent.
Ali Mazaheri
@amazaheri
Oct 18 2015 16:01
iit should as i was using his pump for a week while developing stuff with Scott early on back in July. that error is expected as Ben mentioned, when json diesnt have rate and duration elements.
which is when there is no action or no temp to cancel, or when the existing temp is good.
@msrcgm, i suggest you look at history of changes on your github which is more practical than looking at log. i will be car shopping today but be back later.today. Happy Sunday all.
diabeticgonewild
@diabeticgonewild
Oct 18 2015 18:01
@eszcloud sorry for the super late response but I was receiving immunomodulatory treatment and due to medical problems OpenAPS isn't that high on my priority list right now. My favorite JSON decoder, although MATLAB does it kind of, is MATLAB-JSON http://vision.is.tohoku.ac.jp/~kyamagu/software/json/
eszcloud
@eszcloud
Oct 18 2015 18:07
thanks for the link @diabeticgonewild
diabeticgonewild
@diabeticgonewild
Oct 18 2015 18:13
You're welcome!