Parameter defining the required amount of insulin administration in Android APS
Let's consider which parameter is responsible for calculating the required volume of insulin administration.
In the previous article we determined that such a parameter is insulinReq, here we will consider it in the context of different insulin administration modes, namely basal and SMB.
To answer the question accurately, let's examine the main file – determine-basal.js
Explanation of some terms from this article
**snoozeBG**
— is an alternative predicted glucose level that takes into account active insulin boluses. This parameter is included in the calculation for situations where a bolus has recently been delivered (e.g. via the Super Micro Bolus (SMB) feature). In such cases, the insulin effect may be more pronounced than the usual prediction. eventualBG
and therefore this factor must be taken into account to avoid hypoglycemia.
**minDelta**
— this is the minimum change in glucose levels over the past few minutes. The program uses this value to determine the current trend of glucose changes (whether it is rising or falling and at what speed).
**expectedDelta**
— is the expected change in glucose level calculated based on insulin activity (BGI) and the difference between the current and target glucose level. The program uses this parameter to compare the actual change in glucose level with the expected one, which helps adjust insulin doses.
Super Micro Bolus (SMB) is a mechanism for delivering small doses of insulin in response to high glucose levels or when the predicted glucose level is above the target. SMB allows for more flexible and precise glucose control, especially after meals.
insulinReq meaning
In the file determine-basal.js
which is the basis for calculating basal insulin, variable insulinReq
really plays a key role in determining the amount of insulin to deliver. In this file insulinReq
used to calculate the required insulin dose based on current glucose level predictions.
Here are some important points regarding usage insulinReq
in code:
Calculation
insulinReq
:insulinReq
is calculated based on the difference between the predicted glucose level (snoozeBG
oreventualBG
) and target glucose levels (target_bg
), divided by insulin sensitivity (sens
).
var insulinReq = round( (Math.min(snoozeBG,eventualBG) - target_bg) / sens, 2);
Correction
insulinReq
:
Meaning
insulinReq
can be adjusted depending on the expected change in glucose levels (for example, usingminDelta
AndexpectedDelta
).
var newinsulinReq = round(( insulinReq * (1 - (minDelta / expectedDelta)) ), 2);
insulinReq = newinsulinReq;
Usage
insulinReq
To set your basal insulin rate:
insulinReq
is used to calculate the basal insulin rate, which the program then applies to correct glucose levels.Example code
var rate = basal + (2 * insulinReq);
SMB
Since we have two modes of insulin delivery – through basal insulin (works as delivery of the same amount of insulin with a periodicity of, for example, 3 minutes to dose a certain hourly volume of insulin)
And SMB is needed for more aggressive adjustment (can deliver more insulin than the typically conservative and significantly limited basal insulin.
Where is SMB calculated?
In the file determine-basal.js
SMB is calculated based on predicted glucose levels and insulin sensitivity. SMB is delivered via microboluses when predicted glucose levels are above target and the program determines that a small additional dose of insulin may help maintain glucose levels in the target range.
What parameter determines the SMB volume?
The SMB volume is determined by the parameter **microBolus**
which is calculated on the basis of **insulinReq**
your current glucose level, your target glucose level, and the time since your last bolus. Here are the key points:
**insulinReq**
used to determine the total insulin dose required.SMB is then calculated as a percentage of
insulinReq
(usually half or less) subject to other restrictions such as the maximum allowable bolus (eg,maxBolus
).
The code associated with SMB calculation may look like this:
var microBolus = Math.floor(Math.min(insulinReq/2,maxBolus)*roundSMBTo)/roundSMBTo;
This code defines the amount of SMB that will be served to the user based on the calculation insulinReq
while observing the maximum restrictions for boluses.