From c0624fc21c16a9e7289730ff22578a1d7447a562 Mon Sep 17 00:00:00 2001 From: Jacob Sachs Date: Mon, 30 Mar 2015 15:32:52 -0500 Subject: [PATCH] Merge branch 'js-problem-severity' Conflicts: package.json test/fixtures/json/CCD_1.json --- README.md | 6 +++--- lib/entryLevel/problemEntryLevel.js | 11 +++++++++++ test/fixtures/json/CCD_1.json | 2 +- test/fixtures/json/sample.JSON | 8 +++++++- test/sample_runs/test-gen-parse-gen.js | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 431b515..c7c0eed 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ This approach is an alternative to direct programming or text based templates su * Required elements are specified in the template and get `nullFlavor` automatically when no data exists. * No coding required to add new templates. * It is also a step in the right direction for the possible future directions - * Factoring out data model dependencies so that blue-button](https://github.com/amida-tech/blue-button) data model changes or other data models can be accomodated more easily - * Automatic generation of templates from [blue-button](https://github.com/amida-tech/blue-button) like CCDA parsers. + * Factoring out data model dependencies so that blue-button](https://github.com/amida-tech/blue-button) data model changes or other data models can be accomodated more easily + * Automatic generation of templates from [blue-button](https://github.com/amida-tech/blue-button) like CCDA parsers. ### Template Structure @@ -91,7 +91,7 @@ The following are the properties of the templates * `attributes`: This describes the attributes of the element. `attributes` can be an object of with `key` and `value` pairs for each attribute or it can be an array of such objects. Each attribute object or can be a function with `input` argument that returns attributes. * `text`: This is a function with `input` attribute that returns text value of the element. * `content`: This is an array of other templates that describe the children of the element. For a single child an object can be used. -* `dataKey`: This is the property of `input` that serves as the date for the template. +* `dataKey`: This is the property of `input` that serves as the data for the template. * `required`: This identifies if template is required or not. If template is required and there is not value in the `input` a `nullFlavor` node is created. * `dataTransform`: This is a function to transform the input. * `existWhen`: This is a boolean function with `input` argument to describe it the elements should exists or not. diff --git a/lib/entryLevel/problemEntryLevel.js b/lib/entryLevel/problemEntryLevel.js index f393f96..7eb6ebe 100644 --- a/lib/entryLevel/problemEntryLevel.js +++ b/lib/entryLevel/problemEntryLevel.js @@ -122,6 +122,17 @@ var problemObservation = { [healthStatusObservation, required] ], existsWhen: condition.keyExists("patient_status") + }, { + key: "entryRelationship", + attributes: { + "typeCode": "SUBJ", + "inversionInd": "true" + }, + content: [ + [sharedEntryLevel.severityObservation] + ], + dataKey: "problem", + existsWhen: condition.keyExists("severity") } ], notImplemented: [ diff --git a/test/fixtures/json/CCD_1.json b/test/fixtures/json/CCD_1.json index 7dd26d2..c116b67 100644 --- a/test/fixtures/json/CCD_1.json +++ b/test/fixtures/json/CCD_1.json @@ -2019,4 +2019,4 @@ "nullFlavor alert: missing but required code in participant -> entry -> payers_section -> CCD", "cardinality error: found 2 when expecting 1..1 at h:entryRelationship/h:act/h:participant" ] -} \ No newline at end of file +} diff --git a/test/fixtures/json/sample.JSON b/test/fixtures/json/sample.JSON index 9431590..896306b 100644 --- a/test/fixtures/json/sample.JSON +++ b/test/fixtures/json/sample.JSON @@ -537,6 +537,12 @@ "code_system_name": "SNOMED CT", "code": "195967001", "name": "Asthma" + }, + "severity": { + "code": { + "code": "L", + "name": "Low" + } } }, "negation_indicator": false, @@ -3731,4 +3737,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/sample_runs/test-gen-parse-gen.js b/test/sample_runs/test-gen-parse-gen.js index 55d083c..e853c8f 100644 --- a/test/sample_runs/test-gen-parse-gen.js +++ b/test/sample_runs/test-gen-parse-gen.js @@ -146,7 +146,7 @@ describe('parse generate parse generate', function () { var data = fs.readFileSync(__dirname + "/../fixtures/json/sample.JSON"); - //convert string into JSON + //convert string into JSON var result = JSON.parse(data); // check validation