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

19th
Sep 2015
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:39
cron is a type of daemon @scottleibrand . Daemon is higher up in the hierarchy though. The two main system processes in Linux are shells and daemons and I suspect that this needs to be described in the documentation so the functionality is understood in OpenAPS. I am just super nauseated and have been for the past couple of days. 90 year old Grandma also had a stroke in the past week.
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:45
I mean this was stuff that I was intending on adding in various places but doing housekeeping on the writeup plus correcting errors or places where people can get lost has taken precedence obviously over this. There are 6 images: http://imgur.com/a/ACzIc
I should also point out that I have access to several books via a library for people with print related disabilities and a lot of things enclosed in ( ) involved documentation in books.
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:51
I'm just saying I have been more sick lately. Going to pull out my laptop later tonight and send @scottleibrand determine-basal.js with comments among other things.
Dana Lewis
@danamlewis
Sep 19 2015 00:55
Just posted an update to openaps.org (http://bit.ly/1iDgv2S), which isn't news to anyone here but just FYI in advance, also sent out to openaps-info and getting ready to share on social. Thanks again @channemann for tag teaming on updating docs and everyone else for the awesome progress we've been making!
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:55
Also @channemann you really don't need a console cable for Mac or Windows to access the Raspberry Pi 2. You would be better off loading an open source software for your respective OS and installing it and just testing it out and making instructions for it.
Dana Lewis
@danamlewis
Sep 19 2015 00:56
@diabeticgonewild can you gist those and share with all, or PR them to the relevant place so we can all see those comments? Lots of tag teaming going on :)
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:56
Open source software that accessed the Ext4 partitions that only Linux technically natively can access without extra software
Yeah I will. I need to trace back some steps and do some cleanup so we don't waste each other's time. Or Better yet just make me do it but set deadlines.
I have access to tons of books on this stuff. Tons. Due to publisher agreements with Bookshare.org and tech publishers tend to sign on quicker with Bookshare.
Dana Lewis
@danamlewis
Sep 19 2015 00:58
how about a goal? goal for @diabeticgonewild @msrcgm @eszcloud, who've recently done setup, to review the latest setup instructions and file any PRs or share gists with commentary by mid week next week? That will help keep us moving forward.
diabeticgonewild
@diabeticgonewild
Sep 19 2015 00:59
that works for me.
Dana Lewis
@danamlewis
Sep 19 2015 00:59
great, thanks
diabeticgonewild
@diabeticgonewild
Sep 19 2015 02:57
I am adding this eventually to the modified instructions for setup of hardware but this is the case you want for the Raspberry Pi 2. Yes the GPIO pins stick out 1 mm or so but it won't ruin your clothes. It's the best minimalistic case avaiable. http://www.amazon.com/Raspberry-Pi-PI2-Acrylic-Case/dp/B00M9ZW6QU/ref=sr_1_2?ie=UTF8&qid=1442631385&sr=8-2&keywords=lasergoodies
This battery too I am adding to the writeup--is the same size roughly of a 722 pump! http://www.amazon.com/dp/B013HSQXZC/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&colid=2OYKR43UGE0YB&coliid=I3LN267DGSSOJ2&psc=1
Chris Hannemann
@channemann
Sep 19 2015 04:45
Never used the console cable; believe that portion was submitted by another
Also, for the battery, please verify that they can be charged and discharged simultaneously, as most out there cannot
eszcloud
@eszcloud
Sep 19 2015 05:27
@danamlewis Sounds good. I have a blank SD card here that needs something on it! I'll work through and make comments.
Dana Lewis
@danamlewis
Sep 19 2015 05:28
Awesome thanks!
Ed Raskin
@msrcgm
Sep 19 2015 05:56
@danamlewis did you see the gist I created for section 4?
Dana Lewis
@danamlewis
Sep 19 2015 05:57
Yep @msrcgm , I think a lot of @channemann 'S pr today covered it but would be great to cross check it
Ed Raskin
@msrcgm
Sep 19 2015 06:00
Also, my PR #8 for setting up RPi covers the GUI setup. Please take a look and see if you like it, I hope it clearly explains the optional path. I don't think PR #9 covered that stuff, but @channemann did a great job
So I made some serious progress today with the amazing gracious @bewest and @amazaheri
I am current running the connected process of get-profile, calculate-ion and determine-basal (which three processes I call "magic" because, why not?)
Scott Leibrand
@scottleibrand
Sep 19 2015 06:04
At some point we need to get you to pull the curtain back on the magic processes and at least play around with their unit tests.
"When I give it these inputs, it should do this"
Ed Raskin
@msrcgm
Sep 19 2015 06:05
Screen Shot 2015-09-18 at 11.04.41 PM.png
But I am getting the following error, which seems to be a clock problem?
Rachel Sandlain
@audiefile
Sep 19 2015 06:07
add your glucose report to your magic
Ed Raskin
@msrcgm
Sep 19 2015 06:07
Right now I am basically "pretend running the pump" to see what kind of predictions/suggestions I get in output. During our hack session today, we didn't have dexcom on hand so we assumed there was a lack of data
Got it
do I just use the openaps alias add magic and add all three existing .json files + glucose.json, -- or do I need to delete magic and start from scratch?
Rachel Sandlain
@audiefile
Sep 19 2015 06:13
however you want to get it done but you need current data in all your reports to get accurate predictions and determine-basal does some time stamp checking
Ed Raskin
@msrcgm
Sep 19 2015 06:13
in other words is there another command to modify an existing process (like adding another .json file?)
Yes, that makes sense. It is reading the pump, but it has no bg data ....
Rachel Sandlain
@audiefile
Sep 19 2015 06:14
not as far as i know. you can edit the .ini file directly if you want/know what you're doing
Ed Raskin
@msrcgm
Sep 19 2015 06:17
hmmm same problem
Screen Shot 2015-09-18 at 11.17.23 PM.png
Rachel Sandlain
@audiefile
Sep 19 2015 06:18
It still looks like the glucose report isn't being invoked
Ed Raskin
@msrcgm
Sep 19 2015 06:20
Any idea why? I added glucose.json to the magic process up top?
Rachel Sandlain
@audiefile
Sep 19 2015 06:21
I missed that initially, sorry
Order matters so it's trying to calculate the suggestion with old data, then it gets new glucose data
Ed Raskin
@msrcgm
Sep 19 2015 06:22
ahhh, didn't know that.
Rachel Sandlain
@audiefile
Sep 19 2015 06:22
I only know because someone told me :)
Ed Raskin
@msrcgm
Sep 19 2015 06:23
Thanks, let's try that again. So 1) glucose, 2) get profile, 3) calculate iob, 4) determine basal?
hahaha
:)
Rachel Sandlain
@audiefile
Sep 19 2015 06:23
Make sure you're getting new pump history before you calculate iob
determine basal needs to be last because it needs everything else to be upto date. you need pump data before job. but other than that it's flexilbe
Ed Raskin
@msrcgm
Sep 19 2015 06:27
Screen Shot 2015-09-18 at 11.26.49 PM.png
still have the problem -- I changed the order. Why does it keep saying BG data is too old, or close set incorrectly?
close=clock
Ed Raskin
@msrcgm
Sep 19 2015 06:54
@bewest I see something is wrong, don't quite know how to fix it ... I'll see you tomorrow!
Oliver Schumacher
@oschumac
Sep 19 2015 09:27
@bewest Hi Ben, is there a chance to get more than 20 entries out of read_selected_basal_profile i use 24 profile entries.
Chris Oattes
@cjo20
Sep 19 2015 14:31
in cob.js, what is the maths to do with avgActivity and liverSensRatio doing?
Chris Oattes
@cjo20
Sep 19 2015 15:13
and am I correct in thinking that getSensitivity returns BG per unit, getCarbRatio returns grams per unit and getCarbAbsorbtionRate returns grams per minute?
Chris Oattes
@cjo20
Sep 19 2015 15:21
and what are the units of liverSens ratio and avgActivity?
Scott Leibrand
@scottleibrand
Sep 19 2015 16:05
It's been awhile since I looked at those. Which version of cob.js are you looking at?
Scott Leibrand
@scottleibrand
Sep 19 2015 16:07
@msrcgm can you run that again, and then also run 'cat clock.json' and 'date'?
Chris Oattes
@cjo20
Sep 19 2015 16:07
~line 57
Scott Leibrand
@scottleibrand
Sep 19 2015 16:07
And 'cat glucose.json' too
which cob.js? URL?
Chris Oattes
@cjo20
Sep 19 2015 16:08
@scottleibrand I linked it just after you asked
Scott Leibrand
@scottleibrand
Sep 19 2015 16:09
Ah sorry.
Small phone screen. :-)
Chris Oattes
@cjo20
Sep 19 2015 16:09
:D
Scott Leibrand
@scottleibrand
Sep 19 2015 16:09
This was my code, imported to nightscout. So I have to read it: one sec.
Chris Oattes
@cjo20
Sep 19 2015 16:17
I was trying to work it out, so I ended up looking at the units of the variables etc, and I couldn't get it to make sense http://pastebin.com/kPdWZvCt
Scott Leibrand
@scottleibrand
Sep 19 2015 16:17
i thought I had done a better write up on hepatic carb absorption, but I can't find it
so insulin sensitivities are mg/dL/U, carb ratios are g/U, and carb absorption rate is g/hr I believe
Chris Oattes
@cjo20
Sep 19 2015 16:24
does what I wrote in that pastebin make any sense?
Scott Leibrand
@scottleibrand
Sep 19 2015 16:25
the liverSensRatio is just a scalar / ratio: it was a way for me to reduce the impact of the hepatic absorption delay effect when I saw it was predicting more of an effect than empirical observations showed. I ended up using a different method to do that, though, and left liverSensRatio at one (which means you could just drop it)
one sec, let me read that too
avgActivity is the average insulin activity level over the timeframe of interest. are you familiar with BGI?
Chris Oattes
@cjo20
Sep 19 2015 16:28
I don't know the acronym, what does it stand for?
Scott Leibrand
@scottleibrand
Sep 19 2015 16:28
BG Impact. if you multiply insulin activity by sensitivity, you get units of mg/dL/5m. that tells you how much BG "should" be rising or falling solely as a result of insulin activity
so if you have lots of IOB, and you're right at peak action (90m or so), activity and BGI will be highly negative
similarly, if you had lots of temps to zero over the last 2 hours, your activity and BGI will turn positive, indicating your BG should be rising
the idea here is that carb absorption is not just a function of time, but also a function of insulin activity. when your insulin activity is high, it tells the liver to store some of the incoming carbs as they come out of the small intestine in the portal vein, before they ever hit the peripheral bloodstream
I model that as delayedCarbs: those carbs that did not (yet) have a direct on BG, but will eventually be released by the liver as it regulates its glycogen stores
the model very simplistically assumes that any delayedCarbs will be released as soon as the regular carb absorption ends, rather than over some longer timeframe (like 2-4h). that is probably a bit inaccurate, but it was good enough to generate pretty accurate post-meal BG predictions with wip/iob-cob (the purple line)
Chris Oattes
@cjo20
Sep 19 2015 16:33
I'm just trying to work out how that calculation gives you an answer in minutes which is then used in the setMinutes call
Scott Leibrand
@scottleibrand
Sep 19 2015 16:34
what that means for COB is that if insulin activity is high, carb absorption will be delayed
k
so delayedCarbs is just units of g, and CarbAbsorptionRate is g/hr
so g / (g/hr) * 60 gives you delayMinutes
to get units of g for delayedCarbs, we have:
U/5m * (mg/dL/U) / (g/U)
sorry, that's not quite right
Chris Oattes
@cjo20
Sep 19 2015 16:37
the 5m doesn't make a difference, does it?
Scott Leibrand
@scottleibrand
Sep 19 2015 16:37
yeah, drop the 5m, because:
I think actStart and actEnd measure the activity at the start and end of the time period, so avgActivity is actually more of a "total activity", rather than a rate
let me confirm the output of iob.CalcTotal, one sec
Chris Oattes
@cjo20
Sep 19 2015 16:38
which gives U * (BG/U) / (g/U) = BG / (g/U) = BG * (U/g) = (BG*U)/g
eugh, markup
Scott Leibrand
@scottleibrand
Sep 19 2015 16:39
ok, yeah, that's not right then
one sec on avgActivity units
fwiw, liverCarbImpactMax = 0.7; is what does all the work now instead of liverSensRatio
    result.activityContrib = sens * treatment.insulin * (2 / dia / 60 - (minAgo - peak) * 2 / dia / 60 / (60 * dia - peak));
Scott Leibrand
@scottleibrand
Sep 19 2015 16:44
so activity units are actually BG/U * U it looks like
Chris Oattes
@cjo20
Sep 19 2015 16:45
the last term in that equation is horrible :P
Scott Leibrand
@scottleibrand
Sep 19 2015 16:45
yeah, I think it's unitless though
we really should comment this code with units, shouldn't we? :)
Chris Oattes
@cjo20
Sep 19 2015 16:46
so it's avgActivity is U * BG/U = BG
Scott Leibrand
@scottleibrand
Sep 19 2015 16:46
let's see if that works
actually commenting this might be the easiest way to keep track of it all
Chris Oattes
@cjo20
Sep 19 2015 16:48
which gives BG * (BG/U) / (g/U) = BG * ((BG/U) * (U/g)) = BG * (BG/g)
Scott Leibrand
@scottleibrand
Sep 19 2015 16:48
yeah, that's not right either. the BG stuff should cancel out
Chris Oattes
@cjo20
Sep 19 2015 16:48
yup
Scott Leibrand
@scottleibrand
Sep 19 2015 16:49
ok, gonna start commenting units from the bottom up
Chris Oattes
@cjo20
Sep 19 2015 16:50
I think you need to swap getSensitivity and getCarbRatio. That would give BG * (g/U) / (BG/U) = BG * ((g/U) * (U/BG)) = BG * (g/BG) = g
but I'll let you work through commenting :)
Garidan
@garidan
Sep 19 2015 16:57
At EASD in Europe they presented YpsoPump, small and nice. It will sell next year in Europe, and has bluetooth inside. They use BL to download history from PC, but they aim in the future to put a bolus wizard in an app. They don't do it now because it's a long way to be approved for that. I don't know if they already put in the firmware an API to act on it but don't use it or if they will require a firmware update. But it's nice to know
Scott Leibrand
@scottleibrand
Sep 19 2015 17:03
    // units: BG (mg/dL)  = (BG/U) *    U insulin     * scalar
    result.activityContrib = sens * treatment.insulin * (2 / dia / 60 / peak) * minAgo;
so yeah, I'm getting BG^2/g too:
      // units: BG^2/g (?) =   BG        *      scalar    *        BG / U                           /        g / U
          var delayedCarbs = avgActivity * liverSensRatio * profile.getSensitivity(treatment.mills) / profile.getCarbRatio(treatment.mills);
Chris Oattes
@cjo20
Sep 19 2015 17:09
glad it's not just me. Don't know if you saw my message saying that I think swapping getSensitivity and getCarbRatio gives you an answer in grams
Scott Leibrand
@scottleibrand
Sep 19 2015 17:09
so if we did swap Sensitivity and CarbRatio, we'd be swapping 40 and 10
heh ya
(on my computer now) :)
so we'd be dividing everything by 16
(those are Dana's ratios that we used to develop these formulas)
Chris Oattes
@cjo20
Sep 19 2015 17:11
that could explain why you felt the need to limit the impact of this term?
Scott Leibrand
@scottleibrand
Sep 19 2015 17:11
could be
although I never went below about 0.5
certainly never as low as 1/16
so as a crude fix, we could try reversing those terms and increasing liverSensRatio to something like 8
but we really need to empirically test what liverSensRatio should be
which requires reviving wip/iob-cob
Chris Oattes
@cjo20
Sep 19 2015 17:13
sorry! :P
Scott Leibrand
@scottleibrand
Sep 19 2015 17:13
heh, something I want to do anyway, along with lots of other things
Oskar Pearson
@oskarpearson
Sep 19 2015 17:14
hey everyone
Chris Oattes
@cjo20
Sep 19 2015 17:14
o/
Scott Leibrand
@scottleibrand
Sep 19 2015 17:14
so for purposes of nightscout, which is the only place this cob.js is in active use, swapping the terms without adjusting liverSens would almost eliminate the effect of delayedCarbs
which might not be a bad thing, as it is just being used to calculate and display a COB number for humans to look at
rather than being used to predict BG, as in wip/iob-cob
Chris Oattes
@cjo20
Sep 19 2015 17:15
meaning it'd lead to people giving less insulin rather more?
potentially
Scott Leibrand
@scottleibrand
Sep 19 2015 17:16
yeah, I suppose so
Oskar Pearson
@oskarpearson
Sep 19 2015 17:16
I was wondering something about openaps-predict: Currently we're running a temporary basal on the pump (2u/h instead of the standard basal of 1.35). predict_glucose.json and predict_glucose_without_future_basal.json are currently exactly the same (in that a diff shows them exactly the same files)
Scott Leibrand
@scottleibrand
Sep 19 2015 17:16
so yes, let's fix the units bug in cob.js, and mark a TODO: on liverSensRatio to empirically determine a number that works with wip/iob-cob
this might also account for why @jasoncalabrese and others had poor results with the purple line predictions after meals in wip/iob-cob
Oskar Pearson
@oskarpearson
Sep 19 2015 17:17
The predict_glucose_without_future_basal report is being passed in "basal_dosing_end = read_clock.json" and predict_glucose isn't - but they are both returning exactly the same reports
Scott Leibrand
@scottleibrand
Sep 19 2015 17:17
as their kids' ratios are way different than Dana's
Chris Oattes
@cjo20
Sep 19 2015 17:18
it's the ratio of the ratios that matters though
plugging my ratios in would give a difference of ~16x too
Oskar Pearson
@oskarpearson
Sep 19 2015 17:18
Does that seem right to you?
Scott Leibrand
@scottleibrand
Sep 19 2015 17:18
what are typical kid ratios?
one sec @oskarpearson
Chris Oattes
@cjo20
Sep 19 2015 17:19
I've got no idea
Oskar Pearson
@oskarpearson
Sep 19 2015 17:19
No problem - finish up doing what you're up to!
Chris Oattes
@cjo20
Sep 19 2015 17:20
anyone active got diabetic kids? :P
Oliver Schumacher
@oschumac
Sep 19 2015 17:21
Jap. What do you need ?
Scott Leibrand
@scottleibrand
Sep 19 2015 17:22
what are typical kids' ratios?
Chris Oattes
@cjo20
Sep 19 2015 17:22
what are their sensitivity and carbratios
Scott Leibrand
@scottleibrand
Sep 19 2015 17:23
I also asked in nightscout/public, fwiw
Chris Oattes
@cjo20
Sep 19 2015 17:23
yeah, saw that
Scott Leibrand
@scottleibrand
Sep 19 2015 17:23
this conversation really belongs there, although I don't follow that channel, so I wouldn't have seen it if you hadn't tagged me. :)
(here I saw it because I read everything)
ok, while we wait for input on that, let's look at oskar's thing
although I don't have any familiarity with openaps-predict yet, so this might be a @channemann or @loudnate question.
create a unit test capturing your situation, and compare it to the test that's already there...
Oliver Schumacher
@oschumac
Sep 19 2015 17:28
Lars has a sensitivity from 180 to 240 per unit. But i know smaller kids they have 350 - 400 per unit.
Scott Leibrand
@scottleibrand
Sep 19 2015 17:28
what is his carb ratio?
Oliver Schumacher
@oschumac
Sep 19 2015 17:28
14 to 24 gramm per unit
Scott Leibrand
@scottleibrand
Sep 19 2015 17:29
ok, that would probably account for what @jasoncalabrese saw then
Chris Oattes
@cjo20
Sep 19 2015 17:30
so that'd mean the new value will be, what, up to 300x smaller?
Scott Leibrand
@scottleibrand
Sep 19 2015 17:30
200^2/16 = 2500
well, not quite that much, as the carb ratio is 2x higher too
Chris Oattes
@cjo20
Sep 19 2015 17:32
200/18 ~= 11, 18/200 = 0.09, which is 100 times smaller
Scott Leibrand
@scottleibrand
Sep 19 2015 17:32
(200/20)^2/(40/10)^2 = 6.25
Oliver Schumacher
@oschumac
Sep 19 2015 17:32
But there is a formula to calculate. 1 Kilo body weight needs 0.7 Units insulin. 1/3 as basal 2/3 as mealtime insulin.
Chris Oattes
@cjo20
Sep 19 2015 17:32
so 6 times more impact than you were seeing
Oliver Schumacher
@oschumac
Sep 19 2015 17:33
That works for almost everybody.
Scott Leibrand
@scottleibrand
Sep 19 2015 17:33
yeah, that could definitely account for how much the predictions were off for him
Oliver Schumacher
@oschumac
Sep 19 2015 17:34
If you need much less insulin you may not be a type 1. Or you are type 1 with a panreas wich still works a bit.
Scott Leibrand
@scottleibrand
Sep 19 2015 17:34
we should probably validate whether people are seeing really long carb absorption times in nightscout in kids with high ISF
Oliver Schumacher
@oschumac
Sep 19 2015 17:36
carbabsorption varies a lot. In the mornings After the hole night no food. lars BZ is like a rocket. in the evenings whe allways need to wave the carbs.
Chris Oattes
@cjo20
Sep 19 2015 17:45
I'd put more brackets in personally
Scott Leibrand
@scottleibrand
Sep 19 2015 17:46
like where?
Chris Oattes
@cjo20
Sep 19 2015 17:49
It's just personal opinion, but A*B*C/D seems less ambiguous than A*B/C*D. The latter has more chance of being interpreted as A*B/(C*D) by someone else reading the code
Scott Leibrand
@scottleibrand
Sep 19 2015 17:49
yay markup :)
yeah, I didn't want to swap C and D, but I could add parentheses
      var delayedCarbs = ( avgActivity *  liverSensRatio / profile.getSensitivity(treatment.mills) ) * profile.getCarbRatio(treatment.mills);
like that?
Chris Oattes
@cjo20
Sep 19 2015 17:51
yeah, that looks better
Scott Leibrand
@scottleibrand
Sep 19 2015 17:51
k
Chris Oattes
@cjo20
Sep 19 2015 17:53
sorry, I just know I've made errors in code when tired/ distracted because of things like that
Scott Leibrand
@scottleibrand
Sep 19 2015 17:55
yeah, me too :)
Chris Hannemann
@channemann
Sep 19 2015 18:10
@oskarpearson really quickly, as I'm running out the door—the difference between the predict_glucose_without_future_basal.json and predict_glucose.json is whether or not it accounts for the temp_basal that the prediction algorithm is suggesting, not a temp basal that you have set manually on the pump (both account for that); is the temp basal you have set manually?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:11
Nope - it's a temp basal that the code set in an earlier test
I've been looking for a bit, and one thing that's interesting to me is that normalized history is just a blank array - it's not picking up the temporary basal the code set earlier
Chris Hannemann
@channemann
Sep 19 2015 18:12
Ah, but you have run the reports again since?
Oh
Hmmmm
Oskar Pearson
@oskarpearson
Sep 19 2015 18:12
read_temp_basal does show the temporary basal
read_temp_basal.json
{
  "duration": 19,
  "rate": 2.0,
  "temp": "absolute"
}
oskarpearson @oskarpearson wonders if he's somehow using the wrong history file or wrong history commands
Chris Hannemann
@channemann
Sep 19 2015 18:13
Could be ...
Oskar Pearson
@oskarpearson
Sep 19 2015 18:13
clean_history.json shows the prime and rewind events etc
Scott Leibrand
@scottleibrand
Sep 19 2015 18:14
I can help troubleshoot that, if Chris has to go.
Oskar Pearson
@oskarpearson
Sep 19 2015 18:14
Would one expect this to show the temporary basal?
[report "recent_history.json"]
device = pump
hours = 6.0
use = iter_pump_hours
reporter = JSON
Chris Hannemann
@channemann
Sep 19 2015 18:14
I'd have to take a closer look at the files, but I won't have time at the moment; see if you can't trace what's happening through the cleaning steps
Scott Leibrand
@scottleibrand
Sep 19 2015 18:14
@cjo20 just opened nightscout/cgm-remote-monitor#1064
Chris Hannemann
@channemann
Sep 19 2015 18:14
Thanks, @scottleibrand
Oskar Pearson
@oskarpearson
Sep 19 2015 18:15
Thanks for your help, both of you! @scottleibrand @channemann
Scott Leibrand
@scottleibrand
Sep 19 2015 18:15
@oskarpearson yes, if it has been run since the temp basal was started. can you run that again and then show the most recent few entries in recent_history.json?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:15
sure - 1 sec
# openaps report invoke recent_history.json
pump://JSON/iter_pump_hours/recent_history.json
reporting recent_history.json
# cat recent_history.json
[
  {
    "_type": "ChangeBolusWizardSetup",
    "_description": "ChangeBolusWizardSetup 2015-09-19T10:33:55 head[2], body[40] op[0x4f]",
    "timestamp": "2015-09-19T10:33:55",
    "_body": "405100962b161e003c14002d3c241582415100962b161e003c14002d3c2415825a0f8b6d0a130f19",
    "appended": [
      {
        "_body": "",
        "_head": "1100",
        "_type": "Base",
        "_date": "0a00000000",
        "_description": "Base (2000, 0, 0, 0, 0, 10) head[2], body[0] op[0x11]"
      }
    ],
    "_head": "4f00",
    "_date": "b7610a130f"
  },
  {
    "_type": "Prime",
    "type": "manual",
    "_description": "Prime 2015-09-19T10:21:16 head[5], body[0] op[0x03]",
    "timestamp": "2015-09-19T10:21:16",
    "_body": "",
    "fixed": 0.0,
    "_head": "030000000c",
    "amount": 1.2,
    "_date": "90552a130f"
  },
  {
    "_type": "Rewind",
    "_description": "Rewind 2015-09-19T10:20:40 head[2], body[0] op[0x21]",
    "timestamp": "2015-09-19T10:20:40",
    "_body": "",
    "_head": "2100",
    "_date": "a8540a130f"
  }
]
Chris Oattes
@cjo20
Sep 19 2015 18:16
@scottleibrand cool, thanks. It makes a nice change for me to do something that approximates useful with my weekend :P
oskarpearson @oskarpearson knows that feeling!
Scott Leibrand
@scottleibrand
Sep 19 2015 18:19
@oskarpearson what time was the temp basal? what are the records right before and after that time?
@cjo20 heh, thanks much for being the first person to really investigate that code. :)
good catch.
Oskar Pearson
@oskarpearson
Sep 19 2015 18:20
Temp basal was a short while ago now (UK time: around 19:10 or so). So that bolus wizard setup was about 8 hours ago now.
I'm wondering if somehow things are reading from an incorrect page or something
Scott Leibrand
@scottleibrand
Sep 19 2015 18:21
ok, so you are running iter_pump_hours 6, and only getting data from 8+ hours ago? that could be a problem. :)
Oskar Pearson
@oskarpearson
Sep 19 2015 18:21
I mentioned a problem like that here a while back - a reboot of the pump seemed to sort it out
Scott Leibrand
@scottleibrand
Sep 19 2015 18:21
try openaps use iter_pump 30 or something
does read_clock report "now" properly?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:24
I presume that should be openaps use pump iter_pump_hours 30 ? That gives me an additional two records - from 2015-09-19T00:00:00 (Model522ResultTotals and MResultTotals)
but nothing post the ChangeBolusWizardSetup above
Scott Leibrand
@scottleibrand
Sep 19 2015 18:25
no, iter_pump, not iter_pump_hours
Oskar Pearson
@oskarpearson
Sep 19 2015 18:25
read_clock returns the correct time
giving that a go
Scott Leibrand
@scottleibrand
Sep 19 2015 18:25
"last X records" vs. "last X hours of records"
Oskar Pearson
@oskarpearson
Sep 19 2015 18:26
busy running
Scott Leibrand
@scottleibrand
Sep 19 2015 18:27
how much history does this pump have? was it reset recently?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:27
Seems to be taking a very long time. Not sure if it's the carelink being flaky or if something else is happening.
It's now died
oskarpearson @oskarpearson retries
Scott Leibrand
@scottleibrand
Sep 19 2015 18:28
we've seen similar issues with newly reset test pumps with limited history. never seemed to be an issue once we had some history of real live basals and boluses going, though
Oskar Pearson
@oskarpearson
Sep 19 2015 18:28
It has a lot of history. 3 or 4 years
Scott Leibrand
@scottleibrand
Sep 19 2015 18:29
ok. I know other folks have had issues with the CGM data getting stuck for hours...
does this pump have a medtronic cgm, or are you using dex?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:29
This is a bit odd. See the dates from 2001...
# openaps use pump iter_pump 30
[
  {
    "_type": "ChangeBolusWizardSetup",
    "_description": "ChangeBolusWizardSetup 2015-09-19T10:33:55 head[2], body[40] op[0x4f]",
    "timestamp": "2015-09-19T10:33:55",
    "_body": "405100962b161e003c14002d3c241582415100962b161e003c14002d3c2415825a0f8b6d0a130f19",
    "appended": [
      {
        "_body": "",
        "_head": "1100",
        "_type": "Base",
        "_date": "0a00000000",
        "_description": "Base (2000, 0, 0, 0, 0, 10) head[2], body[0] op[0x11]"
      }
    ],
    "_head": "4f00",
    "_date": "b7610a130f"
  },
  {
    "_type": "Prime",
    "type": "manual",
    "_description": "Prime 2015-09-19T10:21:16 head[5], body[0] op[0x03]",
    "timestamp": "2015-09-19T10:21:16",
    "_body": "",
    "fixed": 0.0,
    "_head": "030000000c",
    "amount": 1.2,
    "_date": "90552a130f"
  },
  {
    "_type": "Rewind",
    "_description": "Rewind 2015-09-19T10:20:40 head[2], body[0] op[0x21]",
    "timestamp": "2015-09-19T10:20:40",
    "_body": "",
    "_head": "2100",
    "_date": "a8540a130f"
  },
  {
    "_type": "Model522ResultTotals",
    "_description": "Model522ResultTotals 2015-09-19T00:00:00 head[1], body[41] op[0x6d]",
    "timestamp": "2015-09-19T00:00:00",
    "_body": "0608002b0000000004bc04bc640000000000000000000000000000000000000000000008002b000000",
    "_head": "6d",
    "_date": "928f"
  },
  {
    "_type": "MResultTotals",
    "_description": "MResultTotals 2015-09-19T00:00:00 head[5], body[0] op[0x07]",
    "timestamp": "2015-09-19T00:00:00",
    "_body": "",
    "_head": "07000004bc",
    "_date": "928f"
  },
  {
    "_type": "Model522ResultTotals",
    "_description": "Model522ResultTotals 2015-09-18T00:00:00 head[1], body[41] op[0x6d]",
    "timestamp": "2015-09-18T00:00:00",
    "_body": "0608002b0000000004bc04bc640000000000000000000000000000000000000000000008002b000000",
    "_head": "6d",
    "_date": "918f"
  },
  {
    "_type": "MResultTotals",
    "_description": "MResultTotals 2015-09-18T00:00:00 head[5], body[0] op[0x07]",
    "timestamp": "2015-09-18T00:00:00",
    "_body": "",
    "_head": "07000004bc",
    "_date": "918f"
  },
  {
    "_type": "Model522ResultTotals",
    "_description": "Model522ResultTotals 2015-09-17T00:00:00 head[1], body[41] op[0x6d]",
    "timestamp": "2015-09-17T00:00:00",
    "_body": "0608002b0000000004bc04bc640000000000000000000000000000000000000000000008002b000000",
    "_head": "6d",
    "_date": "908f"
  },
  {
    "_type": "ChangeBolusWizardSetup",
    "_description": "ChangeBolusWizardSetup 2001-04-20T00:21:48 head[2], body[40] op[0x4f]",
    "timestamp": "2001-04-20T00:21:48",
    "_body": "701500501601204e0000000300020100007640cb8f0107000004bc8e8f6d8e8f0608002b00000000",
    "appended": [
      {
        "_body": "",
        "_head": "8d8f",
        "_type": "Base",
        "_date": "06008f48ac",
        "_description": "Base (2012, 0, 8, 15, 0, 6) head[2], body[0] op[0x8d]"
      },
      {
        "_body": "",
        "_head": "0500",
        "_type": "Base",
        "_date": "0006ce055e",
        "_description": "Base (2014, 0, 5, 14, 6, 0) head[2], body[0] op[0x05]"
      },
      {
        "_body": "",
        "_head": "04bc",
        "_type": "Base",
        "_date": "04bc640000",
        "_description": "Base (2000, 2, 0, 4, 60, 4) head[2], body[0] op[0x04]"
      }
    ],
    "_head": "4f01",
    "_date": "7015001401"
  },
  {
    "_type": "ChangeBolusWizardSetup",
    "_description": "ChangeBolusWizardSetup 2015-09-13T13:09:50 head[2], body[40] op[0x4f]",
    "timestamp": "2015-09-13T13:09:50",
    "_body": "415100962b161e003c14002d3c241582405100962b161e003c14002d3c24158207000006ce8d8f6d",
    "_head": "4f00",
    "_date": "b2490d0d0f"
  },
  {
    "_type": "SensorAlert",
    "alarm_description": "Lost Sensor",
    "_description": "SensorAlert 2015-09-13T13:03:38 head[3], body[0] op[0x0b]",
    "alarm_type": 113,
    "timestamp": "2015-09-13T13:03:38",
    "_body": "",
    "_head": "0b7100",
    "_date": "a6434dad0f"
  },
  {
    "_type": "SensorAlert",
    "alarm_description": "Lost
Scott Leibrand
@scottleibrand
Sep 19 2015 18:30
the battery didn't die recently, did it?
Ben West
@bewest
Sep 19 2015 18:30
that indicates probably a new record that decocare doesn't understand yet
Scott Leibrand
@scottleibrand
Sep 19 2015 18:30
yeah, that 2001 record in the middle of all the 2015 ones makes no sense
Ben West
@bewest
Sep 19 2015 18:30
it'd be extremely useful to save that output
it does make sense
Scott Leibrand
@scottleibrand
Sep 19 2015 18:31
heh, glad ben made it on
he's the pump whisperer. ;-)
Ben West
@bewest
Sep 19 2015 18:31
but it's not a legit record
the records after it may be bad as well
the record before it should look familiar and hopefully is right
Oskar Pearson
@oskarpearson
Sep 19 2015 18:31
Battery hasn't died in the last day
it's actually a model 722 pump rather than a 522 (UK)
We're using a medtronic CGMS
Ben West
@bewest
Sep 19 2015 18:32
that's fine
Oskar Pearson
@oskarpearson
Sep 19 2015 18:32
Any extra data I can get you?
Scott Leibrand
@scottleibrand
Sep 19 2015 18:32
by "save that output", do you mean anything more than the data he pasted?
Ben West
@bewest
Sep 19 2015 18:32
medtronic hasn't shared details with me of everything the pump can do on the insides
yeah, it'd be nice to get that data and the raw page of data together
ideally, it'd be nice to line it up with some csv from carelink
scottleibrand @scottleibrand never can recall the decocare command to get raw data pages
Oskar Pearson
@oskarpearson
Sep 19 2015 18:33
I can certainly give that a go
Ben West
@bewest
Sep 19 2015 18:33
otherwise, it'd be useful to think through that segment of history
scottleibrand @scottleibrand leave y'all to it
Ben West
@bewest
Sep 19 2015 18:33
and see if you can remember what sort of happened
mm-send-comm.py ReadHistoryData --save --page 0 will save the raw data
Oskar Pearson
@oskarpearson
Sep 19 2015 18:35
Currently getting this. mm-send-comm.py: error: argument command: invalid choice: 'ReadHistoryData' (choose from 'sleep', 'tweak', 'ManualCommand')
Ben West
@bewest
Sep 19 2015 18:36
sorry
tweak ReadHistoryData
btw, there's -h and tab complete at every level, so you can type tw[tab]
Oskar Pearson
@oskarpearson
Sep 19 2015 18:38
Bit strange. I can successfully do a openaps use pump read_clock but I get this:
 mm-send-comm.py tweak ReadHistoryData --save --page 0
## do stuff with an insulin pump over RF
using ` Namespace(autoinit=False, begin=None, bytesPerRecord=None, command='tweak', descr=None, dryrun=False, effectTime=None, end=None, init=False, maxRecords=None, name=None, no_postlude=False, no_prelude=False, no_rf_prelude=False, other='ReadHistoryData', page=0, params=None, port='', postfix=None, prefix=None, prefix_path='', save=True, saveall=False, serial='', session_life=10, verbose=None) `

javascript
{'radio': {'errors.crc': 1,
           'errors.naks': 0,
           'errors.sequence': 0,
           'errors.timeouts': 87,
           'packets.received': 1851L,
           'packets.transmit': 2005L},
 'usb': {'errors.crc': 2,
         'errors.naks': 0,
         'errors.sequence': 0,
         'errors.timeouts': 0,
         'packets.received': 7110L,
         'packets.transmit': 7112L}}
Traceback (most recent call last):
  File "/root/venv-openaps/bin/mm-send-comm.py", line 8, in <module>
    app.run(None)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/helpers/cli.py", line 113, in run
    self.prelude(args)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/helpers/cli.py", line 151, in prelude
    model = pump.read_model( )
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/session.py", line 94, in read_model
    model = self.query(commands.ReadPumpModel)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/session.py", line 110, in query
    self.execute(command)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/session.py", line 107, in execute
    return super(type(self), self).execute(command)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/session.py", line 35, in execute
    self.transfer( )
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/session.py", line 70, in transfer
    return self.stick.transmit_packet(self.command)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/stick.py", line 855, in transmit_packet
    result = self.process( )
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/stick.py", line 490, in process
    ack, response = self.command.respond(raw)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/stick.py", line 405, in respond
    ack, body = super(type(self), self).respond(raw)
  File "/root/venv-openaps/local/lib/python2.7/site-packages/decocare/stick.py", line 73, in respond
    assert False, ("NAK!!\n%s" % lib.hexdump(raw[:3]))
AssertionError: NAK!!
0000   0x01 0x66 0x01                             .f.
Which looks like some sort of wireless/USB controller issue, right?
Oskar Pearson
@oskarpearson
Sep 19 2015 18:44
Hang on. I may be being a numpty
I may be conflicting with the command running on cron
Nope, not that
Still getting that response - and it's almost instantaneous
Oskar Pearson
@oskarpearson
Sep 19 2015 18:53
strace is showing it opening the correct serial ID
9189  open("/dev/serial/by-id/....excerpted...", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 4
9189  ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
9189  ioctl(4, TCFLSH, 0)               = 0
9189  write(1, "```\n", 4)              = 4
9189  write(1, "```\n", 4)              = 4
...
excerpted
...
9189  write(4, "\4\0\0", 3)             = 3
9189  read(4, "\1U\0\v'\0\0\0\1ComLink II\1\20\2\0\1\1\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 64) = 64
... time goes by ... selects and some reading of binascii
9189  write(4, "\4\0\0", 3)             = 3
9189  read(4, "\1U\0\v'\0\0\0\1ComLink II\1\20\2\0\1\1\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 64) = 64
...
9189  write(4, "\6\0\0", 3)             = 3
9189  read(4, "\1U\0\300'\0\0\0\1ComLink II\1\20\2\0\1\1\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 64) = 64
...
9189  write(4, "\5\1\0", 3)             = 3
9189  read(4, "\1U\0\r\0\0\0\0\0\35q\0\0\35~\35\2009w\35~\4\0\0\5\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 64) = 64
9189  write(4, "\5\0\0", 3)             = 3
9189  read(4, "\1U\0\1\0\0[\0\0\7\224\0\0\0106\0\0\3\207\0\242\0049\6\356\0v\0\4\0\0\0\0\1\0\261\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 64) = 64
.. then it crashed out ...
9189  write(1, "```\n", 4)              = 4
9189  write(1, "```javascript\n", 14)   = 14
Oskar Pearson
@oskarpearson
Sep 19 2015 18:58
I think I've figured it out - give me a little bit
I think the serial parameter is missing
This was successful: export SERIAL=XXXXX ; mm-send-comm.py --init sleep 0; mm-send-comm.py tweak ReadHistoryData --save --page 0
Shall I log an issue on the github repo?
Oskar Pearson
@oskarpearson
Sep 19 2015 19:07
I'm going to pull the data into the carelink app
and then create an issue
Scott Leibrand
@scottleibrand
Sep 19 2015 19:08
Issue should probably go in decoding-carelink.
Oskar Pearson
@oskarpearson
Sep 19 2015 19:08
Yep - will create it there
Ali Mazaheri
@amazaheri
Sep 19 2015 19:17
ok issue with @msrcgm resolved, related to glucose report.
Oskar Pearson
@oskarpearson
Sep 19 2015 19:20
So - the specific issue of that individual data item aside - I was wondering if there's anything I can do to start getting pump history again?
Ed Raskin
@msrcgm
Sep 19 2015 19:41
Yep, @amazaheri and @bewest work their magic at cwd
Nathan Racklyeft
@loudnate
Sep 19 2015 20:00
@oskarpearson it looks like we aren't properly decoding your pump's bolus wizard settings entry. since this is all run-length encoding, anything that comes after that will end up look like nonsense if we get the sizes wrong :)
Oskar Pearson
@oskarpearson
Sep 19 2015 20:01
Ah, that makes sense. I didn't realise it was RLL. That'd be a problem!
Nathan Racklyeft
@loudnate
Sep 19 2015 20:01
when you file the ticket in decoding-carelink, please attach the raw data page(s)
Oskar Pearson
@oskarpearson
Sep 19 2015 20:02
I'm wondering if I should try and create a load of events which will fill the page in the meantime
Nathan Racklyeft
@loudnate
Sep 19 2015 20:02
remind me your model number?
Oskar Pearson
@oskarpearson
Sep 19 2015 20:02
722
Nathan Racklyeft
@loudnate
Sep 19 2015 20:02
oh, hmm
filling the history won't matter if you're using iter_pump_hours,
since it's going to keep paging until it finds the specified date range
re: your question on openaps-predict, I run two predictions: one if I cancel the current temp basal and one if I let it continue.
If I don't have a current temp basal, the reports have the exact same data
alright I'm heading out. feel free to PM me... for whatever reason I'm not getting a notification for an @-mention
Oskar Pearson
@oskarpearson
Sep 19 2015 20:06
Thanks everyone for the help - as always
You guys are always super friendly and positive. It rocks :)
Gah, it's really irritating that I can't attach a binary file to the issue
Scott Leibrand
@scottleibrand
Sep 19 2015 20:12
@oskarpearson since the offending bolus wizard record is more than 6h ago, issuing lots of repeated temp basals should help
it will move that off to a previous page so iter_pump_hours doesn't see it.
Oskar Pearson
@oskarpearson
Sep 19 2015 22:43
That has indeed worked
BTW: Has anyone had any success using a carelink with the intel edison? With ubilinux 3.10.17-yocto-standard-r2 I'm getting these:
[  376.632036] usb 1-1: device descriptor read/8, error -75
[  376.762545] usb 1-1: device descriptor read/8, error -75
[  377.012430] usb 1-1: device descriptor read/8, error -75
[  377.142475] usb 1-1: device descriptor read/8, error -75
[  377.392504] usb 1-1: device descriptor read/8, error -75
[  377.522531] usb 1-1: device descriptor read/8, error -75
[  377.629350] hub 1-0:1.0: unable to enumerate USB device on port 1
root@ubilinux:/boot# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
root@ubilinux:/boot#
Seems possibly related to https://gist.github.com/bewest/6488955
Oskar Pearson
@oskarpearson
Sep 19 2015 23:24
@bewest Is the USB 3 problem with the original carelink fixed in later kernels? Or does it always require a patch?