Skip to content

Commit

Permalink
Ignore isNull localId when immediately following a Not operator so th…
Browse files Browse the repository at this point in the history
…at 'null' in 'not null' is not considered a unique clause.
  • Loading branch information
jkotanchik-SB committed Sep 19, 2024
1 parent 4fba0d7 commit 0dbd2f2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
15 changes: 11 additions & 4 deletions dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ module.exports = class MeasureHelpers {
) {
return localIds;
}
// Stop recursing if this node represents the Patient obj since it is not part of coverage consideration.
if (statement?.name === "Patient") return localIds;
// Stop recursing if this node represents the Patient obj since it is not part of coverage consideration.
if (statement.name && statement.name === 'Patient') return localIds;

// looking at the key and value of everything on this object or array
for (const k in statement) {
Expand Down Expand Up @@ -874,11 +874,18 @@ module.exports = class MeasureHelpers {
localId: statement.localId,
isFalsyLiteral: true,
};
// else if the key is localId, push the value
// else if the key is localId, push the value
} else if (k === 'localId') {
// skip IsNulls that immediately follow a Not operator so that users don't have to cover "null" when "not null" is covered.
if (statement.type && statement.type === 'IsNull'
&& typeof parentNode === 'object'
&& parentNode.type && parentNode.type === "Not") {
continue; // skip the localId on this node.
}
localIds[v] = { localId: v };
// if the value is an array or object, recurse
} else if (Array.isArray(v) || (typeof v === 'object' && k !== "codes")) {
} else if (Array.isArray(v)
|| (typeof v === 'object' && k !== 'codes')) {
this.findAllLocalIdsInStatement(
v,
libraryName,
Expand Down
15 changes: 11 additions & 4 deletions dist/browser.js-e
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ module.exports = class MeasureHelpers {
) {
return localIds;
}
// Stop recursing if this node represents the Patient obj since it is not part of coverage consideration.
if (statement?.name === "Patient") return localIds;
// Stop recursing if this node represents the Patient obj since it is not part of coverage consideration.
if (statement.name && statement.name === 'Patient') return localIds;

// looking at the key and value of everything on this object or array
for (const k in statement) {
Expand Down Expand Up @@ -874,11 +874,18 @@ module.exports = class MeasureHelpers {
localId: statement.localId,
isFalsyLiteral: true,
};
// else if the key is localId, push the value
// else if the key is localId, push the value
} else if (k === 'localId') {
// skip IsNulls that immediately follow a Not operator so that users don't have to cover "null" when "not null" is covered.
if (statement.type && statement.type === 'IsNull'
&& typeof parentNode === 'object'
&& parentNode.type && parentNode.type === "Not") {
continue; // skip the localId on this node.
}
localIds[v] = { localId: v };
// if the value is an array or object, recurse
} else if (Array.isArray(v) || (typeof v === 'object' && k !== "codes")) {
} else if (Array.isArray(v)
|| (typeof v === 'object' && k !== 'codes')) {
this.findAllLocalIdsInStatement(
v,
libraryName,
Expand Down
9 changes: 8 additions & 1 deletion lib/helpers/measure_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,15 @@ module.exports = class MeasureHelpers {
localId: statement.localId,
isFalsyLiteral: true,
};
// else if the key is localId, push the value
// else if the key is localId, push the value
} else if (k === 'localId') {
// skip IsNulls that immediately follow a Not operator so that users don't have to cover "null" when "not null" is covered.
if (statement.type && statement.type === 'IsNull'
&& typeof parentNode === 'object'
&& parentNode.type && parentNode.type === 'Not') {
// eslint-disable-next-line
continue; // skip the localId on this node.
}
localIds[v] = { localId: v };
// if the value is an array or object, recurse
} else if (Array.isArray(v)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cqm-execution",
"version": "4.2.2",
"version": "4.2.3",
"description": "NPM module for calculating eCQMs (electronic clinical quality measures) written in CQL (clinical quality language).",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 0dbd2f2

Please sign in to comment.