IOB Model

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
Following on from this thread http://www.diabetes.co.uk/forum/threads/diabetes-management-apps.62199/page-2#post-924862
I have created the code model for IOB calculations to go into my BG Management App. Here are the details and output from the test client which is testing out the model.

Please all have a look and comment. @Spiker

IOB Profile Cofiguration
The Bolus insulin estimation model allows you to set complex profiles of bolus usage against
time and for different injected quantities.
The default profile is linear with 100% at zero hours down to zero effective units at 5 hours (300
minutes)
You can change the profile period to any value you wish and also add additional profiles that come
into effect at different injected quantities
You do not need to restrict yourself to linear profiles either and you could set the profile up as a
curve so that for the first hour it absorbs slowly then accelerates before slowing down for the last
hour.

Test Output
Default IOB Profile
upload_2015-8-25_20-7-48.png

---calculate Effective Bolus---
Date=Sun Sep 20 08:00:00 BST 2015, units=20.0, IOB=20.0
Date=Sun Sep 20 12:00:00 BST 2015, units=20.0, IOB=24.0 (4 hours after first)
---Projected Insulin---
Date=Sun Sep 20 13:00:00 BST 2015, IOB=19.200000000000003
Date=Sun Sep 20 14:00:00 BST 2015, IOB=14.399999999999999
Date=Sun Sep 20 15:00:00 BST 2015, IOB=9.599999999999998
Date=Sun Sep 20 16:00:00 BST 2015, IOB=4.799999999999999
Date=Sun Sep 20 17:00:00 BST 2015, IOB=0.0
upload_2015-8-25_20-11-51.png


Add Bolus adjustment at 10AM

---calculate Effective Bolus---
Date=Sun Sep 20 08:00:00 BST 2015, units=20.0, IOB=20.0
Date=Sun Sep 20 10:00:00 BST 2015, units=10.0, IOB=22.0
Date=Sun Sep 20 12:00:00 BST 2015, units=20.0, IOB=33.2
Date=Sun Sep 20 13:00:00 BST 2015, IOB=26.560000000000002
Date=Sun Sep 20 14:00:00 BST 2015, IOB=19.92
Date=Sun Sep 20 15:00:00 BST 2015, IOB=13.279999999999998
Date=Sun Sep 20 16:00:00 BST 2015, IOB=6.639999999999999
Date=Sun Sep 20 17:00:00 BST 2015, IOB=0.0
upload_2015-8-25_20-14-10.png


upload_2015-8-25_20-15-2.png

upload_2015-8-25_20-15-52.png

upload_2015-8-25_20-16-33.png

upload_2015-8-25_20-17-41.png
 

Attachments

  • upload_2015-8-25_20-11-35.png
    upload_2015-8-25_20-11-35.png
    12 KB · Views: 342
  • Like
Reactions: 2 people

Blackers183

Well-Known Member
Messages
164
Type of diabetes
Type 1
Treatment type
Insulin
Dislikes
Commercial television
Hi All
IOB is an interesting topic because if you continue to have meals/snacks, therefore require insulin, while there is still IOB from last dose you will likely have higher BGLs over 24 hours. Diabetics lose the hormone in the pancreas that controls gastric emptying therefor meals pour into the intestine. DAFNE rule however is main meals only, no snacks (or no more than 10gms CHO between meals) to minimise the post meal highs. Not something that your medical support team tells you!!!!
Read 'Think Like a Pancreas'
Cheers
David
 

Spiker

Well-Known Member
Messages
4,685
Type of diabetes
Type 1
Treatment type
Pump
if you continue to have meals/snacks, therefore require insulin, while there is still IOB from last dose you will likely have higher BGLs over 24 hours. Diabetics lose the hormone in the pancreas that controls gastric emptying therefor meals pour into the intestine.
Sorry I don't understand what you mean.
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
Here is a screen shot of the iob profile model working in the blood glucose app I have been writing

1. New insulin tab
2. iob profile on right
3. can add/change/delete values
4. first row must always be 0,1 and will not let you change it
5. last row must always have a multiplier of 0

upload_2015-9-5_11-10-31.png


TBD
1. Where it shows the insulin table button on left will be a table to enter you insulin doses (bolus and basal) carbs comments similar to bg table and also a real time clock showing current estimate of bolus left based on your bolus entries and iob profile.
2. Save Profile and reload
3. Export and import profile
4. Add graphs of bolus on board estimates based on profile and take on values.
4. Add separate profiles (model already supports) that kicks in based on insulin level at start
 
  • Like
Reactions: 2 people

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
here is a slightly more complex profile
upload_2015-9-5_11-23-1.png
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
mocked up what it will look like or there abouts - any comments
upload_2015-9-5_20-14-10.png
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
lol not the type of comment I was after you have made me blush
 
  • Like
Reactions: 3 people

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
much better I can sneer and jeer at you then ;)
 
  • Like
Reactions: 2 people

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
so have been on this most of the morning and now have the bolus table model written - nothing you can see but I have implemented the bolus IOB Profile threshold functionality. So at the top of the window is a combo box that allows you to select the profile you wish to edit in this case the default (zero). The effective bolus at point of on boarding determines which IOB Profile to use.
upload_2015-9-6_15-51-27.png

the next screen shot shows the profile for units above 10
upload_2015-9-6_15-52-11.png

20 etc
upload_2015-9-6_15-52-45.png


To delete a profile threshold select the appropriate threshold and then once the table has been displayed delete the number in the threshold combo box...

Here is a screen shot showing the list of thresholds I have created profile for
upload_2015-9-6_15-58-0.png
 
  • Like
Reactions: 2 people

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
I have created the insulin table and it shows the bolus and effective bolus. There are no entry abilities yet and it shows test data only. Need to add data entry columns and then database changes to store data and then formatting and export. Following this it needs editing abilities and then other columns and then the graphs of course and the real time counter. Getting there slowly

upload_2015-9-8_21-49-23.png
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
OK next step - the real time bolus on board calculation - look at the yellow panel.

Note that added a zero entry in the bolus does not reset the IOB profile to start again. so you can add observation lines in ith a zero value and ee what your BoB level is

upload_2015-9-9_9-37-19.png

upload_2015-9-9_9-43-35.png
 
Last edited by a moderator:

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
It moves on a bit further. Now have entry and deletion of bolus and basal entries
upload_2015-9-10_20-12-53.png


Need to do the database part and I will release it and then update afterwards
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
Database complete along with the backup and restore for basal and bolus (carbs and comments still not active)
IOB Profile now stored to the database on shutdown and restored on opening
Insulin records saved to database as created and edited
Insulin records read from database on start

Shall publish this interim version in the standard App thread now
http://www.diabetes.co.uk/forum/threads/writing-bg-management-app.56644/page-10
 

andcol

Well-Known Member
Retired Moderator
Messages
3,176
Type of diabetes
I reversed my Type 2
Treatment type
I do not have diabetes
So have now worked on the graphing
Here is an example plot of bolus intake, effective bolus and BG levels

upload_2015-9-14_14-17-24.png