clinical-reasoning
clinical-reasoning copied to clipboard
cannot expand Integer Interval
in http://cql.hl7.org/09-b-cqlreference.html#expand it mentions "The Interval<T> overload for expand is a new feature being introduced in CQL 1.5, and has trial-use status." but if it throws an exception in 2.4.0.
CQL unit test that shows failure:
library RCQLEvaluatorExpandInterval1 version '1.0.0'
define AssertCanExpandIntegerInterval:
Message(expand Interval[1, 10] per 1 '1',
Count(expand Interval[1, 10] per 1 '1') != 10,
'Integer interval expanded should result in list',
'Error',
'List should be from 1 to 10 by 1 but found ' & ToString(Count(expand Interval[1, 10] per 1 '1'))
)
the following exception is thrown: org.opencds.cqf.cql.engine.exception.CqlException: java.lang.ClassCastException: class org.opencds.cqf.cql.engine.runtime.Interval cannot be cast to class java.lang.Iterable (org.opencds.cqf.cql.engine.runtime.Interval is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @722c41f4; java.lang.Iterable is in module java.base of loader 'bootstrap') at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:33) at org.opencds.cqf.cql.engine.elm.execution.MessageEvaluator.internalEvaluate(MessageEvaluator.java:68) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:14) at org.opencds.cqf.cql.engine.elm.execution.ExpressionDefEvaluator.internalEvaluate(ExpressionDefEvaluator.java:23) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:14) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluateExpressions(CqlEngine.java:191) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluate(CqlEngine.java:169) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluate(CqlEngine.java:148) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:89) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:76) at org.opencds.cqf.cql.evaluator.cli.command.CqlCommand.call(CqlCommand.java:216) at org.opencds.cqf.cql.evaluator.cli.command.CqlCommand.call(CqlCommand.java:38) at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
The two examples at the bottom of CQL Appendix B section 9.10 (http://cql.hl7.org/09-b-cqlreference.html#expand) also have the same issue:
expand Interval[1, 10]
expand Interval[1, 10] per 2