Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pump profile required for autotune #298

Merged
merged 2 commits into from Dec 28, 2016

Conversation

danamlewis
Copy link
Contributor

No description provided.

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.

Thanks Dana, and Dana! ;-)

Tested and confirmed it works correctly.

@scottleibrand scottleibrand merged commit bb549b6 into autotune Dec 28, 2016
@scottleibrand scottleibrand deleted the mandatory-pump-profile branch December 28, 2016 23:27
scottleibrand added a commit that referenced this pull request Jan 10, 2017
Implements new Autotune feature (#261)

Commit details:

* oref0-autotune-prep.js

* use oref0/lib/autotune-prep

* don't print autosens debug stuff when running in meal mode

* divide basal_glucose_data from isf_glucose_data at basalBgi > -3 * bgi; comments and TODOs

* bucketize data, calculate deltas and deviations, and use those to better allocate data to csf, isf, or basals

* prep for an optimized append mode to an existing autotune/glucose.json

* initial framework for oref0-autotune.js

* adjust basals for basal deviations

* add bgi to output json

* try including rising BGs in ISF calculations

* initial basic ISF autotuning

* use medians, not averages, for ISF calcs

* add mealCarbs and mealAbsorption start/end

* first pass at CSF estimation

* when avgDelta with large negative BGI, don't use that for ISF or basal tuning

* convert sgv records into glucose if needed

* add support for nightscout treatments.json format

* only consider BGs for 6h before a meal to speed up processing

* properly map sgv to glucose

* add support for carbs from NS

* remove unnecessary clock and basalprofile arguments

* update basalprofile

* profile needs isfProfile not isf_profile

* use min_5m_carbimpact in calculating total deviations too

* way more efficient and simpler iterative algorithm for calculating COB

* add mealCarbs to glucose_data

* make sure new CSF isn't NaN

* disable min deviation for CSF calculation

* smooth out basal adjustments by incrementing evenly and reducing proportionally over 3h

* smooth out basal adjustments by using average of current and last 3 hours as iob_inputs.profile.current_basal

* make sure increases and decreases of basal are both doing the same 20%

* minPossibleDeviation, and actually basal_glucose_data.push when avgDelta > 0

* include Math.max(0,bgi) in minPossibleDeviation

* null treatment check

* add pumpprofile as optional argument

* TODO: use pumpprofile to implement 20% limit on tuning

* use pumpprofile to implement 20% limit on tuning

* use pumpprofile to implement 20% limit on ISF and CSF tuning

* only set pumpCSF if setting pumpISF

* logging

* null check

* undefined check

* Commenting to describe index.js

* Deleting unnecssary variable that's not used

* More commenting

* Last bit of commenting for now

* Rename function from diaCarbs to categorizeBGdatums

* Rename total.js to categorize.js

* Update reference to now categorize.js

* Reference categorize instead of total.js

* Rename total.js to categorize.js

* Rename categorize.js to tune.js

* Fixing function naming from diacarbs to tuneAllTheThings

* Delete tune.js

* Simplifying min and maxrate

* Tweaking troubleshooting language

* Adding to-do about dinner carbs not absorbed at midnight

* Defining fullNewCSF

* Function tuneAllTheThings instead of Generate

* Update index.js

* Make pump profile required for autotune (#298)

* Make pump profile required for autotune

* Added oref0-autotune-test.sh script to test autotune. Allows the user to specify date range and number of runs as well as openaps directory and user's Nightscout URL. Note that the pump profile is pulled from the following location: <loop dir>/settings/profile.json. Also note that --end-date and --runs are not required parameters, but the script will default to the day before today as the end date and 5 runs, so you may or may not want to use those. Example Usage: ./oref0-autotune-test.sh --dir=openaps --ns-host=<NS URL> --start-date=2016-12-9 --end-date=2016-12-10 --runs=2

* Added oref0-autotune-test.sh script to test the autotune. Allows the user to specify date range and number of runs as well as openaps directory and user's Nightscout URL. Note that the pump profile is pulled from the following location: <loop dir>/settings/profile.json. Also note that --end-date and --runs are not required parameters, but the script will default to the day before today as the end date and 5 runs, so you may or may not want to use those. Example Usage: ./oref0-autotune-test.sh --dir=openaps --ns-host=<NS URL> --start-date=2016-12-9 --end-date=2016-12-10 --runs=2 (#303)

* Added stdout logging option to oref0-autotune-test.sh. Terminal output is still there as it was before. Logging is off by default, but can be enabled with the --log=true option. Also cleaned up odds and ends in the file :)

* default to 1 run, for yesterday, if not otherwise specified

* If a previous settings/autotune.json exists, use that; otherwise start from settings/profile.json

* write out isf to sens too: used by determine-basal

* make sure suggested.json is printed all on one line

* support optional --autotune autotune.json

* round insulinReq

* add @sulkaharo's method to calculate basal start

* small fix for autotune command line parameters (#308)

correct documentation of parameters and exit if user enters an unknown
command line option

* autotune export to microsoft excel

initial version, requires xlsxwriter

* increment version number for autotune

* export excel improvements for autotune

swap run and date column, do some formatting (font size, etc)

* rename export to excel to .xlsx instead of .xls for consistency

* missed one... changed --xls to --xlsx in the cli example

* swap Date and Run column, add license stuff in script

* Install autotune with oref0-setup (#312)

* Commenting out "type": = "current" (#296)

* restart networking completely instead just cycling wlan0 (#284)

* restart networking completely instead just cycling wlan0

this has proved more stable for me across some wifi netoworks

* Re-add dhclient release/renew

* Update oref0-online.sh

* Bt device name (#307)

* Update oref0-online.sh

Change the BT devicename from BlueZ 5.37 to hostname of Board

* Update oref0-setup.sh

add hostname as BT device name.

* Exit scripts when variables under or functions fail (#309)

* Exit script when variables unset or functions fail

* first attempt at setting up nightly autotune with oref0-setup and using autotuned profile.json for looping

* increment version number for autotune

* check if settings/autotune.json is valid json

* specify a default for radio_locale

* require openaps 0.1.6 or higher for radio_locale

* radio_locale requires openaps 0.2.0-dev or later

* redirect oref0-ns-autotune stderr to log file

* update script name in usage

* use settings/pumpprofile.json in oref0-ns-autotune

* Updated bin/oref-autotune-test.sh with capability of running a small summary report at the end of the script. The report consists of the tunable parameters of interest, their current pump value and the autotune recommendation. Implemented report separately in oref0-autotune-recommends-report.sh. Example Usage: ~/src/oref0/bin/oref0-autotune-recommends-report.sh <Full path to OpenAPS Directory>.

* Merged changes that were incorporated into the updated oref0-ns-autotune.sh to add terminal logging to autotune.<date/time stamp>.log in the autotune directory as well as a simple table report at the end of this manual autotune to show current pump profile vs autotune recommended profile. Implemented report in oref0-autotune-recommends-report.sh

* rename to oref0-autotune-core.js and oref0-autotune.sh

* Clarify usage

* We're redirecting stderr not stdout

* only cp autotune/profile.json if it's valid

* camelCase autotune and use pumpProfile.autosens_max and min (#319)

* camelCase autotune.js and categorize.js

* use pumpProfile.autosens_max and min instead of 20% hard-coded cap

* revert require('../profile/isf');

* camelCase autotuneM(in|ax)

* profile/isf function is still isfLookup

* change ISFProfile back to isfProfile to match pumpprofile

* change basalProfile back to basalprofile to match pumpprofile.json

* change ISFProfile back to isfProfile to match pumpprofile

* camelCase pumpHistory to match categorize.js

* change basalProfile back to basalprofile to match pumpprofile.json

* camelCase pumpProfile to match autotune/index.js

* camelCase to match autotune/index.js

* autotuneMin/Max and camelCase fixes

* update 20% log statements for basals to reflect autotune min/max

* mmtune a bit more often

* fix start and end date for ns-treatments.json

* leave ISF unchanged if fewer than 5 ISF data points (#322)

* leave ISF unchanged if fewer than 5 ISF data points

* move stuff out of the else block

* output csf as expected by oref0-autotune-recommends-report.sh

* fix ww pump and dexusb with small changes (#323)

* fix blocker bug for ww pumps and for dex usb

* additional upcasing for radio_locale for cli

* Compare lowercase radio_locale to "ww"

* bump version and require oref0@0.3.6 or later

* install jq for autotune

* use pip install rather than cloning (#324)

* pip install git+URL@dev instead of cloning

* sudo pip install

* move openaps dev install out where it belongs

* remove commented code

* bump version and require oref0@0.3.6 or later

* redirect stderr to stdout so we can grep it

* Continue and output a non-autotuned profile if we don't have autotune_data
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.

None yet

2 participants