Skip to content

Conversation

@jpcunningh
Copy link
Contributor

This is an attempt to address #1093.

Having tested Fiasp a couple of weeks ago, we noticed the same behavior.

This uses the pump profile to keep curve, dia, and peak up to date.

Copy link
Contributor

@tim2000s tim2000s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me, but does using pumpprofile.json override the Mandated minimum DIA?

I think you may have also given me an idea for fixing the isfprofile issues.

@jpcunningh
Copy link
Contributor Author

@tim2000s, it won't affect overriding the Mandated minimum DIA since that mandate is enforced in the determine IOB calculation code regardless of the settings passed in.

I didn't change how ISF is handled because autotune tunes ISF similar to basals. It looked like the code already respects the boundaries on how far ISF can be moved from the pump profile which would get updated if the pump setting changed.

profile_data.curve = pumpprofile_data.curve;

// if not tuning the insulinEndTime and insulinPeakTime, then use data from pump profile
if (!tune_insulin_curve) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would change those values back to defaults on subsequent runs if you tune insulin curve manually and have autotune running on cron. Do we want that? Or should we stick with the tuned insulin curve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insulinPeakTime will track the user's value changes entered in preferences.

Perhaps we should add a preference for customDIA and dia to allow the user to manually override the value from the pump? That way, if they aren't intentionally overriding the pump value, it tracks the pump value if the user changes it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the more common use case is that someone will only have DIA set in the pump, and then will run tune_insulin_curve in a manual autotune run. I don't want to impose too many hoops: it seems like the default behavior should be "if you've tuned insulinPeakTime or insulinEndTime, keep using the tuned values"...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense for that to be the more common use case.

Any thoughts on how to make the fact that curve values have been tuned persist so it could test for that case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be as simple as checking whether useCustomPeakTime is set (whatever it's called exactly) instead of checking to see if we're doing tune_insulin_curve at the moment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I add a flag to the autotune output profile it would set to true if tune_insulin_curve had been run? Testing the flag instead of the argument would then be used to determine if it needs to keep the dia and peak from the previous autotune profile vs. pull it in from the pumpprofile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m proposing we just use useCustomPeakTime as that flag.
https://github.com/openaps/oref0/blob/master/lib/profile/index.js#L5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I was overthinking it. Changed to use useCustomPeakTime.

@jpcunningh
Copy link
Contributor Author

Just a note that this has an interaction with #1114.

Whichever is merged first, the other will need to be updated.

@jpcunningh jpcunningh force-pushed the keep-autotune-insuline-curve-updated branch from 0bcc461 to 6f596b2 Compare September 3, 2018 14:51
@jpcunningh
Copy link
Contributor Author

Rebased onto #1106 to resolve conflict.

@scottleibrand
Copy link
Contributor

Looks like merging the other PRs introduced another merge conflict.

@jpcunningh jpcunningh force-pushed the keep-autotune-insuline-curve-updated branch from fc193d5 to c0714a2 Compare September 25, 2018 21:55
@jpcunningh
Copy link
Contributor Author

rebased to dev to resolve merge conflict.

Added command tests for new option in autotune-core.
Copy link
Contributor

@scottleibrand scottleibrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Ready to merge?

@jpcunningh
Copy link
Contributor Author

Not yet. There is a question in the thread above about default behavior.

dia and insulinPeakTime from previous autotune or to
use the pump profile values.
@jpcunningh
Copy link
Contributor Author

Ready to merge.

@scottleibrand scottleibrand merged commit 492121e into openaps:dev Sep 29, 2018
@jpcunningh jpcunningh deleted the keep-autotune-insuline-curve-updated branch September 29, 2018 03:00
ivalkou pushed a commit to ivalkou/oref0 that referenced this pull request Nov 27, 2018
* Keep insulin curve, peak, and dia up to date.

* Migrated oref0-autotune-core.js argument processing to yargs.

* Removed unused option.

* Added tune insulin curve argument to autotune-core

* Add tune-insulin-curve option to oref0-autotune-core
Use pump profile dia and insulinPeakTime if not tuning insulin curve.

* Fixed arg processing in autotune-core for tune-insulin-curve.

* Fixed error in autotune-prep introduced by the rebase.
Added command tests for new option in autotune-core.

* Use useCustomPeakTime to determine whether to persist
dia and insulinPeakTime from previous autotune or to
use the pump profile values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants