question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CQL-to-ELM Translator - Incorrect elm generated for ToString(argument Time)

See original GitHub issue

The cql-to-elm translator generates incorrect elm for the ToString function when Time is passed as an argument as shown below

CQL: define TimeOverload: ToString(@12:30:00.000)

ELM:

<def name="TimeOverload" context="Patient" accessLevel="Public">
   <expression xsi:type="ToString">
      <signature name="t:Ratio" xsi:type="NamedTypeSpecifier"/>
      <operand xsi:type="Ratio">
         <numerator value="30" unit="1"/>
         <denominator value="0.000" unit="1"/>
      </operand>
   </expression>
</def>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
p9gcommented, Sep 19, 2019

Thanks for catching the spec flaw. STU comment submitted at http://www.hl7.org/dstucomments/showdetail_comment.cfm?commentid=1857

1reaction
cmoeselcommented, Sep 19, 2019

Hi @sanumula. In CQL, time literals start w/ @T – so your code above should actually be:

define TimeOverload: ToString(@T12:30:00.000)

See: https://cql.hl7.org/02-authorsguide.html#date-datetime-and-time

Once you add the T, it should work as expected. Did CQL-to-ELM report any errors regarding that line of code or did it run smoothly and just produce unexpected ELM? I’d hope that it would have reported an error since @12:30:00.000 isn’t really a valid construct in CQL.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implicit Use of FHIRHelpers Functions #382 - GitHub
I'm noticing there seems to be a change in how the CQL-to-ELM ... the translator tries to use the type of the AgeInYearsAt...
Read more >
6. Translation Semantics - Clinical Quality Language (CQL)
In both CQL and ELM, the basic container for all declarations is the Library. ... an implementation could emit a ToString which took...
Read more >
CQL-to-ELM Translator Reference Implementation
The CQL-to-ELM Translator is an open-source reference implementation that translates the high-level CQL syntax into the Expression Logical ...
Read more >
Understanding Elm's Type Mismatch Error - Thoughtbot
One of the first error messages you'll run into is the “Type Mismatch” error. This error is fundamental to Elm's enforcement of its...
Read more >
Db2 11 - Db2 SQL - TRANSLATE - IBM
The numeric argument is implicitly cast to a VARCHAR data type. to-string: An expression that specifies the characters to which certain characters in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found