question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Units in the Meal Absoption Model

See original GitHub issue

Hi,

I just looked through the meal absoption model in detail and I noticed the following in the script t1dpatient.py:

When you calculate the variable Dbar in line 130, which is in turn used to calculate the nonlinear gastric emptying rate kgut, you add the variables last_Qsto and last_foodtaken. However, the variable last_Qsto is in mg as all the digestion states, whereas the variable last_foodtaken is in g (line 100).

Shouldn’t these variables both be in mg, as Dbar is in mg?

Cheers, Manuel

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
manueichcommented, Mar 20, 2022

I hava made some further investigations into this and found the following:

I have extracted the parameters for a normal subject from the article “Meal Simulation Model of the Glucose-Insulin System”, Dalla Man, IEEE TBME, 2007. I had to assume a BW of 78 kg as it is not provided. The paper gives the following time course of the rate of glucose appearance (Ra) from three meals: Ra_DallaMan

I then adapted the code to give me Ra using it as a second observation:

Ra = self.state[2] * self._params.f * self._params.kabs / self._params.BW

The fact that the model of the toolbox describes a T1DM subject is irrelevant as the meal absoption model is identical. Using the current code, i.e. NOT multiplying by 1000, I get the following result which does not match with the shape given in the paper Ra_old

However, if I multiply by 1000, as I suggested before, I get a result that matches much better regarding shape. The amplitude is dependent on the BW which I had to assume, so it cannot be compared Ra_new

For me this makes it quite clear that my suggestion is correct and the current version (without multiplying 1000) is a bug. Here is the csv file with the parameters I extracted from the paper. The subject is called “normal”: vpatient_params.csv

0reactions
jxx123commented, May 25, 2022

Wow that was really detailed investigation. You are right. I checked the equation. Dbar should be in mg. Let me submit a fix for this. Thank you so much for your bug report. Please do submit issues to this repo when you find any other bugs in the future. Thank you so much! image image image

Read more comments on GitHub >

github_iconTop Results From Across the Web

A New Meal Absorption Model for Artificial Pancreas Systems
Absorption has units of µmol/kg (FFM)/min. FFM: fat free mass. Among all models, Model 1, which assumes a single shape, is the least...
Read more >
After-meal blood glucose level prediction using an absorption ...
A new training method is proposed for a neural network in which an absorption model is applied that uses the nutrient contents of...
Read more >
Increased Rates of Meal Absorption Do Not Explain Elevated ...
Animal models of type 2 diabetes exhibit enhanced activity and abundance of intestinal sodium-dependent glucose cotransporter 1 (SGLT-1) and solute carrier ...
Read more >
Enhancing Blood Glucose Prediction with Meal Absorption ...
Here, we present a novel glucose prediction algorithm which, in addition to standard inputs, accounts for meal absorption and physical exercise information to ......
Read more >
Sensors | Free Full-Text | Using Absorption Models for Insulin and ...
Experimenting with various absorption curve shapes for all patients and for all meals is a slight methodological error (no wonder it did not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found