Skip to content

Commit

Permalink
Handled observation function unique names for patient based measures
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitKandimalla committed Mar 5, 2024
1 parent da53798 commit 44b1a29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,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 Expand Up @@ -1787,7 +1787,7 @@ module.exports = class Calculator {
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.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
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/calculator_helpers.js
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion lib/models/calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = class Calculator {
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.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
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ elliptic@^6.5.3, elliptic@^6.5.4:

emitter-component@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/emitter-component/-/emitter-component-1.1.2.tgz#d65af5833dc7c682fd0ade35f902d16bc4bad772"
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:
Expand Down

0 comments on commit 44b1a29

Please sign in to comment.