What conclusions can we draw when investigating Insulin Sensitivity using the Autosens function within #OpenAPS? An n=1 study

What conclusions can we draw when investigating Insulin Sensitivity using the Autosens function within #OpenAPS. An n=1 study
What conclusions can we draw when investigating Insulin Sensitivity using the Autosens function within #OpenAPS. An n=1 study

As we know, OpenAPS is an open source software platform that allows users to build their own artificial pancreas, and as a result, the way it captures data and calculates the various factors it uses to determine the best course of action is completely transparent (at least,  transparent if you can read through javascript and python and interpret log data). This openness allows anyone to pick it up and use it, but it also provides access to information that we don’t readily have available as normal human beings.

The data it provides creates some amazing opportunities to undertake research into various aspects of living with diabetes that are not obviously available elsewhere, and in this case, for me, it is insulin sensitivity.

For some time, OpenAPS has had an advanced feature known as Autosens. This automatically calculates insulin sensitivity and then adjusts basal rate and insulin sensitivity factor accordingly. The mechanism that is uses to do this is detailed on Dana’s site. Basically, what it does is:

It looks at each BG data point for the last 24 hours and calculates the delta (actual observed change) over the last 5 minutes. It then compares it to “BGI” (blood glucose impact, which is how much BG *should* be dropping from insulin alone), and assesses the “deviations” (differences between the delta and BGI).

Details of BGI can be found in the OpenAPS reference design document.

Autosens calculates a ratio that it then applies it to basal rate and ISF.

With a small script, it’s possible to capture this ratio data and observe a time series dataset of insulin sensitivity, and map it to things like exercise, foods, etc. It also offers, amongst the OpenAPS community, an effect tool to undertake a small cohort study looking at the effects of any of these factors on a small sample population. But before we jump ahead of ourselves with a proper study, I’ve been undertaking some preliminary investigations to see the effects of various activities on my body and the patterns that emerge, and this is the outcome.

Ahead of the details, I’m a 41 year old male with a current weight of 97kg. Most of the work day I’m fairly sedentary and I do various bits of exercise throughout the week, including resistance training in the gym and cycling 8 miles to and from work. Over the course of the data capture period, I’ve not been eating a very low carb diet, more of a medium-low carb diet (averaging at around 130g per day). I’m aware that these things all have an effect on my insulin sensitivity (IS), but I’ve never tracked it, until now. And the results of doing so are interesting, if not necessarily surprising.

The data…

I’ve collected data for seven days, and attempted to see over that time period, what happens with exercise and anything else that could affect sensitivity. To kick the process off, I decided to start collecting data a few hours ahead of heading to the gym, to see what the effects on my IS would be of that, after having spent a few weeks not going. The measured ISF that that Autosens was showing at the start was 1.24x what I had registered in my pump, and the following graph shows how that has changed over the week following it, with various activity items highlighted in situ.

The chart shows insulin sensitivity ratio to the settings on the pump, so where the value is greater than one, I am less sensitive (I need more insulin to achieve the same adjustment in glucose level) and where it is less than one I am more sensitive (I need less insulin to achieve the same adjustment in glucose level).

For completeness, this is my step count metrics over the past week and a bit. As you can see, it varies a little on a day by day basis, but when we compare that to the sensitivity data set, it doesn’t seem to make a lot of difference.

Looking at the overall week chart, it shows the three periods of exercise that I undertook during the week. The first was a gym session that consisted of:

  • 5 x 10 Squats carrying 60kg interspersed with;
  • 5 x 10 press-ups

The second was:

  • Superset: 3 x 10 deadlifts @ 90kg / 3 x 8 pull ups
  • Superset: 3 x 10 barbell rows @ 50hg / 3 x 10 press-ups
  • 3 x 10 Hamstring curls @ 75kg

Finally we had the T20 Cricket Match, in which I fielded for 20 overs, accumulating about 18,000 steps on the day, of which roughly 7,000 of those were on the cricket pitch, and which included bowling four overs, which constitutes a brief period of HIIT type activity in bursts of 3 mins on, 3 mins off.

There are also some periods where the data looks a little iffy, the reasons for which are shown on the chart.

The two interesting things to note in the chart are the improvements in insulin sensitivity after the gym sessions, and the notable lack of any beneficial variation after the cricket match, suggesting that some forms of cricket are not really exercise… Both workouts resulted in noticeable improvements, with the first less intense showing an improvement of around 20% in sensitivity, and the second, more intense, showing an improvement of around 33%.

What’s not shown on the chart is the preceding few days, where my IS was holding steady around the 1.2 level, based on OpenAPS stored data.

It’s worth noting that I found management after the second gym session really tough as I was struggling with not paying attention to the ratio, and over bolusing for food. In this more sensitive state (likely due to more available GLUT4 receptors), Fiasp was working extremely fast and I was having to bolus post meal to avoid drops occurring early.

When we look at this on a day by day basis, we see the following:

Taking the two charts in concert, we can see that post the gym sessions, IS increased soon after the sessions, but didn’t hit peak increase until the morning of the day following. This is consistent with the behaviour I used to undertake when using MDI, where my evening basal insulin after a gym session was reduced.

What we then see is that about 36 hours after the gym session, insulin sensitivity reverts back to roughly the level it was before the gym, or maybe slightly better. Based on previous experience, if the gym sessions are kept two to three days apart, I maintain that sensitivity level. If I extend the time off, my sensitivity gets worse to a maximum of about 25% greater insulin requirement than my average.

Talking of the average, if we replace all 7 days data with an average ratio, we get the picture below:

Which is remarkably close to a ratio of 1 (which is what you’d hope) and shows how I’ve adjusted my ISF settings to manage within the variation of what I experience reasonably well when training regularly.

Another point of note is that there doesn’t seem to be any variation that I can attribute to the sets I use on my pump, at least on my current two day change out schedule. If there is an effect, it seems fairly small on this change cycle. it would be interesting to keep a set running for longer to see if it has any effect.

What conclusions can we draw from this n=1 observational study?

What’s very clear is that for me, post a resistance training session, my major IS improvements don’t occur immediately afterwards, but in the following eight to twelve hours, and then persist for a further twelve to twenty four hours. This is likely down to the immediate aftermath of the stress that weights put the body through, the use of glycogen and then the replenishing of glycogen stores.

The immediate takeaway from this point is:

I need to adjust my insulin ratios for bolusing on the day after a gym session. I also need less insulin for most of the day afterwards, so using a pump it would make sense to set up a “Post-Gym day” basal schedule, and if on MDI, use less basal.

This is something that has been seen in a number of trials that have been undertaken in places like Swansea University, but I’m not sure that they’ve been able to clearly map sensitivity in this way.

Secondly, regular resistance training helps to keep insulin sensitivity higher, i.e I don’t need as much insulin. Anecdotally I could have told you this, but it’s starkly here in multicolour.

Finally, having a mechanism to provide a clear value for how much to adjust your boluses by as IS changes is incredibly useful, and even more so with an insulin like Fiasp, which seems to be even more affected by these changes than traditional fast acting insulins. Incorporating this variation data into a bolus wizard would make it much more convenient to use and would add an additional level of safety into bolusing.

Where do we take this next?

This n=1 study allows me to draw conclusions about myself, and while I can extrapolate them to a population, it’s clearly not a statistically safe thing to do.

As a set of next steps, I’d like to get a group of 10-20 OpenAPS users to undertake a defined exercise programme and capture that data to see how reaction to this exercise varies and to try and draw some better conclusions across a broader sample size. With data like this, it would provide a better way to understand how insulin sensitivity typically varies and potentially provide a better insight into how to manage type 1 diabetes post-exercise, and not just during it.


  1. Interesting. Could you point me in the direction on how to retrieve the data?
    Seems like you ended up putting data in excel and are showing excel charts?
    ISF changes are not stored in Mlab are they, i.e. accessible through NS? Papertrail stores them for sure.

    • There is a small script that can be used on the rig that simply generates a log file. I extracted the data from this and used it in excel to create the graph. I’ll update the post to clarify how to do that. Mlab (and Papertrail) store ISF. What we’re looking at here is the Sens ratio, which isn’t currently in that data set.

Leave a Reply

Your email address will not be published.