rnpenguin / cgm-remote-monitor

Nightscout - A remote monitoring web server and client for continuous glucose management
http://nightscouthd.azurewebsites.net/
24 stars 116 forks source link

Add upload trend data to support pebble app. #23

Open TC2013 opened 10 years ago

TC2013 commented 10 years ago

I don't know how to submit suggestions for code changes, so here goes:

In the UpLoadHelper file in the Dexcom Uploader repo, after line 44 add:

            testData.put ("trend", data[i].trend);

In this NightScout repo, in the server.js fiel after line 142 add:

                          obj.trend = element.trend;

These 2 changes get everything working with Jason Calabrese's Pebble CGM app (https://github.com/jasoncalabrese/cgm-pebble), except for the delta, which is currently always outputting "false."

TC2013 commented 10 years ago

Almost forgot... In this repo in the pebble.js file, line 17 needs changed to:

                 obj.trend = element.trend;
TC2013 commented 10 years ago

I emailed Lane D on this last night. Lane would like to make enhancements to the current trend arrow calculations (current done in the Dexcom), so that NightScout assigns the arrow value. I'm not positive, but I think the current calculations go something like (I'm terrible at typing out math with out a rich text editor):

  1. < + or - 1 mg/dL/minute = steady arrow
  2. = + or -1mg/dL/minute < + or -2mg/dL/minute = forty-five up/down

  3. = + or -2mg/dL/minute < + or -3mg/dL/minute = up/down

  4. = + or -3mg/dL/minute = Double Up/Down

scottleibrand commented 10 years ago

I believe that is correct, based on a 30m trailing average. However, there is more to the Dexcom algorithm than that. For example, if the noise level at the sensor is too high, the Dex will not display a trend arrow. Also, when you recalibrate, the Dexcom arrows maintain the previous trend, in spite of a big calibration jump/drop. If you attempt to do your own trend arrows, it is difficult but necessary to avoid having a calibration throw them off.

IMO it's useful to collect the Dexcom trend arrows and use them as a sanity check on your own trend calculations. We do a rudimentary version of that in #DIYPS now.

Scott

On May 12, 2014, at 5:58 AM, TC2013 notifications@github.com wrote:

I emailed Lane D on this last night. Lane would like to make enhancements to the current trend arrow calculations (current done in the Dexcom), so that NightScout assigns the arrow value. I'm not positive, but I think the current calculations go something like (I'm terrible at typing out math with out a rich text editor):

  1. < + or - 1 mg/dL/minute = steady arrow
  2. = + or -1mg/dL/minute < + or -2mg/dL/minute = forty-five up/down

  3. = + or -2mg/dL/minute < + or -3mg/dL/minute = up/down

  4. = + or -3mg/dL/minute = Double Up/Down

— Reply to this email directly or view it on GitHub.