CQL Translator produces Double List Promotion at Retrieve Codes
See original GitHub issueAfter updating from 1.3.10 to 1.3.14, the following CQL example translates to different ELM:
library Test
using FHIR version '4.0.0'
codesystem test: 'test'
code T0: '0' from test
define Observations: [Observation: T0]
The relevant part is the Retrieve Expression. Here you have the double list promotion:
{
"dataType" : "{http://hl7.org/fhir}Observation",
"codeProperty" : "code",
"type" : "Retrieve",
"codes" : {
"type" : "ToList",
"operand" : {
"type" : "ToList",
"operand" : {
"name" : "T0",
"type" : "CodeRef"
}
}
}
}
With version 1.3.10 I get:
{
"dataType" : "{http://hl7.org/fhir}Observation",
"codeProperty" : "code",
"type" : "Retrieve",
"codes" : {
"type" : "ToList",
"operand" : {
"name" : "T0",
"type" : "CodeRef"
}
}
}
With disabled list promotion, I get no lists with both versions.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
3. Developer's Guide - Clinical Quality Language (CQL)
Promotion is used to implicitly convert a value to a list of values of that type. Whenever an operation that expects a list-valued...
Read more >HL7.FHIR.US.CQFMEASURES\Using CQL - FHIR v4.0.1
This instructs the translator to disallow promotion of singletons to list-valued expressions. The list promotion feature of CQL is used to enable functionality ......
Read more >Custom promotions - Optimizely
This topic describes how to work with custom promotions in Optimizely Commerce Cloud. ... Like all content types, it is possible to translate...
Read more >Advanced Query Functions - Northwestern University
This manual contains terms, concepts, and procedures that are rooted in traditional Structured Query Language (SQL).
Read more >Challenge solutions - Pwning OWASP Juice Shop
The presence of deletedAt you might have derived from Retrieve a list of all user credentials via SQL Injection and enforcing it to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @alexanderkiel , thank you for the report. I have confirmed this behavior, it is a byproduct of list promotion, as well as some fixes to type resolution that were included in the 1.3.14 release.
In detail, what’s happening is that within the retrieve, when the terminology target is a direct reference code, the translator will attempt to resolve equality in to validate the terminology target. The type resolution in 1.3.14 is tighter, so that resolution results in a failure if list-promotion is disabled (which shows up as a warning when resolving terminology targets). But with list-promotion enabled, the translator will opt to promote both sides to a list and allow the comparison (effectively pushing the equality determination to a run-time operation). And finally, because it’s a direct-reference code, the translator assumes it needs to automatically promote the code to a list because the retrieve is expecting a list of codes (the failure here is that it is not checking whether the equality resolution actually resulted in a list promotion).
So the internal part about not resolving code equality correctly is actually an issue that is scheduled to be addressed in the first 1.4 release.
The other issue (not checking whether equality resolution resulted in list promotion, producing double-list promotion) I will address in this release.
Thanks. I rewrote my queries and was able to update to v1.3.15. Only my comments about the equal tests and the
TestEqualNull
are still relevant. Should I open separate issues on that?