OpenAPS SMB and Panda Express

Panda Express isn’t the first thing most type 1s call a “fun time”.  It’s a lot of carbs, both slow and fast.  BUT, oh how Anna loves their orange chicken.  It was the first meal that had made us cry after diagnosis.  We were fresh off our first endocrinologist visit only few days before.  They’d emphasized still living life and “just count carbs and dose, you’ll be fine.”  We desperately wanted to not live in fear and give her a small bit of her old life back after what had been a very tough week.  We picked up a plate of orange chicken, carefully weighed out the food and calculated the carbs.  We bolused 6 units, waited 15 minutes and she ate.  When she was 398 mg/dl not long later, we all started to cry.  She swore off food.  I swore at diabetes (and orange chicken).  And all the insulin shots later to bring her down…oh we were miserable.

Things got better though.  We learned that fats and proteins needed to be involved in all those dosing decisions  We learned that we needed to split the insulin up over time to keep her from going low early and high later.  We learned that weighing food was not going to happen very often for us and we needed to get better at eyeballing.  But, we also still ended up staying up late at night giving multiple corrections, usually to treat lingering high BGs and then eventually to treat a low BG when the food finally gave up.

So where do we stand on Panda now?  We do pretty well, but it takes about 16 units and the meal lasts close to 7 hours of impacts to BG.  We’ve learned through trial and error about how and when to split up the total needed bolus over time to help get smoother BGs.  But, there’s still some difficulty to that.  Mostly the first part is easy…we give about 8 units of insulin at least 30 minutes ahead.  Another 3-4 units about 5 minutes before eating.  And another 2-3 units usually just after she eats.

The hard part is knowing what to do nearly three hours later when the first boluses have lost their steam, but the chow mein noodles are still plugging away.  I always wonder when the right time to do that tailing bolus is.  And how much.  Of course, doing all this in the middle of the night adds to the fun.

Let’s cut to the chase…I wanted to see how Panda did using SMB and what I may (or may not) notice as a result.  Below is a comparison photo of Panda meals.  On the left is Panda on normal OpenAPS use.  On the right is Panda on SMB OpenAPS use.

loop-panda

Overall they don’t look THAT different, but there were some really notable difference in experience.

Early low on the left?  That was just my bad…too much early bolus.  We cut back on how much we gave up front…so that was human error.  After that though is the interesting part.  And probably the part that will be the hardest part for people to wrap their brains around in SMB use.  See that large long swath of suspended basal in the SMB side?  Yeah…traditionally it would be the opposite of what you’d want to see in a meal with large carbs that hits hard later.  BUT…bear with me as we talk through the math and logic (and safety).

The interesting part begins when OpenAPS first starts to see a significant carb impact.  It’s set its first SMB of 0.1 earlier. And maybe it was prepping to give more?

IMG_2898And now let’s see what the logic is for the looping decisions now by looking at the OpenAPS pill…

IMG_2899

The loop has seen a positive “deviation” (Dev: 165) meaning BGs have gone up more than the rig had expected.  The Eventual BG is predicted to be 170 vs my normal target of 90.  The loop also predicts that an extra 1.58 units of insulin will be needed to bring Anna back to target eventually (HOW COOL IS THAT NUGGET OF INFO?!).

And here’s where the SMB logic absolutely caused me panic and confusion when I first saw it.  The loop sets a 90 min temp basal and only gives 0.4 units of super microbolus.  Myself thinking “OMG.  WHAT?!  Suspending in the middle of a Panda Express meal for 90 minutes?!  And ONLY 0.4 units when it knows it needs 1.58 units?”

So…these panic points need a little explanation and understanding of the SMB logic and safety points.  The key part is to remember that SMB is designed to give you reasonably SAFE amounts of bolus needed upfront and use suspensions to balance them out.  Suspensions will be part of the regular looping behavior in SMB mode.  Suspensions can vary in duration…all the way up to 120 mins long.  These suspensions are important safety factors because if the rig has been front-loading you with SMBs and the rig suddenly fails…you want that longer temp basal to help keep you safe.

Single SMB amounts are limited by several factors.  The largest a single SMB bolus can be is the SMALLEST value of:

  • 30 minutes of the current regular basal rate, or
  • 1/3 of the Insulin Required amount, or
  • the remaining portion of your max-iob setting in preferences.

For Anna, her regular basal rate is about 0.8 u/hour therefore we’d never see a SMB given greater than 0.4 units typically.

SMBs can be administered every 5 minutes.  If SMB thinks Anna is going high, it would be able to administer approximately 5 units in an hour of SMB use (assuming the other two factors were not limiting doses).  That’s a lot of insulin…more than enough to make up for the 0.8 units that would be suspended for safety-sake during that same period of time.  So, the suspension really isn’t that much of an issue in the overall math and loop ability to administer sufficient insulin.  But, if you really missed a whole bolus for a meal that needs nearly 16 units to control…yeah, you’re still gonna have a high BG before coming down.  Bolusing is still important in looping if you want to stay near target range.

The next part…why doesn’t the loop just turn the regular basal (or a high temp basal) on while it’s also giving SMBs to more quickly give the required insulin?  SAFETY.  This system still needs to keep safety in mind (and you want it to).  If the deviations and trends show a real need, those suspensions will be canceled…but only when they safely can be.  The loop needs to see the deviations and BG predictions and IOB all showing that it would be safe to do so.

If she needed 1.6 units of insulin extra, that could be delivered in just 12-15 minutes with SMB.  That’s not a long time to sacrifice for safety sake to make sure that all that insulin is still needed.  Makes sense to confirm the need by collecting a little bit of BG trend to confirm that need, rather than laying it all on at once.  Remember…this isn’t a rage bolus loop.  😉

Ok, so then what happens a little later?  Just as I suspected…chow mein noodles are really coming on now.  But, SMB had been adding to the IOB and helping out every 3 minutes.  I also knew that around this time is when I normally give the start of the 2-3 boluses that chase the Chinese Food effect.

IMG_2901

So, I looked at the OpenAPS pill to see what the logic was offering up at this point in the game.

IMG_2900

Now it’s showing an Eventual BG of 401 (probably not that far off for what Panda has shown us in the past).  The loop was still setting SMBs but now the Insulin Required had grown to 3.96 units.  That confirmed what I suspected.  This is the part in the meal that the tail bolusing needed to start.  And normally this is where I kick myself that I’d missed the rise.  I was going to be chasing this rise…ugh.  I chose to give 2 units of the 3.96 units it wanted.  I figured that was sort of split the middle and provide some help, but also give some wiggle room if the meal also suddenly stopped BG impacts.  After all, diabetes rarely does the same things exactly the same in repeated experiments.

It worked great…except it was about 11:30pm, and I was ready to stop watching the experiment and go to bed.  I still had (my old logic) in my head that I’d probably waited too long to give that last bolus.  So, i gave another unit absentmindedly and called it a night.

IMG_2906

Except it turns out that was a mistake.  I’d underestimated (and not looked at) how much the SMBs had been doing before 11:30pm.  That last bolus was not necessary.  So I gave a little juice (hence the climb at midnight) and then really called it a night.  Lesson learned (again): SMB do an excellent job of fine tune fixing when the insulin required is less than about 2-3 units.  Not a good idea to give extra corrections when the insulin required is that little (I cannot believe how I’m even able to write that 2-3 units is a loop correctable within comfort zone amount now…freaking amazing).

As you can see, SMB and OpenAPS took care of the rest of that meal no problem at all.  In fact, it saved me an extra bolus AND a temp target in the middle of the night that I used to have to do.  Thumbs UP.  I’m all for more sleep and less manual bolusing in the middle of the night.  And we got to wake up to this:

openaps-panda

Kind of funny to see that my error caused the worst BG of the night.

My lesson from this:  SMB is a good help to know WHEN to do later boluses in extended bolus-type meals.  The Insulin Required estimate is a good help for deciding when a manual correction is needed and to provide a rough estimate of how much to give.  If the Insulin Required is over about 2-3 units, we will use that as an indication that a manual bolus will help.  I will likely never give the whole amount (since large meals are prone to so much carb counting error), but giving about half the required amount and letting SMB pick up the sloppy edges worked really well.

There’s a couple other random lessons about see RAW data (did you notice that her CGM pooped out early in the meal?!) and using bolus menu while SMBs are enacted (might require some habit changes…we are thinking about how to handle that).  I’ll post those items separately when I have more time.  Now I need to prepare…Anna has a BOY coming over to the house tonight so we can meet him before we allow a “date”.  Can’t wait to see the BGs from that.

Leave a Reply

Your email address will not be published.