Open celikalp opened 3 years ago
Gb is the initial fasting bg. I re-computed values of Gs, Gpb, Gtb, EGPb, Vm0 and it did the job. I used the paper to interpret the equations. Here is the code:
@classmethod
def withName(cls, name, **kwargs):
'''
Construct patient by name.
Names can be
adolescent#001 - adolescent#010
adult#001 - adult#001
child#001 - child#010
'''
patient_params = pd.read_csv(PATIENT_PARA_FILE)
params = patient_params.loc[patient_params.Name == name].squeeze()
# set fasting blood glucose if given in kwargs
if 'fasting_bg' in kwargs and kwargs['fasting_bg'] is not None:
params.Gb = kwargs['fasting_bg']
params.Gpb = params.Gb * params.Vg
params.EGPb = params.kp1 - params.kp2 * params.Gpb - params.kp3 * params.Ib
Gtb = (params.Fsnc - params.EGPb + params.k1 * params.Gpb) / params.k2
params.Vm0 = (params.EGPb - params.Fsnc) * (params.Km0 + Gtb) / Gtb
params.iloc[5] = params.Gpb
params.iloc[6] = Gtb
params.iloc[14] = params.Gpb
kwargs.pop('fasting_bg', None)
return cls(params, **kwargs)
I think, @jxx123 you may want to fix #18.
@aacelik Thanks! I will take a look. If you want to go head and fix it, please send me a pull request :)
Hi @aacelik and @jxx123,
I'm interested in following up on this question. After this new feature added, is it possible for the user to select a new initial blood glucose level for the patient?
For example, Patient adolescent#002 has an initial glucose level 152.41. I want to change this level to another number (let's say 120) at the beginning. I read the repo and the article that you used to implement this repo. I attempted to change some parameters in "vpatient_params.csv" as follows: 1. Changed Vg and u2ss; 2. Changed from x0_1 to x0_13 and u2ss. However, both attempts fail to fulfill this goal as the new BG keeps on increasing without any meal or insulin input. I'm wondering whether or not I can change the initial glucose level of Patient adolescent#002 from 152.41 to 120 by using this new feature (or other features)? If not, any parameters in "vpatient_params.csv" that I can change to achieve the same goal? Please correct me if my understanding is imprecise.
Thanks for your reply in advance,
I think I've solved this issue. Forget my question. Thanks,
Hi @aacelik and @jxx123,
I'm interested in following up on this question. After this new feature added, is it possible for the user to select a new initial blood glucose level for the patient?
For example, Patient adolescent#002 has an initial glucose level 152.41. I want to change this level to another number (let's say 120) at the beginning. I read the repo and the article that you used to implement this repo. I attempted to change some parameters in "vpatient_params.csv" as follows: 1. Changed Vg and u2ss; 2. Changed from x0_1 to x0_13 and u2ss. However, both attempts fail to fulfill this goal as the new BG keeps on increasing without any meal or insulin input. I'm wondering whether or not I can change the initial glucose level of Patient adolescent#002 from 152.41 to 120 by using this new feature (or other features)? If not, any parameters in "vpatient_params.csv" that I can change to achieve the same goal? Please correct me if my understanding is imprecise.
Thanks for your reply in advance,
I think I've solved this issue. Forget my question. Thanks,
@junzhuang-code where you able to achieve this. Wanted to work with a similar situation where I set my initial BG, lets say at 7am.
How can I add initial fasting blood glucose as an input parameter to the simulator?