Insulin therapy simulator

It so happened that in my life I encountered type 1 diabetes in children. This disease requires constant monitoring and maintaining blood sugar levels within normal limits to ensure a high quality of life. You can live the old-fashioned way – take measurements with a glucometer and inject insulin with syringes. Or you can use a modern technological device – an insulin pump. A modern insulin pump allows you to monitor blood sugar levels and inject insulin for meals and to maintain the background daily requirement. From a technical point of view, an insulin pump is a high-precision pump for delivering insulin, a control circuit with a wireless interface for receiving sugar data from a wireless sensor.

The main problem with using this equipment is its setup and operation. Since this equipment is rare in our hospitals, it is difficult to find a professional in insulin pumps. In addition to the initial setup in the hospital, the patient (his parent, if the patient is a child) must be able to reconfigure the pump and operate it independently.

Over 9 years of insulin therapy, I have gone from the Medtronic 722 insulin pump to the Medtronic 740. Throughout this long journey, I have encountered a very big problem – the insufficient level of training in insulin pump therapy for both doctors and parents of diabetic children.

There is no learning mechanism, only a “combat” version, when the device is installed on the patient and his condition and health in general depend on your actions.

As a person who can develop desktop applications in Delphi, I wanted to create a training simulator that would solve the problem of teaching doctors and patients the basics of insulin pump therapy.

The Medtronic 640 pump, which was actively installed in hospitals before the start of the SVO, was chosen as a prototype. But simply repeating the menu without simulating the patient is wrong and no one needs it. As a result, the “virtual patient” technology helped. Now all the pump manipulations were projected onto the virtual patient and the reaction followed in the form of the blood sugar level value. Soon the project grew into a full-fledged software product, the structural diagram of which is shown in the figure.

And the Medtronic 640 and 722 simulator modules began to completely replicate the main menus of the pumps.

As an extra feature, the ability to create different virtual patients for training and manage the complexity of tasks has been added. In addition, the simulator has been supplemented with functions that are useful for doctors and patients in everyday life – a bolus calculator and a transition calculator.

The main cycle of the simulator is the body of the timer with a 5-minute delay. In the body of which the calculation of the current glucose level is performed.

 ind:=(chas div 4)+1;
 N_ed:=((baz_prof_et[ind]/12)-(baz_prof[ind]/12));

 index:=chas*12+(minut div 5)+1;

 //Расчет активного инсулина
 buf:=0;
 for i:=1 to 288 do buf:=buf+Activ[i];
 Act:=buf;

 for i:=0 to 47 do
   if (index+i<289) then Glu[index+i]:=Glu[index+i]+Insul(i+1,N_ed)*PH_CH_Ins_et[((index+i)div 24)+1]
    else Glu[index+i-288]:=Glu[index+i-288]+Insul(i+1,N_ed)*PH_CH_Ins_et[((index+i)div 48)+1];

 Gluc:=Gluc_old+Glu[index]-Activ1[index];

Line 3 calculates the difference in the current basal profile rate. Where baz_prof_et is the virtual patient's basal profile, and baz_prof is set in the pump settings. This difference corresponds to an incorrectly set basal insulin rate in units, which will lead to an increase or decrease in glucose levels.

Lines 12-13 calculate glucose depending on the current value of the glucose array Glu, the value of the difference in basal profiles N_ed, and the insulin sensitivity factor of the virtual patient. The same Glu array stores data on food intake. In this case, the conversion of bread units of food into glucose is carried out taking into account the carbohydrate coefficient.

Line 15 records the active insulin at the current time. The Activ1 array represents the value of active insulin (set for food or for correction), recalculated taking into account the insulin sensitivity factor.

A very important point is to take into account the distribution of the insulin function over time. For this purpose, the insulin function Lispro (Humalog) is approximated by a polynomial function.

// функция Хумалога
function TPomp.Insul(j:integer;N:real):real;
var
  tmp:real;
begin
  tmp:=N*(-472.8*exp(-0.9079*j/12)+472.8*exp(-0.905923*j/12))/12;
  Result:=tmp;
end;

And food raises glucose levels differently depending on the glycemic index.

 // для высокого ГИ
       if Tabl.Cells[3,ij]='Высокий ГИ' then
        for i:=0 to 17 do
         if (index+i<289) then Glu[index+i]:=Glu[index+i]+Fast(i+1,N_ins*PH_CH_Ins_et[ind])
          else Glu[index+i-288]:=Glu[index+i-288]+Fast(i+1,N_ins*PH_CH_Ins_et[ind]);

       // для среднего ГИ
       if Tabl.Cells[3,ij]='Средний ГИ' then
        for i:=0 to 25 do
         if (index+i<289) then Glu[index+i]:=Glu[index+i]+Medium(i+1,N_ins*PH_CH_Ins_et[ind])
          else Glu[index+i-288]:=Glu[index+i-288]+Medium(i+1,N_ins*PH_CH_Ins_et[ind]);

       // для медленных ГИ
       if Tabl.Cells[3,ij]='Низкий ГИ ' then
        for i:=0 to 37 do
         if (index+i<289) then Glu[index+i]:=Glu[index+i]+Slow(i+1,N_ins*PH_CH_Ins_et[ind])
          else Glu[index+i-288]:=Glu[index+i-288]+Slow(i+1,N_ins*PH_CH_Ins_et[ind]);

The software product was assessed by endocrinologists as part of the course “Modern Technologies in the Treatment of Diabetes Mellitus” at the Department of Endocrinology of the Federal State Budgetary Educational Institution of Higher Education Bashkir State Medical University of the Ministry of Health of the Russian Federation in Ufa from March 11 to 23, 2024. The use of SugarNorm improved the quality of training due to the variability of the tasks performed on insulin therapy with simultaneous automatic control of the correctness of the actions to configure the pump. In addition, trainees note the greater clarity of the proposed approach, which ensures the involvement of trainees in the process.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *