cqframework / clinical_quality_language

Clinical Quality Language (CQL) is an HL7 specification for the expression of clinical knowledge that can be used within both the Clinical Decision Support (CDS) and Clinical Quality Measurement (CQM) domains. This repository contains complementary tooling in support of that specification.
https://confluence.hl7.org/display/CDS/Clinical+Quality+Language
Apache License 2.0
267 stars 123 forks source link

Update ProperContains evaluator implementation #1393

Closed antvaset closed 4 months ago

antvaset commented 4 months ago

This PR includes the following changes related to ProperContains:

1) Fix the ProperContainsNullRightFalse and ProperContainsNullRightTrue tests to make sure they are parsed as ProperContains(List<T>, T) (to match the test name/group). Without null as String, the expressions

{'s', 'u', 'n'} properly includes null
{'s', 'u', 'n', null} properly includes null

were parsed as ProperIncludes(List<T>, List<T>).

2) Set the expected values of the library-based ProperContainsTimeNull and ProperInTimeNull tests to null to match those of the XML-based ProperContainsTimeNull (link) and ProperInTimeNull (link).

3) Update implementation of ProperContains evaluator to match the spec (link).

4) Add tests covering the edge cases in the ProperContains logic.

github-actions[bot] commented 4 months ago

Formatting check succeeded!

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 63.73%. Comparing base (0670c4a) to head (f2095cb).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1393 +/- ## ============================================ + Coverage 63.70% 63.73% +0.03% + Complexity 2666 2665 -1 ============================================ Files 493 493 Lines 27750 27774 +24 Branches 5513 5521 +8 ============================================ + Hits 17677 17703 +26 Misses 7830 7830 + Partials 2243 2241 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

brynrhodes commented 4 months ago

This looks good @antvaset , my only question is is there a corresponding PR against the cql-tests repository to update these tests?

antvaset commented 4 months ago

Depends on https://github.com/cqframework/cql-tests/pull/40

antvaset commented 4 months ago

This looks good @antvaset , my only question is is there a corresponding PR against the cql-tests repository to update these tests?

Hi @brynrhodes, thanks for having a look! I've opened https://github.com/cqframework/cql-tests/pull/40 in cql-tests to add the new tests for both ProperContains and ProperIn. The new tests for ProperIn in that PR all pass this updated implementation (see https://github.com/cqframework/clinical_quality_language/pull/1394).

antvaset commented 3 months ago

Note also https://github.com/cqframework/cql-tests/pull/48 and https://github.com/cqframework/clinical_quality_language/pull/1394.