Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Feature/review of systems #4

Merged
merged 4 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/parser/ccda/ccd.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var exportCCD = function (version) {
var hospital_discharge_instructions_section = require("./sections/hospital_discharge_instructions").hospital_discharge_instructions_section(version)[0];
var hospital_discharge_medications_section = require("./sections/hospital_discharge_medications").hospital_discharge_medications_section(version)[0];
var functional_status_section = require("./sections/functional_status").functionalStatusSection(version)[0];
var review_of_systems_section = require("./sections/review_of_systems").reviewOfSystemsSection(version)[0];
var nutrition_section = require("./sections/nutrition").nutritionSection(version);

return component.define("CCD")
Expand All @@ -43,7 +44,8 @@ var exportCCD = function (version) {
["hospital_discharge_instructions", "0..1", hospital_discharge_instructions_section.xpath(), hospital_discharge_instructions_section],
["hospital_discharge_medications", "0..1", hospital_discharge_medications_section.xpath(), hospital_discharge_medications_section],
["functional_statuses", "0..1", functional_status_section.xpath(), functional_status_section],
["nutrition_observations", "0..1", nutrition_section.xpath(), nutrition_section]
["nutrition_observations", "0..1", nutrition_section.xpath(), nutrition_section],
["review_of_systems", "0..1", review_of_systems_section.xpath(), review_of_systems_section]
]);
};

Expand Down
27 changes: 27 additions & 0 deletions lib/parser/ccda/sections/review_of_systems.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict";

var shared = require("../shared");
var component = require("@amida-tech/blue-button-xml").component.withNullFlavor();
var cleanup = require("../cleanup");
var bbm = require("@amida-tech/blue-button-meta");
var processor = require("@amida-tech/blue-button-xml").processor;


var exportReviewOfSystemsSection= function (version) {
var sectionIDs = bbm.CCDA["sections" + version];
var clinicalStatementsIDs = bbm.CCDA["statements" + version];

var reviewOfSystemsSection = component.define("reviewOfSystems");
reviewOfSystemsSection.templateRoot([
sectionIDs.ReviewOfSystemsSection
])
reviewOfSystemsSection.fields([
["code", "1..1", "h:code", shared.ConceptDescriptor],
["title", "1..1", "h:title", processor.asString],
["text", "1..1", "h:text", shared.asString],
])

return [reviewOfSystemsSection];
}

exports.reviewOfSystemsSection = exportReviewOfSystemsSection;
26 changes: 0 additions & 26 deletions lib/parser/ccda/sections/social_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,6 @@ var cleanup = require("../cleanup");
var bbm = require("@amida-tech/blue-button-meta");
var _ = require("lodash");


var stupidCleanup = function (flist) { // We need cleanup function to become objects
var r = function () {
flist.forEach(function (k) {
var tmp;

if (this.js !== undefined && this.js !== null) {
// console.log( this.js[k]);
tmp = this.js[k];
delete this.js[k];
}
if (tmp) { //HACK: added this if
if (tmp.js) {
Object.keys(tmp.js).forEach(function (m) {
if (this.js[m] === undefined) {
this.js[m] = tmp.js[m];
}
}, this);
}
}
}, this);
};
return r;
};


var exportSocialHistorySection = function (version) {
var sectionIDs = bbm.CCDA["sections" + version];
var clinicalStatementsIDs = bbm.CCDA["statements" + version];
Expand Down
17 changes: 17 additions & 0 deletions test/fixtures/parser-ccda/CCD_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,23 @@
</entry>
</section>
</component>
<!-- ************************************ REVIEW OF SYSTEMS ************************************ -->
<component>
<section>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.18"/>
<code code="10187-3" codeSystem="2.16.840.1.113883.6.1"
codeSystemName="LOINC"
displayName="REVIEW OF SYSTEMS"/>
<title>REVIEW OF SYSTEMS</title>
<text>
<paragraph>
Patient denies recent history of fever or malaise. Positive
For weakness and shortness of breath. One episode of melena. No recent
headaches. Positive for osteoarthritis in hips, knees and hands.
</paragraph>
</text>
</section>
</component>
<!-- ************************************ ASSESSMENT ************************************ -->
<component>
<section>
Expand Down
18 changes: 18 additions & 0 deletions test/parser-ccda/ccd-review-of-systems/test-review-of-systems.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var fs = require('fs');
var bb = require('../../../index.js');

describe('review of systems', function () {
it('without', function () {
var xmlfile = fs.readFileSync(__dirname + '/without.xml', 'utf-8').toString();
var result = bb.parse(xmlfile);

expect(result.data.review_of_systems).not.toBeDefined();
});

it('with', function () {
var xmlfile = fs.readFileSync(__dirname + '/with.xml', 'utf-8').toString();
var result = bb.parse(xmlfile);

expect(result.data.review_of_systems).toBeDefined();
});
});
Loading