-
Notifications
You must be signed in to change notification settings - Fork 396
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
use pip install rather than cloning #324
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [email protected] 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 [email protected] 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
scottleibrand
added a commit
that referenced
this pull request
Mar 15, 2017
* typofix * 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) * syntax * 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 * disable some debugging * 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" * Don't need quotes * bump version and require [email protected] 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 [email protected] 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 * support upload of G4 raw data from USB with cgm-loop * support upload of G4 raw data from USB with cgm-loop * sudo /etc/init.d/networking * install bc for g4-raw * first WIP attempt at supermicrobolus testing for #262 * round * 3m for now * bash version of openaps pump-loop (mostly @cjo20's work) * mmtune; multi-line for readability; remove ;'s * remove 3 more openaps invokations * put main() pump-loop at the top for readability * move config stuff into a function * implement supermicrobolus in bin/oref0-pump-loop.sh * cp smb-enacted.json to enacted.json for upload * only copy smb-enacted.json if updated; don't bolus w/o 0 temp * don't print old smb-enacted.json * verify rate matches and duration is > 5m less than smb-suggested.json * smb zero temp whenever microBolusAllowed and durationReq > 0 * echo -n filenames * more tweaks * zero temp up to 100; 120m max * set lastBolusTime for any size bolus * some SMBs can be slightly above profile_data.current_basal/2 * only set lastBolusTime for boluses * print lastBolusAge more often * debugging * more tweaks * cap lowtempimpact at 30 minutes * don't mmtune every loop * Temp refresh before invoke enact/smb-suggested.json * plumbing to pass reservoir_data to determine-basal * define reservoir_data * reservoir default: false * echo echo... * reservoir.json is not actually json * set rT.reservoir = reservoir_data; * if in SMB mode, don't cancel SMB zero temp when eventually in range * syntax * clearer Warning on missing reservoir data * if in SMB mode, don't cancel SMB zero temp for delta < minDelta * retry smb_check if first attempt fails * only print last line of mmeowlink-any-pump-comms.py tracebacks * wait-for-silence before retry * syntax * if in SMB mode, don't cancel SMB zero temp for delta < minDelta * () for 2>&1 * only bolus 1/3 the insulinReq every 5m * keep profile and autosens up to date when SMBing * only consider what we're about to bolus for durationReq * don't set a zero temp if <15m is needed * if no zero temp is required, allow later code to set a high temp * only set rT.rate = 0 if we're setting a temp * reason grammar * only check rate and duration if rate is suggested * debug print statement * don't print 'setting 0m zero temp' * reason grammar * reason grammar * don't fallback to pump-loop on refresh fails * syntax * cp smb suggested and enacted files immediately after invoking * syntax * round insulinReq * only fall back to pump-loop if temp is too old * debug statement * parentheses * remove some TODOs * don't zero temp up to 100, just to temptarget target_bg * echo -n * comment out debug jq * less unnecessary debugging * less unnecessary debugging * less unnecessary debugging * debug output * -mmin +5 = more than 5m old * continue if ! smb_old_temp * less unnecessary debugging * less unnecessary debugging * jq --exit-status * note when Retrying SMB checks * always display reservoir levels * grep -v changes exit status; redirect stdout instead. sleep 20s. * random wait_for_silence * syntax * less unnecessary debugging * zero seconds doesn't work * less unnecessary debugging * don't need to sleep when randomizing wait_for_silence * echo "Waiting for 45s" * less unnecessary debugging * print monitor/status.json * if smb_old_temp && normal pump-loop succeeds, complete SMB pump-loop * always show last line of stderr when invoking reports * support xdrip data source for MDI autotune * don't redirect determine-basal output * cat monitor/status.json after invoking * openaps get-settings 2>/dev/null * support date field in addition to dateString and displayTime * remove debugging lines * remove debugging lines * no need to be as stringent on low carb_ratios for autotune * use decay historical carbs by currentDeviation if > min_5m_carbimpact * remove old comments and TODOs I no longer want to do * check pump clock is within 2m of current time * check that pumphistory is less than 1m old after refresh * one-line pump clock output * checking pump time vs. rig time in oref0-pump-loop instead * check -120 < pump clock delta < 120 * newlines and spaces are hard * get clock-zoned.json to print inline? * put pumphistory check on its own line * let's require 1m accuracy on pump clock * use currentDeviation/2 instead of currentDeviation * display smb-suggested.json reservoir reading * always include reservoir level * always include reservoir level * check smb-suggested reservoir against reservoir.json * syntax * make sure reservoir diff isn't negative * add deliverAt * smb_verify_suggested * mmtune after 30s; 200 wait_for_silence attempts * remove completed TODO * add reports to oref0-setup * oref0-pump-loop.sh * oref0-pump-loop * future-proof the grep * the future is now * need bc for SMB * killall -g oref0-pump-loop * This is creating a file oref0-runagain.sh to save interactive setup options to more easily run again. * This is properly doing a tmp and then later saving it to the directory we created. * log both public and private IPs * New tool to sync profile data from OpenAPS to Nightscout (#301) * New tool to sync profile data from OpenAPS to Nightscout * Hashing the secret * Added tool to package.json * Support both hashed and unhashed api key * Added --preview support. Code run through js-beautify. Less console logging. * Fixed bug with parameter checking order, better logging in case of error / success on upload * Added profile JSON validity checking * One more check for the downloaded profile * Updated HAPP treatments parsing (#350) It may also make sense to look for !(current.timestamp) && current.insulin since I believe HAPP may give you the ability to edit the "Entered by" string (need to confirm that though). * Autotune dayofweek (#359) * script for autotuning based on day of week * +x * exit on usage * accept command-line arguments * cp mmtune.json to mmtune_old.json for mmtune-speedup * upgrade mmeowlink * upgrade mmeowlink * upgrade mmeowlink if older than 0.10.1 * upgrade mmeowlink if older than 0.10.1 * syntax * repair/reset/truncate cgm-loop git repo too * repair/reset/truncate cgm-loop git repo too * 0.3.7 for oref0-pump-loop * 0.3.7 for oref0-pump-loop * monitor-pump stdout to /dev/null * Trying to prioritize one mac address;if fail, try another * tested and working: disables wifi if it's not working, until BT goes away * do this in oref0-online instead * oref0-bluetoothup no longer needs MAC * kill off old oref0-pump-loops too * and openaps-report too * mmtune 25% of the time * wait for silence before mmtuning * Added additonal logic for HAPP Temp basals (#370) * Added additonal logic for HAPP Temp basals Needed to change the timestamp and rate to created_at and absolute respectively. * Update history.js * Update history.js * set -o pipefail to preserve false exit statuses when piping * units * turn off debugging * only run oref0-truncate-git-history if not already running * syntax * clarify reasons for @danamlewis * update tests to match reason change * syntax * die when something doesn't work * don't print blank lines from autotune_recommendations.log * reject captive portal redirects * turn off debugging * only run du after truncating * kill off any existing git operations so we can gc * clean out any tmp_pack_ stuff from * re-randomize sleep times each time through * prep beforehand too * don't match on 'killall -g oref0-pump-loop' * refresh_smb_temp_and_enact before pumphistory for faster low-temps * wait_for_silence 60 if "usedDefault": true * Add explorer board prompt and auto-port-itize it if so (#381) * Attempting to add explorer board prompt to setup script to resolve common error and confusion * Fix bugs. Be awesome. * Remove a stray -n for readability * sorts the treatments collection to address #390 * remove largest old git repo from to avoid filling up /tmp/ * wrong variable * typo * oref0-radio-reboot * oref0-radio-reboot * oref0-radio-reboot * wait 5m to reboot; cancel if it recovers by then * run oref0-radio-reboot in cron two more times before actually rebooting * /run/nologin only exists for 5m; run every minute * print extra newlines to clear old spidev5.1 errors faster * don't extend reboot time every minute * write cancelation to logfile * If we're in SMB mode, disable bolus snooze * only zero-temp for insulin already delivered, to help with intermittent pump comms * remove U label for line wrapping @ 120m * comments * only re-enact SMB temp if smb_verify_enacted fails * remove duplicate smb_verify_enacted * smb_suggest if not doing a full smb_enact_temp * only enact if smb_verify_enacted fails * echo No smb_enact needed * let low-temps run until they have 25m left in SMB mode * simplify last remaining iwconfig * Revert "let low-temps run until they have 25m left in SMB mode" This reverts commit d0d41fd. This was not canceling zero temps still running after COB expired and SMBs stopped. * add unannounced meal detection to autotune * use min_5m_carbimpact for 15g lunch after 15g breakfast Conflicts: lib/determine-basal/determine-basal.js * remove unused send-tempbasal-Azure.js * version bump to 0.5.0-dev for oref0-pump-loop * WARNING: supermicrobolus mode is not yet documented or ready for general testing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.