An Electron app for uploading diabetes device data to Tidepool's backend
JavaScript CSS Other
Switch branches/tags
v2.7.4 v2.7.3 v2.7.2 v2.7.2-upload-blobs.5 v2.7.2-upload-blobs.4 v2.6.5 v2.6.4 v2.6.4-upload-blobs.3 v2.6.4-cdc-acm.1 v2.6.2 v2.6.0 v2.6.0-update-serialport.10 v2.6.0-update-serialport.7 v2.6.0-update-serialport.6 v2.6.0-update-serialport.5 v2.6.0-update-serialport.4 v2.5.13 v2.5.13-update-serialport.3 v2.5.11 v2.5.11-update-serialport.2 v2.5.9 v2.5.9-truemetrix.6 v2.5.9-truemetrix.4 v2.5.9-more-rollbar-logging.1 v2.5.9-add-devicetags.2 v2.5.8 v2.5.7 v2.5.7-time-check-copy v2.5.6-truemetrix.2 v2.5.6-truemetrix.1 v2.5.6-fslibre-fix-missing-records.1 v2.5.5 v2.5.5-electron-update.4 v2.5.5-electron-update.3 v2.5.4 v2.5.4-time-difference.7 v2.5.4-time-difference.6 v2.5.4-time-difference.5 v2.5.4-time-difference.3 v2.5.4-time-difference.2 v2.5.4-time-difference.1 v2.5.3 v2.5.3-libre-decompress-bug.1 v2.5.2-rollbar.1 v2.5.1 v2.4.1-omnipod-mmol-fix.1 v2.4.0 v2.3.0 v2.2.5 v2.2.4 v2.2.4-verio-flex.1 v2.2.4-libre-pro.1 v2.2.4-animas-fix.1 v2.2.3 v2.2.2 v2.2.2-veo-support.1 v2.2.2-pxtra-timeout.1 v2.2.2-dep-updates.3 v2.2.2-dep-updates.2 v2.2.1 v2.2.1-nov-bugfixes.2 v2.2.1-nov-bugfixes.1 v2.2.1-libre-pro.1 v2.2.0 v2.2.0-libre-rollbar.3 v2.2.0-libre-rollbar.2 v2.2.0-libre-rollbar.1 v2.1.1 v2.1.0 v2.0.4-qa.1 v2.0.2 v2.0.1 v2.0.1-dev.3 v2.0.1-dev.1 v2.0.0 v0.320.0-alpha.6 v0.320.0-alpha.5 v0.320.0-alpha.4 v0.320.0-alpha.3 v0.320.0-alpha.1 v0.312.0 v0.311.0 v0.310.0 v0.310.0-beta.1 v0.310.0-alpha.25 v0.310.0-alpha.24 v0.310.0-alpha.23 v0.310.0-alpha.22 v0.310.0-alpha.21 v0.310.0-alpha.19 v0.310.0-alpha.18 v0.310.0-alpha.17 v0.310.0-alpha.16 v0.310.0-alpha.15 v0.310.0-alpha.14 v0.310.0-alpha.13 v0.310.0-alpha.12 v0.310.0-alpha.11 v0.310.0-alpha.10 v0.310.0-alpha.9
Nothing to show
Clone or download
Latest commit 84db47e Aug 10, 2018
Permalink
Failed to load latest commit information.
.circleci add greenkeeper-lockfile to circleCI May 3, 2018
app v2.7.4 Aug 9, 2018
config Merge branch 'master' into dorianscholz/otverio Nov 7, 2017
docs Merge from master, PR review suggestions Jun 9, 2018
fonts Removes Blip icon set. Using the updated one that includes a pencil f… Feb 16, 2015
images Update 600-series device image Jun 14, 2018
lib revert changes to medtronic drivers for testing purposes Aug 8, 2018
resources installation of disk permission helper Nov 7, 2017
scripts Merge master into electron-medtronic600. Bump version to `qa.17` Mar 26, 2018
sounds add back in audio queues with new wav files Aug 16, 2017
styles Changes requested in PR review Jun 15, 2018
test Don't create temp basals when missing suppressed basal info Aug 3, 2018
.babelrc Merge branch `master` into `electron-medtronic600` May 3, 2018
.bookignore Merge branch 'master' into gniezen/medtronic May 29, 2017
.config.js blip -> app in URLs Oct 4, 2017
.eslintignore fixing some linting issues Sep 12, 2017
.eslintrc lint-fix and add more exclusions for linting Nov 10, 2017
.gitignore update to serialport v6.2.0 May 3, 2018
.nvmrc update electron to v1.8.2 and node to v.8.2.1 Feb 16, 2018
LICENSE add BSD2 license file May 28, 2015
README.md Change developer.tidepool.io references to developer.tidepool.org Aug 3, 2018
SUMMARY.md add MedT checklists to summary May 29, 2017
appveyor.yml Merge branch 'appveyor-skip-branch' into electron-update Feb 16, 2018
greenkeeper.json chore: add Greenkeeper config file May 3, 2018
package.json v2.7.4 Aug 9, 2018
server.js progress towards the electron port Feb 15, 2017
webpack.config.base.js move alias to base Oct 4, 2017
webpack.config.development.js Merge branch 'master' into krystophv/dep-updates Nov 10, 2017
webpack.config.electron.js Merge branch 'master' into krystophv/dep-updates Nov 10, 2017
webpack.config.eslint.js Importing electron-react-boilerplate Feb 15, 2017
webpack.config.production.js Merge branch 'master' into krystophv/dep-updates Nov 10, 2017
webpack.config.test.js update webpack and plugins to 3.x Oct 1, 2017
yarn.lock remove pre-release tag from platform-client Aug 8, 2018

README.md

Tidepool Uploader

Greenkeeper badge

CircleCI Build status

This is an Electron App that acts as an uploader client for Tidepool. It is intended to allow you to plug diabetes devices into your computer's USB port, read the data stored on them, and upload a standardized version of the data to the Tidepool cloud.

This README is focused on just the details of getting the uploader running locally. For more detailed information aimed at those working on the development of the uploader, please see the developer guide.

Table of contents


How to set it up

  1. Clone this repository.
  2. Make sure you have node v8.x installed. If you are managing node installations with nvm, which we highly recommend, you can just do nvm use when navigating to this repository to switch to the correct version of node. (In this repository, the correct version of node will always be the version of node packaged by the version of Electron that we are using and specified in the .nvmrc file.)
  3. Run npm install or, preferably, yarn
  4. Set the config for the environment you want to target (see Config below)
  5. Run the following command:
$ npm run dev

or

$ yarn dev

(This will bundle the application with webpack and watch for changes. When it stops printing output you can continue to the next step.)

NB: React components and CSS will hot load after changes (this can be confirmed by watching the JavaScript console), but changes to device drivers and other code outside of the React components will not - use 'Reload' to reload after such changes. If the compilation/hot reload of a component fails for any reason (e.g. from a syntax error) you may need to reinitialize the hot loader by reloading the application.

Config

Configuration values (for example the URL of the Tidepool Platform) are set via environment variables. If you need to add a config value, modify the .config.js file. If you need to read a config value inside the app, use var config = require('./lib/config'). To set config values (do this before building the app), you can use Shell scripts that export environment variables (see config/local.sh for an example that exports the appropriate variables when running the whole Tidepool platform locally using runservers), for example:

$ source config/local.sh
$ yarn start

Debug Mode(s)

For ease of development we have several debug features that developers can turn on and off at will (and to suit various development use cases, such as working on a new device driver versus working on the app's UI). Each of these debug features is set with an environment variable, but rather than being loaded through .config.js (as we do for production configuration variables, see above), we load these through the webpack DefinePlugin (see Pete Hunt's webpack-howto for an example, although note Hunt uses the term 'feature flag').

DEBUG_ERROR

The environment variable DEBUG_ERROR (boolean) controls whether or not errors sourced in device drivers are caught and an error message displayed in the UI (the production setting) or whether they are thrown in the console (much more useful for local development because then the file name and line number of the error are easily accessible, along with a stack trace). DEBUG_ERROR mode is turned on by default in config/device-debug.sh.

This can also be toggled internally in the running Electron app via a right-click context menu available on the login screen, much like the menu for switching environments.

Local Development w/o Debug Mode(s)

All debug options are turned off by default in config/local.sh.

Tests

To run the tests in this repository as they are run on CircleCI and Appveyor use:

$ yarn test

or

$ yarn test

Linting & Code Style

We use ESLint to lint our JavaScript code. We try to use the same linting options across all our client apps, but there are a few exceptions in this application, noted with comments in the .eslintrc configuration file.

To run the linter (which also runs on CircleCI and Appveyor with every push, along with npm test), use:

$ npm run lint

Aside from the (fairly minimal) JavaScript code style options we enforce through the linter, we ask that internal developers and external contributors try to match the style of the code in each module being modified. New modules should look to similar modules for style guidance. In React component code, use existing ES6/ES2015 components (not legacy ES5 components) as the style model for new components.

NB: Please keep ES5 and ES6/ES2015 code distinct. Do NOT use ES6/ES2105 features in ES5 modules (most easily recognizable by the use of require rather than import).

Docs

Docs reside in several places in this repository, such as docs/ and lib/drivers/docs. They are built as a static site with GitBook and served at developer.tidepool.org via GitHub Pages.

See this guidance on our use of GitBook at Tidepool.

Publishing

Release management and application updates are handled via the Github provider in the electron-builder project. The recommended workflow for a new production release is as follows:

  1. When you're working on what might become a new release, increment the version number in package.json and app/package.json and commit/push (on the branch)
  2. The CI server(s) will create a draft release in Github with the title of the version from the package.json file and will automatically attach the distribution artifacts to that draft (drafts are not publicly visible)
  3. When your pull request is approved and merged to master, go to the draft release and type in the version for the tag name, ensure that you're targeting the master branch, fill out the release notes and publish the release. This will create the tag for you.
  4. After you've smoke tested the release, run yarn av-whitelist to submit the release to Kaspersky Labs for whitelisting. The script generates an XML file and uploads it to their FTP. It requires a password that can be set using the FTP_AV_PASSWORD_TIDEPOOL environment variable and is stored in 1Password.

For a non-production release (alpha, dev, etc.)

  1. Increment the version number in package.json and app/package.json and ensure that you have included the channel information after the version patch number (i.e. v0.304.0-alpha or v0.304.0-beta.2). The hyphen separated version semantic is important.
  2. The CI server(s) will create a draft release in Github with the title of the version from the package.json file and will automatically attach the distribution artifacts to that draft (drafts are not publicly visible)
  3. When you want to publish your non-production release, go to your draft and type in the version for the tag name, ensure that you're targeting the branch that you're currently releasing from, mark the release as a pre-release, fill out the release notes and publish the release. This will create the tag for you on the branch that you want.

The Uploader has a self-update mechanism that will look at the latest release and compare versions, downloading and prompting the user to update if a newer version is available. For production releases, only official releases will be considered. For non-production releases (-alpha, -beta.2, etc.) releases marked as pre-release will also be checked, matching against the string portion of the post-hyphen version segment. For more detail about this behavior see the electron-builder docs concerning auto-update options

Editor Configuration

Atom

apm install editorconfig es6-javascript javascript-snippets linter linter-eslint language-babel autocomplete-modules file-icons

Sublime

Others

DevTools

Toggle Chrome DevTools

  • OS X: Cmd Alt I or F12
  • Linux: Ctrl Shift I or F12
  • Windows: Ctrl Shift I or F12

See electron-debug for more information.

DevTools extension

This project includes the following DevTools extensions:

You can find the tabs on Chrome DevTools.

If you want to update extensions version, please set UPGRADE_EXTENSIONS env, just run:

$ UPGRADE_EXTENSIONS=1 npm run dev

# For Windows
$ set UPGRADE_EXTENSIONS=1 && npm run dev

CSS Modules

All .module.less files will be use css-modules.

Packaging

To package apps for the local platform:

$ npm run package
$ yarn package

To package apps with options:

$ npm run package -- --[option]

Further commands

To run the application without packaging run

$ npm run build
$ npm start

To run End-to-End Test

$ npm run build
$ npm run test-e2e

Options

See electron-builder CLI Usage

Module Structure

This project uses a two package.json structure.

  1. If the module is native to a platform or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.
  2. If a module is imported by another module, include it in dependencies in ./package.json. See this ESLint rule.
  3. Otherwise, modules used for building, testing and debugging should be included in devDependencies in ./package.json.