amida-tech / blue-button

Blue Button (CCDA/CMS Blue Button/etc) to JSON Parser.
Other
49 stars 44 forks source link

Blue Button

Blue Button JavaScript library

NPM

Build Status Coverage Status

blue-button.js

This library is part of blue-button family of parsers and provides the following functionality:

Actual implementation of sensing type of data and parsing CCDA and C32 reside in this repository. Implementation of other functionalities reside in

In addition CCDA generation from blue-button, JSON objects is available in blue-button-generate.

Quick up and running guide

Prerequisites

# Install dependencies
npm i

# Install grunt
npm i -g grunt

# Test
grunt

Usage

Require blue-button module

var bb = require("@amida-tech/blue-button")

Load some health data content. Currently CCDA (CCD), C32 and CMS are supported

var data = "some CCDA.xml, C32.xml or CMS.txt here...";

Generate JSON representation of the health data

var doc = bb.parse(data);

parse method senses the type of the health data, parses and converts it into JSON. All types of health data is converted into a common model. Validate doc according to the common model schema

var valid = bb.validator.validateDocumentModel(doc);
if (! valid) {
    throw new Error('failed');
}

Do changes to doc in your application

doc.data.demographics.phone.number = "(555)555-5555";

Create a CCDA (CCD) document that includes your changes

var bbg = require("@amida-tech/blue-button-generate")
var modifiedDataCCD = bbg.generateCCD(doc);

Data Model

Blue Button library converts all types of health data (CCDA, C32, CMS) into a common model. Data model schema and validation implementation can be found in blue-button-model.

API

XML Utilities

Blue Button library provides basic XML parsing and XPath functionality via libxmljs (node.js) and DomParser (browsers). All XML related API methods are inherited from blue-button-xml and available from xml object

var xml = bb.xml;

parse(src)

Parses XML content string into an XML Object which can be used in other API methods. Details of the actual XML object can be found in the documentation of underlying libraries libxmljs (node.js) and DomParser (browsers).

Arguments

xpath(doc, p, ns)

Finds the XML nodes that are specified by p.

Arguments

Sensing

senseString(data)

Senses the type of the string content.

Arguments

senseXml(data)

Senses the type of an XML object.

Arguments

JSON Generation

parse(data, options)

This is the primary method in Blue Button library that both senses the type of the input content and generates JSON out of it. Underneath it calls to other sensing and JSON generation methods.

Arguments

parseString(data, options)

This is similar to parse but it assumes data to be valid XML.

parseXml(data, options)

This is similar to parse but it assumes data to be an XML object.

parseText(data)

This is similar to parse but it assumes data to be Text (ASCII) and options is not used. Currently only Text content in CMS format is supported.

Examples

See scripts in /example or /test directories that use the above API methods for CCDA, C32 and CMS examples.

Goals

Future Roadmap

Contributing

Contributors are welcome. See issues https://github.com/amida-tech/blue-button/issues

Release Notes

See release notes here

License

Licensed under Apache 2.0

Project was influenced by and used some code from:

bluebutton.js library licensed under MIT

Josh Mandel's ccda-to-json library licensed under [Apache 2.0] (https://github.com/jmandel/ccda-to-json/blob/master/LICENSE)