clinical_quality_language icon indicating copy to clipboard operation
clinical_quality_language copied to clipboard

CQL-to-ELM: Annotation Parsing

Open bkaney opened this issue 2 years ago • 1 comments

When using cql-to-elm version 1.5 there are a few issues when processing annotations

1. Tag-only annotations do not appear in ELM

CQL:

/**
 * Annotations for define
 * 
 * @test
 */

ELM actual:

<annotation xsi:type="a:Annotation">
  <a:s r="8">
    <a:s>/**
 * Annotations for define
 *
 * @test
 */
     </a:s>
     ...snip...
  </a:s>
</annotation>

ELM expected:

<annotation xsi:type="a:Annotation">
  <a:s r="8">
    <a:t name="test"/>
    <a:s>/**
 * Annotations for define
 *
 * @test
 */
     </a:s>
     ...snip...
  </a:s>
</annotation>

(There is a workaround to use @test:, but this it not documented. Should the spec allow @test without colon?)

2. Handling end of line / annotation

CQL

/**
 * Annotations for define
 *
 * @test:
 * @data: has-t2dm-cohort
 * @context: Patient
 */

ELM acutual

<annotation xsi:type="a:Annotation">
   <a:t name="test" value="*"/>
   <a:t name="data" value="has-t2dm-cohort&#xa; *"/>
   <a:t name="context" value="Patient=123"/>
   <a:s r="13">
      <a:s>/**
* Annotations for define
*
* @test:
* @data: has-t2dm-cohort
* @context: Patient=123
*/
      </a:s>
     ...snip...
  </a:s>
</annotation>

ELM expected

<annotation xsi:type="a:Annotation">
   <a:t name="test"/>
   <a:t name="data" value="has-t2dm-cohort"/>
   <a:t name="context" value="Patient=123"/>
   <a:s r="13">
      <a:s>/**
* Annotations for define
*
* @test:
* @data: has-t2dm-cohort
* @context: Patient=123
*/
      </a:s>
     ...snip...
  </a:s>
</annotation>

3. Handling annotation values with @

CQL

/**
 * Annotations for define
 *
 * @asof: @2020-10-01 
 * @parameter: "Measurement Interval" [@2019,@2020]
 */

ELM actual

<annotation xsi:type="a:Annotation">
   <a:t name="asof" value=""/>
   <a:t name="parameter" value="&quot;Measurement Interval&quot; ["/>
   <a:s r="8">
      <a:s>/**
* Annotations for define
*
* @asof: @2020-10-01 
* @parameter: &quot;Measurement Interval&quot; [@2019,@2020]
*/
      </a:s>
     ...snip...
  </a:s>
</annotation>

ELM expected

<annotation xsi:type="a:Annotation">
   <a:t name="asof" value="@2020-10-01"/>
   <a:t name="parameter" value="&quot;Measurement Interval&quot; [@2019,@2020]"/>
   <a:s r="8">
      <a:s>/**
* Annotations for define
*
* @asof: @2020-10-01 
* @parameter: &quot;Measurement Interval&quot; [@2019,@2020]
*/
      </a:s>
     ...snip...
  </a:s>
</annotation>

bkaney avatar Jul 12 '22 22:07 bkaney

Thank you for the report, we'll get this corrected

brynrhodes avatar Jul 29 '22 15:07 brynrhodes

Included in v2.1.0

brynrhodes avatar Sep 08 '22 17:09 brynrhodes