Skip to content

Commit

Permalink
Merge pull request #172 from amida-tech/em-doc
Browse files Browse the repository at this point in the history
Edits
  • Loading branch information
kachok committed Sep 2, 2014
2 parents 6dcde53 + a1bdaea commit dd84df0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ Blue Button JavaScript (Node.js) library

## Library interfaces/APIs

This library provides following functionality
This library provides the following functionality

- Parse XML documents (via libxmljs)
- Sense type of data (e.g. CCDA, C32, etc)
- Sense type of data (e.g. CCDA, CMS, C32, etc)
- Parse CCDA into JSON representation
- Parse CCDA elements (sections) into JSON representation
- Generating JSON object based on data model
- Parse CMS into JSON representation
- Parse CMS elements (sections) into JSON representation
- Generate JSON object based on data model

### Usage example

Expand Down Expand Up @@ -228,25 +230,24 @@ getting:
] }
```

Also, see [/example](./example) for example above as well as how to parse individual sections.
See [/example](./example) for example above as well as how to parse individual sections.
***

## CCDA Generation: Introduction
This module converts data in JSON format (originally parsed from a CCDA) back to CCDA/blue-button format. The module determines the
section template to which the JSON data belongs to, runs the data through the appropriate templater, and generates the corresponding CCDA/blue-button section. An entire CCDA document can be generated by iteravitely running the JSON data through the templaters for each section.
This module converts data in JSON format (originally parsed from a CCDA) back to CCDA/blue-button format. It determines the section template (e.g. allergies, immunizations, etc) to which the JSON data belongs, runs the data through the appropriate templater, and generates the corresponding CCDA/blue-button section. An entire CCDA document can be generated by iteratively running the JSON data through the templaters for each section.

The API exposes genWholeCCDA() for this purpose, which takes in CCDA data in JSON format as a parameter and converts it into CCDA/XML.

The module uses libxmljs for its templaters and uses a JS XML DOM implementation (https://github.com/jindw/xmldom) to traverse the generated and expected XML documents for testing and compare them by node (tagName) and by attribute and value.

## CCDA Generation: Testing
A suite of tests and a test class (test/test-generator and test/test-lib, respectively) help in verifying that the generated CCDA is accurate. Tests include:
- parsing ccda to json, generating back the ccda from json, and comparing the original and generated ccdas for differences.
- parsing, generating, and parsing again, comparing the first parsed JSON data with the second parsed JSON data for equality.
- Comparing a specific, single section of CCDA to the original specific, single section, achieving testing granularity.
- Testing the generator against the entire corpora of ccda documents at: https://github.com/chb/sample_ccdas using the internal ccda_explorer module
- Parsing CCDA to JSON, regenerating the CCDA from the new JSON file, and comparing the original and generated CCDA files for differences.
- Parsing, generating, and parsing again, comparing the first parsed JSON data with the second parsed JSON data for equality.
- Comparing a specific, single section of CCDA to the original specific, single section, to achieve testing granularity.
- Testing the generator against the entire corpora of CCDA documents at: https://github.com/chb/sample_ccdas using the internal ccda_explorer module

The testing class/library provides methods to compare two XML/CCDA documents by recursively walking the XML document tree and comparing two documents node-by-node. Assertion-based or diff-based testing can be used with this library by setting the appropriate flags. The default settings ignore comments, whitespace, newlines, tab or text nodes. Here is an example of diff-based testing output after testing the CCDA Procedures Section:
The testing class/library provides methods to compare two XML/CCDA documents by recursively walking the XML document tree and comparing the documents node-by-node. Assertion-based or diff-based testing can be used with this library by setting the appropriate flags. The default settings ignore comments, whitespace, newlines, tab or text nodes. Here is an example of diff-based testing output after testing the CCDA Procedures Section:

````
PROCESSING PROCEDURES
Expand Down
7 changes: 5 additions & 2 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# blue-button.js Release Notes

# v1.0.4 - Jul 18, 2014
# v.1.1.0 - September 2, 2014
-

# v1.0.4 - July 18, 2014
- Bug fix on handling null or UNK encounter in cleanup step

# v1.0.3 - Jul 18, 2014
# v1.0.3 - July 18, 2014
- Updates to data models
- CCDA export functionality
- CMS parsing functionality
Expand Down

0 comments on commit dd84df0

Please sign in to comment.