Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active September 5, 2024 18:46
Show Gist options
  • Save kenwebb/57c5ae984305ff40adac10e98468b3ee to your computer and use it in GitHub Desktop.
Save kenwebb/57c5ae984305ff40adac10e98468b3ee to your computer and use it in GitHub Desktop.
Fung Diabetes Code - 1
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Thu Sep 05 2024 14:45:51 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Fung Diabetes Code - 1
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 57c5ae984305ff40adac10e98468b3ee
Keywords:
My Notes
--------
3 September 2024
In this workbook, I explore some simple concept from Dr. Jason Fung's book The Diabetes Code, published in 2018.
I intend using Xholon Petri Nets.
I am starting with Chapter 5 - The role of insulin in energy storage
### References
() https://www.doctorjasonfung.com/the-diabetes-code
Prevent and reverse type 2 diabetes with intermittent fasting
Today, most doctors, dietitians, and even diabetes specialists consider type 2 diabetes to be a chronic and progressive disease—a life sentence with no possibility of parole.
But the truth, as Dr. Fung reveals in this paradigm-shifting book, is that type 2 diabetes is reversible.
Writing with clear, persuasive language, he explains why conventional treatments that rely on insulin or other blood-glucose-lowering drugs can actually exacerbate the problem,
leading to significant weight gain and even heart disease. The only way to treat type 2 diabetes effectively, he argues, is proper dieting and intermittent fasting—not medication.
() https://en.wikipedia.org/wiki/Diabetes
() https://en.wikipedia.org/wiki/Type_2_diabetes
() https://en.wikipedia.org/wiki/Insulin
() https://en.wikipedia.org/wiki/Peptide_hormone
() https://en.wikipedia.org/wiki/Homeostasis
In biology, homeostasis is the state of steady internal physical and chemical conditions maintained by living systems.
This is the condition of optimal functioning for the organism and includes many variables, such as body temperature and fluid balance,
being kept within certain pre-set limits (homeostatic range). Other variables include the pH of extracellular fluid,
the concentrations of sodium, potassium, and calcium ions, as well as the blood sugar level,
and these need to be regulated despite changes in the environment, diet, or level of activity.
Each of these variables is controlled by one or more regulators or homeostatic mechanisms, which together maintain life.
Homeostasis is brought about by a natural resistance to change when already in optimal conditions, and equilibrium is maintained by many regulatory mechanisms;
it is thought to be the central motivation for all organic action.
All homeostatic control mechanisms have at least three interdependent components for the variable being regulated: a receptor, a control center, and an effector.
The receptor is the sensing component that monitors and responds to changes in the environment, either external or internal.
Receptors include thermoreceptors and mechanoreceptors. Control centers include the respiratory center and the renin-angiotensin system.
An effector is the target acted on, to bring about the change back to the normal state.
At the cellular level, effectors include nuclear receptors
that bring about changes in gene expression through up-regulation or down-regulation and act in negative feedback mechanisms.
An example of this is in the control of bile acids in the liver.
() E-DES
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<!-- "I can make anybody fat, How? ... I prescribe insulin.
Although insulin is a natural hormone, excessive insulin causes weight gain and obesity.
(Fung p.49) -->
<!-- hormones are chemical messengers -->
<Hormone superClass="Script">
<PeptideHormone>
<Insulin/>
</PeptideHormone>
</Hormone>
<!-- some simplistic conditions -->
<Condition>
<WeightGain/>
<Obesity/>
</Condition>
<Experiment/> <!-- encompasses a Scenario and a PetriNet -->
<Scenario/>
<!-- Petri Net
based on:
https://www.primordion.com/Xholon/gwt/wb/editwb.html?app=3377945&src=gist
Petri net - Cell model
-->
<HormoneTPN superClass="TransitionPN">
<PeptideHormoneTPN>
<InsulinTPN/>
</PeptideHormoneTPN>
</HormoneTPN>
<ConditionPPN superClass="PlacePN">
<GlucosePPN/> <!-- Glucose may be present -->
<WeightGainPPN/>
<ObesityPPN/>
</ConditionPPN>
<PlaceSpace/>
</_-.XholonClass>
<xholonClassDetails>
<Insulin><DefaultContent><![CDATA[
var me, wtgain, obesity, beh = {
postConfigure: function() {
me = this.cnode;
wtgain = me.xpath("../WeightGain");
obesity = me.xpath("../Obesity");
},
act: function() {
me.println(`${me.name()} amount: ${me.amount} | ${wtgain.name()}: ${wtgain.amount} | ${obesity.name()}: ${obesity.amount}`);
if (me.amount > 0) {
me.amount--;
wtgain.amount++;
obesity.amount++;
}
}
}
//# sourceURL=Insulin.js
]]></DefaultContent></Insulin>
<Avatar><Color>red</Color></Avatar>
</xholonClassDetails>
<PhysicalSystem>
<!-- excessive insulin causes weight gain and obesity -->
<Experiment roleName="A">
<Scenario roleName="Aaa">
<Insulin amount="10"/>
<WeightGain amount="0"/>
<Obesity amount="0"/>
</Scenario>
</Experiment>
<!-- ******************************* -->
<!-- a scenario that uses petri nets -->
<Experiment roleName="B">
<Scenario roleName="Bbb">
<PlaceSpace>
<WeightGainPPN token="15"/>
<ObesityPPN token="10"/>
<Plot mode="new"/>
</PlaceSpace>
<InsulinTPN p="1" count="1">
<InputArcs>
<InputArc weight="1" connector="ancestor::Scenario/PlaceSpace/WeightGainPPN"/>
<InputArc weight="1" connector="ancestor::Scenario/PlaceSpace/ObesityPPN"/>
</InputArcs>
</InsulinTPN>
</Scenario>
<!-- kineticsType
1 = Basic place/transition net kinetics (default) (use p)
2 = Mass action kinetics (use k)
3 = Grid (use count)
4 = Michaelis-Menten enzyme/catalyst kinetics (use vmax and km)
-->
<PetriNet roleName="fung" kineticsType="1" p="1.0" timeStepMultiplier="1">
<!-- shuffling has little or no effect -->
<QueueTransitions shouldAct="true" shouldShuffle="false" connector="ancestor::Experiment/Scenario"/>
<AnalysisCRN/>
</PetriNet>
</Experiment>
<!-- ************************************* -->
<!-- another scenario that uses petri nets -->
<Experiment roleName="C">
<Scenario roleName="Ccc">
<PlaceSpace>
<GlucosePPN token="100"/>
<WeightGainPPN token="15"/>
<ObesityPPN token="10"/>
<Plot mode="new"/>
</PlaceSpace>
<InsulinTPN p="1.0" count="1">
<InputArcs>
<InputArc weight="1" connector="ancestor::Scenario/PlaceSpace/GlucosePPN"/>
</InputArcs>
<OutputArcs>
<OutputArc weight="1" connector="ancestor::Scenario/PlaceSpace/WeightGainPPN"/>
<OutputArc weight="1" connector="ancestor::Scenario/PlaceSpace/ObesityPPN"/>
</OutputArcs>
</InsulinTPN>
</Scenario>
<PetriNet roleName="fung2" kineticsType="1" p="1.0" timeStepMultiplier="1">
<QueueTransitions shouldAct="true" shouldShuffle="false" connector="ancestor::Experiment/Scenario"/>
<AnalysisCRN/>
</PetriNet>
</Experiment>
</PhysicalSystem>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet href="Xholon.css" type="text/css"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.28.0 (20140111.2315)
-->
<!-- Title: 64 Pages: 1 -->
<svg width="500pt" height="168pt"
viewBox="0.00 0.00 500.00 167.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Experiment[@roleName=&#39;C&#39;]" class="graph" transform="scale(1 1) rotate(0) translate(4 163.8)">
<title>64</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-163.8 496,-163.8 496,4 -4,4"/>
<text text-anchor="middle" x="246" y="-8.2" font-family="Courier New" font-size="14.00">C</text>
<!-- 67 -->
<g id="Experiment[@roleName=&#39;C&#39;]/Scenario/PlaceSpace/GlucosePPN" class="node"><title>67</title>
<ellipse fill="#ffff00" stroke="black" cx="71" cy="-91.8" rx="70.9021" ry="29.3315"/>
<text text-anchor="middle" x="71" y="-96" font-family="Courier New" font-size="14.00">GlucosePPN</text>
<text text-anchor="middle" x="71" y="-79.2" font-family="Courier New" font-size="14.00">100</text>
</g>
<!-- 71 -->
<g id="Experiment[@roleName=&#39;C&#39;]/Scenario/InsulinTPN" class="node"><title>71</title>
<polygon fill="#00ffff" stroke="black" points="277.986,-109.8 178.014,-109.8 178.014,-73.8 277.986,-73.8 277.986,-109.8"/>
<text text-anchor="middle" x="228" y="-87.6" font-family="Courier New" font-size="14.00">InsulinTPN</text>
</g>
<!-- 67&#45;&gt;71 -->
<g id="Experiment[@roleName=&#39;C&#39;]_edge1" class="edge"><title>67&#45;&gt;71</title>
<path fill="none" stroke="black" d="M141.792,-91.8C150.475,-91.8 159.288,-91.8 167.79,-91.8"/>
<polygon fill="black" stroke="black" points="177.977,-91.8 167.977,-96.3001 172.977,-91.8 167.977,-91.8001 167.977,-91.8001 167.977,-91.8001 172.977,-91.8 167.977,-87.3001 177.977,-91.8 177.977,-91.8"/>
</g>
<!-- 68 -->
<g id="Experiment[@roleName=&#39;C&#39;]/Scenario/PlaceSpace/WeightGainPPN" class="node"><title>68</title>
<ellipse fill="#ffff00" stroke="black" cx="403" cy="-130.8" rx="88.5338" ry="29.3315"/>
<text text-anchor="middle" x="403" y="-135" font-family="Courier New" font-size="14.00">WeightGainPPN</text>
<text text-anchor="middle" x="403" y="-118.2" font-family="Courier New" font-size="14.00">15</text>
</g>
<!-- 69 -->
<g id="Experiment[@roleName=&#39;C&#39;]/Scenario/PlaceSpace/ObesityPPN" class="node"><title>69</title>
<ellipse fill="#ffff00" stroke="black" cx="403" cy="-53.8" rx="70.9021" ry="29.3315"/>
<text text-anchor="middle" x="403" y="-58" font-family="Courier New" font-size="14.00">ObesityPPN</text>
<text text-anchor="middle" x="403" y="-41.2" font-family="Courier New" font-size="14.00">10</text>
</g>
<!-- 71&#45;&gt;68 -->
<g id="Experiment[@roleName=&#39;C&#39;]_edge2" class="edge"><title>71&#45;&gt;68</title>
<path fill="none" stroke="black" d="M278.112,-102.872C291.098,-105.799 305.477,-109.04 319.704,-112.248"/>
<polygon fill="black" stroke="black" points="329.51,-114.458 318.765,-116.649 324.632,-113.359 319.754,-112.259 319.754,-112.259 319.754,-112.259 324.632,-113.359 320.744,-107.869 329.51,-114.458 329.51,-114.458"/>
</g>
<!-- 71&#45;&gt;69 -->
<g id="Experiment[@roleName=&#39;C&#39;]_edge3" class="edge"><title>71&#45;&gt;69</title>
<path fill="none" stroke="black" d="M278.112,-81.0124C294.229,-77.4723 312.49,-73.4612 329.943,-69.6275"/>
<polygon fill="black" stroke="black" points="340.104,-67.3956 331.302,-73.9363 335.221,-68.4684 330.337,-69.5411 330.337,-69.5411 330.337,-69.5411 335.221,-68.4684 329.372,-65.1459 340.104,-67.3956 340.104,-67.3956"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment