UNPKG

cql-execution

Version:

An execution framework for the Clinical Quality Language (CQL)

76 lines (60 loc) 2.25 kB
// Generated by CoffeeScript 1.12.7 (function() { var Code, Concept, Element, Expression, Instance, Quantity, build, ref, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Expression = require('./expression').Expression; build = require('./builder').build; Quantity = require('./quantity').Quantity; ref = require('../datatypes/datatypes'), Code = ref.Code, Concept = ref.Concept; Element = (function() { function Element(json) { this.name = json.name; this.value = build(json.value); } Element.prototype.exec = function(ctx) { var ref1; return (ref1 = this.value) != null ? ref1.execute(ctx) : void 0; }; return Element; })(); module.exports.Instance = Instance = (function(superClass) { extend(Instance, superClass); function Instance(json) { var child; Instance.__super__.constructor.apply(this, arguments); this.classType = json.classType; this.element = (function() { var i, len, ref1, results; ref1 = json.element; results = []; for (i = 0, len = ref1.length; i < len; i++) { child = ref1[i]; results.push(new Element(child)); } return results; })(); } Instance.prototype.exec = function(ctx) { var el, i, len, obj, ref1; obj = {}; ref1 = this.element; for (i = 0, len = ref1.length; i < len; i++) { el = ref1[i]; obj[el.name] = el.exec(ctx); } switch (this.classType) { case "{urn:hl7-org:elm-types:r1}Quantity": return new Quantity(obj); case "{urn:hl7-org:elm-types:r1}Code": return new Code(obj.code, obj.system, obj.version, obj.display); case "{urn:hl7-org:elm-types:r1}Concept": return new Concept(obj.codes, obj.display); default: return obj; } }; return Instance; })(Expression); }).call(this); //# sourceMappingURL=instance.js.map