diff --git a/docs/docs/walkthrough/phase-6/Configure-Automatic-Sensitivity-Mode.md b/docs/docs/walkthrough/phase-6/Configure-Automatic-Sensitivity-Mode.md index c478603fe..a93a2384b 100644 --- a/docs/docs/walkthrough/phase-6/Configure-Automatic-Sensitivity-Mode.md +++ b/docs/docs/walkthrough/phase-6/Configure-Automatic-Sensitivity-Mode.md @@ -2,14 +2,13 @@ For more information review https://github.com/openaps/oref0/issues/58 -1) Ensure to get the latest dev branch +1) Install the latest dev branch of `oref0`: ``` sudo npm install -g git://github.com/openaps/oref0.git'#dev' ``` - -2) Next in order to properly execute the new auto-sensitivity module, you need to have at least 24 hour worth of pump history data and enough bg readings (past 24 hours). -In your openaps.ini apply the following changes: +2) Next in order for the new auto-sensitivity report to run, you need to have at least 24 hours worth of pump history data and enough bg readings (24 hours). +In your `openaps.ini` apply the following changes: ``` [report "monitor/glucose.json"] device = cgm @@ -18,13 +17,9 @@ reporter = JSON count = 288 ``` -Note: If using Nightscout add count=288 to your entries.json API call as a querystring parameter - -One way to do this is to go to your openaps directory and do: +(NOTE: if using Nightscout, add `count=288` to your `entries.json` API call as a querystring parameter) -`nano ns-glucose.ini` -this opens the file in the Nano editor which allows you to make these changes: -For NS it will look something like this depending on how you implement it (note the ?count=288) that is what you have to add +One way to do this is to go to your openaps directory and edit the `ns-glucose.ini` file. Depending on how you've implemented it, it should look something like this (please note the `?count=288`): ``` [device "curl"] fields = @@ -32,25 +27,22 @@ cmd = bash vendor = openaps.vendors.process args = -c "curl -s https://[Your URL]/api/v1/entries.json?count=288 | json -e 'this.glucose = this.sgv'" ``` +If your `glucose.json` does not have enough entries you will see a warning when running your `auto-sens.json` report: +``` +Error: not enough glucose data to calculate autosens. +``` - -If your [glucose.json] does not have enough entries you will see a warning when running your auto-sens.json report "Error: not enough glucose data to calculate autosens." - -3) After applying the above change you need to add a new device and report. -A process device must be added, call it "auto-sens" +3) After applying the above change you need to add a new `auto-sens` device and an `auto-sens` report. Run this command to create the `auto-sens` report: `openaps device add auto-sens process --require "glucose pumphistory insulin_sensitivities basal_profile profile" oref0 detect-sensitivity` -Inspecting openaps.ini with - -`less openaps.ini` will reveal - +If the command exectuted properly, the contents of `openaps.ini` should contain: ``` [device "auto-sens"] vendor = openaps.vendors.process extra = auto-sens.ini ``` -and your auto-sens.ini using `less auto-sens.ini` should look like this: +Another new file named `auto-sens.ini` should have been created, and it should contain: ``` [device "auto-sens"] fields = glucose pumphistory insulin_sensitivities basal_profile profile @@ -58,35 +50,32 @@ cmd = oref0 args = detect-sensitivity ``` -4) Next create this report. The easiest method is to +4) In order for `auto-sens` to run properly, you need to make sure you pull enough history from your pump - 24 hours plus however many yours you have set for your DIA. To do this, you will create a new report called `pumphistory-24h.json`: +``` +openaps report add settings/pumphistory-24h.json JSON pump iter_pump_hours 28 +``` +(NOTE: the `28` assumes a 4h DIA - please adjust accordingly) -`nano openaps.ini` cut and paste: +5) Once the device is created, we need to create the `auto-sens.json` report. Run this command to create the `auto-sens.json` report: +``` +openaps report add settings/auto-sens.json text auto-sens shell monitor/glucose.json settings/pumphistory-24h.json settings/insulin_sensitivities.json settings/basal_profile.json settings/profile.json [] +``` +Now invoke the report to test: +``` +openaps invoke report settings/auto-sens.json ``` -[report "monitor/auto-sens.json"] -profile = settings/profile.json -use = shell -reporter = text -json_default = True -pumphistory = monitor/pumphistory_zoned.json -basal_profile = settings/basal_profile.json -insulin_sensitivities = settings/insulin_sensitivities.json -glucose = monitor/ns-glucose.json -device = auto-sens -remainder = [] -``` -Invoke the report to debug. If you used different conventions than listed above the report will return errors that you will be able to recognize -5) Next we need to pass auto-sens.json to oref0-determine-basal.json, in openaps.ini add a new input simillar to folowing example below: +6) Next we need to add the `auto-sens.json` report to the `oref0-determine-basal` device. In `openaps.ini` make sure your `oref0-determine-basal` looks similar to this: ``` [device "oref0-determine-basal"] -fields = iob current-temps glucose profile auto-sens meal +fields = iob current-temps glucose profile **auto-sens** meal cmd = oref0-determine-basal vendor = openaps.vendors.process args = ``` +(NOTE: in the `fields` above, `meal` should only be present if meal assist is configured) -Note that in the "fields" above that "meal" should only be present if meal assist is configured - +7) At this point, in the process you should already have an `enact/suggested.json` report. Edit your `openaps.ini` file and add the following bolded line to that report: ``` [report "enact/suggested.json"] profile = [Your Path]/profile.json @@ -97,30 +86,22 @@ device = oref0-determine-basal iob = [Your Path]/iob.json glucose = [Your Path]/glucose.json meal = [Your Path]/meal.json -auto-sens = [Your Path]/auto-sens.json +**auto-sens = settings/auto-sens.json** ``` -As per the comment with the device, "meal" should be deleted if meal assist is not activated +(NOTE: as stated above, if you do not have meal assist enabled, do not include the `meal` line) -6) Next you have to make sure you pull 28 hours (24h + DIA) of pump history. Change the hours to 24, so your pump history report should look like this: +8) Based on the configuration of the basic loop, it is recommended that the `settings/auto-sens.json` be added to the `gather-profile` alias: ``` -[report "monitor/pumphistory.json"] -device = pump -hours = 28 -use = iter_pump_hours -reporter = JSON +gather-profile report invoke settings/settings.json settings/bg_targets.json settings/insulin_sensitivities.json settings/basal_profile.json settings/profile.json **monitor/auto-sens.json** ``` - -Based on the configuration of the basic loop, suggest that the invoking the monitor/auto-sens.json be added to the gather-profile alias: -`gather-profile report invoke settings/settings.json settings/bg_targets.json settings/insulin_sensitivities.json settings/basal_profile.json settings/profile.json monitor/auto-sens.json` - -and that the gather alias be adjusted to make sure gather-profile is at the end. This is because the monitor/auto-sens.json report depends upon elements from the preceding two aliases to run. +and that the `gather` alias be adjusted to make sure `gather-profile` is at the end. This is because the `settings/auto-sens.json` report depends upon elements from the preceding two aliases to run. `gather ! bash -c "rm -f monitor/*; openaps monitor-cgm && openaps monitor-pump && openaps gather-profile"` -Note. Your loop should run without auto-sens.json report but if you don't pass that as an input you will see the following message while executing oref0-determine-basal.js: - +Note. Your loop should run without `auto-sens.json` report but if you don't pass that as an input you will see the following message while executing `oref0-determine-basal.js`: +``` Optional feature Auto Sensitivity not enabled: { [Error: ENOENT: no such file or directory, open 'online'] errno: -2, code: 'ENOENT', syscall: 'open', path: 'online' } - +``` Here is an example of running the loop with Auto Sensitivity feature enabled: ``` Feb 26 22:26:11 raspberrypi openaps-loop: reporting oref0-prepare/mm-normalized.json @@ -176,7 +157,3 @@ Feb 26 22:26:42 raspberrypi openaps-loop: "reason": "Eventual BG 104>100 but A Feb 26 22:26:42 raspberrypi openaps-loop: } Feb 26 22:26:43 raspberrypi openaps-loop: No recommendation to send ``` - - - -