projecttacoma / fqm-execution

fqm-execution is a library that allows users to calculate FHIR-based electronic Clinical Quality Measures (eCQMs) and retrieve the results in a variety of formats
https://projecttacoma.github.io/fqm-execution/
Apache License 2.0
18 stars 6 forks source link

Specify errors that come from cql-execution #203

Closed sarahmcdougall closed 1 year ago

sarahmcdougall commented 1 year ago

Summary

Adds more detailed error throwing in Execution.ts in the sense that it is more clear when the error came from the underlying cql-execution engine.

New behavior

When the user encounters an issue from cql-execution, the error message and stack from cql-execution will be thrown (as was the case before) and the error message will explicitly state that the error came from cql-execution.

Code changes

All changes occur in Execution.ts. If an error is thrown from the executor, it will be caught and the error message will be amended to include a blurb about the error occurring in cql-execution. That original error is thrown (throwing a whole new error results in the fqm-execution stack trace being included instead of the cql-execution stack trace).

Testing Guidance

No unit tests exist for Execution.ts, so testing should be done via the CLI.

  1. Test with patient/measure bundles that we expect to successfully calculate. Check that no errors are thrown and that we get the expected behavior.
  2. Test with patient/measure bundles that should result in a cql-execution issue and check that the resulting error message includes “The following error occurred in the cql-execution engine” and that the error stack points to where the issue occurred in cql-execution.

    Example test case: Test with the HospitalHarmHyperglycemiainHospitalizedPatientsFHIR measure and patient bundles in the ecqm-content-r4-2021 repository. These bundles have issues with date formatting, and so you should get an error from interval.ts (“List of intervals contains mismatched types”).

github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟢 Statements 85.01% 1990/2341
🟡 Branches 73.68% 1755/2382
🟢 Functions 87.1% 351/403
🟢 Lines 85.3% 1920/2251

Test suite run success

364 tests passing in 28 suites.

Report generated by 🧪jest coverage report action from ed98ccfd84a28e818ce69d607e14b4e2ad4a546c