Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(docRootPath, ref) {
this.docRootPath = docRootPath;
this.ref = ref;
this.children = [];
// These are set during parsing
this.fragment = undefined;
this.domXml = new libxml.Document().node('div');
}
module.exports = function (data, codeSystems, isCCD, CCDxml) {
var doc = new libxmljs.Document();
var xmlDoc = libCCDAGen.header_v2(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.3",
"2.16.840.1.113883.10.20.22.2.3.1", sec_entries_codes["ResultsSection"], "RESULTS", isCCD);
// entries loop
var n = data.length;
for (var i = 0; i < n; ++i) {
updateEntry(xmlDoc, data[i]);
}
xmlDoc = xmlDoc.parent(); // end clinicalDocument
return isCCD ? xmlDoc : doc;
};
module.exports = function (data, codeSystems, isCCD, CCDxml) {
// create a new xml document and generate the header
var doc = new libxmljs.Document();
var xmlDoc = libCCDAgen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.6", "2.16.840.1.113883.10.20.22.2.6.1",
"48765-2", "2.16.840.1.113883.6.1", undefined, undefined, "ALLERGIES, ADVERSE REACTIONS, ALERTS", isCCD);
// Now loop over each entry in the data set
for (var i = 0; i < data.length; i++) {
updateEntry(xmlDoc, data[i], i);
}
xmlDoc = xmlDoc.parent() // end section
.parent(); // end clinicalDocument (or component)
return isCCD ? xmlDoc : doc;
};
module.exports = function (data, codeSystems, isCCD, CCDxml) {
var doc = new libxmljs.Document();
var xmlDoc = libCCDAGen.header_v2(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.17",
undefined, sec_entries_codes["SocialHistorySection"], "SOCIAL HISTORY", isCCD);
// entries loop
for (var i = 0; i < data.length; i++) {
var smoking = data[i]["value"] ? data[i]["value"].indexOf("smoke") > -1 : undefined;
var e = xmlDoc.node('entry').attr({typeCode: "DRIV"});
var ob = e.node('observation').attr({classCode: "OBS", moodCode: "EVN"});
var tId = smoking ? "2.16.840.1.113883.10.20.22.4.78" : "2.16.840.1.113883.10.20.22.4.38";
ob.node('templateId').attr({root: tId});
libCCDAGen.id(ob, data[i].identifiers);
if (smoking) {
libCCDAGen.code(ob, undefined, sec_entries_codes["SmokingStatusObservation"]);
} else {
var c = libCCDAGen.code(ob, data[i].code);
module.exports = function (data, codeSystems, isCCD, CCDxml) {
var doc = new libxmljs.Document();
var xmlDoc = libCCDAGen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.5", "2.16.840.1.113883.10.20.22.2.5.1", "11450-4",
"2.16.840.1.113883.6.1", "LOINC", "PROBLEM LIST", "PROBLEMS", isCCD);
// entries loop
for (var i = 0; i < data.length; i++) {
var e = xmlDoc.node('entry').attr({typeCode: "DRIV"});
var act = e.node('act').attr({classCode: "ACT", moodCode: "EVN"}); // problem concern act
act.node('templateId').attr({root: "2.16.840.1.113883.10.20.22.4.3"});
libCCDAGen.id(act, data[i].source_list_identifiers);
libCCDAGen.code(act, undefined, sec_entries_codes["ProblemConcernAct"]);
act.node('statusCode').attr({code: 'completed'});
libCCDAGen.effectiveTime(act, libCCDAGen.getTimes(data[i].date_time));
var er = act.node('entryRelationship').attr({typeCode: "SUBJ"});
var obsAttrs = {classCode: "OBS", moodCode: "EVN"};
if (data[i].hasOwnProperty('negation_indicator')) {
obsAttrs.negationInd = data[i].negation_indicator.toString();
module.exports = function (data, codeSystems, isCCD, CCDxml) {
var doc = new libxmljs.Document();
var xmlDoc = libCCDAGen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.22", "2.16.840.1.113883.10.20.22.2.22.1",
"46240-8", "2.16.840.1.113883.6.1", "LOINC", "History of encounters", "ENCOUNTERS", isCCD);
// entries loop
for (var i = 0; i < data.length; i++) {
// start the templating
var e = xmlDoc.node('entry').attr({
typeCode: "DRIV"
});
var enc = e.node('encounter').attr({
classCode: "ENC",
moodCode: "EVN"
}); // encounter activities
enc.node('templateId').attr({
root: "2.16.840.1.113883.10.20.22.4.49"
exports.respond = function(res, response, defaultFormat) {
var format = res.req.query.output || defaultFormat || 'json';
switch (format) {
case 'json':
return res.json(response);
case 'xml':
var doc = new xml.Document();
generateXML(doc, response);
return res.type('xml').send(doc.toString());
default:
res.send(400, 'Invalid output format');
}
};
writeDoc: function() {
var doc = new libxml.Document();
doc.node('osm').attr({ version: 0.6, generator: GENERATOR });
return doc;
},
self.xml = function(rootElement, namespace) {
if (null == xml) {
if ('undefined' !== typeof rootElement) {
xml = new libxmljs.Document();
var rootNode = xml.node(rootElement);
if ('undefined' !== typeof namespace) {
rootNode.namespace(namespace);
}
}
}
return xml;
};
}
toXML: function buildXML(params) {
var xml = new libxml.Document();
this.serializeStructure(this.root, this.rules, params, xml, this.xmlns);
return xml.root().toString();
},