-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## CCDA Generation: Introduction | ||
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, 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 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 | ||
Error: Generated number of child nodes different from expected (generated: 0 at lineNumber: 8, expected: 1 at lineNumber:12 | ||
Error: Generated number of child nodes different from expected (generated: 11 at lineNumber: 10, expected: 10 at lineNumber:32 | ||
Attributes mismatch. Different lengths: 1 attributes but expected 0 attributes @ lineNumber: 70, 94 | ||
Error: Generated number of child nodes different from expected (generated: 10 at lineNumber: 71, expected: 11 at lineNumber:95 | ||
Attributes mismatch. Different lengths: 1 attributes but expected 0 attributes @ lineNumber: 119, 149 | ||
Error: Attributes mismatch: Encountered: moodCode="EVN" but expected: moodCode="INT" @ lineNumber: 120, 150 | ||
Error: Encountered different tagNames: Encountered <code> but expected <priorityCode>, lineNumber: 130, 161 | ||
Error: Generated number of child nodes different from expected (generated: 4 at lineNumber: 151, expected: 5 at lineNumber:182 | ||
ERRORS: 8 | ||
```` | ||
|
||
|
||
|
||
**Alterable flags (in test-lib.js)**: | ||
-PROMPT_TO_SKIP: If set to true, will prompt the user to either skip or not skip the failed test. | ||
-DIFF (default): If set to true, will continue execution even upon failing a test and will output all of the errors/differences to the console. This is the default setting. | ||
|
||
**Alterable settings (testXML.error_settings in test-lib.js)**: | ||
-"silence_cap": If set to true, will silence the output of capitalization errors. False by default. | ||
-"silence_len": If set to true, will silence the output of attribute length errors (i.e. actual node has 2 attributes but expected node has 3 attributes). False by default. | ||
|
||
**Test suite settings**: | ||
-TEST_CCDA_SAMPLES: uses ccda-explorer to test against sample_ccdas | ||
-TEST_CCD: tests against one generic sample ccda | ||
-TEST_SECTIONS: tests each section individually | ||
|
||
|
||
*** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "blue-button", | ||
"version": "1.1.0-beta.18", | ||
"version": "1.1.0", | ||
"description": "Blue Button (CCDA) to JSON Parser.", | ||
"main": "/index.js", | ||
"directories": { | ||
|
@@ -22,7 +22,7 @@ | |
"email": "[email protected]" | ||
} | ||
], | ||
"license": "MIT", | ||
"license": "Apache-2.0", | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
}, | ||
|