These are chat archives for nightscout/intend-to-bolus

13th
Jan 2016
Alex
@SuicidalTissue
Jan 13 2016 00:27
I'm trying to get ns-get.sh working as part of oref0. What are the arguments for it? I can't seem to get it to create a report, not sure if it's not connecting or what.
Oskar Pearson
@oskarpearson
Jan 13 2016 00:29
I've not used it, sorry. I actually don't use nightscout at all - perhaps someone else here can help :(
Scott Leibrand
@scottleibrand
Jan 13 2016 00:32
$ ./bin/ns-get.sh --config
Device name missing.
Usage: ns-get.sh <entries.json> [NIGHTSCOUT_HOST|localhost:1337] [QUERY] [stdout|-]

ns-get.sh type <entries.json> <NIGHTSCOUT_HOST|localhost:1337] [QUERY] [stdout|-]
ns-get.sh host <NIGHTSCOUT_HOST|localhost:1337> <entries.json> [QUERY] [stdout|-]

ns-get.sh --config <device> <entries.json> <NIGHTSCOUT_HOST>  <monitor/entries.json>
I actually have an earlier one-liner that does the same thing, so don't use that script directly
Pete Schwamb
@ps2
Jan 13 2016 00:54
@sulkaharo if you look in that document a little further down, you'll see the pin out.
Matthias Granberry
@mgranberry
Jan 13 2016 03:02
https://github.com/tidepool-org/chrome-uploader/pull/218/files For differences in G4/G5 USB record format
eyim
@eyim
Jan 13 2016 03:06
Question for those that do the meal pre-bolus in order to stop the spike. What do you do if the person already has significant iob - say more than 2+ units. Do you find it helpful to give another 1+unit to stop the spike? Or at that point does he has enough on board? Normally he would have carbs he is still digesting. We still try to give the insulin early
Dana Lewis
@danamlewis
Jan 13 2016 03:08
No. It's not about amount, it's about timing.( If insulin on board more than negative) key is having insulin peaking by the time or before carbs kick into gear
Scott Leibrand
@scottleibrand
Jan 13 2016 03:12
If you have a loop running, you can also look at BGI to see when insulin activity peaks. If it's below -10 mg/dL or so when carbs are absorbing, insulin levels should be high enough to prevent meal rise completely.
eyim
@eyim
Jan 13 2016 03:14
Okay thank you. His dia is so long (5 hours) and his carb absorption rate so fast 40+ that we have a hard time stopping the spike. I'll keep working on it. Thanks for the advice
Matthias Granberry
@mgranberry
Jan 13 2016 03:28
have you tried super-bolusing? Stealing from basal to provide extra mealtime insulin and depending on the residual insulin to act instead of the basal insulin later? It might be a better match for absorption.
@eyim It doesn't normally work great for me, but sometimes it helps.
eyim
@eyim
Jan 13 2016 03:33
@mgranberry Thank you for the suggestion. I've tried it a few times. Been stealing two hours of basal and giving it up front and then temp basal to 0 for two hours. It has helped some but can't seem to get those magical small lifts I see posted here. We generally see at least a 100 point rise that then takes several hours to get back into a nice range.
Scott Leibrand
@scottleibrand
Jan 13 2016 03:34
Are you doing a full hour-earlier eating soon bolus?
eyim
@eyim
Jan 13 2016 03:34
He eats so much that I sometimes get scared seeing 15 units on board and him looking around hungry at what else to eat #tennage boys
@scottleibrand that is what I have been experimenting with as well. The hardest part is that I am not always with him so hard to get him to do it
eyim
@eyim
Jan 13 2016 03:39
That is part of the reason I am so excited about the smaller OpenAPS devices. That way it can help him at all times - even those times he forgets to do the right thing :smile:
Dana Lewis
@danamlewis
Jan 13 2016 03:44
:)
Matthias Granberry
@mgranberry
Jan 13 2016 04:20
@eyim it's hard to manage zero food rise with high-carb diet along with any amount of insulin resistance, which just being a teenager will tend to cause. Medical literature indicates that metformin helps some teens and it's fairly safe, and 15 minutes of light exercise soon after a meal will help too.
symlin/pramlintide or a GLP-1 agonist might slow food absorption too, but that's one more thing to deal with
I hated my time on a GLP-1 agonist, but I've heard very different things from other people who have tried them
eyim
@eyim
Jan 13 2016 04:37
@mgranberry thank you for the additional information. I'm not ready to go down those routes yet. I'll keep experimenting.
Thomas Emge
@ThomasEmge
Jan 13 2016 05:36
I am still stuck on my cron issue. The loop script is working when called manually in the CLI, I do see entries when I check on cron status that the cron job runs every 10 minutes, but no actual log file is created as a result of it. I am expecting a log file because stdout and stderr are piped into it. What else can I check?
Scott Leibrand
@scottleibrand
Jan 13 2016 05:38
Permissions on the log file maybe. Did you try redirecting output to the log when running it manually?
you should also put together a simpler cron that runs every minute writing to the log file, and then start adding things to that as you verify it's working.
Thomas Emge
@ThomasEmge
Jan 13 2016 05:40
yes I ran the same line I inserted in crontab manually and the log is generated as expected. Each run should produce is own log file (and it does when called manually)
ok I'll start with a simply echo shell
Thomas Emge
@ThomasEmge
Jan 13 2016 05:54
hmm, a log file is created when I pipe the echo inside the shell script and not in the crontab but it it is not created when I only have an echo in the script and the pipe in the crontab. What is that trying to tell me?
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 06:14
blob
So this is the visible result! withaout and with loop running :)
this is the 3rd night having loop running
Thomas Emge
@ThomasEmge
Jan 13 2016 07:07
one general question, how do you keep your APS connected if one were to upload to NS. Keep it tethered to the mobile or how do you transition from work to home to the soccer fields?
Howard Look
@HowardLook
Jan 13 2016 07:17
@jasoncalabrese Back when Andrew was not using the OpenAPS rig during the day at school, what was your strategy for making sure that it “inhereted” a good IOB from the open loop system when you made the switch in the evening?
Jason Calabrese
@jasoncalabrese
Jan 13 2016 07:29
normaly iob is very low or zero at that time, unless we're correcting a high
so it hasn't been much of an issue
before we had the new expected delta, 0 iob made determine basal not high temp, but it's much better now in those 0 iob situations
even when there have been bugs and y2016 issue and we had 0 iob there are enough safeguards
planning to send the rig to school for the first time next Tuesday
Scott Leibrand
@scottleibrand
Jan 13 2016 17:27
:+1: @ktomy! :-)
@ThomasEmge we use a Tecknet battery on our mobile rig, so it can be plugged in without cutting power to the Pi. After we leave home we hotspot from the phone, and then kill the hotspot when we get home. Annoyingly manual, but fortunately the loop works fine offline if I forget, so I only have to hotspot when I want visibility.
On the cron thing, you may need a PATH defined, or to specify the full path to date
or try >> to a single log file instead of one per run. :-)
Paul Andrel
@stavlor
Jan 13 2016 17:31
ah nice the few batteries i've tested with cut off power when power is connected to them
Dana Lewis
@danamlewis
Jan 13 2016 17:31
yup. that was a game changer. cut down on SD corruption a lot
Thomas Emge
@ThomasEmge
Jan 13 2016 18:22
@scottleibrand I haven't explore the PATH venue yet. I did rebuild my script yesterday and now have something that does (kind of) run and produces log files - well that part now works reliably. 'kind of' for the reason that I am running now into the issue that mm-stick warmup returns 1 when run in the cron job but returns 0 when executed manually in the CLI. Would this point to a PATH issue as well?
Scott Leibrand
@scottleibrand
Jan 13 2016 18:30
Yep. All commands need to be fully qualified if you don't have a PATH
Thomas Emge
@ThomasEmge
Jan 13 2016 18:36
darn it, now I wish I'd brought the rig to work to try it right now. ;)
Scott Leibrand
@scottleibrand
Jan 13 2016 18:39
Darn day jobs ;-)
Paul Andrel
@stavlor
Jan 13 2016 18:43
heh they pay for the toys and insurance lol
Scott Leibrand
@scottleibrand
Jan 13 2016 18:44
;-)
Kevin Wells
@wkcwells
Jan 13 2016 18:59
I’m working on Visualization per the docs. Status upload is working, but treatment upload is failing with Cannot POST /api/v1/treatments.json. any help would be much appreciatd.
I believe I am running the dev branch of Nightscout, but I don’t know how to confirm that.
Paul Andrel
@stavlor
Jan 13 2016 19:01
Rachel Sandlain
@audiefile
Jan 13 2016 19:01
easiest way is to open the settings in your site and scroll to the bottom. there's a version number
Kevin Wells
@wkcwells
Jan 13 2016 19:02
Thanks! "version":"0.9.0-dev”
Paul Andrel
@stavlor
Jan 13 2016 19:03
Hmm if your getting cannot post to api/v1/treatments.json is careportal enabled?
Kevin Wells
@wkcwells
Jan 13 2016 19:03
Thanks @audiefile. That would have been the obvious thing to try!
Paul Andrel
@stavlor
Jan 13 2016 19:03
what does your /api/v1/status.json look like?
Kevin Wells
@wkcwells
Jan 13 2016 19:10
@stavlor Ah, there’s the problem. careportal is enabled and the treatment upload is working.
Thank you! Do I have to do something else that I missed to get the blue basal profile and temp basal line to show up?
Paul Andrel
@stavlor
Jan 13 2016 19:12
@wkcwells it is likely disabled by default, change the render basal option from default to which ever you prefer
may need to add basal to your enable not sure if it gets enabled by default or not my setup has a bunch of ENV stuff set and check that you have a default profile in your profile editor
Rachel Sandlain
@audiefile
Jan 13 2016 19:14
Basal is a separate enable
Paul Andrel
@stavlor
Jan 13 2016 19:15
couldn't recall if it was in the default enabled plugins or not
Kevin Wells
@wkcwells
Jan 13 2016 19:15
It’s all working now. Awesome! thanks so much. I am ready to monitor for a couple days and then close the loop! Will feedback to the docs alos...
Rachel Sandlain
@audiefile
Jan 13 2016 19:16
:+1:
Paul Andrel
@stavlor
Jan 13 2016 19:19
nice @wkcwells glad your working
Dana Lewis
@danamlewis
Jan 13 2016 19:19
Yay @wkcwells !
Toby Canning
@TC2013
Jan 13 2016 19:22
The worst thing about switching to the Edison is that I haven't figured out how to back it up. I've reloaded our setup on it no less than 4x now
Paul Andrel
@stavlor
Jan 13 2016 19:31
@TC2013 ouch
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 20:13
@wkcwells in my setup this error was caused by missing $nigthscout_host
so it is possible that if you will replace #nightscout_host in script by your host (without trailing shash)(something like http://yourname.herokuapp.com ) and #api_secret by hashed api secret it could work
Scott Leibrand
@scottleibrand
Jan 13 2016 20:20
better to set the NIGHTSCOUT_HOST environment variable in cron rather than hard-coding it in the script
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 20:24
absolutly, but for an imediate workaround/finding cause it is good enough in my opinion
Scott Leibrand
@scottleibrand
Jan 13 2016 20:25
yep. just remember to fix it after you're done troubleshooting, or you'll have issues the next time we update that script
Ben West
@bewest
Jan 13 2016 20:40
the --config switch will show a technique for putting NIGHSCOUT_HOST in extra ini file as argument to script
this allows it to show up in script as $1 usually
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:10
is there something already done like: if last bg reading is older than 15 minutes - no actions should be done on pump?
Rachel Sandlain
@audiefile
Jan 13 2016 22:10
yes. determine basal won't provide suggestions if data is older than 5 minutes
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:10
My problem is that if for a reason I don't have bg readings for a time, i take last read bg and it can lead to completely wrong results if this bg reading is old
seems that not in my version
can you please give me the file/lkine where this check is done to put some debug logging there?
Scott Leibrand
@scottleibrand
Jan 13 2016 22:13
@audiefile it's 10m old, or 5m in future
Rachel Sandlain
@audiefile
Jan 13 2016 22:13
:+1:
@ktomy what exactly do you mean by "don't have bg readings for a time"? what exactly is in glucose.json?
John Males
@johnmales
Jan 13 2016 22:15
Is the current time defined by the pump (clock.json or similar)?
Scott Leibrand
@scottleibrand
Jan 13 2016 22:15
if you can reproduce this, I want to dig in: acting on old data is a serious issue.
current time for the BG check is the Pi clock time
John Males
@johnmales
Jan 13 2016 22:16
thinking about the circumstance where the pi isn’t internet connected and the time may be off
if NTP is down, that sets the Pi clock to the most recent of the pump and CGM clocks
John Males
@johnmales
Jan 13 2016 22:18
Is that something that happens automagically or needs to be invoked?
Scott Leibrand
@scottleibrand
Jan 13 2016 22:19
if you want that behavior you need to set it up in your cron/loop somewhere
we had it in loop.sh and used it on the honeymoon
but that was before oref0
John Males
@johnmales
Jan 13 2016 22:20
something to add for the furture when looping outside of the home
thanks
Scott Leibrand
@scottleibrand
Jan 13 2016 22:20
I don't think I have it in my current oref0 setup
you only need it if you shut down the Pi for hours and then bring it back online without Internet
if you are connected after power-on before losing Internet, your clock will be fine
John Males
@johnmales
Jan 13 2016 22:22
True.
Scott Leibrand
@scottleibrand
Jan 13 2016 22:25
I just checked our mobile Pi, and it has never gotten stuck with a bad clock in the month since I started writing out the bgtime in the logs
so traveling internationally with no Internet seems like the main use case for clockset.sh
John Males
@johnmales
Jan 13 2016 22:26
that is comforting :)
Scott Leibrand
@scottleibrand
Jan 13 2016 22:27
it helps that I am quite fastidious about hotspotting. :)
Dana Lewis
@danamlewis
Jan 13 2016 22:27
(one of us is ;))
Scott Leibrand
@scottleibrand
Jan 13 2016 22:27
need to figure out how to let it automatically hotspot with BT without requiring manual activation like wifi does. bluez hates me though. :-(
John Males
@johnmales
Jan 13 2016 22:28
yes having a few weeks of limited connectivity has brought this into focus. The bluetooth thing would certainly be useful!
Scott Leibrand
@scottleibrand
Jan 13 2016 22:29
if anyone wants a project, figuring out BT tethering from the Pi to a smartphone would be very useful
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:30
:) let me show you the first results:
    var systemTime = new Date();
var bgTime;
bgTime = new Date("Wed Jan 13 23:09:46 EET 2016");
    var minAgo = (systemTime - bgTime) / 60 / 1000;
console.error("System date: " + systemTime)
console.error("BG Date:"+bgTime);
    if (minAgo > 10 || minAgo < -5) { // Dexcom data is too old, or way in the future
console.error("ok");
}
else
{
console.error("fail");
}
and the output is...
pi@raspberrypi:~ $ ./test.js
System date: Thu Jan 14 2016 00:28:50 GMT+0200 (EET)
BG Date:Invalid Date
fail
:)
date string was got from ns-glucose.json
Scott Leibrand
@scottleibrand
Jan 13 2016 22:32
expected format is "display_time": "2016-01-13T14:30:48",
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:33
    if (glucose_data[0].display_time) {
        bgTime = new Date(glucose_data[0].display_time.replace('T', ' '));
    } else if (glucose_data[0].dateString) {
        bgTime = new Date(glucose_data[0].dateString);
this is from determine-basal
Ben West
@bewest
Jan 13 2016 22:33
instead of new Date( )
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:33
in ns-glucose.json I don't have display_time
Scott Leibrand
@scottleibrand
Jan 13 2016 22:33
or dateString": "2016-01-10T14:09:35.000Z",, right
not "Wed Jan 13 23:09:46 EET 2016"
Ben West
@bewest
Jan 13 2016 22:34
use something like (new Date( )).toISOString( )
call toISOString( ) to get the right format
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:35
so, as I have in my ns-glucose.json:
  {
    "_id": "5696bd4f8d78da1521046804",
    "unfiltered": 139392,
    "filtered": 143264,
    "direction": "Flat",
    "device": "dexcom",
    "rssi": 175,
    "sgv": 130,
    "dateString": "Wed Jan 13 23:09:46 EET 2016",
    "type": "sgv",
    "date": 1452719386000,
    "noise": 1,
    "glucose": 130
  },
Ben West
@bewest
Jan 13 2016 22:35
that will cause errors
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:35
i should parse string in this format, or at first convert it to iso
Ben West
@bewest
Jan 13 2016 22:35
need to add toISOString( )
then you can call Date.parse( ) and many other functions on it
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:36
let me understand, toIsoString() is a method which accespts string as parameter?
Ben West
@bewest
Jan 13 2016 22:36
needs to be "iso8601" format
no. all dates have a method called toISOString
it needs to be called whenever you want to format/save a date
you are implicitly calling my_date.toString( )
which gets you that format
that's the wrong format
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:37
yes, but in glucose_data[0].dateString I don't have date, object i have string
Ben West
@bewest
Jan 13 2016 22:38
right, the thing that is making that json is broken
Scott Leibrand
@scottleibrand
Jan 13 2016 22:38
I use openaps device add ns-glucose process 'bash -c "curl -s $NIGHTSCOUT_HOST/api/v1/entries/sgv.json | json -e \"this.glucose = this.sgv\""'
Ben West
@bewest
Jan 13 2016 22:38
the json needs to have iso format
Scott Leibrand
@scottleibrand
Jan 13 2016 22:38
@ktomy what are you using to make your ns-glucose.json?
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:39
cmd = bash -c "curl -s $NIGHTSCOUT_HOST/api/v1/entries/sgv.json | json -e \"this.glucose = this.sgv\""
Ben West
@bewest
Jan 13 2016 22:40
ah, sorry
so you are getting data from NS and putting it openaps
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:40
yes
but somewhere it is converted ok as normally openaps works :)
Ben West
@bewest
Jan 13 2016 22:41
hmm
out of curiosity, which uploader are you using to get data into NS?
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:42
I don't know the version right now
but for sure this is the one got from play store
...almost sure
:)
Ben West
@bewest
Jan 13 2016 22:42
ok
I'm used to seeing iso strings for long time now
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:42
and entries from api are exactly with date in this format
Ben West
@bewest
Jan 13 2016 22:42
gotcha
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:43
anyway, we should make this check more fail-safe, will try my js skills :)
so if conversion fails it should return error
Ben West
@bewest
Jan 13 2016 22:48
@ktomy it is returning error
> bgTime = new Date(Date.parse("Wed Jan 13 23:09:46 EET 2016")); Invalid Date
you can try using date instead of dateString
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:55
can you please check if your entries.json from NS is returning dateString in iso format or it is the same like my case?
Scott Leibrand
@scottleibrand
Jan 13 2016 22:57
  {
    "_id": "569269f2e311eba6eb521c82",
    "sgv": 145,
    "date": 1452435875000,
    "dateString": "2016-01-10T14:24:35.000Z",
    "trend": 4,
    "direction": "Flat",
    "device": "share2",
    "type": "sgv",
    "glucose": 145
  },
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:57
share.....
so you are not using dexcom uploader but share bridge, right?
Scott Leibrand
@scottleibrand
Jan 13 2016 22:58
yeah, NS is getting it from Dexcom's servers
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 22:59
ok, let's ask somebody to post a "native" uploader dateString :)
better on NS/public as there are more people alive I think :)
Ben West
@bewest
Jan 13 2016 23:00
I did
or will
{"_id":"56952d4170a0d7821fca6a57","device":"dexcom","date":1452617020000,"dateString":"2016-01-12T16:43:40+00:00","sgv":10,"direction":"NOT_COMPUTABLE","noise":4,"type":"sgv","filtered":244960,"unfiltered":275392,"rssi":189}
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 23:01
do you have own-compiled version of uploader app or is is play store one?
Ben West
@bewest
Jan 13 2016 23:02
I'm using cabled version with g4 and g4+share, I have my own compiled one based on a dev branch using the mqtt transport
but, I thought this particular change had been standard for some time
you are using rest/http method?
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 23:02
yes
Ben West
@bewest
Jan 13 2016 23:02
we can make a change to NS server to convert it automatically
we've been discussing it for long time
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 23:03
yes, it is more simple I think :)
...but best option is to use .date :) as it will be always int
Jason Calabrese
@jasoncalabrese
Jan 13 2016 23:15
the master version of the NS uploader has the wrong date format
I think that whole repo should be marked as deprecated
with that uploader the date field is your only option
we can also fix the data on the post at the server
using the date field
Alin Artiom Kenibasov
@ktomy
Jan 13 2016 23:34
aha, thank you, I'll make a small change in determine-basal to avoid this issue, if my PR will be accepted then no more worries :)
Scott Leibrand
@scottleibrand
Jan 13 2016 23:38
yeah, seems like we should be liberal in what we accept there, and/or bail properly when it's not what we know how to handle. looking forward to the PR. :)
Toby Canning
@TC2013
Jan 13 2016 23:49
So, now that I have the Edison up and running with the RileyLink, I'm thinking of purchasing a Share receiver to pair with the Edison. Does anyone know if https://github.com/bewest/openxshareble is working reliably?
Scott Leibrand
@scottleibrand
Jan 13 2016 23:54
I haven't yet gotten it working with a Pi
@bewest is having good success from his laptop
gonna try a different Share receiver, hopefully tonight. my problem was the Share wouldn't recognize the pairing
Toby Canning
@TC2013
Jan 13 2016 23:55
Very good, let me know how it goes!