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 e00ad6a
Show file tree
Hide file tree
Showing 5 changed files with 636 additions and 616 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
8 changes: 7 additions & 1 deletion lib/helpers/measure_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,14 @@ 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.

Check failure on line 336 in lib/helpers/measure_helpers.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected use of continue statement

Check failure on line 336 in lib/helpers/measure_helpers.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected use of continue statement
}
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
Loading

0 comments on commit e00ad6a

Please sign in to comment.