ISF State changes: underlying circadian rythm
First attempt at modelling the state changes in context.
So far I'm seeing one underlying circadian state loop with the main states "awake" and "asleep" (Profiles default
and sleep
) and the brief transitional states wake up
and rise
which both (might) introduce hormonal resistances.
graph LR;
D ==>|go to bed\nPS sleep\nstarts circadian cycle| BED;
BED ==> S;
S ==>dawn;
dawn ==> W;
W ==> U;
U ==> D;
U--> |triggers AP| D;
BED ==>|triggers|dawn;
linkStyle 0 stroke-width:2px,fill:none,stroke:blue;
linkStyle 1 stroke-width:2px,fill:none,stroke:blue;
linkStyle 2 stroke-width:2px,fill:none,stroke:blue;
linkStyle 3 stroke-width:2px,fill:none,stroke:blue;
linkStyle 4 stroke-width:2px,fill:none,stroke:blue;
linkStyle 5 stroke-width:2px,fill:none,stroke:blue;
style D fill:#9C9,stroke:#333,stroke-width:2px;
style S fill:#9C9,stroke:#333,stroke-width:2px;
style BED fill:#69f,stroke:#333,stroke-width:2px;
subgraph awake;
D((default));
W((wake));
U((rise));
end;
subgraph asleep;
BED{falling asleep};
S((sleep));
dawn{dawn};
end;
Profile Switches (PS)
- default: based on isf profile while awake
-
sleep: insulin sensitivity raised (reducing BR to about 70%), timed to return to default at a later point in time. (The onset of
sleep
would be the moment to set time shifts to the circadian rythm) Note: 70% usually proves too little if late meals are still showing their effects, one more vote for jiggling ISF down while there are still meal-related positive deviations. - wake: hormonal/stress level dependant rise based on waking up. Highly variable, usually already taking effect before consciously waking up. Mght merit some handling of its own. Possible idea: leave BR and Target, but lower ISF if large deltas are observed up to 2hrs prior to normal rising time. Corrections with nighttime ISF don't cut it, a rise from 90mg/dl to 140mg/dl within the span of 10min is not uncommon, and even if the calculation of ISF is not capped, it is stabilized too much against the previous hours to have any leverage (example: peregrine 2018-12-08 08:04, ISF lowered from about 135 to 120). Caveat sensor noise. Unfortunately a sudden rise like that also gets labeled as possible noise... Hence: observe plateau after that rise, and add a little leverage to ISF then?
-
rise: rise IOB to daytime level. "Aufstehphänomen" Teupe: "Aufstehbolus" to get IOB back to daytime level - he is calculating with a slightly different logic: since in traditional basal rates a prolonged sleepig period is calculated in to avoid lows when sleeping in, the missing insulin needs to be accounted for when rising earlier (i.e. as for normal working days) With the profile switch to daytime dosing and ISF, this amount doesn't need to be taken into account. What the workflow from
wake
torise
would need to calculate and give immediately would be the difference to get the IOB to the level needed for the daytimedefault
profile (already taking into account the activity/commute almost certainly scheduled within the acting time of that insulin. No duration needed for this.
Further implications
using this state-model, the loop also "knows" when the user is asleep, and could further peruse this information to adapt its "interuptiveness" in order to not disturb the circadian rythm more than absolutely necessary.
- do not nag noise notifications can be suppressed. The loop takes a longer avg delta for its considerations.
Profile transitions
from wide awake to sleeping
graph LR;
D ==>|go to bed\nPS sleep\nstarts circadian cycle| BED;
BED ==> S;
BED ==>|triggers|dawn;
S ==> dawn;
linkStyle 0 stroke-width:2px,fill:none,stroke:blue;
linkStyle 1 stroke-width:2px,fill:none,stroke:blue;
style D fill:#9C9,stroke:#333,stroke-width:2px;
style S fill:#9C9,stroke:#333,stroke-width:2px;
subgraph awake;
D((default));
end;
subgraph asleep;
BED{falling asleep};
S((sleep));
dawn{dawn};
end;