Skip to content

Commit

Permalink
Add More CQL Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkiel committed Nov 27, 2024
1 parent f7e2973 commit 6342ed6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
23 changes: 23 additions & 0 deletions modules/cql/test/blaze/cql/translator_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@
[1 :expression :operand 0 :operand :source :name] := "Patient"
[1 :expression :operand 1 :type] := "Literal"))

(testing "Overlaps"
(given-translation
"library Test
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'
codesystem snomed: 'http://snomed.info/sct'
define InInitialPopulation:
exists
from [Procedure: Code '431182000' from snomed] P
where P.performed overlaps Interval[@2020-02-01, @2020-06-01]"
[0 :name] := "InInitialPopulation"
[0 :context] := "Patient"
[0 :expression :type] := "Exists"
[0 :expression :resultTypeName] := "{urn:hl7-org:elm-types:r1}Boolean"
[0 :expression :operand :type] := "Query"
[0 :expression :operand :where :type] := "Overlaps"
[0 :expression :operand :where :operand 0 :type] := "FunctionRef"
[0 :expression :operand :where :operand 0 :name] := "ToInterval"
[0 :expression :operand :where :operand 0 :operand 0 :type] := "As"
[0 :expression :operand :where :operand 0 :operand 0 :asType] := "{http://hl7.org/fhir}Period"))

(testing "Returns a valid :elm/library"
(are [cql] (s/valid? :elm/library (translate cql))
"library Test
Expand Down
4 changes: 3 additions & 1 deletion modules/cql/test/blaze/elm/compiler/reusing_logic_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@
:end nil}
(interval/interval
(system/date-time 2021 2 23 14 12 45)
nil)))
nil)
nil
nil))

(testing "expression is dynamic"
(is (false? (core/-static expr))))
Expand Down

0 comments on commit 6342ed6

Please sign in to comment.