Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Width allows Interval<Any> as a parameter #734

Open
EvanMachusakNCQA opened this issue Mar 21, 2022 · 0 comments
Open

Width allows Interval<Any> as a parameter #734

EvanMachusakNCQA opened this issue Mar 21, 2022 · 0 comments
Labels
bug cql The issue relates to or requires a change or clarification on the CQL specification
Milestone

Comments

@EvanMachusakNCQA
Copy link

EvanMachusakNCQA commented Mar 21, 2022

From the official tests, this is an example:

define "IntervalTestWidthNull":
  ( width of ( null as Interval<Any>) ) = null as Integer

In appendix B for width (https://cql.hl7.org/09-b-cqlreference.html#width), width's signature is generic but we have two contrary statements:

Note that because CQL defines duration and difference operations for date and time valued intervals, width is not defined for intervals of these types.

and:

The width operator returns the width of an interval. The result of this operator is equivalent to invoking: (end of argument – start of argument).

In particular, if an engine implements Width as suggested by using end and start, then we look at the documentation for end (https://cql.hl7.org/09-b-cqlreference.html#end).

End's documentation says this:

If the high boundary of the interval is open, this operator returns the predecessor of the high value of the interval.

(ditto for Start and the successor operator).

Thus in order to implement end, you need to implement it through predecessor.

The documentation for predecessor (https://cql.hl7.org/09-b-cqlreference.html#predecessor) says this:

The predecessor operator is defined for the Integer, Long, Decimal, Quantity, Date, DateTime, and Time types.

So, peeling this backwards, we can see that Width could only be implemented on the types that Predecessor and Successor support. Of those, the Width documentation specifically discludes date and time values because of the custom operators (which use quantity units).

This leaves us with Width being only defined for Integer, Long, Decimal, and Quantity types.

Therefore I think CQL-to-ELM should raise an error on Width on any interval type except those 4.

@brynrhodes brynrhodes added bug cql The issue relates to or requires a change or clarification on the CQL specification labels Apr 14, 2022
@brynrhodes brynrhodes added this to the Maintenance milestone Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cql The issue relates to or requires a change or clarification on the CQL specification
Projects
None yet
Development

No branches or pull requests

2 participants