oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

Autotune: Better input checking, self-explanatory error messages, and bailing if missing input

Open danamlewis opened this issue 7 years ago • 3 comments

We need volunteers to work through autotune and provide:

  1. Better input checking
  2. Self-explanatory error messages
  3. Make it bail if it's missing required inputs

danamlewis avatar Jan 26 '17 04:01 danamlewis

Running oref0-autotune --dir=~/myopenaps --ns-host=https://MYURL.herokuapp.com-start-date=2017-01-31 created this error because the parameters were entered incorrectly. (forgot a ' -' between the link and start-date') This and other errors with the arguments should fail earlier/more gracefully.

root@ubuntu-512mb-nyc3-01:~/myopenaps/autotune# oref0-autotune --dir=~/myopenaps --ns-host=https://MYURL.herokuapp.com-start-date=2017-01-31

Running oref0-autotune --dir=/root/myopenaps --ns-host=https://MYURL.herokuapp.com-start-date=2017-01-31 --start-date=2017-01-31 --runs=1 --end-date=2017-01-31
Grabbing NIGHTSCOUT treatments.json for date range...
https://MYURL.herokuapp.com-start-date=2017-01-31/api/v1/treatments.json?find\[created_at\]\[$gte\]=2017-01-30T20:00-05:00&find\[created_at\]\[$lte\]=2017-02-01T00:00-05:00
-rw-r--r-- 1 root root 0 Feb  1 20:28 ns-treatments.json
Grabbing NIGHTSCOUT entries/sgv.json for date range...
https://MYURL.herokuapp.com-start-date=2017-01-31/api/v1/entries/sgv.json?find\[date\]\[$gte\]=1485838800000&find\[date\]\[$lte\]=1485925200000&count=1000
-rw-r--r-- 1 root root 0 Feb  1 20:28 ns-entries.2017-01-31.json
Running 1 runs from 2017-01-31 to 2017-01-31
oref0-autotune-prep ns-treatments.json profile.json ns-entries.2017-01-31.json > autotune.1.2017-01-31.json
Could not parse input data:  [SyntaxError: Unexpected end of input]
oref0-autotune-core autotune.1.2017-01-31.json profile.json profile.pump.json > newprofile.1.2017-01-31.json
/root/src/oref0/lib/autotune/index.js:77
        for (var i=0; i < basalGlucose.length; ++i) {
                                      ^

TypeError: Cannot read property 'length' of undefined
    at tuneAllTheThings (/root/src/oref0/lib/autotune/index.js:77:39)
    at Object.<anonymous> (/root/src/oref0/bin/oref0-autotune-core.js:59:27)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

jessiepusateri avatar Feb 02 '17 02:02 jessiepusateri

I think something that would help is using /api/v1/profile/current.json on nightscout to get the current settings as a default with the option to specify another. It would reduce a lot of the errors in data entry and allow for the strong input validation in nightscout that exists already.

beached avatar Feb 11 '17 16:02 beached

There is an issue open for that: https://github.com/openaps/oref0/issues/300

scottleibrand avatar Feb 11 '17 18:02 scottleibrand