New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fqm-execution

Package Overview
Dependencies
Maintainers
0
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fqm-execution - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

2

build/calculation/ClauseResultsBuilder.js

@@ -272,3 +272,3 @@ "use strict";

// create clause results for all localIds in this statement
const localIds = ClauseResultsHelpers.findAllLocalIdsInStatementByName(elmLibrary, statementResult.statementName);
const localIds = ClauseResultsHelpers.findLocalIdsInStatementByName(elmLibrary, statementResult.statementName);
for (const localId in localIds) {

@@ -275,0 +275,0 @@ const clause = localIds[localId];

@@ -418,6 +418,6 @@ "use strict";

(_b = populationGroup.stratifier) === null || _b === void 0 ? void 0 : _b.forEach(strata => {
var _a, _b, _c, _d;
const strataCode = (_b = (_a = strata.code) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : `strata-${strataIndex++}`;
if ((_c = strata.criteria) === null || _c === void 0 ? void 0 : _c.expression) {
const rawEpisodeResults = patientResults[(_d = strata.criteria) === null || _d === void 0 ? void 0 : _d.expression];
var _a, _b, _c, _d, _e;
const strataCode = (_c = (_b = (_a = strata.code) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : strata.id) !== null && _c !== void 0 ? _c : `strata-${strataIndex++}`;
if ((_d = strata.criteria) === null || _d === void 0 ? void 0 : _d.expression) {
const rawEpisodeResults = patientResults[(_e = strata.criteria) === null || _e === void 0 ? void 0 : _e.expression];
createOrSetValueOfEpisodes(rawEpisodeResults, episodeResultsSet, populationGroup, undefined, undefined, strataCode, strata.id);

@@ -496,5 +496,5 @@ }

(_b = populationGroup.stratifier) === null || _b === void 0 ? void 0 : _b.forEach(strata => {
var _a, _b, _c;
const newStrataCode = (_b = (_a = strata.code) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : `strata-${strataIndex++}`;
(_c = newEpisodeResults.stratifierResults) === null || _c === void 0 ? void 0 : _c.push(Object.assign(Object.assign({}, (strataId ? { strataId } : {})), { strataCode: newStrataCode, result: newStrataCode === strataCode ? true : false, appliesResult: newStrataCode === strataCode ? true : false }));
var _a, _b, _c, _d;
const newStrataCode = (_c = (_b = (_a = strata.code) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : strata.id) !== null && _c !== void 0 ? _c : `strata-${strataIndex++}`;
(_d = newEpisodeResults.stratifierResults) === null || _d === void 0 ? void 0 : _d.push(Object.assign(Object.assign({}, (strataId ? { strataId } : {})), { strataCode: newStrataCode, result: newStrataCode === strataCode ? true : false, appliesResult: newStrataCode === strataCode ? true : false }));
});

@@ -501,0 +501,0 @@ }

@@ -74,8 +74,8 @@ "use strict";

const clauseResults = context.data.root.clauseResults;
const clauseResult = clauseResults.filter(result => result.libraryName === libraryName && result.localId === localId);
const clauseResult = clauseResults.find(result => result.libraryName === libraryName && result.localId === localId);
if (clauseResult) {
if (clauseResult.some(c => c.final === Enums_1.FinalResult.TRUE)) {
if (clauseResult.final === Enums_1.FinalResult.TRUE) {
return objToCSS(exports.cqlLogicClauseCoveredStyle);
}
else if (clauseResult.every(c => c.final === Enums_1.FinalResult.FALSE || c.final === Enums_1.FinalResult.UNHIT)) {
else if (clauseResult.final === Enums_1.FinalResult.FALSE || clauseResult.final === Enums_1.FinalResult.UNHIT) {
return objToCSS(exports.cqlLogicUncoveredClauseStyle);

@@ -82,0 +82,0 @@ }

@@ -193,3 +193,3 @@ "use strict";

const strata = ((_a = group.stratifier) === null || _a === void 0 ? void 0 : _a.find(s => { var _a; return s.code && ((_a = s.code[0]) === null || _a === void 0 ? void 0 : _a.text) === stratResults.strataCode; })) ||
((_b = group.stratifier) === null || _b === void 0 ? void 0 : _b.find(s => s.id === stratResults.strataCode));
((_b = group.stratifier) === null || _b === void 0 ? void 0 : _b.find(s => s.id === stratResults.strataCode)); // strataCode may have an id value if code did not originally exist
const stratum = (_c = strata === null || strata === void 0 ? void 0 : strata.stratum) === null || _c === void 0 ? void 0 : _c[0];

@@ -584,4 +584,4 @@ if (stratum) {

const reports = [];
const measure = (0, MeasureBundleHelpers_1.extractMeasureFromBundle)(measureBundle);
executionResults.forEach(result => {
const measure = (0, MeasureBundleHelpers_1.extractMeasureFromBundle)(measureBundle);
const builder = new MeasureReportBuilder(measure, options);

@@ -588,0 +588,0 @@ builder.addPatientResults(result);

import { ELM, ELMBinaryExpression, ELMStatement } from '../types/ELMTypes';
/**
* Finds all localIds in a statement by it's library and statement name.
* Finds all of the localIds that are needed for clause results for a single statement.
* @public
* @param {ELM} libraryElm - The library the statement belongs to.
* @param {string} statementName - The statement name to search for.
* @return {Hash} List of local ids in the statement.
* @return {Hash} List of result-relevant local ids in the statement.
*/
export declare function findAllLocalIdsInStatementByName(libraryElm: ELM, statementName: string): any;
export declare function findLocalIdsInStatementByName(libraryElm: ELM, statementName: string): any;
/**

@@ -11,0 +11,0 @@ * Finds all localIds in the statement structure recursively.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSupplementalDataElementStatement = exports.isStatementFunction = exports.findLocalIdForLibraryRef = exports.findLocalIdsForComparisonOperators = exports.findAllLocalIdsInSort = exports.findAllLocalIdsInStatement = exports.findAllLocalIdsInStatementByName = void 0;
exports.isSupplementalDataElementStatement = exports.isStatementFunction = exports.findLocalIdForLibraryRef = exports.findLocalIdsForComparisonOperators = exports.findAllLocalIdsInSort = exports.findAllLocalIdsInStatement = exports.findLocalIdsInStatementByName = void 0;
/**
* Finds all localIds in a statement by it's library and statement name.
* Finds all of the localIds that are needed for clause results for a single statement.
* @public
* @param {ELM} libraryElm - The library the statement belongs to.
* @param {string} statementName - The statement name to search for.
* @return {Hash} List of local ids in the statement.
* @return {Hash} List of result-relevant local ids in the statement.
*/
function findAllLocalIdsInStatementByName(libraryElm, statementName) {
function findLocalIdsInStatementByName(libraryElm, statementName) {
// create place for aliases and their usages to be placed to be filled in later. Aliases and their usages (aka scope)

@@ -25,3 +25,3 @@ // and returns do not have localIds in the elm but do in elm_annotations at a consistent calculable offset.

// and have a localId for the clause that the result should map to
if (localIds[alias.expressionLocalId] != null && alias.aliasLocalId != null) {
if (localIds[alias.expressionLocalId] != null && alias.aliasLocalId) {
localIds[alias.aliasLocalId] = {

@@ -41,6 +41,36 @@ localId: alias.aliasLocalId,

}
return localIds;
// find all localids in the annotation
const allAnnotatedIds = findAnnotationLocalIds(statement === null || statement === void 0 ? void 0 : statement.annotation);
// filter out local ids that aren't in the annotation
const annotatedLocalIds = {};
for (const [key, value] of Object.entries(localIds)) {
if (allAnnotatedIds.includes(key)) {
annotatedLocalIds[key] = value;
}
}
return annotatedLocalIds;
}
exports.findAllLocalIdsInStatementByName = findAllLocalIdsInStatementByName;
exports.findLocalIdsInStatementByName = findLocalIdsInStatementByName;
/**
* Recursively finds localIds that are in an annotation structure by pulling out all "r:"-keyed values
* @public
* @param {object} annotation - all or a subset of the annotation structure to search
* @return {Array} List of local ids in the annotation.
*/
function findAnnotationLocalIds(annotation) {
if (Array.isArray(annotation)) {
return annotation.flatMap(ent => findAnnotationLocalIds(ent));
}
else if (typeof annotation === 'object') {
return Object.entries(annotation).flatMap(ent => {
// if key is r, return value, else recurse
if (ent[0] === 'r')
return ent[1];
return findAnnotationLocalIds(ent[1]);
});
}
// default empty
return [];
}
/**
* Finds all localIds in the statement structure recursively.

@@ -87,7 +117,12 @@ * @private

if (statement.localId) {
// Older translator versions require with statements to use the statement.expression.localId + 1 as the alias Id
// even if the statement already has a localId. There is not a clear mapping for alias with statements in the new
// translator, so they will go un highlighted but this will not affect coverage calculation
// There is not a clear mapping for `With` and `Without` relationship aliases with statements in newer
// translator versions. The node in the annotation that contains the alias has a local id that doesn't
// exist in the elm. We have to find this localId by looking for it in the annotation structure.
if (statement.type === 'With' || statement.type === 'Without') {
alId = (parseInt(statement.expression.localId, 10) + 1).toString();
if (annotation) {
const id = findRelationshipAliasAnnotationId(annotation, statement.expression.localId);
if (id) {
alId = id;
}
}
}

@@ -297,2 +332,71 @@ else {

/**
* Helper function to kick off the recursive search for the relationship (With, Without) source's localId in the annotation
* structure. If found this returns the localId of the parent node of the given source localId. Null is returned if not
* found.
*/
function findRelationshipAliasAnnotationId(annotation, sourceLocalId) {
for (const a of annotation) {
const id = findRelationshipAliasNodeAnnotationId([a.s], sourceLocalId);
if (id) {
return id;
}
}
return null;
}
/**
* Recursively looks through the annotation structure for the source localId and grabs its parent id which also contains
* the alias. This search is valid to be used with relationship (With, Without) clauses and allows us to tag the found
* localId, which only exists in the annotation, as the alias localId for the source so it can be highlighted when the
* source clause has a result.
*
* For example in the below snippet. We are looking for the source localId 355 and want to return 301 which includes
* the alias.
*
* {
* "r": "301",
* "s": [
* {
* "r": "355",
* "s": [
* {
* "s": [
* {
* "value": [
* "\"Bladder Cancer Diagnosis\""
* ]
* }
* ]
* }
* ]
* },
* {
* "value": [
* " ",
* "BladderCancer"
* ]
* }
* ]
* }
*
* @returns id of the node that is parent to the source localId if found
*/
function findRelationshipAliasNodeAnnotationId(annotation, sourceLocalId) {
var _a;
for (const node of annotation) {
// if this node has a list of more nodes in s, look at the first one and see if it matches the sourceLocalId
if (node.r && node.s && ((_a = node.s[0]) === null || _a === void 0 ? void 0 : _a.r) === sourceLocalId) {
// return this localId which is the parent of the sourceLocalId
return node.r;
}
else if (node.s) {
// otherwise, keep recursing and return the alias localId if found
const id = findRelationshipAliasNodeAnnotationId(node.s, sourceLocalId);
if (id) {
return id;
}
}
}
return null;
}
/**
* Find the localId of the library reference in the JSON elm annotation. This recursively searches the annotation structure

@@ -299,0 +403,0 @@ * for the clause of the library ref. When that is found it knows where to look inside of that for where the library

{
"name": "fqm-execution",
"version": "1.5.0",
"version": "1.6.0",
"description": "FHIR Quality Measure Execution",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc