Sign inSign up

nightscout/cgm-remote-monitor-development

By nightscout

Updated about 10 years ago

DEVELOPMENT VERSION! Use is without warranty or support. Review the LICENSE in the repository!

Image
5

100K+

nightscout/cgm-remote-monitor-development repository overview

Nightscout Web Monitor (a.k.a. cgm-remote-monitor)

nightscout horizontal

Build Status Dependency Status Coverage Status Codacy Badge Gitter chat

Deploy to Azure Deploy to Heroku

This acts as a web-based CGM (Continuous Glucose Monitor) to allow multiple caregivers to remotely view a patient's glucose data in real time. The server reads a MongoDB which is intended to be data from a physical CGM, where it sends new SGV (sensor glucose values) as the data becomes available. The data is then displayed graphically and blood glucose values are predicted 0.5 hours ahead using an autoregressive second order model. Alarms are generated for high and low values, which can be cleared by any watcher of the data.

#WeAreNotWaiting and this is why.

Community maintained fork of the original cgm-remote-monitor.

Coverage Status

Table of Contents

Install

Requirements:

Clone this repo then install dependencies into the root of the project:

$ npm install

#Usage

The data being uploaded from the server to the client is from a MongoDB server such as mongolab.

Updating my version?

The easiest way to update your version of cgm-remote-monitor to our latest recommended version is to use the update my fork tool. It even gives out stars if you are up to date.

What is my mongo string?

Try the what is my mongo string tool to get a good idea of your mongo string. You can copy and paste the text in the gray box into your MONGO_CONNECTION environment variable.

Configure my uploader to match

Use the autoconfigure tool to sync an uploader to your config.

Nightscout API

The Nightscout API enables direct access to your DData without the need for direct Mongo access. You can find CGM data in /api/v1/entries, Care Portal Treatments in /api/v1/treatments, and Treatment Profiles in /api/v1/profile. The server status and settings are available from /api/v1/status.json.

By default the /entries and /treatments APIs limit results to the the most recent 10 values from the last 2 days. You can get many more results, by using the count, date, dateString, and created_at parameters, depending on the type of data you're looking for.

Example Queries

(replace http://localhost:1337 with your base url, YOUR-SITE)

  • 100's: http://localhost:1337/api/v1/entries.json?find[sgv]=100
  • BGs between 2 days: http://localhost:1337/api/v1/entries/sgv.json?find[dateString][$gte]=2015-08-28&find[dateString][$lte]=2015-08-30
  • Juice Box corrections in a year: http://localhost:1337/api/v1/treatments.json?count=1000&find[carbs]=15&find[eventType]=Carb+Correction&find[created_at][$gte]=2015
  • Boluses over 2U: http://localhost:1337/api/v1/treatments.json?find[insulin][$gte]=2

The API is Swagger enabled, so you can generate client code to make working with the API easy. To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.html or review swagger.yaml.

Environment

VARIABLE (default) - description

Required
  • MONGO_CONNECTION - Your mongo uri, for example: mongodb://sally:[email protected]:99999/nightscout
  • DISPLAY_UNITS (mg/dl) - Choices: mg/dl and mmol. Setting to mmol puts the entire server into mmol mode by default, no further settings needed.
  • BASE_URL - Used for building links to your sites api, ie pushover callbacks, usually the URL of your Nightscout site you may want https instead of http
Features/Labs
  • ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob, see plugins below
  • DISABLE - Used to disable default features, expects a space delimited list, such as: direction upbat, see plugins below
  • API_SECRET - A secret passphrase that must be at least 12 characters long, required to enable POST and PUT; also required for the Care Portal
  • TREATMENTS_AUTH (off) - possible values on or off. When on device must be authenticated by entering API_SECRET to create treatments
Alarms

These alarm setting effect all delivery methods (browser, pushover, maker, etc), some settings can be overridden per client (web browser)

  • ALARM_TYPES (simple if any BG_* ENV's are set, otherwise predict) - currently 2 alarm types are supported, and can be used independently or combined. The simple alarm type only compares the current BG to BG_ thresholds above, the predict alarm type uses highly tuned formula that forecasts where the BG is going based on it's trend. predict DOES NOT currently use any of the BG_* ENV's
  • BG_HIGH (260) - must be set using mg/dl units; the high BG outside the target range that is considered urgent
  • BG_TARGET_TOP (180) - must be set using mg/dl units; the top of the target range, also used to draw the line on the chart
  • BG_TARGET_BOTTOM (80) - must be set using mg/dl units; the bottom of the target range, also used to draw the line on the chart
  • BG_LOW (55) - must be set using mg/dl units; the low BG outside the target range that is considered urgent
  • ALARM_URGENT_HIGH (on) - possible values on or off
  • ALARM_URGENT_HIGH_MINS (30 60 90 120) - Number of minutes to snooze urgent high alarms, space separated for options in browser, first used for pushover
  • ALARM_HIGH (on) - possible values on or off
  • ALARM_HIGH_MINS (30 60 90 120) - Number of minutes to snooze high alarms, space separated for options in browser, first used for pushover
  • ALARM_LOW (on) - possible values on or off
  • ALARM_LOW_MINS (15 30 45 60) - Number of minutes to snooze low alarms, space separated for options in browser, first used for pushover
  • ALARM_URGENT_LOW (on) - possible values on or off
  • ALARM_URGENT_LOW_MINS (15 30 45) - Number of minutes to snooze urgent low alarms, space separated for options in browser, first used for pushover
  • ALARM_URGENT_MINS (30 60 90 120) - Number of minutes to snooze urgent alarms (that aren't tagged as high or low), space separated for options in browser, first used for pushover
  • ALARM_WARN_MINS (30 60 90 120) - Number of minutes to snooze warning alarms (that aren't tagged as high or low), space separated for options in browser, first used for pushover
Core
  • MONGO_COLLECTION (entries) - The collection used to store SGV, MBG, and CAL records from your CGM device
  • MONGO_TREATMENTS_COLLECTION (treatments) -The collection used to store treatments entered in the Care Portal, see the ENABLE env var above
  • MONGO_DEVICESTATUS_COLLECTION(devicestatus) - The collection used to store device status information such as uploader battery
  • MONGO_PROFILE_COLLECTION(profile) - The collection used to store your profiles
  • MONGO_FOOD_COLLECTION(food) - The collection used to store your food database
  • PORT (1337) - The port that the node.js application will listen on.
  • SSL_KEY - Path to your ssl key file, so that ssl(https) can be enabled directly in node.js
  • SSL_CERT - Path to your ssl cert file, so that ssl(https) can be enabled directly in node.js
  • SSL_CA - Path to your ssl ca file, so that ssl(https) can be enabled directly in node.js
  • HEARTBEAT (60) - Number of seconds to wait in between database checks
Predefined values for your browser settings (optional)
  • TIME_FORMAT (12)- possible values 12 or 24
  • NIGHT_MODE (off) - possible values on or off
  • SHOW_RAWBG (never) - possible values always, never or noise
  • CUSTOM_TITLE (Nightscout) - Usually name of T1
  • THEME (default) - possible values default or colors
  • ALARM_TIMEAGO_WARN (on) - possible values on or off
  • ALARM_TIMEAGO_WARN_MINS (15) - minutes since the last reading to trigger a warning
  • ALARM_TIMEAGO_URGENT (on) - possible values on or off
  • ALARM_TIMEAGO_URGENT_MINS (30) - minutes since the last reading to trigger a urgent alarm
  • SHOW_PLUGINS - enabled plugins that should have their visualizations shown, defaults to all enabled
  • SHOW_FORECAST (ar2) - plugin forecasts that should be shown by default, supports space delimited values such as "ar2 openaps"
  • LANGUAGE (en) - language of Nightscout. If not available english is used
  • SCALE_Y (log) - The type of scaling used for the Y axis of the charts system wide.
    • The default log (logarithmic) option will let you see more detail towards the lower range, while still showing the full CGM range.
    • The linear option has equidistant tick marks, the range used is dynamic so that space at the top of chart isn't wasted.
    • The log-dynamic is similar to the default log options, but uses the same dynamic range and the linear scale.
  • EDIT_MODE (on) - possible values on or off. Enable or disable icon allowing enter treatments edit mode
Plugins

Plugins are used extend the way information is displayed, how notifications are sent, alarms are triggered, and more.

The built-in/example plugins that are available by default are listed below. The plugins may still need to be enabled by adding to the ENABLE environment variable.

Default Plugins

These can be disabled by setting the DISABLE env var, for example DISABLE="direction upbat"

delta (BG Delta)

Calculates and displays the change between the last 2 BG values.

direction (BG Direction)

Displays the trend direction.

upbat (Uploader Battery)

Displays the most recent battery status from the uploader phone.

timeago (Time Ago)

Displays the time since last CGM entry. Use these extended setting to adjust behavior:

  • TIMEAGO_ENABLE_ALERTS (false) - Set to true to enable stale data alarms via Pushover and IFTTT.
  • ALARM_TIMEAGO_WARN (on) - possible values on or off
  • ALARM_TIMEAGO_WARN_MINS (15) - minutes since the last reading to trigger a warning
  • ALARM_TIMEAGO_URGENT (on) - possible values on or off
  • ALARM_TIMEAGO_URGENT_MINS (30) - minutes since the last reading to trigger a urgent alarm
devicestatus (Device Status)

Used by upbat and other plugins to display device status info. Supports the DEVICESTATUS_ADVANCED="true" extended setting to send all device statuses to the client for retrospective use and to support other plugins.

errorcodes (CGM Error Codes)

Generates alarms for CGM codes 9 (hourglass) and 10 (???).

  • Use extended settings to adjust what errorcodes trigger notifications and alarms:
    • ERRORCODES_INFO (1 2 3 4 5 6 7 8) - By default the needs calibration (blood drop) and other codes below 9 generate an info level notification, set to a space separate list of number or off to disable
    • ERRORCODES_WARN (off) - By default there are no warning configured, set to a space separate list of numbers or off to disable
    • ERRORCODES_URGENT (9 10) - By default the hourglass and ??? generate an urgent alarm, set to a space separate list of numbers or off to disable
ar2 (AR2 Forecasting)

Generates alarms based on forecasted values. See Forecasting using AR2 algorithm

  • Enabled by default if no thresholds are set OR ALARM_TYPES includes predict.
  • Use extended settings to adjust AR2 behavior:
    • AR2_USE_RAW (false) - to forecast using rawbg values when standard values don't trigger an alarm.
    • AR2_CONE_FACTOR (2) - to adjust size of cone, use 0 for a single line.
simplealarms (Simple BG Alarms)

Uses BG_HIGH, BG_TARGET_TOP, BG_TARGET_BOTTOM, BG_LOW thresholds to generate alarms.

  • Enabled by default if 1 of these thresholds is set OR ALARM_TYPES includes simple.
profile (Treatment Profile)

Add link to Profile Editor and allow to enter treatment profile settings. Also uses the extended setting:

  • PROFILE_HISTORY (off) - possible values on or off. Enable/disable NS ability to keep history of your profiles (still experimental)
  • PROFILE_MULTIPLE (off) - possible values on or off. Enable/disable NS ability to handle and switch between multiple treatment profiles
Advanced Plugins:
careportal (Careportal)

An optional form to enter treatments.

boluscalc (Bolus Wizard)
food (Custom Foods)

An option plugin to enable adding foods from database in Bolus Wizard and enable .

rawbg (Raw BG)

Calculates BG using sensor and calibration records from and displays an alternate BG values and noise levels.

iob (Insulin-on-Board)

Adds the IOB pill visualization in the client and calculates values that used by other plugins. Uses treatments with insulin doses and the dia and sens fields from the treatment profile.

cob (Carbs-on-Board)

Adds the COB pill visualization in the client and calculates values that used by other plugins. Uses treatments with carb doses and the carbs_hr, carbratio, and sens fields from the treatment profile.

bwp (Bolus Wizard Preview)

This plugin in intended for the purpose of automatically snoozing alarms when the CGM indicates high blood sugar but there is also insulin on board (IOB) and secondly, alerting to user that it might be beneficial to measure the blood sugar using a glucometer and dosing insulin as calculated by the pump or instructed by trained medicare professionals. The values provided by the plugin are provided as a reference based on CGM data and insulin sensitivity you have configured, and are not intended to be used as a reference for bolus calculation. The plugin calculates the bolus amount when above your target, generates alarms when you should consider checking and bolusing, and snoozes alarms when there is enough IOB to cover a high BG. Uses the results of the iob plugin and sens, target_high, and target_low fields from the treatment profile. Defaults that can be adjusted with extended setting

  • BWP_WARN (0.50) - If BWP is > BWP_WARN a warning alarm will be triggered.
  • BWP_URGENT (1.00) - If BWP is > BWP_URGENT an urgent alarm will be triggered.
  • BWP_SNOOZE_MINS (10) - minutes to snooze when there is enough IOB to cover a high BG.
  • BWP_SNOOZE - (0.10) If BG is higher then the target_high and BWP < BWP_SNOOZE alarms will be snoozed for BWP_SNOOZE_MINS.
cage (Cannula Age)

Calculates the number of hours since the last Site Change treatment that was recorded.

  • CAGE_ENABLE_ALERTS (false) - Set to true to enable notifications to remind you of upcoming cannula change.
  • CAGE_INFO (44) - If time since last Site Change matches CAGE_INFO, user will be warned of upcoming cannula change
  • CAGE_WARN (48) - If time since last Site Change matches CAGE_WARN, user will be alarmed to to change the cannula
  • CAGE_URGENT (72) - If time since last Site Change matches CAGE_URGENT, user will be issued a persistent warning of overdue change.
  • CAGE_DISPLAY (hours) - Possible values are 'hours' or 'days'. If 'days' is selected and age of canula is greater than 24h number is displayed in days and hours
sage (Sensor Age)

Calculates the number of days and hours since the last Sensor Start and Sensor Change treatment that was recorded.

  • SAGE_ENABLE_ALERTS (false) - Set to true to enable notifications to remind you of upcoming sensor change.
  • SAGE_INFO (144) - If time since last sensor event matches SAGE_INFO, user will be warned of upcoming sensor change
  • SAGE_WARN (164) - If time since last sensor event matches SAGE_WARN, user will be alarmed to to change/restart the sensor
  • SAGE_URGENT (166) - If time since last sensor event matches SAGE_URGENT, user will be issued a persistent warning of overdue change.
iage (Insulin Age)

Calculates the number of days and hours since the last Insulin Change treatment that was recorded.

  • IAGE_ENABLE_ALERTS (false) - Set to true to enable notifications to remind you of upcoming insulin reservoir change.
  • IAGE_INFO (44) - If time since last Insulin Change matches IAGE_INFO, user will be warned of upcoming insulin reservoir change
  • IAGE_WARN (48) - If time since last Insulin Change matches IAGE_WARN, user will be alarmed to to change the insulin reservoir
  • IAGE_URGENT (72) - If time since last Insulin Change matches IAGE_URGENT, user will be issued a persistent warning of overdue change.
treatmentnotify (Treatment Notifications)

Generates notifications when a treatment has been entered and snoozes alarms minutes after a treatment. Default snooze is 10 minutes, and can be set using the TREATMENTNOTIFY_SNOOZE_MINS extended setting.

basal (Basal Profile)

Adds the Basal pill visualization to display the basal rate for the current time. Also enables the bwp plugin to calculate correction temp basal suggestions. Uses the basal field from the treatment profile. Also uses the extended setting:

  • BASAL_RENDER (none) - Possible values are none, default, or icicle (inverted)
bridge (Share2Nightscout bridge)

Glucose reading directly from the Share service, uses these extended settings:

  • BRIDGE_USER_NAME - Your user name for the Share service.
  • BRIDGE_PASSWORD - Your password for the Share service.
  • BRIDGE_INTERVAL (150000 2.5 minutes) - The time to wait between each update.
  • BRIDGE_MAX_COUNT (1) - The maximum number of records to fetch per update.
  • BRIDGE_FIRST_FETCH_COUNT (3) - Changes max count during the very first update only.
  • BRIDGE_MAX_FAILURES (3) - How many failures before giving up.
  • BRIDGE_MINUTES (1400) - The time window to search for new data per update (default is one day in minutes).
mmconnect (MiniMed Connect bridge)

Transfer real-time MiniMed Connect data from the Medtronic CareLink server into Nightscout (read more)

  • MMCONNECT_USER_NAME - Your user name for CareLink Connect.
  • MMCONNECT_PASSWORD - Your password for CareLink Connect.
  • MMCONNECT_INTERVAL (60000 1 minute) - Number of milliseconds to wait between requests to the CareLink server.
  • MMCONNECT_MAX_RETRY_DURATION (32) - Maximum number of total seconds to spend retrying failed requests before giving up.
  • MMCONNECT_SGV_LIMIT (24) - Maximum number of recent sensor glucose values to send to Nightscout on each request.
  • MMCONNECT_VERBOSE - Set this to "true" to log CareLink request information to the console.
  • MMCONNECT_STORE_RAW_DATA - Set this to "true" to store raw data returned from CareLink as type: "carelink_raw" database entries (useful for development).
pump (Pump Monitoring)

Generic Pump Monitoring for OpenAPS, MiniMed Connect, RileyLink, t:slim, with more on the way

  • Requires DEVICESTATUS_ADVANCED="true" to be set
  • PUMP_ENABLE_ALERTS (false) - Set to true to enable notifications for Pump battery and reservoir.
  • PUMP_FIELDS (reservoir battery) - The fields to display by default. Any of the following fields: reservoir, battery, clock, status, and device
  • PUMP_RETRO_FIELDS (reservoir battery clock) - The fields to display in retro mode. Any of the above fields.
  • PUMP_WARN_CLOCK (30) - The number of minutes ago that needs to be exceed before an alert is triggered.
  • PUMP_URGENT_CLOCK (60) - The number of minutes ago that needs to be exceed before an urgent alarm is triggered.
  • PUMP_WARN_RES (10) - The number of units remaining, a warning will be triggered when dropping below this threshold.
  • PUMP_URGENT_RES (5) - The number of units remaining, an urgent alarm will b

Tag summary

Content type

Image

Digest

sha256:0b8b4db06

Size

415.8 MB

Last updated

about 10 years ago

docker pull nightscout/cgm-remote-monitor-development