sgvdata

Utilities to deal with serum glucose values.


Keywords
sgv, cgm, glucose, format
License
GPL-2.0+
Install
npm install sgvdata@0.0.2

Documentation

sgvdata

Some basic data modeling utilities for SGV: sensor glucose values.

This module allows easily converting sgv records to and from plain text (csv, tsv) and json.

Exposes streaming and synchronous interfaces for parsing and formatting sgv records and text and json records.

status

Build Status Coverage Status Code Climate browser support

npm

Use in your project by including it from npm like so:

$ npm install --save sgvdata

What's an SGV record?

Serum glucose value:

  • dateString - ISO8601
  • date - unix epoch
  • direction
  • sgv
  • device

usage

sync

Synchronous functions to manipulate a single record.

text

Handle text formats: csv, tsv.

format - format(json) -> {tsv}

Format a single json record as csv or tsv.

parse - parse(text) -> {json}

Parse a single textual record (csv or tsv) as a json record.

json

Synchronous functions for handling json records.

echo echo(rec) -> linted_record

Synchronously return linted json record.

mapper - mapper(sync, opts) -> <WritableStream>

Quick wrapper utility around es.map to turn a synchronous function into a stream.

format - format( ) - <WritableStream>

Format all json elements in stream, emitting new elements formatted as text.

parse - parse( ) - <WritableStream>

Parse all text elements in stream, emitting new json objects.

lint - lint(opts) - <WritableStream>

Echo all sgv elements in stream, optionally throwing errors.

options

  • strict - true - throw errors on invalid elements

EG: { strict: true }