Skip to content

Duplicate Type attribute when using ElmLibraryWriter to generate JSON from Library #1380

@gregory-akins

Description

@gregory-akins

When using clinical_quality_language ElmLibraryWriter.java ( ./Src/java/elm/src/main/java/org/cqframework/cql/elm/serializing/ElmLibraryWriter.java ) to generate JSON from a Library that was created with org.cqframework.cql.cql2elm.CqlTranslator

In version 3.3.2, the resulting JSON was correct (ie., could be parsed by org.json.JSONObject). When using version 3.11.0, the resulting JSON is incorrect and yields the message "Duplicate key 'type' encountered at line 308 column 20" ( Below, you can see the two "type" definitions under localId 263

"resultTypeSpecifier" : {
               "localId" : "262",
               "type" : "ListTypeSpecifier",
               "elementType" : {
                  "localId" : "263",
                  "type" : "ChoiceTypeSpecifier",
                  "type" : [ ],
                  "choice" : [ {
                     "localId" : "264",
                     "name" : "{urn:healthit-gov:qdm:v5_6}PositiveEncounterPerformed",
                     "type" : "NamedTypeSpecifier"
                  }, {
                     "localId" : "265",
                     "name" : "{urn:healthit-gov:qdm:v5_6}PositiveInterventionPerformed
[3.3.2-LibraryJson.json](https://github.com/user-attachments/files/16144388/3.3.2-LibraryJson.json)
[3.11.0-LibraryJson.json](https://github.com/user-attachments/files/16144389/3.11.0-LibraryJson.json)
[3.3.2-LibraryJson.json](https://github.com/user-attachments/files/16144406/3.3.2-LibraryJson.json)
[3.11.0-LibraryJson.json](https://github.com/user-attachments/files/16144407/3.11.0-LibraryJson.json)
",
                     "type" : "NamedTypeSpecifier"
                  } ]
               }
            },

I haven't determined whether the problem is with the translator, or the Writer.

The error seems to occur when CQL contains UNION

library MAT6463GenerateElmJSON version '2.0.000'

using QDM version '5.6'


parameter "Measurement Period" Interval<DateTime>

context Patient

define "IPP":
  true
define "Undefined Encounter":
 ["Encounter, Performed"]
define "Undefined Intervention":
 ["Intervention, Performed"]
 define "Union of UnDefined":
 ("Undefined Encounter" union "Undefined Intervention")



3.3.2-LibraryJson.json
3.11.0-LibraryJson.json

Metadata

Metadata

Assignees

Labels

md impact trackingThe issue is impacting measure development

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions