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

Using index to differentiate between reused observation definitions f… #261

Merged
merged 2 commits into from
Mar 10, 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
114,948 changes: 57,474 additions & 57,474 deletions dist/browser.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/helpers/calculator_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ module.exports = class CalculatorHelpers {

// Returns a JSON function to add to the ELM before ELM JSON is used to calculate results for episode based measures
// This ELM template was generated by the CQL-to-ELM Translation Service.
static generateEpisodeELMJSONFunction(functionName, parameter) {
static generateEpisodeELMJSONFunction(functionName, parameter, index) {
const elmFunction = {
name: `obs_func_${functionName}`,
name: `obs_func_${functionName}_${index}`,
context: 'Patient',
accessLevel: 'Public',
expression: {
Expand Down Expand Up @@ -523,9 +523,9 @@ module.exports = class CalculatorHelpers {

// Returns a JSON function to add to the ELM before ELM JSON is used to calculate results for patient based measures
// This ELM template was generated by the CQL-to-ELM Translation Service.
static generatePatientELMJSONFunction(functionName) {
static generatePatientELMJSONFunction(functionName, index) {
const elmFunction = {
name: `obs_func_${functionName}`,
name: `obs_func_${functionName}_${index}`,
context: 'Patient',
accessLevel: 'Public',
expression: {
Expand Down
8 changes: 4 additions & 4 deletions lib/models/calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ module.exports = class Calculator {
const observationDefs = [];
let generatedELMJSON;
if (observations) {
observations.forEach((obs) => {
observations.forEach((obs, index) => {
const funcName = obs.observation_function.statement_name;
const param = obs.observation_parameter.statement_name;
generatedELMJSON = (measure.calculation_method === 'PATIENT' && !measure.composite)
? CalculatorHelpers.generatePatientELMJSONFunction(funcName)
: CalculatorHelpers.generateEpisodeELMJSONFunction(funcName, param);
? CalculatorHelpers.generatePatientELMJSONFunction(funcName, index)
: CalculatorHelpers.generateEpisodeELMJSONFunction(funcName, param, index);
// Save the name of the generated define statement, so we can check
// its result later in the CQL calculation process. These added
// define statements are called 'obs_func_' followed by the
// name of the function - see the 'generateELMJSONFunction' function.
observationDefs.push(`obs_func_${funcName}`);
observationDefs.push(`obs_func_${funcName}_${index}`);
// Add the generated elm representing the observation function into the elm
mainLibraryElm.library.statements.def.push(generatedELMJSON);
});
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.1.5",
"version": "4.1.6",
"description": "NPM module for calculating eCQMs (electronic clinical quality measures) written in CQL (clinical quality language).",
"main": "lib/index.js",
"scripts": {
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@

"@lhncbc/ucum-lhc@^4.1.3":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@lhncbc/ucum-lhc/-/ucum-lhc-4.2.0.tgz#522cc16fe37739d7da16c27c8b9ad039ee39c2d7"
resolved "https://registry.npmjs.org/@lhncbc/ucum-lhc/-/ucum-lhc-4.2.0.tgz"
integrity sha512-OEiWX7IHFHLTFs7+w5EvGtI5dhXhhL0341LqZ9WEBWErtoY0/9xl/vn+wwT9vnBHnjQ7Ux0o7iEUXvN8uVn4xg==
dependencies:
coffeescript "^2.7.0"
Expand Down Expand Up @@ -1137,7 +1137,7 @@ browserify-rsa@^4.0.0, browserify-rsa@^4.1.0:

browserify-sign@^4.0.0:
version "4.2.2"
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e"
resolved "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz"
integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==
dependencies:
bn.js "^5.2.1"
Expand Down Expand Up @@ -1230,7 +1230,7 @@ bser@2.1.1:

bson@*:
version "6.3.0"
resolved "https://registry.yarnpkg.com/bson/-/bson-6.3.0.tgz#d47acba525ba7d7eb0e816c10538bce26a337fe0"
resolved "https://registry.npmjs.org/bson/-/bson-6.3.0.tgz"
integrity sha512-balJfqwwTBddxfnidJZagCBPP/f48zj9Sdp3OJswREOgsJzHiQSaOIAtApSgDQFYgHqAvFkp53AFSqjMDZoTFw==

bson@^1.1.4:
Expand Down Expand Up @@ -1706,9 +1706,9 @@ elliptic@^6.5.3, elliptic@^6.5.4:
minimalistic-crypto-utils "^1.0.1"

emitter-component@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.1.tgz"
integrity sha512-G+mpdiAySMuB7kesVRLuyvYRqDmshB7ReKEVuyBPkzQlmiDiLrt7hHHIy4Aff552bgknVN7B2/d3lzhGO5dvpQ==
version "1.1.2"
resolved "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.2.tgz"
integrity sha512-QdXO3nXOzZB4pAjM0n6ZE+R9/+kPpECA/XSELIcc54NeYVnBqIk+4DFiBgK+8QbV3mdvTG6nedl7dTYgO+5wDw==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -2231,7 +2231,7 @@ gopd@^1.0.1:

graceful-fs@^4.1.6:
version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==

graceful-fs@^4.2.4, graceful-fs@^4.2.9:
Expand Down Expand Up @@ -3839,7 +3839,7 @@ readable-stream@^2.0.2, readable-stream@^2.2.2, readable-stream@~2.3.6:

readable-stream@^2.1.0, readable-stream@^2.3.5:
version "2.3.8"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz"
integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
dependencies:
core-util-is "~1.0.0"
Expand Down
Loading