Skip to content

Commit

Permalink
Implement Implies Operator and update to cql2elm 3.12.0 (#320)
Browse files Browse the repository at this point in the history
Implements the `implies` operator and updates CQL translator to 3.12.0. Also updates gradle wrapper to latest 8.x for Java 21 support. Enables the spec-tests for Implies operator.

Note: The translator has a bug with choice types in the output that caused issues with some tests. This issue was manually edited out in the ELM after running the `build:test-data` command. cqframework/clinical_quality_language#1380

This is a squash commit containing these original commits:

* updated to use cql-to-elm 3.12.0. fixed localid on tests that relied on localids. manual work around for bad choicetype elm

* updated spec tests with 3.12.0 translation

* re-enable spec tests for implies operator

* implemented implies operator

* fixed npm audit concerns

* removed xml import that is not needed. added comments to explain duplicated type field in tests

* maked implies operator as supported in excel sheet

* updated NYC, fixing out of heap space issue in coverage run

* replaced hardcoded localIds in tests with a helper function to grab a localId in the elm structure

* moved getLocalIdByPath to new testHelpers file. Replaced localids in query-test.ts with helperfile usage.

* Now throwing an error in localId helper function when its not found to make test checks simpler

* removed not.be.null checks from list-test.ts
  • Loading branch information
hossenlopp authored Jul 31, 2024
1 parent d69c85e commit 039f795
Show file tree
Hide file tree
Showing 55 changed files with 95,317 additions and 62,136 deletions.
Binary file modified CQL_Execution_Features.xlsx
Binary file not shown.
23 changes: 22 additions & 1 deletion examples/browser/cql4browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,17 @@ class ThreeValuedLogic {
return null;
}
}
static implies(left, right) {
if (left === true) {
return right;
}
else if (left === false) {
return true;
}
else {
return right === true ? true : null;
}
}
}
exports.ThreeValuedLogic = ThreeValuedLogic;

Expand Down Expand Up @@ -5805,7 +5816,7 @@ exports.StringLiteral = StringLiteral;
},{"./expression":22}],30:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IsFalse = exports.IsTrue = exports.Xor = exports.Not = exports.Or = exports.And = void 0;
exports.IsFalse = exports.IsTrue = exports.Xor = exports.Not = exports.Or = exports.Implies = exports.And = void 0;
const expression_1 = require("./expression");
const datatypes_1 = require("../datatypes/datatypes");
class And extends expression_1.Expression {
Expand All @@ -5817,6 +5828,16 @@ class And extends expression_1.Expression {
}
}
exports.And = And;
class Implies extends expression_1.Expression {
constructor(json) {
super(json);
}
async exec(ctx) {
const [left, right] = await this.execArgs(ctx);
return datatypes_1.ThreeValuedLogic.implies(left, right);
}
}
exports.Implies = Implies;
class Or extends expression_1.Expression {
constructor(json) {
super(json);
Expand Down
Loading

0 comments on commit 039f795

Please sign in to comment.