Miss any of our Open RFC calls?Watch the recordings here! »

@tidepool/data-tools

2.4.0 • Public • Published

@tidepool/data-tools

Node streams to work with Tidepool API data

Installation

$ npm install @tidepool/data-tools

Example

import TidepoolDataTools from '@tidepool/data-tools';
 
// Set up the processing stream
const processingStream = readStream
      .pipe(TidepoolDataTools.jsonParser())
      .pipe(TidepoolDataTools.tidepoolProcessor());
 
// Now attach multiple parallel output streams
processingStream
        .pipe(TidepoolDataTools.xlsxStreamWriter(xlsxStream));
 
processingStream
        .pipe(someOtherOutputStream);

Methods

TidepoolDataTools.jsonParser()

Convenience function to return a JSONStream.parse('*').
See also the JSONStream NPM Module.

TidepoolDataTools.tidepoolProcessor()

Returns a through stream that processes the JSON Object data according the the config.

TidepoolDataTools.xlsxStreamWriter(outputStream)

Writes an xlsx Workbook to outputStream with different Worksheets according to the config.

Command Line Usage

@tidepool/data-tools includes a command-line tool

Install globally:

$ npm i -g @tidepool/data-tools && tidepool-data-tools --help
Usage: tidepool-data-tools [options] [command]
 
Options:
  -V, --version      output the version number
  -h, --help         output usage information
 
Commands:
  convert [options]  Convert data between different formats
 
$ tidepool-data-tools convert --help
Usage: tidepool-data-tools [options]
 
Options:
  -V, --version                            output the version number
  -i, --input-tidepool-data <file>         csv, xlsx, or json file that contains Tidepool data
  -c, --config <file>                      a JSON file that contains the field export configuration
  --salt <salt>                            salt used in the hashing algorithm (default: "no salt specified")
  -o, --output-data-path <path>            the path where the data is exported (default: "./example-data/export")
  -f, --output-format <format>             the path where the data is exported (default: ["all"])
  --start-date [date]                      filter data by startDate
  --end-date [date]                        filter data by endDate
  --merge-wizard-data                      option to merge wizard data with bolus data. Default is true
  --filterByDatesExceptUploadsAndSettings  upload and settings data can occur before and after start and end dates, so include ALL upload and settings data in export
  -h, --help                               output usage information

License

Licensed under the BSD-2-Clause License

Keywords

none

Install

npm i @tidepool/data-tools

DownloadsWeekly Downloads

14

Version

2.4.0

License

BSD-2-Clause

Unpacked Size

46.3 kB

Total Files

7

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar