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

23rd
Nov 2015
Scott Leibrand
@scottleibrand
Nov 23 2015 00:18
That's not the best way to fix it though. Better to put https:// in your $NIGHTSCOUT_HOST itself.
Tim Howard
@tghoward
Nov 23 2015 00:29
+1 @scottleibrand
here's a way to get the time of the most recent BG entry from nightscout using oref0's ns-get
ns-get entries.json $NIGHTSCOUT_HOST | json -c 'this.name == "GlucoseSensorData"' | json -a name date dateString | sort | head -1 | cut -d' ' -f3
Tim Howard
@tghoward
Nov 23 2015 01:12
or using awk at the end
ns-get entries.json $NIGHTSCOUT_HOST | json -c 'this.name == "GlucoseSensorData"' | json -a name date dateString | sort | head -1 | awk 'BEGIN {} {print $3}'
Jason Calabrese
@jasoncalabrese
Nov 23 2015 01:30
any issues swapping sd cards between pis?
Scott Leibrand
@scottleibrand
Nov 23 2015 01:30
nope
I even swap them between pi B and pi 2
Jason Calabrese
@jasoncalabrese
Nov 23 2015 01:31
was thinking about making an image
for easy restore
Scott Leibrand
@scottleibrand
Nov 23 2015 01:31
yep, that's what I just did
for awhile I was installing fresh each time, as oref0 was changing so fast, but now it's mostly stable (and can be updated with a quick run of the install script) so I made an image
Jason Calabrese
@jasoncalabrese
Nov 23 2015 01:32
thats what I was thinking too
going to try getting that done tonight
just about have the 2nd pi setup
old pi isn't running jessie, so hoping thats the cause of the wifi issues
but offline is working good
Scott Leibrand
@scottleibrand
Nov 23 2015 01:33
had to resize2fs to get the file system down to < 3 GB, but was never able to figure out how to shrink the partition itself. ended up just dd'ing the first 3GB of the SD card, and it figured it out. :)
Jason Calabrese
@jasoncalabrese
Nov 23 2015 01:34
the mac disk utility doesn't work?
Scott Leibrand
@scottleibrand
Nov 23 2015 01:35
not with ext4
Tim Howard
@tghoward
Nov 23 2015 01:35
do either of you rotate log files? syslog apparently rotates on a four day schedule
Jason Calabrese
@jasoncalabrese
Nov 23 2015 01:35
ah
I saw something about rotating in the docs
Scott Leibrand
@scottleibrand
Nov 23 2015 01:35
yes, I created a couple of logrotate files
at one point I had updated cron to run logrotate more often than default, but that no longer seems necessary with the latest versions of openaps etc.
Tim Howard
@tghoward
Nov 23 2015 01:40
Very nice.
Peter Miller
@ochenmiller
Nov 23 2015 04:01
regarding convo about duplicate treatment (or BG) data. Because I'm still writing directly to mongo, I've been able to use the "upsert" feature and create a unique key (generally just the date). This allows uploads from several devices monitoring dexcom, and redundant writes of treatment data.
Jason Calabrese
@jasoncalabrese
Nov 23 2015 04:21
for cgm entries the api supports a sysTime field that's used as an id
the beta ns uploader was using that for upserts
Peter Miller
@ochenmiller
Nov 23 2015 04:23
Cool! I hadn't found that yet. Nothing like re-inventing the wheel.
Jason Calabrese
@jasoncalabrese
Nov 23 2015 05:56
somehow I screwed up the install on the 2nd pi
the time zone stuff isn't working
TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'
Jason Calabrese
@jasoncalabrese
Nov 23 2015 06:18
gave up trying to pull the released packages and went back to using the dev branches of my forks
eyim
@eyim
Nov 23 2015 07:25
@jasoncalabrese Hi Jason - yes I had that same error on the release package. But the dev branch fixed it
Scott Leibrand
@scottleibrand
Nov 23 2015 07:36
Dev branch of which? Of openaps?
Jim Matheson
@jmatheson
Nov 23 2015 07:46
@eyim I was already using the https:// NIGHTSCOUT_HOST, but I tried hard coding it just in case. No dice. It looks like the upload is working ok for me for treatments from the pump, but not working for BG uploads.
still need to dig in on the BG side.
Ben West
@bewest
Nov 23 2015 08:16
need to prep several releases
dexcom_reader is needed
meant to do that awhile ago
recently there's been some worthwhile decocare submissions
might as well do both
I think openapscontrib is up to date, but probably worth checking and reving if not
then finally openaps again
oy
Jim Matheson
@jmatheson
Nov 23 2015 08:52
Does anyone know where ns-upload-glucose.sh ended up? I saw a merge into dev here openaps/openaps-js#33 but can’t figure out where it went from there.
Jason Calabrese
@jasoncalabrese
Nov 23 2015 14:59
yeah, needed the dev version of openaps for sure, I also used the dev version of openapscontrib, but not sure if I needed that
Jason Calabrese
@jasoncalabrese
Nov 23 2015 15:10
with the updated pi wifi has been solid all night, huge improvement, think the issue is that in my initial instal I didn't upgrade to Jessie
Jason Calabrese
@jasoncalabrese
Nov 23 2015 16:55
seeing an issue where sometimes when latest-ns-treatment-time fails it produces empty output, and then tons of dupes are added
think we just need some valildation
only trick is for new setups, where there wouldn't be a value
eyim
@eyim
Nov 23 2015 16:59
I've been testing effective ranges of the carelink and found that in an open air environment - nothing between the carelink and the dexcom the effective range is about 9 feet. Once I put the carelink / pi surrounded by my jacket, the effective distance only dropped by 1 foot to 8 feet. In addition, whether you pointed the front or the back only had a small effect. Both failed at 10 feet but at 9 feet with the back pointed to the pump, it ran through the loop quickly. When I turned it around and had the front of the carelink pointed at the pump, it ran slower but still completed the loop. Similar effect when I pointed the tip at the pump - bottom toward the floor. So the direction of the carelink is facing doesn't seem to have a significant impact. I was testing with the newer 723 pump. So either the 722 pumps have a shorter effective range (or the 722 pump I have has an issue) or my kid's blanket has a lead lining that I am not aware of. I'll test with the 722 tonight
Jason Calabrese
@jasoncalabrese
Nov 23 2015 17:01
range is a real pain and causes some issues since temps don't get canceled when they should
could see that being bad
like a high temp then going out of range
Matthias Granberry
@mgranberry
Nov 23 2015 17:03
It sounds like shorter temps might be better for safety. Is battery life impacted by more frequent commands?
or do they have to be 30 minutes to ensure that insulin delivery is actually affected?
Lori
@LoriLori
Nov 23 2015 17:05
think 30min is minimum
Jason Calabrese
@jasoncalabrese
Nov 23 2015 17:06
yeah, 30 is the min, shorter would be perfect though
Matthias Granberry
@mgranberry
Nov 23 2015 17:06
That makes sense. OpenAPS probably wasn't in their set of use cases when they were specing it out. Tandem's default 15 mins drives me batty.
Jason Calabrese
@jasoncalabrese
Nov 23 2015 17:06
could see having a check of recent uptime before high temping
eyim
@eyim
Nov 23 2015 17:07
Yes - that is the problem we had last night. Luckily he needed all the insulin it gave to him but the connection cut out for an hour or so right after high temping him
Matthias Granberry
@mgranberry
Nov 23 2015 17:08
The only thing you can do is choose less-aggressive amounts and more/longer high-temps as a safety control.
Jason Calabrese
@jasoncalabrese
Nov 23 2015 17:09
Screen Shot 2015-11-23 at 10.08.29 AM.png
lots of low temping for us last night, would have needed tons of juice without it
Lori
@LoriLori
Nov 23 2015 17:09
yes, connection loose is big issue, need a beep beep beep
.
Matthias Granberry
@mgranberry
Nov 23 2015 17:10
I wouldn't want to be woken unless an actual change was delayed for longer than 30-60 mins
Lori
@LoriLori
Nov 23 2015 17:10
it should have cancel low temp, but couldn't connect for 30 minutes
yes it should try for 10 minutes at least before alarm unless low/high alarm triggers it any way
eyim
@eyim
Nov 23 2015 17:16
blob
@jasoncalabrese Nice. We had the opposite issue last night. He had a bad infusion site so super high even with 15 units on board. Replaced it before going to bed but was hesitant to give him more insulin with so much on board. Openaps gave him extra when I fell asleep for a couple of hours. Helped to augment the insulin I gave him.
mannixlab
@mannixlab
Nov 23 2015 17:22
I was wondering if anyone might be able to point me in the right direction for a Minimed 722 or 723 less that 2.4 version. Want to be lucky n=21 for #OpenAPS closed loop.
Most of the sellers on medwow didn't respond to me so I had to contact a lot of them
mannixlab
@mannixlab
Nov 23 2015 17:24
@eyim Thank you.
Scott Leibrand
@scottleibrand
Nov 23 2015 17:25
@jasoncalabrese have you seen openaps give a high temp that would be dangerous to continue for a full 30m? Idea is that those should be safe to run to completion. If they're not, when are we being too aggressive?
Jason Calabrese
@jasoncalabrese
Nov 23 2015 17:36
@eyim the lows we had were from some rage bolusing when dinner decided to start taking effect hours later
could be that I'm letting it temp too much, could also be a jumpy sensor messing up the forecast
Scott Leibrand
@scottleibrand
Nov 23 2015 17:39
Yeah, the part most likely to be (briefly) too aggressive seems to be the 15m deviation stuff. May need to add a 30m avg delta as well and go with whichever of those two deviations is smaller, or something like that.
eyim
@eyim
Nov 23 2015 17:43
I have but I don't think there is anything that openaps can do about it. My son exercises 4 to 6+ hours per day and on some hard days he can drop from 300 to 50 in a matter of 20 to 30 minutes when the body muscles try to recover all the sugar. It looks like a compression drop. We didn't have one that severe a few nights ago but still a pretty significant drop. Openaps was high temping him at the time and then lost connection. I shut it off manually and was giving him sugar. This is a pretty extreme case though that probably most people don't face. Dana said she hadn't experienced it before. But I face the same challenges / problems when manually deciding to give him insulin or not in those cases and have made the error of giving him insulin to bring him down and then 5 minutes later yelling in anger as he drops and I am giving him 40 to 50 unaccounted for carbs
Overall - the system seems very safe and feels less aggressive than what I do manually
eyim
@eyim
Nov 23 2015 17:53
The only change I have made to the algo is to lower the threshold level when the low temp kicks in when he is below the target bg. It is set normally at -30 below target bg. That seems to work great for most people but I changed it to -10. His target bg is 120 so for us 90 is too low to start low temping. Basically because of the sports, if he is near his target bg and has insulin on board, we immediately start to low temp and / or give him sugar. For us, it is rare that he will hang around 100 with insulin on board and not drop low.
Scott Leibrand
@scottleibrand
Nov 23 2015 18:06
you shouldn't have to do that to get that effect
if his target range is 110-120, then if he's 110 with positive IOB, it should be low-temping
that's not based on the low glucose suspend threshold that you modified, but rather based on eventualBG and snoozeBG being less than target range
could you put together an example (BG, IOB, etc.) of when you think it's not low-temping enough?
eyim
@eyim
Nov 23 2015 18:13
Unfortunately I deleted the logs from that night. I send the results from the loop I run to a txt file so I can know and analyze what decisions it made on each pass. I'll revert back to the -30 and let you know if I see the situation again where I would low temp sooner.
Scott Leibrand
@scottleibrand
Nov 23 2015 18:15
or, if you can just come up with some idealized test cases, we can run them through determine-basal.test.js
the default inputs for my tests are https://github.com/openaps/oref0/blob/master/tests/determine-basal.test.js#L64: you can override those per test if you want
basically, tests are just a structured way to think about what you want the code to do in different situations, so you can write down the various interesting cases and have the system check to make sure the code does what you expect, now and after any future changes.
eyim
@eyim
Nov 23 2015 18:20
Got it. I'm probably the least technical person on this thread so figuring out how to do so will take me a bit
Scott Leibrand
@scottleibrand
Nov 23 2015 18:21
don't worry about the technical and syntax details
just get us the inputs and expected outputs (paste them here is fine)
we can discuss and then add them as tests, and then you can replicate and vary those to capture other scenarios you come up with
Lori
@LoriLori
Nov 23 2015 18:55
just on remark of high temp, it calc bg-target bg, divide by sensitivity , which is like bolus wizard, and then sets high temp 30 minutes
which eventually deliver 1/2 of estimated bolus in 1/2 hour, then it might setup next one
think it is quite safe should sensitivity and max iob (max positive basal iob) numbers be reasonable
Scott Leibrand
@scottleibrand
Nov 23 2015 18:59
no, it's not 1/2 of estimated bolus: it will deliver the entire amount of extra insulin required over the 30 minutes, as long as it doesn't exceed max iob or max basal
Lori
@LoriLori
Nov 23 2015 19:00
thought it was half now I see
var rate = profile.current_basal + (2 * insulinReq);
scottleibrand @scottleibrand nods
Lori
@LoriLori
Nov 23 2015 19:00
thanks for explanation @scottleibrand
Lori
@LoriLori
Nov 23 2015 19:07
could you please explain
var deviation = Math.round( 15 / 5 * ( glucose_status.avgdelta - bgi ) );
its just
Math.round( 3 * ( glucose_status.avgdelta - bgi ) );
no need to explain
it doesn't follow iob activity time curve but pretty much numbers are so small it is near
Scott Leibrand
@scottleibrand
Nov 23 2015 19:25
15 and 5 are meaningful numbers there: 15 = the 15 minutes used to calculate avgdelta, and 5 is the 5 minutes used in bgi (and delta/tick)
deviation represents how much more BG is rising or falling that would be expected solely based on insulin activity (bgi)
the assumption is that whatever is causing the deviation is likely to continue for the next 15-30m, and that over that time the extra rise/fall will be about the same magnitude as what we've seen over the last 15m (it might slow down, but the total deviation over DIA will be at least that much)
And yes, we don't worry about how insulin activity will change over 15m, since it's such a rough estimate to begin with.
Dana Lewis
@danamlewis
Nov 23 2015 19:37
@jasoncalabrese I wonder if your meal bolusing behavior will change as you have more time with the loop (less "rage bolusing" like in the example above?)
Jim Matheson
@jmatheson
Nov 23 2015 19:38
@jasoncalabrese I have reviewed that setup script but I don’t see anything in there that uploads BG values from the pi to NS. From previous thread in here it seems that @cjo20 added this functionality, it got merged into dev here openaps/openaps-js#33 but then disappeared.
Ben West
@bewest
Nov 23 2015 19:48
oref0 now
I just released decocare and dexcom_reaader, btw
Scott Leibrand
@scottleibrand
Nov 23 2015 19:54
where did the medtronic CGM upload functionality end up in oref0?
Jim Matheson
@jmatheson
Nov 23 2015 19:59
i am actually hoping to get the CGM glucose values from Dexcom since it is already plugged into my pi and then just upload it to NS from there while I am doing everything else.
Scott Leibrand
@scottleibrand
Nov 23 2015 20:00
ah. is it a Share receiver?
Jim Matheson
@jmatheson
Nov 23 2015 20:02
unclear. i have not received my new one yet. I am currently just using some sample BG data which I have on my pi from my old G4 that is a couple years old.
Scott Leibrand
@scottleibrand
Nov 23 2015 20:03
k. all new receivers should be Share, so most people upload BG that way, either using the Share bridge built into Nightscout, or the xDrip app if they have Android instead of iPhone.
Jim Matheson
@jmatheson
Nov 23 2015 20:03
i figure it is easier to have one connection point for my BG anway. That way i know for sure my loop will be acting on the same data i am seeing on my NS.
Ben West
@bewest
Nov 23 2015 20:04
that's only true in the US
so it's not true for most of world
Scott Leibrand
@scottleibrand
Nov 23 2015 20:04
right
Ben West
@bewest
Nov 23 2015 20:04
even in US
there's a long tail to replacing all units in a market
most units are still older units
they haven't been replaced yet
Scott Leibrand
@scottleibrand
Nov 23 2015 20:04
I'm talking about out of the 16 people currently looping, not the whole market
Jim Matheson
@jmatheson
Nov 23 2015 20:05
i assume i will be getting a share. i called last week and said i wanted a G4 isntead of G5. I am US based.
Ben West
@bewest
Nov 23 2015 20:05
ah, yeah
share for you
:-)
I'm working on python - ble link right now for share
that should go long way towards making wireless/local work better
btw, this doc is very very good
apparently rpi has ble built in
Jim Matheson
@jmatheson
Nov 23 2015 20:06
so did the group just give up on that script i mentioned above?
John Males
@johnmales
Nov 23 2015 20:07
@scottleibrand @bewest is the medtronic CGM upload functionaliy in oref0? It seems to me that it disappeared?
Ben West
@bewest
Nov 23 2015 20:07

bewest@hither:~/src/Adafruit_Python_BluefruitLE$ python examples/list_uarts.py 
Using adapter: hither
Searching for UART devices...
Press Ctrl-C to quit (will take ~30 seconds on OSX).
Found UART: DEXCOMRX [E8:37:9C:DB:FC:BD]
hmm
no
ns-upload entries
with mm-format-ns-glucose
there's two ways
ns-upload-entries
or ns-upload $NIGHTSCOUT_HOST $API_SECRET entries.json <file-to-upload.json>
where file to upload is output from eg mm-format-ns-glucose
John Males
@johnmales
Nov 23 2015 20:09
right in front of me - sorry
BTW the newer medtronic sensors which came out about the time of the 640g, but which work with the older pumps are definitely an improvement - seem to be more consistent and accurate than before. Can’t comment on how they compare to the dexcom though.
Ben West
@bewest
Nov 23 2015 20:12
good
I heard they were supposed to get much better
Scott Leibrand
@scottleibrand
Nov 23 2015 20:20
anecdotally they seem comparable with pediatric (pre-505) dexcom
Jim Matheson
@jmatheson
Nov 23 2015 20:30
thanks i will try that
Chris Oattes
@cjo20
Nov 23 2015 20:54
johnmales: you mean the "new" enlites?
John Males
@johnmales
Nov 23 2015 21:12
@cjo20 yes I do - comments were made by the family that they seem better, without my prompting. Could be placebo, but I agree they seem more accurate.
Have you had any experience with them?
Chris Oattes
@cjo20
Nov 23 2015 21:13
I'm using enlites now
and I used them before they changed too
(and I used the old sensors too)
Ben West
@bewest
Nov 23 2015 21:13
here's dexcom share vs standard g4:
standard g4 is the older line
dexcom share is the newer one taking over
blob
John Males
@johnmales
Nov 23 2015 21:37
Is that two sets of values from one sensor? If so why are they different?
Ben West
@bewest
Nov 23 2015 21:38
two receivers, the last calibration matches, but the previous 5 do not (or do not exist)
Jim Matheson
@jmatheson
Nov 23 2015 21:38
just reviewing determine basal to get a feel for what oref0 is doing. Seems like there is a typo here https://github.com/openaps/oref0/blob/dev/bin/oref0-determine-basal.js#L120
should be checking for min to be defined...
right?
Ben West
@bewest
Nov 23 2015 21:39
yeah, good catch
Scott Leibrand
@scottleibrand
Nov 23 2015 21:39
what, you don't think if (A && A) is useful? :)
want to PR that, or should we just fix it?
Ben West
@bewest
Nov 23 2015 21:40
PR
should be simple to rev this as patch release
eyim
@eyim
Nov 23 2015 21:42

@scottleibrand Hi Scott - Here is an example of where I would have prefered the system to keep a low temp going. It isn't exactly the same situation I described above but as I search my memory this is the case that made me decide to fiddle with things a bit. Basically if you look starting at 5 am, the system starts a high temp because of negative iob due to the low temp the previous 45 min or so (my guess as to what is happening since I no longer have the logs). Then he starts to drop (not because of the high temp - that is too quick). Openaps starts to low temp him once he hits 55 or so but goes back to normal basal around 65/70 by the looks of it around 5:40 am or so. I think on this day the target was 100 rather than our more normal 120. My personal preference would be to leave the low temp on longer even if that meant I overshoot a bit on the high side during the recovery.

I had thought the part of the code that governs this starts on line 166 on oref0-determine-basal. In this scenario I felt a comfortable level would be where threshold is set at profile.min_bg -10 rather than -30. I was trying to make the system leave on the low temp basal until 10 bg below the target rather than 30. Maybe I misread what the code does. Another way I could have handled this was to raise the target bg to 130 or so at night

John Males
@johnmales
Nov 23 2015 21:43
I see
eyim
@eyim
Nov 23 2015 21:43
blob
Again more of a personal preference than a bug of any sort
Scott Leibrand
@scottleibrand
Nov 23 2015 21:45
@eyim there are actually two numbers that make up target range: how wide do you normally have your range set?
ours is 110-120
eyim
@eyim
Nov 23 2015 21:46
@scottleibrand I set them to be the same. I don't do a range. Maybe something I should change ...
Scott Leibrand
@scottleibrand
Nov 23 2015 21:46
possibly, though not necessarily
looking through the scenario, one sec
from oref0's perspective, he rose 50 points in 5 minutes: it doesn't know about the time gap from the ??? state
Ben West
@bewest
Nov 23 2015 21:49
need more tools/refactoring
should bail out in scenarios from false delta
would be nice to be able to move determine basal to dcalc
get oref0/openaps combo to validate everything better and better
eyim
@eyim
Nov 23 2015 21:51
Yes I saw that happen in another case where I put in a blood sugar reading which popped up the latest reading and oref0 thought he was spiking way up and high temped him even though there was no real change. It was just the CGM resetting itself.
Scott Leibrand
@scottleibrand
Nov 23 2015 21:52
@eyim I think resuming normal basal at 80 or 90 would be appropriate when he has that much negative IOB (full hour without insulin). agreed that a 110 or 120 target is better than 100. we had discussed at some point making the low glucose suspend threshold some other formula than simple subtraction from min, to deal with people who set their min threshold too low...
wish we'd captured that discussion better, in an issue or something. was that @cjo20's idea?
Chris Oattes
@cjo20
Nov 23 2015 21:53
I don't know about my idea. I was part of the discussion
Scott Leibrand
@scottleibrand
Nov 23 2015 21:53
were you the one who did the comparison of the different formulas?
Chris Oattes
@cjo20
Nov 23 2015 21:54
yeah, plotted stuff in Excel, although I don't think I have that any longer
Scott Leibrand
@scottleibrand
Nov 23 2015 21:54
k
Oct 04, 8pm GMT
@scottleibrand: ^
Scott Leibrand
@scottleibrand
Nov 23 2015 22:01
thx
openaps/oref0#29
Scott Leibrand
@scottleibrand
Nov 23 2015 22:08
I'm leaning towards min_bg-0.5*(min_bg-50)
min_bg min_bg-30 min_bg-0.5*(min_bg-50)
90 60 70
100 70 75
110 80 80
120 90 85
130 100 90
Scott Leibrand
@scottleibrand
Nov 23 2015 22:14
I don't really want to copy a vendor implementation directly...
Lori
@LoriLori
Nov 23 2015 22:15
probably it doesn't work like described there
Scott Leibrand
@scottleibrand
Nov 23 2015 22:16
openaps/oref0@e4ac719
Lori
@LoriLori
Nov 23 2015 22:17
kind of missing point why massage min_bg :( because people set it low?
is there a connection between how determine basal works with min bg and this adjustment ?
Scott Leibrand
@scottleibrand
Nov 23 2015 22:22
we're not changing min_bg itself, we're changing how the LGS threshold is calculated
right now it's min_bg - 30 mg/dL, but for a min_bg of 90, that means a threshold of 60, which people feel is too low
Lori
@LoriLori
Nov 23 2015 22:23
why put there -30 ?
Scott Leibrand
@scottleibrand
Nov 23 2015 22:23
that's the current algorithm
this commit would change the algorithm from min_bg-30 to min_bg-0.5*(min_bg-50)
Lori
@LoriLori
Nov 23 2015 22:25
should it change it to min_bg = min_bg ? so that people set it to 90 will get 90 as low suspend?
Scott Leibrand
@scottleibrand
Nov 23 2015 22:25
no
min_bg is the lower end of your target range
normally, we don't trigger LGS at all: when eventualBG falls below min_bg, we low-temp enough to bring it back up to (min_bg+max_bg)/2
Lori
@LoriLori
Nov 23 2015 22:26
so threshold should be higher like my target is 100 then start suspend if 120 and droppping
Scott Leibrand
@scottleibrand
Nov 23 2015 22:26
we use IOB to calculate eventualBG, so that we are often low-temping when current BG is high but IOB is too much and will eventually bring BG down below target
so if you are 120 with 1U IOB, we will low-temp, probably to zero.
if you are 120 with 0 IOB (dropping for no reason), we will take the 15m deviation (how much you dropped over last 15m) and subtract that from 120 to get eventualBG
so if you're dropping fast, we will low-temp while you're still above your target range
Lori
@LoriLori
Nov 23 2015 22:28
kind of miss how is min_bg-0.5*(min_bg-50) related to eventual bg
Scott Leibrand
@scottleibrand
Nov 23 2015 22:28
it's not, at all
it's the backup low glucose suspend threshold
Lori
@LoriLori
Nov 23 2015 22:29
so why change it :(
Scott Leibrand
@scottleibrand
Nov 23 2015 22:29
if current bg is below that threshold, it temps to zero
regardless of how much positive or negative IOB you have
Lori
@LoriLori
Nov 23 2015 22:29
point is, why is min_bg-0.5*(min_bg-50) better then - 30
Scott Leibrand
@scottleibrand
Nov 23 2015 22:30
because 61 mg/dL and flat/falling is too low to be allowing normal basal delivery
Chris Oattes
@cjo20
Nov 23 2015 22:30
blob
Scott Leibrand
@scottleibrand
Nov 23 2015 22:30
this is a safety threshold to deal with people who set their min_bg too low
@cjo20 you can cut off everything left of 90
Jim Matheson
@jmatheson
Nov 23 2015 22:31
i think the new calc feels right.
Lori
@LoriLori
Nov 23 2015 22:31
what about system.exit(1), log.error(" Please setup you min bg higher"
Chris Oattes
@cjo20
Nov 23 2015 22:31
It might be better to implement it as 0.5 * min_bg + 25, for simplicity (with the original code in the comments)
Scott Leibrand
@scottleibrand
Nov 23 2015 22:32
@LorelaiL is it safer to exit() and allow pump to keep overdosing insulin, or temp to zero?
Lori
@LoriLori
Nov 23 2015 22:33
it would be at start of function to validate reasonable parametrs
it wouldn't do anything without good number
Scott Leibrand
@scottleibrand
Nov 23 2015 22:33
the problem is, you can't "not do anything". not setting a temp means letting the pump deliver its scheduled basal.
Chris Oattes
@cjo20
Nov 23 2015 22:34
@scottleibrand i was including it in case it was interesting for "what happens if a bad min_bg gets through"
Lori
@LoriLori
Nov 23 2015 22:34
when you setup openAPS it would print just error
please setup min_bg higher
Scott Leibrand
@scottleibrand
Nov 23 2015 22:34
yeah, it may not be a bad idea to do that too
but i don't think 90mg/dL is an entirely unreasonable low end of threshold range for some people
Lori
@LoriLori
Nov 23 2015 22:35
and I think if you look at history of runs, when it hits hard low suspend, it far too late
Scott Leibrand
@scottleibrand
Nov 23 2015 22:35
Lori
@LoriLori
Nov 23 2015 22:36
didn't know there is such thing :(
Jason Calabrese
@jasoncalabrese
Nov 23 2015 22:37
@danamlewis meal boluses is definitely what we need to work on, yesterday was a more tricky day hours at the pool, pizza for lunch, then Mexican food dinner
Feel like I'm trying to game the system too much for meals
Need to start considering carbs, then hopefully I can be more consistent
Scott Leibrand
@scottleibrand
Nov 23 2015 22:38
why are you not just bolusing normally for them?
oref0 isn't supposed to help with meal boluses: it's just supposed to smoothly take over afterward.
Jim Matheson
@jmatheson
Nov 23 2015 22:41
I run my bottom threshold at 90..
Ben West
@bewest
Nov 23 2015 22:41
yeah, counter to intuition/expectation, it assumes you are doing everything according to best rules
Dana Lewis
@danamlewis
Nov 23 2015 22:41
That's my point - do usual meal bolus, let loop pick up. Loop has problems with excessive IoB from human rage bolusing, but otherwise can deal toward the end of the meal.
Ben West
@bewest
Nov 23 2015 22:41
do you run with any upward/downard basal pressure?
I find if I'm 90, it's way too late for low temps to work
Scott Leibrand
@scottleibrand
Nov 23 2015 22:42
we keep basals neutral, and low-temps work fine at 90
Ben West
@bewest
Nov 23 2015 22:42
for me, with any downward pressure at all, the low temps need to start in low 110 - 104 area
Chris Oattes
@cjo20
Nov 23 2015 22:42
@bewest doesn't that depend on gradient?
Ben West
@bewest
Nov 23 2015 22:42
probably higher
Dana Lewis
@danamlewis
Nov 23 2015 22:43
@bewest If plummeting vs slowly drifting, differs
Ben West
@bewest
Nov 23 2015 22:43
right, I'm saying with any downward pressure, for me, low temp is not enough at 90
had interesting discussion with bruce b and ken s about this, too
Dana Lewis
@danamlewis
Nov 23 2015 22:43
Plummeting usually implies rage bolusing, heat activity from shower, extreme exercise kicking in, etc.
Scott Leibrand
@scottleibrand
Nov 23 2015 22:43
generally by the time she gets to 80 (LGS threshold w/ 110 min_bg) she has -0.5 to -1.0 IOB
@bewest what is the downward pressure from?
because you set basals too high?
Ben West
@bewest
Nov 23 2015 22:44
a low temp will take about 45 minutes to have any effect, and 60 - 90 minutes for liver to put out more
no, it's a simple timing thing
if the delta needed over 45 minutes exceeds this, low temp won't be enough
that's what defines the balance/tipping point
Scott Leibrand
@scottleibrand
Nov 23 2015 22:45
for us, if basals are correct, low-temps will prevent her from dropping below about 70-75
they don't start at 90, though. min_bg is 110
Lori
@LoriLori
Nov 23 2015 22:46
you hit "no two diabetes are the same"
Dana Lewis
@danamlewis
Nov 23 2015 22:46
@bewest Remind me what your targets are?
Ben West
@bewest
Nov 23 2015 22:46
it's about the delta needed over 45 - 90 minutes
there's some tipping point where low temp will work vs not
Scott Leibrand
@scottleibrand
Nov 23 2015 22:47
low temp will always work eventually, just a question of how low you'll go while waiting for it to work
Ben West
@bewest
Nov 23 2015 22:47
ok for comparison's apples-apples, sake, I'm defining working at 80
Dana Lewis
@danamlewis
Nov 23 2015 22:47
Also a definition of what is disbursed working. For me, not waking up and having to do carbs mean it works. I'm ok if I drift to 75 then come back up without requiring manual intervention. Even though <80 is technically low.
Ben West
@bewest
Nov 23 2015 22:47
could go to 70 too
right, that's why it's not about basal
Chris Oattes
@cjo20
Nov 23 2015 22:48
<80 technically low?
Ben West
@bewest
Nov 23 2015 22:48
and more about whatever downward vs upward pressure exists
the time in range tool considers 80 - 180
Dana Lewis
@danamlewis
Nov 23 2015 22:48
@cjo20 Low is considered to be < 80
Ben West
@bewest
Nov 23 2015 22:48
I was trained at 70, but whatever
Chris Oattes
@cjo20
Nov 23 2015 22:48
thats eems a bit high
Dana Lewis
@danamlewis
Nov 23 2015 22:49
Normal bg is 80-120. What people feel low at is a totally different story.
Ben West
@bewest
Nov 23 2015 22:49
normal bg for healthy people can go up to 180
it doesn't stay there
Dana Lewis
@danamlewis
Nov 23 2015 22:50
Before loop, I used to not like 70s because meant going low. Now, I don't mind if I dip to 75 and have negative IoB that brings me back up to range.
Right. *normal fasting is 80-120
Will be curious to see the variance different closed loops allow for mealtime excursions. Some of the commercial ones still have a spike like that (180+), but of course bring you back down
Matthias Granberry
@mgranberry
Nov 23 2015 22:55
but >105 fasting usually indicates poor insulin production. The 80-120 range doesn't mean much. Healthy pregnant women dip into the 60-70 range fairly frequently.
Chris Oattes
@cjo20
Nov 23 2015 22:55
70 isn't unhealthy
And in non-diabetics, I don't think there is any real impairment until closer to 60
Dana Lewis
@danamlewis
Nov 23 2015 22:57
It doesn't mean much yet it's the standard touted and that we are compared against
Matthias Granberry
@mgranberry
Nov 23 2015 22:57
below 70ish and the brain's response to low bg begins to become impaired. Best to avoid hanging out down there.
Ben West
@bewest
Nov 23 2015 22:58
thinking there is there's 20% room for doubt anyway
Matthias Granberry
@mgranberry
Nov 23 2015 22:59
I think it's better to an objective function that looks like LBGI/HBGI where the risk of hypoglycemia is weighted non-linearly as the value decreases
that particularly function is centered at 110, but other targets might be appropriate.
Ben West
@bewest
Nov 23 2015 23:00
I've been looking at some of david rodbards lbgi/hbgi stuff
there's an interesting triangle looking thing, wasn't sure about it
here's the comparison tool for time in range, go easy on this... wincing... http://bewest.labs.diabetes.watch/report/compare.html#
Chris Oattes
@cjo20
Nov 23 2015 23:01
it's blank for me :P
oh, it's slowly populating
Ben West
@bewest
Nov 23 2015 23:02
it slowly caches basically all sgvs into memory, day by day
rest api is bit sluggish... tried breaking it up into day by day requests, but then flooded server with too many small ones
Matthias Granberry
@mgranberry
Nov 23 2015 23:04
the core of lbgi/hbgi is this, scaled +/- 10x depending on whether it is low/high. It works pretty well for identifying periods where I go low.
    public fun rf(bg: Double): Double {
        return 1.509 * (Math.pow(Math.log(bg), 1.084) - 5.381)
    }
actually that's too simplistic.

    public fun rf(bg: Double): Double {
        return 1.509 * (Math.pow(Math.log(bg), 1.084) - 5.381)
    }

    public fun rl(bg: Double): Double {
        val rv = rf(bg)
        return if (rv < 0) -10 * rv else 0.0
    }

    public fun rh(bg: Double): Double {
        val rv = rf(bg)
        return if (rv > 0) 10 * rv else 0.0
    }

    public fun lbgi(records: List<BloodGlucoseRecord>): Double {
        return records.map { rl(it.value) }.average()
    }

    public fun hbgi(records: List<BloodGlucoseRecord>): Double {
        return records.map { rh(it.value) }.average()
    }
Matthias Granberry
@mgranberry
Nov 23 2015 23:09
it is rl is 0 above 110 and very high when low. rh is 0 below 110 and slowly gets high as BG gets high.