DynamicISF – an update

Going back to the summer of last year, we rolled out an initial version of DynamicISF, based on user data gathered by Chris Wilson, and submitted to the Dev branch of AndroidAPS, where it has been working, alongside a version in FreeAPSX. Most of the details of that were discussed in this post.

Since the initial implementation, the model and deployment have been refined, to what we have today. This post provides an update on that.

What’s changed?

The calculation

Firstly, the DynamicISF calculation has evolved. It is now based around a natural logarithmic function that takes into account total daily dose of insulin, the peak time of the insulin and current glucose level. The equation is shown below:

variableSensitivity = 1800 / (tdd * (ln((glucoseStatus.glucose / insulinDivisor) + 1)))

As you can see, we’ve ended up in a place where it superficially appears similar to the “1800” rule.

TDD is total daily dose, modified by an adjustment factor if required. TDD is calculated using an average of the 7-day average TDD, the previous day’s TDD and an extrapolation of the weighted average of the last eight hours, weighted to the last four. This mix is used to try and capture whether more insulin is being used more recently and therefore indicates that a user may be less insulin sensitive.

There is an adjustment factor incorporated in preferences that allows a user to tweak the calculation by adjusting the TDD value up or down.

InsulinDivisor is a value based on the type of insulin used that varies with the peak time of the insulin in use.

This is the basic calculation of DynamicISF.

In addition, traditional Autosens value is replaced with a value that contains the rolling 24h TDD / 7 day average TDD.

Implementation – predictions

The above calculation is used to define sensitivity in multiple locations. Firstly, it defines the sensitivity where profile value was previously used. This is the starting sensitivity for predictions, and is also used in the CSF calculation.

In the latest version of the code (not yet in the AndroidAPS Dev repository), every prediction point that oref1 creates uses this equation to calculate the sensitivity for each point in the IOB, ZT and UAM curves. This means that the predictions for ZT and IOB result in lower values more quickly, and the UAM value results in a higher value more quickly.

The COB curve has been left to use the initial calculation, and therefore uses a static value throughout its prediction curve.

Implementation – dosing

The value of ISF used for calculating the insulin required for dosing uses the same calculation structure as defined previously, however, dependent on the current state of the glucose levels and recent history, it may use current glucose or the minimum predicted glucose, or a combination of both.

If glucose levels are climbing, only current glucose level is used.

If glucose levels are falling, the lower of minimum predicted value or current bg is used.

When levels are flat, an average value of current BG and lowest of current or minimum value is used.

This, in theory, allows a safer value when flat or falling.

Implementation – Low Glucose Suspend

In addition, the DynamicISF plugin also has a user definable “low glucose suspend” level.

In the standard code, the minimum threshold value is set at 65mg/dl, with a calculated update to the number on every loop cycle, and if the value is higher, that is used by the system.

In DynamicISF, the user can define the minimum threshold value upmto 100mg/dl, allowing an earlier low glucose suspend, should it be required.

In summary…

DynamicISF remains an experimental approach to managing variability of ISF values with blood glucose level, a phenomenon that has been observed by many within the Diabetes community and some within the commercial APS community.

It remains to be seen whether this is the correct approach in the long run, and there are various conversations going on constantly about tweaks and modifications that may need to be made.

If you’re interested in this approach, feel free to check out the Dev branch of AndroidAPS and the predicted curves test branch at https://github.com/tim2000s/AndroidAPS-2/tree/dynisf_pred_curves


    • If you mean “Loop”, then no.

      FreeAPS X, on the other hand, has middleware that enables this.

  1. Concerned clinician: In caring for hundreds of patients on insulin pumps and long-acting insulin, I do not see significant variations in the Correction Factor, which is NOT RELATED to actual insulin sensitivity. The CorrF or ISF primarily depends on having a stable and sufficient basal rate or long-acting insulin dose. This stabilizes correction dosing. Insufficient or excessive meal boluses CAN alter a CorrF but with your algorithm weighted to the last 4 and 8 hours, the algorithm would appear to project forward the mistakes of the last meal or two. Appreciate what you are trying to do, but this algorithm may need significant clinical research.

    • Hi John, thanks for the feedback. Some in the open source community have expressed similar concerns and the TDD component of the algorithm has proven to be the most contentious of the concept.

      In terms of how weighted to the recent period it is, the TDD uses 33% previous day, 34% seven day average, 10% the four hours from four hours ago and 23% the last four hours, so the majority of the weighting is in data from seven days and the previous day. This is one aspect where we would be very interested to see further data that might inform debate, if you’re aware of any.

      In addition, as it’s in use within the oref1 container, meal errors are ameliorated by the algorithm reducing post meal insulin to zero until anything additional is observed to be required, reducing the risk that these cause an unwarranted flex in the values.

      Both Chris and I would welcome further research into sensitivity variability in relation to glucose level, as there seems to be little currently in place. We are aware that this has been looked at in the commercial AID world and that the research done does indicate a relationship, but there is nothing published.

      As we have said all the way through, this is experimental and we welcome further interest.

      • Despite the medical community needing timely and costly clinical trials, I (n=1), really appreciate the work being done as my diabetes management is easier and better with Dynamic ISF than with constant ISF. I am hoping that it will be incorporated in AAPS master eventually. Thank you Tim Street and the others for being at the forefront and proposing better solutions, I am a happy guinea pig and count with me if you need happy=1 for a publication or other evidence to convince the scientific community

    • Hi John,

      Just largely seconding most of Tim’s comments; We’re aware that the TDD weighting is controversial (and I actually used a more stable, longer-term weighted average in much of my testing), but we haven’t really seen/heard any significant level of pushback that would warrant modifying the current weighting.

      As Tim mentioned, we’d welcome any additional data or studies you might be aware of on the speed/magnitude of changes in GLUT translocation/expression rates resulting from changes to insulin exposure which would better inform the timing adjustments and weighting.

      We (or at least I) would also be happy to work with anyone interested in running tests against in-silico models or “virtual patients” to evaluate and further refine things.

Leave a Reply

Your email address will not be published.