Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "cql-execution in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'cql-execution' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

function performExecuteArtifact(elmFiles, artifactName, params, patients, vsacCredentials, codeService, dataModel) {
  // Set up the library
  const elmFile = JSON.parse(_.find(elmFiles, f =>
    f.name.replace(/[\s-\\/]/g, '') === artifactName.replace(/[\s-\\/]/g, '')).content);
  const libraries = _.filter(elmFiles, f =>
    f.name.replace(/[\s-\\/]/g, '') !== artifactName.replace(/[\s-\\/]/g, '')).map(f => JSON.parse(f.content));
  const library = new cql.Library(elmFile, new cql.Repository(libraries));

  // Set up the parameters
  const cqlExecParams = convertParameters(params);

  // Create the patient source
  const patientSource = (dataModel.version === '3.0.0')
    ? cqlfhir.PatientSource.FHIRv300()
    : cqlfhir.PatientSource.FHIRv102();

  // Load the patient source with the patient
  patientSource.loadBundles(patients);

  // Extract the value sets from the ELM
  let valueSets = [];
  if (elmFile.library && elmFile.library.valueSets && elmFile.library.valueSets.def) {
    valueSets = elmFile.library.valueSets.def;
function executeElmAgainstPatientSource(executionInputs, patientSource) {
  // executionInputs.elmDependencies = [ fhirhelpersElm ]
  const repository = new cql.Repository(executionInputs.elmDependencies);
  const lib = new cql.Library(executionInputs.elm, repository);
  const codeService = new cql.CodeService(executionInputs.valueSetDB);
  const executor = new cql.Executor(lib, codeService, executionInputs.parameters);
  const results = executor.exec(patientSource);
  return results.patientResults[Object.keys(results.patientResults)[0]];
}
function executeElmAgainstPatientSource(executionInputs, patientSource) {
  // executionInputs.elmDependencies = [ fhirhelpersElm ]
  const repository = new cql.Repository(executionInputs.elmDependencies);
  const lib = new cql.Library(executionInputs.elm, repository);
  const codeService = new cql.CodeService(executionInputs.valueSetDB);
  const executor = new cql.Executor(lib, codeService, executionInputs.parameters);
  const results = executor.exec(patientSource);
  return results.patientResults[Object.keys(results.patientResults)[0]];
}
function executeElmAgainstPatientSource(executionInputs, patientSource) {
  // executionInputs.elmDependencies = [ fhirhelpersElm ]
  const repository = new cql.Repository(executionInputs.elmDependencies);
  const lib = new cql.Library(executionInputs.elm, repository);
  const codeService = new cql.CodeService(executionInputs.valueSetDB);
  const executor = new cql.Executor(lib, codeService, executionInputs.parameters);
  const results = executor.exec(patientSource);
  return results.patientResults[Object.keys(results.patientResults)[0]];
}
.then(() => {
      // Value sets are loaded, so execute!
      const executor = new cql.Executor(library, codeService, cqlExecParams);
      const results = executor.exec(patientSource);
      return results;
    });
}
function executeElmAgainstPatientSource(executionInputs, patientSource) {
  // executionInputs.elmDependencies = [ fhirhelpersElm ]
  const repository = new cql.Repository(executionInputs.elmDependencies);
  const lib = new cql.Library(executionInputs.elm, repository);
  const codeService = new cql.CodeService(executionInputs.valueSetDB);
  const executor = new cql.Executor(lib, codeService, executionInputs.parameters);
  const results = executor.exec(patientSource);
  return results.patientResults[Object.keys(results.patientResults)[0]];
}
case 'interval_of_decimal':
        paramsObj[p.name] = new cql.Interval(p.value.firstDecimal, p.value.secondDecimal);
        break;
      case 'interval_of_integer':
        paramsObj[p.name] = new cql.Interval(p.value.firstInteger, p.value.secondInteger);
        break;
      case 'interval_of_quantity': {
        const q1 = p.value.firstQuantity != null ? new cql.Quantity({
          value: p.value.firstQuantity,
          unit: p.value.unit
        }) : null;
        const q2 = p.value.secondQuantity != null ? new cql.Quantity({
          value: p.value.secondQuantity,
          unit: p.value.unit
        }) : null;
        paramsObj[p.name] = new cql.Interval(q1, q2);
        break;
      }
      case 'string':
        // Remove the leading and trailing single-quotes
        paramsObj[p.name] = p.value.replace(/^'(.*)'$/, '$1');
        break;
      case 'system_code':
        paramsObj[p.name] = new cql.Code(p.value.code, p.value.uri);
        break;
      case 'system_concept':
        paramsObj[p.name] = new cql.Concept([new cql.Code(p.value.code, p.value.uri)]);
        break;
      case 'system_quantity':
        paramsObj[p.name] = new cql.Quantity({
          value: p.value.quantity,
          unit: p.value.unit
if (p.value.firstDate) {
          const str = p.value.firstTime ? `${p.value.firstDate}T${p.value.firstTime}` : p.value.firstDate;
          d1 = cql.DateTime.parse(str);
        }
        if (p.value.secondDate) {
          const str = p.value.secondTime ? `${p.value.secondDate}T${p.value.secondTime}` : p.value.secondDate;
          d2 = cql.DateTime.parse(str);
        }
        paramsObj[p.name] = new cql.Interval(d1, d2);
        break;
      }
      case 'interval_of_decimal':
        paramsObj[p.name] = new cql.Interval(p.value.firstDecimal, p.value.secondDecimal);
        break;
      case 'interval_of_integer':
        paramsObj[p.name] = new cql.Interval(p.value.firstInteger, p.value.secondInteger);
        break;
      case 'interval_of_quantity': {
        const q1 = p.value.firstQuantity != null ? new cql.Quantity({
          value: p.value.firstQuantity,
          unit: p.value.unit
        }) : null;
        const q2 = p.value.secondQuantity != null ? new cql.Quantity({
          value: p.value.secondQuantity,
          unit: p.value.unit
        }) : null;
        paramsObj[p.name] = new cql.Interval(q1, q2);
        break;
      }
      case 'string':
        // Remove the leading and trailing single-quotes
        paramsObj[p.name] = p.value.replace(/^'(.*)'$/, '$1');
const q2 = p.value.secondQuantity != null ? new cql.Quantity({
          value: p.value.secondQuantity,
          unit: p.value.unit
        }) : null;
        paramsObj[p.name] = new cql.Interval(q1, q2);
        break;
      }
      case 'string':
        // Remove the leading and trailing single-quotes
        paramsObj[p.name] = p.value.replace(/^'(.*)'$/, '$1');
        break;
      case 'system_code':
        paramsObj[p.name] = new cql.Code(p.value.code, p.value.uri);
        break;
      case 'system_concept':
        paramsObj[p.name] = new cql.Concept([new cql.Code(p.value.code, p.value.uri)]);
        break;
      case 'system_quantity':
        paramsObj[p.name] = new cql.Quantity({
          value: p.value.quantity,
          unit: p.value.unit
        });
        break;
      case 'time':
        // CQL exec doesn't expose a Time class, so we must construct a DT and then get the Time
        paramsObj[p.name] = cql.DateTime.parse(`@0000-01-01${p.value.slice(1)}`).getTime();
        break;
      default: // do nothing
    }
  });
  return paramsObj;
}
        if (p.value.secondDate) {
          const str = p.value.secondTime ? `${p.value.secondDate}T${p.value.secondTime}` : p.value.secondDate;
          d2 = cql.DateTime.parse(str);
        }
        paramsObj[p.name] = new cql.Interval(d1, d2);
        break;
      }
      case 'interval_of_decimal':
        paramsObj[p.name] = new cql.Interval(p.value.firstDecimal, p.value.secondDecimal);
        break;
      case 'interval_of_integer':
        paramsObj[p.name] = new cql.Interval(p.value.firstInteger, p.value.secondInteger);
        break;
      case 'interval_of_quantity': {
        const q1 = p.value.firstQuantity != null ? new cql.Quantity({
          value: p.value.firstQuantity,
          unit: p.value.unit
        }) : null;
        const q2 = p.value.secondQuantity != null ? new cql.Quantity({
          value: p.value.secondQuantity,
          unit: p.value.unit
        }) : null;
        paramsObj[p.name] = new cql.Interval(q1, q2);
        break;
      }
      case 'string':
        // Remove the leading and trailing single-quotes
        paramsObj[p.name] = p.value.replace(/^'(.*)'$/, '$1');
        break;
      case 'system_code':
        paramsObj[p.name] = new cql.Code(p.value.code, p.value.uri);

Is your System Free of Underlying Vulnerabilities?
Find Out Now