UNPKG

cql-execution

Version:

An execution framework for the Clinical Quality Language (CQL)

134 lines (122 loc) 3.6 kB
// Generated by CoffeeScript 1.9.3 (function() { var Code, ValueSet, typeIsArray, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; typeIsArray = require('../util/util').typeIsArray; module.exports.Code = Code = (function() { function Code(code1, system1, version1) { this.code = code1; this.system = system1; this.version = version1; } return Code; })(); module.exports.ValueSet = ValueSet = (function() { function ValueSet(oid, version1, codes) { this.oid = oid; this.version = version1; this.codes = codes != null ? codes : []; } ValueSet.prototype.hasCode = function(code, system, version) { var c, matches, ref; if (typeIsArray(code)) { matches = (function() { var i, len, results; results = []; for (i = 0, len = code.length; i < len; i++) { c = code[i]; results.push(this.hasCode(c)); } return results; }).call(this); return indexOf.call(matches, true) >= 0; } if (code instanceof Object) { ref = [code.code, code.system, code.version], code = ref[0], system = ref[1], version = ref[2]; } matches = (function() { var i, len, ref1, results; ref1 = this.codes; results = []; for (i = 0, len = ref1.length; i < len; i++) { c = ref1[i]; if (c.code === code) { results.push(c); } } return results; }).call(this); if (system != null) { matches = (function() { var i, len, results; results = []; for (i = 0, len = matches.length; i < len; i++) { c = matches[i]; if (c.system === system) { results.push(c); } } return results; })(); } if (version != null) { matches = (function() { var i, len, results; results = []; for (i = 0, len = matches.length; i < len; i++) { c = matches[i]; if (c.version === version) { results.push(c); } } return results; })(); } return matches.length > 0; }; ValueSet.prototype.matchCode = function(code, system, version) { var c, matches; matches = (function() { var i, len, ref, results; ref = this.codes; results = []; for (i = 0, len = ref.length; i < len; i++) { c = ref[i]; if (c.code === code) { results.push(c); } } return results; }).call(this); if (system != null) { matches = (function() { var i, len, results; results = []; for (i = 0, len = matches.length; i < len; i++) { c = matches[i]; if (c.system === system) { results.push(c); } } return results; })(); } if (version != null) { matches = (function() { var i, len, results; results = []; for (i = 0, len = matches.length; i < len; i++) { c = matches[i]; if (c.version === version) { results.push(c); } } return results; })(); } return matches.length > 0; }; return ValueSet; })(); }).call(this); //# sourceMappingURL=clinical.js.map