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

22nd
Nov 2015
Jason Calabrese
@jasoncalabrese
Nov 22 2015 01:46
nice
like that idea
spent all day without network, had bad site too, need better offline tools
and I think that means android and ios
if I had happ setup that might have been good
Peter Miller
@ochenmiller
Nov 22 2015 02:12
Just finished building "Hank Jr". Carelink and Wixel are inside the RPi case! Also hard wired the power cable, as the micro USB ones kept getting bent. It's the little things.
Ben West
@bewest
Nov 22 2015 02:12
nice
take some pictures :-)
Dana Lewis
@danamlewis
Nov 22 2015 02:13
Nice :)
You don't have range issues w Carelink inside do you?
Peter Miller
@ochenmiller
Nov 22 2015 02:14
They don't seem to be worse than with it hanging off on the outside. Plus, it's not in its cover. Still eager for a better transceiver...
I tore off the usb connector and soldered leads onto it. Covered in heat shrink.
Dana Lewis
@danamlewis
Nov 22 2015 02:15
Did you have it plugged in directly to Pi before, or on an extension cord?
Peter Miller
@ochenmiller
Nov 22 2015 02:15
Bottom of the stick is facing away from the RPi mother board
Directly in before
Old rig had a second RPi case taped to the end of the first. That contained/covered the wixel and carelink
So this one is half the size
Do you get better performance from carelink on the end of a cord? I considered that to get it closer to the pump for sleeping
Dana Lewis
@danamlewis
Nov 22 2015 02:27
Yes, I always have mine on a cord, but I have issues keeping connectivity with only one usb even if it's beside the bed sometimes.
Dana Lewis
@danamlewis
Nov 22 2015 02:36
Neat
Scott Leibrand
@scottleibrand
Nov 22 2015 02:36
What is plugged into the GPIO pins there?
Peter Miller
@ochenmiller
Nov 22 2015 02:40
The wixel is plugged into the serial tx and rx, 5V and ground. It shows up on the RPi as ttyAMA0
The carelink is soldered to the back of the left hand USB. Totally to spec! Just like the pros do it!
The usb power cable is just pushed through the audio jack , fished through the two pass through holes in the board, and soldered to the back of the miniusb power connector
@LorelaiL , very cool BLE application!
Peter Miller
@ochenmiller
Nov 22 2015 02:50
@LorelaiL , what BLE dongle are you using on the RPi?
Peter Miller
@ochenmiller
Nov 22 2015 03:03
I've been keeping the RPi velcroed to the nightstand at about matress top level, back of the Carelink stick towards the mattress.
John Males
@johnmales
Nov 22 2015 04:51

So I'm working with pump data in mmol/L writing a script to convert my read_bg_targets to have values in mg/dl.

oref0 get-profile read_settings.json read_bg_targets.json read_insulin_sensitivies.json read_selected_basal_profile.json max_iob.json 
BG Target data is expected to be expressed in mg/dL. Found mmol/L in read_bg_targets.json

my read_bg_targets.json is:

{
  "units": "mmol/L",
  "raw": "0x02 0x00 0x28 0x37 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00",
  "targets": [
    {
      "high": 5.5,
      "start": "00:00:00",
      "low": 4,
      "offset": 0,
      "i": 0,
      "x": 0
    }
  ],
  "first": 2
}

So if I manually change units to mmol/L and convert the high and low values to mg/dl manually the get-profile command works.

So I'm trying to write a script to convert these values. I can do this to convert the mmol/L to mg/dl:

cat < read_bg_targets.json | json -e 'this.units="mg/dL"'

But I'm not sure how to reference the "high" and "low" values within the "targets" array - help appreciated :)

John Males
@johnmales
Nov 22 2015 11:58
I think I figured out the answer to my own question. If I do this:
echo -e "{ \"units\": \"mg/dL\","  \"raw\" ":" \""$(json -f read_bg_targets.json | json -a raw)" ":"  \""," \"targets\":"" "$(json -f read_bg_targets.json | json -a targets | json -e 'this.high=this.high*18' | json -e 'this.low=this.low*18')" "}” | json

I get this output

{
  "units": "mg/dL",
  "raw": "0x02 0x00 0x28 0x37 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 : ",
  "targets": [
    {
      "high": 99,
      "start": "00:00:00",
      "low": 72,
      "offset": 0,
      "i": 0,
      "x": 0
    }
  ]
}

Which I can then use for oref0 get-profile. I’m sure there is a way which is 1000x more elegant…its just that I don’t know it

Jason Calabrese
@jasoncalabrese
Nov 22 2015 13:37
seems like we need a little oref0 tool to convert to mgdl
thought there was someone else running in mmol
timomer
@timomer
Nov 22 2015 16:35
fyi - HAPP now supports oref0-determine-basal.js without any changes to the js thanks to the code from @LorelaiL
Jason Calabrese
@jasoncalabrese
Nov 22 2015 18:02
nice
Scott Leibrand
@scottleibrand
Nov 22 2015 19:54
@timomer @LorelaiL awesome! :-)
Joe
@t1djoe
Nov 22 2015 19:55
Pulled the current version to test. 😄
Scott Leibrand
@scottleibrand
Nov 22 2015 19:59
The README says you're still using https://github.com/timomer/openaps-js: is that now out of date?
timomer
@timomer
Nov 22 2015 21:21
@scottleibrand yep it is out of date, I better update that...
I now use, openaps-js, oref0 and my port to android - pick what you want to use in the app settings
nice to have an option to change the algorithm - means you can test an openAPS dev version or add any other algorithm
Scott Leibrand
@scottleibrand
Nov 22 2015 21:24
What do you use from openaps-js that's not in oref0?
Thinking about completely deprecating openaps-js now.
timomer
@timomer
Nov 22 2015 21:26
nothing, it just there for me to compare
Scott Leibrand
@scottleibrand
Nov 22 2015 21:26
Any objections to deprecating it?
timomer
@timomer
Nov 22 2015 21:26
I have not looked at oref0 to see if there are any changes in iob.js
nope, none at all
Scott Leibrand
@scottleibrand
Nov 22 2015 21:27
Yes, a big refactor and some important bug fixes.
timomer
@timomer
Nov 22 2015 21:27
right, I better check it out
I am still using my Android port of it
I plan to talk to Gustavo about simPancreas and see if I can get the code to add as an APS algorithm option to HAPP
Scott Leibrand
@scottleibrand
Nov 22 2015 21:29
Nice
@loudnate's openaps-predict based algorithm might also be interesting.
Tim Howard
@tghoward
Nov 22 2015 22:27
I recognize we are careful about not duplicating treatment data in the database serving nightscout. (got me into trouble earlier). I am currently not careful about duplicate BG data, however (entries collection). Does Nightscout API handle duplicate entry data smoothly?
Any suggestions about culling BG data before sending up to NS?
I need to handle periods away from connectivity when a few hours of BG data need to be pushed up, but in other times only one or two records.
Scott Leibrand
@scottleibrand
Nov 22 2015 22:33
You could probably do something like ns-latest-treatments does and check timestamp of last entry in NS.
Tim Howard
@tghoward
Nov 22 2015 22:42
Are you filtering for dups?
... in entries?
yes, good idea to reuse what's been written for ns-latest-treatments
timomer
@timomer
Nov 22 2015 22:49
@tghoward in HAPP when I submit a treatment I capture the JSON reply and add the NS ID for that treatment into my DB
This allows me to manage offline support and know what data has been uploaded
There has been one or two reports of duplicates, I think it was my code, now fixed. If not I'll be looking at getting the last X treatments from NS comparing them to my DB before uploading
Tim Howard
@tghoward
Nov 22 2015 22:52
@timomer that's excellent. So you are storing data locally in an SQLite DB? The same for BG data?
Jason Calabrese
@jasoncalabrese
Nov 22 2015 22:53
I've been trying to avoid dupes, but makes things tricky
Tim Howard
@tghoward
Nov 22 2015 22:54
should be able to tag what's sent up locally and not ask NS what it has?
diabeticgonewild
@diabeticgonewild
Nov 22 2015 22:55

Yeah, so just to give everyone an update on #VirtualPancreas: I think this can be done better in OpenBUGS, which is open source, at least for the first part of my project, as MATLAB cannot inherently handle intrinsic Gaussian conditional autoregression, and that is difficult to program, as the information on it is sparse, as it is a relatively recent discovery. OpenBUGS does handle intrinsic Gaussian conditional autoregression (ICAR) natively, so it's a better fit.

So, I'm in the process of translating a bunch of my code, and learning the basics of OpenBUGS/BUGS language.

The controller (second part of my project) will be in MATLAB no matter what. That is the industry standard for controls.

timomer
@timomer
Nov 22 2015 22:55
@tghoward yep, correct. Checkout NSuploader.java class in HAPP
diabeticgonewild
@diabeticgonewild
Nov 22 2015 22:55
BTW, WinBUGS (not open source, but similar to OpenBUGS) was used for the paper I have been working on.
timomer
@timomer
Nov 22 2015 22:56
I have designed it to work with any integration
@tghoward yep that's what I'm doing now, but if I fail to get the JSON reply from NS, I never mark the record as uploaded. This could happen for example with a bad network connection
Tim Howard
@tghoward
Nov 22 2015 22:59
Yes, good point.
very nice.
timomer
@timomer
Nov 22 2015 23:01
@tghoward checkout my class, PM any questions. I think I commented it well
Tim Howard
@tghoward
Nov 22 2015 23:07
@timomer not going over to android yet but I certainly like it as an option for the future. But I will look at it, for sure.
timomer
@timomer
Nov 22 2015 23:10
My code is simple, should be able to use my concept for your own platform
Tim Howard
@tghoward
Nov 22 2015 23:16
Yes, looks clean. Thanks.
eyim
@eyim
Nov 22 2015 23:37

@jmatheson This might fix the issue you were having with uploading to Azure. It worked for me once I added the https://

@scottleibrand that did it! Thanks. @eyim , a syntax that works is to not use $NIGHTSCOUT_HOST, but use the full path to the host, prefaced by https://, like this nightscout latest-openaps-treatment https://bcbteddy.azurewebsites.net

@scottleibrand @timomer Thank you Ti and Scott