Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore isNull localId when immediately following a Not operator so that 'null' in 'not null' is not considered a unique clause. #270

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading