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

3rd
Apr 2018
Alexander Teepe
@ateepe
Apr 03 2018 00:00
It's not my setup exactly. I'm a CS student doing my senior design group project on writing an improved control algorithm for our customer, who has been running Loop on his iphone and is publishing data to NightScout. The control algorithm will be running on a Raspberry Pi 3. We are pulling all sgv, iob, cob, and treatment data from Nightscout's web api. The only thing we needed OpenAPS for is programmatically checking what the recommended basal rate is (as a starting point from which we'll adjust up or down) and to send commands to the pump.
James Babcock
@jimrandomh
Apr 03 2018 00:01
That BG-target setting is wrong. If you ignore OpenAPS and use the bolus wizard, generally you tell it your BG and it gives you a correction bolus to lower you to the top of that range; if you're below the bottom of the range, it subtracts off of a meal bolus to bring you up to the bottom of the range. So if you set a huge range, what you're doing is turning correction boluses off.
I'm not sure how OpenAPS will respond to that weird setting, but I don't think it'll be good.
Possibly very not good. Definitely don't continue using with those settings.
Paul Heltzel
@pheltzel
Apr 03 2018 00:03
Thanks, James--you're talking about the Bolus Wizard Setup settings?
James Babcock
@jimrandomh
Apr 03 2018 00:03
@pheltzel Yes
Paul Heltzel
@pheltzel
Apr 03 2018 00:04
Again, I think I'm misunderstanding this but I thought the top end was ignored by OpenAPS, but was meant to keep the pump from double-dipping by correcting while being unaware of the OpenAPS-driven temp basals.
James Babcock
@jimrandomh
Apr 03 2018 00:04
@ateepe So he doesn't currently have any automated closed-loop thing in place?
Paul Heltzel
@pheltzel
Apr 03 2018 00:05
"If you use the Boluz Wizard, ensure the high end of the BG target range is a high number such as 250 mg/dL. OpenAPS default behavior (wide_bg_target_range preference) is to only use the target range lower end. Setting the high end does not impact the OpenAPS algorithms." http://openaps.readthedocs.io/en/latest/docs/Customize-Iterate/usability-considerations.html?highlight=250
But you're saying to get that range tightened up on the medtronic?
James Babcock
@jimrandomh
Apr 03 2018 00:06
Okay, I may be misunderstanding that, then
Yeah, forget what I said earlier, that was incorrect
Paul Heltzel
@pheltzel
Apr 03 2018 00:07
There's definitely discussion of too wide a range causing trouble, I'm just not sure where to close the gap. I've just now made the targets tighter in Heroku (BG_TARGET_BOTTOM/BG_TARGET_TOP)
James Babcock
@jimrandomh
Apr 03 2018 00:08
Do you have Nightscout configured to show you what the temp basals are? Does it look like it's setting high temps to try to bring your BG down?
Paul Heltzel
@pheltzel
Apr 03 2018 00:09
James Babcock
@jimrandomh
Apr 03 2018 00:10
I notice that records a recent fingerstick test of 99, at a time when the CGM was supposedly reading 180?
Is that real data?
Paul Heltzel
@pheltzel
Apr 03 2018 00:11
I've seen it at more than 2x my normal max basal today. Just in terms of a snapshot this makes sense to me -- I'm high (197) but there's 4U of IOB
Huh, weird, I don't know what that 99 fingerstick data point is.
I did a site change but I don't remember seeing 99 at all.
James Babcock
@jimrandomh
Apr 03 2018 00:12
I'd do a calibration now to be safe
Paul Heltzel
@pheltzel
Apr 03 2018 00:13
OK, thanks. I noted a correction bolus in NS b/c I was high but had to swap a new infusion set. I'm finding when I'm disconnected I need a unit or two or I spike.
James Babcock
@jimrandomh
Apr 03 2018 00:14
Some of that graph looks implausible as anything other than unreliable-CGM-sensor troubles. When was the sensor changed, what kind of sensor is it and was it pre-soaked?
Alexander Teepe
@ateepe
Apr 03 2018 00:18
@jimrandomh No, Loop is acting as the closed-loop system right now. He's running it on his phone and wearing a trasmitter to communicate with the pump and automatically control the insulin treatments. The reason we're switching to OpenAPS and a raspberry pi is because we're writing our own control algorithm that uses tensorflow to predict what basal rate to use, and needs to run on dedicated hardware. We're using OpenAPS's determine-basal function to get what the "default" basal rate setting would be, use tensorflow to predict how the blood glucose levels will react at the current rate, and use that to increase or decrease the basal. Loop is already making basal rate decisions, but the problem is that it sends them directly to pump, and then we would have to retroactively read what Loop sent to the pump (from NighScout) and then overwrite the command with a new basal. With OpenAPS, we want to intercept what the basal would be before it goes to the pump (by calling that determine-basal script), and then change it before sending the pump command.
James Babcock
@jimrandomh
Apr 03 2018 00:20
@ateepe Do you know about supermicroboluses?
Paul Heltzel
@pheltzel
Apr 03 2018 00:21
Thanks, James. The sensor is more than a week old, I hadn't thought about that. I had read about presoaking, but like I was saying I'm only on day 3. I had tried to go 'high and wide' to just be conservative and watch it a lot.
Alexander Teepe
@ateepe
Apr 03 2018 00:21
@jimrandomh not exactly
James Babcock
@jimrandomh
Apr 03 2018 00:21
Pre-soaking just means not using a sensor on its first half-day to a day
Paul Heltzel
@pheltzel
Apr 03 2018 00:21
I've been calibrating a couple times a day and it's been accurate. But you're right, it's way off now.
Jeremy Cunningham
@jpcunningh
Apr 03 2018 00:22
@pheltzel , the pump site change record is showing that 180 units were delivered. I believe the insulin field in the Pump Site change record is for if you gave a bolus when you change the site. It isn't affecting anything because OpenAPS only uses the data it retrieves from the pump history, but it is covering up good NS info. :smile:
Paul Heltzel
@pheltzel
Apr 03 2018 00:22
I've read about SMBs but I was just trying to get a baseline. I'm definitely interested, just still v. much in tuning phase.
Thanks, Jeremy. I had just been using the bolus wizard, and today started adding data in NS. I need watch that.
James Babcock
@jimrandomh
Apr 03 2018 00:25
@ateepe OpenAPS (with advanced config settings enabled) doesn't just control basal, it also gives boluses. Basically the trick is, you take basal from the future and "borrow" it and give it immediately. This gives an effect kind of like having a faster-acting insulin than the insulin you actually have.
@ateepe This means that if you want to reproduce OpenAPS' algorithm in Loop, determine-basal isn't the only thing you have to worry about.
Jeremy Cunningham
@jpcunningh
Apr 03 2018 00:27
Autotune only moves the basals 20% of the calculated basal adjustment needed in one run. If the basal rates are significantly off, it will take several days for it to "tune" into them. We faced the same result when we started where it left us running high because the basal rates we started with were lower than what was really required. If you are consistently running high with a positive IOB, chances are very good that Autotune will continue to increase your basal rates day over day as it runs in the morning.
Paul Heltzel
@pheltzel
Apr 03 2018 00:28
Autotune is suggesting basals that were very similar to what I had set up. I did a few days of very low carb and small adjustments since I moved from the Omnipod.
Is it possible to edit a faulty data point in NS?
Jeremy Cunningham
@jpcunningh
Apr 03 2018 00:28
The OpenAPS algorithm doesn't use the NightScout BG_TARGET_BOTTOM/BG_TARGET_TOP settings for decisions. Those are only used for NS display and the High and Low alarms from NS.
Paul Heltzel
@pheltzel
Apr 03 2018 00:29
Got it, thanks Jeremy. There's been some talk of tightening up the range--but I'm not sure where that would be if not in NS or the bolus wizard settings.
Jeremy Cunningham
@jpcunningh
Apr 03 2018 00:30
Yes, if you go to the reports and run the treatment report, it will provide a table for the results. Find the treatment entry in the table and click the little pencil icon on the left side. You may have to "Authenticate" by clicking the Authenticate link at the bottom of the page. Put in your API_SECRET value when it ask you to Authenticate.
Unless you have the OpenAPS preference wide_bg_target_range set to true in your ~/myopenaps/preferences.json file, OpenAPS uses the low target set in your pump's bolus wizard settings. It doesn't use the high target at all.
Paul Heltzel
@pheltzel
Apr 03 2018 00:34
That's what I thought. I'm pretty sure I'm misunderstanding something. But it sounds like the range on the pump is ok (and is set per the online documentation to avoid double dipping.)
And the ranges on NS are just for reporting.
Dana had posted something on the FB group but it was from Aug. 2017 -- "I've noticed a couple of people mention having non-optimal (i.e. not as great as they'd like) outcomes with their DIY system of choice. One thing I've noticed in common in many of these situations is very wide target ranges. You may want to think about your target ranges, and how your DIY system behaves given the target range. But keep in mind, if your target is very wide (say, 50 or more points wide), I've observed many people being frustrated by expecting an algorithm to be doing something and it's not (because BG is eventually predicted to be in that wide range). You may want to experiment with adjusting your targets to be a closer together range (say, 20 points apart instead of 50), and observe how the behavior of your system changes as a result."
So I was hunting for some place to tighten up the range. But maybe that's no longer an issue.
Jeremy Cunningham
@jpcunningh
Apr 03 2018 00:40
That's before we found OpenAPS, so it's very possible how it uses the high target has been modified since then. It's always getting better! :smile:
Paul Heltzel
@pheltzel
Apr 03 2018 00:41
Gotcha, thanks--and thx for the tip on removing an errant treatment. That worked great.
So it sounds like I just need to make sure the infusion site is good, be contentious about calibrating and maybe presoak/do a sensor change. Then explore SMBs.
Scott Leibrand
@scottleibrand
Apr 03 2018 00:45
@pheltzel yeah, that sounds correct. unless you've explicitly enabled wide target ranges in your preferences.json, the new OpenAPS behavior (as of 0.6.0 I believe) is to only use the low target, as you noted in the docs
That Aug 2017 behavior would've been the old (oref 0.5.x I believe) behavior where it used both by default
@ateepe that sounds like a really interesting project. it might be easier if we move the algorithm-enhancement discussion over to https://gitter.im/openaps/oref0 to avoid getting drowned out by the various troubleshooting that occurs here.
Paul Heltzel
@pheltzel
Apr 03 2018 00:47
Got it. Thanks everybody, that's super helpful.
Scott Leibrand
@scottleibrand
Apr 03 2018 00:52
@ateepe I replied over there as well: https://gitter.im/openaps/oref0?at=5ac2cf4cc4d0ae80072bb123
Martin Haeberli
@mhaeberli
Apr 03 2018 05:56
i recall seeing a post recently saying that I can adjust the maximum time SMB can extend, for example, after a carb announcement ? (hints for keyword would be appreciated to aid googling)
maxSMBBasalminutes
Scott Leibrand
@scottleibrand
Apr 03 2018 06:34
Was that what you were looking for, or something else?
Martin Haeberli
@mhaeberli
Apr 03 2018 08:17
Indeed-that was it! Thx @scottleibrand
j4cbo
@j4cbo
Apr 03 2018 13:34
sigh. I’m going back to Novolog.
35 units Saturday, 60 units Sunday
woke up at 275 at 5am despite 18U delivered so far (usual basal 1u/hr)
f u Fiasp
James Babcock
@jimrandomh
Apr 03 2018 13:38
That sounds like it might be an infusion set problem?
live4sw
@live4sw
Apr 03 2018 13:39
@j4cbo How long had you been on Fiasp? I just finished my first month and it was like a miracle for the first 3 weeks, and since then I've had a lot of resistance, but I also have a very bad cold, so I'm withholding judgment until I'm better.
j4cbo
@j4cbo
Apr 03 2018 13:40
this is 50/50 Fiasp/Novolog; I’ve been on it for about 4 months
and it seems to be getting slowly worse
Dana Lewis
@danamlewis
Apr 03 2018 13:51
Have you been particularly inactive? I find that if I do zero activity, and/or have no vitamin D, my tdd jumps up significantly. But, is resolved with getting even a little bit of movement in the day and taking vitamin d. (I know many people have fiasp problems, but throwing that out there as another possibility, too, if you're not sure)
ideeagit
@ideeagit
Apr 03 2018 14:40
I am still thinking about a right visualization of my openAPS which is used with nightscout. The Pebble watch is a good option but isn't there a possibility to use AndroidAps to visualize all the openAps data and also do careportal entries?
James Babcock
@jimrandomh
Apr 03 2018 14:51
Personally I just put a bookmark to the Nightscout site on my Android home screen. It's not perfect - a widget would be better - but it's not bad.
connormilton
@connormilton
Apr 03 2018 16:44
Hey guys, I might be missing the obvious, however I cant seem to find a command to show the output from autotune? It should be running automatically. I'm oref 0.6.0 . I've read the autotune tabs and it will seems to point at how to run it manually. What I'm I missing?
Scott Leibrand
@scottleibrand
Apr 03 2018 16:59
cat-autotune
thisistw
@thisistw
Apr 03 2018 19:35

Can anyone offer advice on copying autotune from rig1 to rig2, im trying to follow http://openaps.readthedocs.io/en/master/docs/Customize-Iterate/autotune.html?highlight=copy%20over%20autotune#how-to-copy-over-autotune-files-from-another-rig

I seem to get "couldnot resolve host name", I've substituted rig name, do you need to substitute the "local" for an IP address or similar?

Both rigs are connected with PuTTY...
Scott Leibrand
@scottleibrand
Apr 03 2018 19:51
can you copy and paste the exact command you're running and its output?
thisistw
@thisistw
Apr 03 2018 19:52
scp -r root@Edd209.local:~/myopenaps/autotune/ ~/myopenaps/autotune
where Edd209 is the original rig
(sorry if Im doing something stupid)
and im running the command in PuTTY of the new rig
Scott Leibrand
@scottleibrand
Apr 03 2018 19:55
that command looks right. are both rigs on the same wifi network?
you can run ifconfig wlan0 on both to get their IP addresses, make sure they're on the same subnet (only the last number should differ), and then try replacing Edd209.local with the IP of the rig
thisistw
@thisistw
Apr 03 2018 19:57
I tried that earlier and it said something about no route
(just reconnecting to both rigs to try again)
Ahh FANTASTIC that just worked
Thanks scott
Scott Leibrand
@scottleibrand
Apr 03 2018 20:04
:+1:
Martin Haeberli
@mhaeberli
Apr 03 2018 21:19
IMG_2566.PNG
IMG_2567.PNG
IMG_2568.PNG
so the question related to the above is: - narrow, high (150,150) temp target set; patient sleeping; how to prevent any temp basal above zero when already well below target. [bonus question - how/why such a long drift down from 150 -> … (it went all the way to 67!) with a long zero temp… theoretically no IOB, no COB]
like - is there a setting we can use?
Martin Haeberli
@mhaeberli
Apr 03 2018 21:25
at 67 - patient was woken remotely and added carbs …!
Scott Leibrand
@scottleibrand
Apr 03 2018 21:28
looks like you have high_temptarget_raises_sensitivity set to false?
Scott Leibrand
@scottleibrand
Apr 03 2018 21:35
that (or its synonym, exercise_mode) would definitely help
Martin Haeberli
@mhaeberli
Apr 03 2018 21:36
so maybe should set to ‘true;?
  • my personal theory is that she was very active during the day and it all caught up to her...
btw, if i edit preferences.json, do I need to re-run oref0-runagain, etc, or kill and restart oref0? or reboot? or just go with it?
ps - ‘was woken remotely’ is never as easy as it sounds ...
Scott Leibrand
@scottleibrand
Apr 03 2018 21:42
heh, I bet it wasn't.
you can just edit preferences.json and it will get automatically picked up within 15m
Martin Haeberli
@mhaeberli
Apr 03 2018 21:43
k thx
Scott Leibrand
@scottleibrand
Apr 03 2018 21:44
yeah, with this option, if there was activity you can manually set a high target to trigger sensitivity (instead of the 112% resistance you were actually seeing)
This message was deleted
Martin Haeberli
@mhaeberli
Apr 03 2018 21:44
any other way to set some threshold below which basal won’t resume
Scott Leibrand
@scottleibrand
Apr 03 2018 21:44
that is set automatically based on your target
although even with that it will still resume in certain narrow circumstances
for a normal target the threshold usually ends up being around 70
Martin Haeberli
@mhaeberli
Apr 03 2018 21:45
which are…?
right so for target high and low 150,150 vs 120 that would be maybe 88?
Scott Leibrand
@scottleibrand
Apr 03 2018 21:46
var threshold = min_bg - 0.5*(min_bg-40);
Martin Haeberli
@mhaeberli
Apr 03 2018 21:46
i get 95
Scott Leibrand
@scottleibrand
Apr 03 2018 21:46
with what inputs?
Martin Haeberli
@mhaeberli
Apr 03 2018 21:47
minbg 150
Scott Leibrand
@scottleibrand
Apr 03 2018 21:49
// don't low glucose suspend if IOB is already super negative and BG is rising faster than predicted
if (bg < threshold && iob_data.iob < -profile.current_basal*20/60 && minDelta > 0 && minDelta > expectedDelta) {
    rT.reason += "IOB "+iob_data.iob+" < " + round(-profile.current_basal*20/60,2);
    rT.reason += " and minDelta " + convert_bg(minDelta, profile) + " > " + "expectedDelta " + convert_bg(expectedDelta, profile) + "; ";
// predictive low glucose suspend mode: BG is / is projected to be < threshold
} else if ( bg < threshold || minGuardBG < threshold ) {
so yeah, with that target of 150, then once bg or minGuardBG goes below 95 it zero temps unless IOB is super negative and BG is rising fast
Martin Haeberli
@mhaeberli
Apr 03 2018 21:51
ok thx
i haven’t yet been able to beam in and change, but i’ll fix sensistivity ASAP
wondering whether there are some FAQs on tuning for optimum - we’re seeing some wide swings from time to time… …