Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Fix cql engine test cases--arithmetic and cql types #560

Closed
wants to merge 2 commits into from

Conversation

leima888
Copy link

@leima888 leima888 commented May 2, 2022

No description provided.

Copy link
Member

@brynrhodes brynrhodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit calculations seem to be looking for and returning 1 as the unit and erroring otherwise, why would the calculation convert the unit to 1? Shouldn't the units be preserved?

@leima888
Copy link
Author

leima888 commented May 10, 2022

The unit calculations seem to be looking for and returning 1 as the unit and erroring otherwise, why would the calculation convert the unit to 1? Shouldn't the units be preserved?

Which unit calculation are you referring to? For division if the dividend and divisor have the same unit the result should have the unit '1' (no unit) otherwise calculate the unit such as 'cm3' / 'cm2' = 'cm' while for multiplication the unit calculation goes like 'cm'*'cm' = 'cm2'. It should throw an error if we have 20 '1' / 5 'cm' but 20 'cm' / 5 '1' should result in 4 'cm'.
Please advice if there're issues in these calculations.

@JPercival
Copy link
Contributor

This PR is largely the same as #570. Closing this one in favor of that one.

As a note to contributors, the source of the xml tests in the cql-engine repo is actually the CQL specification IG here:

https://github.com/HL7/cql/tree/master/tests/cql

If there are tests that are incorrectly specified they should be fixed in the CQL spec (i.e. edit the XML there) and we'll propagate that to the cql-engine repo. I looked through the tests and the only one I'm certain that's wrong is TruncatedDivide10d1ByNeg3D1Quantity. I added an issue to track that here: HL7/cql#77

It doesn't look to me like the other changes are correct. Those appear to me to be bugs in the cql-engine, and therefore there should be cql-engine changes to fix that as opposed to bugs in the tests.This PR duplicates effort in #560, not sure if that's intended or not.

The source of the xml tests in the cql-engine repo is actually the CQL specification IG here:

https://github.com/HL7/cql/tree/master/tests/cql

If there are tests that are incorrectly specified they should be fixed in the CQL spec (i.e. edit the XML there) and we'll propagate that to the cql-engine repo. I looked through the tests and the only one I'm certain that's wrong is TruncatedDivide10d1ByNeg3D1Quantity. I added an issue to track that here: HL7/cql#77

It doesn't look to me like the other changes are correct. Those appear to me to be bugs in the cql-engine, and therefore there should be cql-engine changes to fix that as opposed to bugs in the tests.

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

Successfully merging this pull request may close these issues.

3 participants