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

collapse of integer intervals fails in 2.4.0 #225

Open
revans2023 opened this issue Jan 12, 2023 · 3 comments
Open

collapse of integer intervals fails in 2.4.0 #225

revans2023 opened this issue Jan 12, 2023 · 3 comments

Comments

@revans2023
Copy link

revans2023 commented Jan 12, 2023

the example in CQL reference appendix B for collapse (see http:https://cql.hl7.org/09-b-cqlreference.html#collapse) throws an error in 2.4.0. Example is define "Collapse1To9": collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] } // { Interval[1, 9] }

Using the CQL IDE web site with this CQL (https://cql-runner.dataphoria.org/):
library Welcome version '1.0.0'
define CollapseIntegerIntervals: collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] }

results in this error message:

evaluation error: {
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns="http:https://www.w3.org/1999/xhtml\">

Operation Outcome

<table border="0"><td style="font-weight: bold;">ERROR[]
\n\t\t\t\n\t\t\n\t"
},
"issue": [
{
"severity": "error",
"details": {
"text": "Unsupported interval point type for FHIR conversion java.lang.Integer"
}
}
]
}

@revans2023
Copy link
Author

This works in CQL Unit test so maybe CQL IDE is an older version of CQL evaluator?

define AssertCanCollapseIntegerIntervals:
Message(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] },
(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] }) != { Interval[1, 9] },
'Integer Intervals were not collapsed correctly',
'Error',
'Expected {Interval[1, 9]} but found start=' & ToString(start of First(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] })) & ' end=' & ToString(end of First(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] }))
)

@revans2023
Copy link
Author

In CQL Author's guide for interval values (see http:https://cql.hl7.org/02-authorsguide.html#interval-values), the following also do not work in CQL IDE (see https://cql-runner.dataphoria.org/):

  • Interval[3, 5) fails with "Unsupported interval point type for FHIR conversion java.lang.Integer"
  • Interval[3.0, 5.0) fails with "Unsupported interval point type for FHIR conversion java.math.BigDecimal"
  • point from Interval[1, 5] fails with "Cannot perform PointFrom operation on intervals that are not unit intervals."
  • Interval[1, 4] except Interval[3, 6] fails with "Unsupported interval point type for FHIR conversion java.lang.Integer"

@revans2023
Copy link
Author

revans2023 commented Jan 12, 2023

These all work in 2.4.0:

// see see http:https://cql.hl7.org/09-b-cqlreference.html#collapse
define AssertCanCollapseIntegerIntervals:
Message(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] },
(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] }) != { Interval[1, 9] },
'Integer Intervals were not collapsed correctly',
'Error',
'Expected {Interval[1, 9]} but found start=' & ToString(start of First(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] })) & ' end=' & ToString(end of First(collapse { Interval[1, 4], Interval[4, 8], Interval[7, 9] }))
)

// see http:https://cql.hl7.org/02-authorsguide.html#interval-values
define AssertCanUsePointONIntegerIntervals:
Message(point from Interval[1, 1],
point from Interval[1, 1] != 1,
'Integer Intervals were not correct after using point',
'Error',
'Expected 1 but found start=' & ToString(point from Interval[1, 1])
)

// see http:https://cql.hl7.org/02-authorsguide.html#computing-intervals
define AssertCanUseUnionOnIntegerIntervals:
Message(Interval[1, 4] union Interval[3, 6],
start of (Interval[1, 4] union Interval[3, 6]) != 1 or
end of (Interval[1, 4] union Interval[3, 6]) != 6,
'Integer Intervals were not correct after using union',
'Error',
'Expected Interval[1, 6] but found start=' & ToString(start of (Interval[1, 4] except Interval[3, 6])) & ' end=' & ToString(end of (Interval[1, 4] except Interval[3, 6]))
)

define AssertCanUseIntersectOnIntegerIntervals:
Message(Interval[1, 4] intersect Interval[3, 6],
start of (Interval[1, 4] intersect Interval[3, 6]) != 3 or
end of (Interval[1, 4] intersect Interval[3, 6]) != 4,
'Integer Intervals were not correct after using intersect',
'Error',
'Expected Interval[3, 4] but found start=' & ToString(start of (Interval[1, 4] except Interval[3, 6])) & ' end=' & ToString(end of (Interval[1, 4] except Interval[3, 6]))
)

define AssertCanUseExceptOnIntegerIntervals:
Message(Interval[1, 4] except Interval[3, 6],
start of (Interval[1, 4] except Interval[3, 6]) != 1 or
end of (Interval[1, 4] except Interval[3, 6]) != 2,
'Integer Intervals were not correctly after using except',
'Error',
'Expected Interval[1, 2] but found start=' & ToString(start of (Interval[1, 4] except Interval[3, 6])) & ' end=' & ToString(end of (Interval[1, 4] except Interval[3, 6]))
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant