Include insulin model delay in computation of dose#1238
Conversation
ps2
left a comment
There was a problem hiding this comment.
Good catch! Thanks for hunting this down, @dm61! Need to fix the specification of 10m, so it's not in duplicate places. Could do this with a settings value, or updating LoopKit to included it in the model. I think either way would require a LoopKit change.
| let unit = correctionRange.unit | ||
| let sensitivityValue = sensitivity.doubleValue(for: unit) | ||
| let suspendThresholdValue = suspendThreshold.doubleValue(for: unit) | ||
| let delay = TimeInterval(minutes: 10) |
There was a problem hiding this comment.
This value should not be hard-coded. We are also using a default value (of 10m) in LoopKit; if one changes, so should the other, so they should be controlled by a settings value, or at least a single value specified in one place.
There was a problem hiding this comment.
Yup, I was going to look into how to get that value from LoopKit, but then decided to just put this out so you can quickly take a look.
I'd prefer including the delay in the insulin model, where it really belongs ([edit] (does not look very difficult, so will work on this).
A 10-min delay is included in calculation of effected insulin so that the insulin model used in dose calculations becomes consistent with the insulin model used for prediction calculations.
This addresses an issue brought up in the Partial Bolus Recommendation topic on Loop Zulip where a nonzero bolus recommendation is observed immediately after a bolus recommendation has been accepted. DoseMathTests have been updated accordingly.