Error with CQL-TO-ELM Translator

I have been trying to translate my FHIR3 based eCQM to ELM using the CQL-TO-ELM translator but keep getting the following error and not knowing what to go about to fix this issue. Can someone please tell me where to look or how to fix this issue. Thanks very much.

C:\CQL_Project\clinical_quality_language-master\Src\java\cql-to-elm\build\install\cql-to-elm\bin>cql-to-elm --input C:\CQL_Project\clinical_quality_language-master\Examples\FHIR_1550.cql

TRANSLATE C:\CQL_Project\clinical_quality_language-master\Examples\FHIR_1550.cql
Translation failed due to errors:
Error:[107:45, 107:45] Syntax error at as
Error:[40:82, 40:82] Syntax error at from
Error:[40:74, 40:92] Could not resolve identifier timezone in the current library.

The file you are referencing, FHIR_1550.cql, is not one of the examples in the repository. Can you post that file here so I can take a look at the CQL? Alternatively, you can download the Atom language-cql plugin and use that to see the errors highlighted in an editor.

Hi Bryn,

You are absolutely right. I was trying to validate my own version of FHIR-based CQL (FHIR_1550.cql) file using the CQL-TO-ELM tool. Below is the FHIR_1550.cql file. Many thanks for your help.

library RiskStandardizedComplicationRateFollowingElectivePrimaryTotalHipArthroplastyAndTotalKneeArthroplastyTKAeCQM version ‘0.0.008’

using FHIR version ‘3.0.0’

include MATGlobalCommonFunctions_FHIR3 version ‘2.0.000’ called Global
include SupplementalDataElements_FHIR3 version ‘1.0.0’ called SDE
include FHIRHelpers version ‘3.0.0’ called FHIRHelpers

valueset “Acute Myocardial Infarction”: ‘urn:oid:2.16.840.1.113883.3.666.5.1958’
valueset “Encounter Hospital Outpatient”: ‘urn:oid:2.16.840.1.113883.3.3157.1002.14’
valueset “Ethnicity”: ‘urn:oid:2.16.840.1.114222.4.11.837’
valueset “Fracture Exclusions For Hip And Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.2’
valueset “Inpatient encounter CCDE”: ‘urn:oid:2.16.840.1.113762.1.4.1104.8’
valueset “Left Against Medical Advice”: ‘urn:oid:2.16.840.1.113883.13.190.5.8’
valueset “Malignant Neoplasm Complications Related To Hip and Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.7’
valueset “Mechanical Complications Related To Hip and Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.1’
valueset “Nonprimary Total Hip, Total Knee Replacement”: ‘urn:oid:2.16.840.1.113762.1.4.1206.5’
valueset “ONC Administrative Sex”: ‘urn:oid:2.16.840.1.113762.1.4.1’
valueset “Payer”: ‘urn:oid:2.16.840.1.114222.4.11.3591’
valueset “Periprosthetic Joint Infection/Wound Infection and Other Wound Complications”: ‘urn:oid:2.16.840.1.113762.1.4.1206.8’
valueset “Pneumonia Complications Related To Hip and Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.6’
valueset “Procedures Resulted From Periprosthetic Joint Infection/Wound Infections”: ‘urn:oid:2.16.840.1.113762.1.4.1206.9’
valueset “Procedures Resulted From Surgical Site Bleeding and Other Surgical Site Complications”: ‘urn:oid:2.16.840.1.113762.1.4.1206.11’
valueset “Pulmonary Embolism Complications Related To Hip and Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.3’
valueset “Race”: ‘urn:oid:2.16.840.1.114222.4.11.836’
valueset “Sepsis Complications Related To Hip and Knee Procedures”: ‘urn:oid:2.16.840.1.113762.1.4.1206.4’
valueset “Surgical Site Bleeding and Other Surgical Site Complications”: ‘urn:oid:2.16.840.1.113762.1.4.1206.10’
valueset “Total Hip, Total Knee Replacement”: ‘urn:oid:2.16.840.1.113762.1.4.1029.96’
valueset “Transfer From Acute Care Hospital”: ‘urn:oid:2.16.840.1.113883.13.190.5.43’

parameter “Measurement Period” Interval

context Patient
define “SDE Ethnicity”:
SDE.“SDE Ethnicity”

define “SDE Payer”:
SDE.“SDE Payer”

define “SDE Race”:
SDE.“SDE Race”

define “SDE Sex”:
SDE.“SDE Sex”

define “Non-Primary THA_TKA Procedures”:
[Procedure: “Nonprimary Total Hip, Total Knee Replacement”] NonPrimaryProcedures
where NonPrimaryProcedures.status = ‘completed’
and NonPrimaryProcedures.performed starts during “Measurement Period”

/Retrieving all Diagnosis events for the patient with a code in those specified Complication value sets that during the measurement period./
define “Qualifying Complications”:
(“AMI Diagnosis”
union “Mechanical Diagnosis”
union “Pneumonia Diagnosis”
union “Pulmonary Diagnosis”
union “Sepsis Diagnosis”
union “Active Bleeding Diagnosis”
union “Wound Infection Diagnosis”) QualifyingComplications
where Global.“Normalize Onset”(QualifyingComplications.onset) starts on or before end of “Measurement Period”

/This retrieves all qualifying THA-TKA procedure events for the patient. Note that the value set only contains codes for primary procedures./
define “Primary THA-TKA Procedures”:
[Procedure: “Total Hip, Total Knee Replacement”] PrimaryProcedures
where PrimaryProcedures.status = ‘completed’
and PrimaryProcedures.performed starts during “Measurement Period”

define “Diagnosed With Excluded Conditions”:
( [Condition : “Malignant Neoplasm Complications Related To Hip and Knee Procedures”]
union [Condition : “Mechanical Complications Related To Hip and Knee Procedures”]
union [Condition : “Fracture Exclusions For Hip And Knee Procedures”] ) ExcludedConditions
where ExcludedConditions.clinicalStatus = ‘active’
and Global.“Normalize Onset”(ExcludedConditions.onset) starts on or before end of “Measurement Period”

define “Qualifying THA-TKA Procedures With Excluded Procedures”:
“Qualifying Encounters Related To THA & TKA Procedures” QualifyingEncounter
with “Non-Primary THA_TKA Procedures” ExcludedProcedure
such that ExcludedProcedure.performed starts during QualifyingEncounter.period

/Identify all encounters related to THA-TKA procedures during the measurement year where the patient was at least 18 years of age as of procedure date./
define “Initial Population”:
“Encounter Related To Elective Primary THA And TKA Procedures With Age”

define “Numerator”:
“Encounter With Complications During Index Admission”
union “Encounter With Complications Within 7 Days From The Start Of The Index Admission”
union “Encounter With Complications Within 30 Days From The Start Of The Index Admission”
union “Encounter With Procedure Resulted From Surgical Site Bleeding Complications Within 30 Days Of Index Admission”
union “Encounter With Complications Within 90 Days From The Start Of The Index Admission”
union “Encounter With Procedure Resulted From Joint Infection Within 90 Days Of Index Admission”
union “Died Within 30 Days From The Start Of The Index Admission”

define “Denominator”:
“Initial Population”

define “Denominator Exclusion”:
“Transferred From Acute Care Hospital Or Left Against Medical Advice”
union “Qualifying THA-TKA Procedures With Excluded Conditions”
union “Qualifying THA-TKA Procedures With Excluded Procedures”
union “Encounter With More Than 2 THA-TKA Procedures Codes During The Index Admission”

/The patient who undergwent qualifying procecdures and died within 30 days from the start of the index admission date./

define “Died Within 30 Days From The Start Of The Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE7
with [“Patient Characteristic: Expired”] as Deceased
such that Deceased.deceasedDateTime.value 30 days or less on or after start of QE7.period
return QE7

/The patient must be at least 18 of age on or before the THA-TKA procedure date./

define “Encounter Related To Elective Primary THA And TKA Procedures With Age”:
exists “Qualifying Encounters Related To THA & TKA Procedures” Procedure
and Global.“CalendarAgeInYearsAt”(FHIRHelpers.ToDate(Patient.birthDate), start of “Measurement Period”) >= 18

/The patient had experienced any specified complication (i.e. Mechanical, Bleeding, Wound infection, Pulmonary Embolism, Pneumonia) during the index admission/
define “Encounter With Complications During Index Admission”:
from
“Qualifying Encounters Related To THA & TKA Procedures” QE1,
“Qualifying Complications” Complications
where Global.“Normalize Onset”(Complications.onset) starts during QE1.period
return QE1

/The patient had experienced Surgical Site Bleeding or Pulmonary Embolism complication within 30 days from the start of the index admission/

define “Encounter With Complications Within 30 Days From The Start Of The Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE3
with ( “Pulmonary Diagnosis”
union “Active Bleeding Diagnosis” ) ABComplications
such that Global.“Normalize Onset”(ABComplications.onset) starts 30 days or less after start of QE3.period
return QE3

/The patient had experienced Pneumonia, AMI or Sepsis complication within 7 days from the start of the index admission./

define “Encounter With Complications Within 7 Days From The Start Of The Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE2
with ( “Pneumonia Diagnosis”
union “AMI Diagnosis”
union “Sepsis Diagnosis” ) Complications
such that Global.“Normalize Onset”(Complications.onset) starts 7 days or less after start of QE2.period
return QE2

/The patient had experienced Mechanical complication or Wound Infection within 90 days from the start of the index admission./

define “Encounter With Complications Within 90 Days From The Start Of The Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE4
with ( “Mechanical Diagnosis”
union “Wound Infection Diagnosis” ) WIComplications
such that Global.“Normalize Onset”(WIComplications.onset) starts 90 days or less after start of QE4.period
return QE4

/The patient had more than 2 THA-TKA procedure codes during index admission/

define “Encounter With More Than 2 THA-TKA Procedures Codes During The Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” Encounters
where Count((“Primary THA-TKA Procedures”
union “Non-Primary THA_TKA Procedures”)Procedures
where Procedures.performed starts during Encounters.period
)> 2

/The patient underwent a procedure resulted from joint infection complication associated with THA-TKA procedure/

define “Encounter With Procedure Resulted From Joint Infection Within 90 Days Of Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE5
with [Procedure: “Procedures Resulted From Periprosthetic Joint Infection/Wound Infections”] PJProcedure
such that PJProcedure.status = ‘completed’
and PJProcedure.performed starts 90 days or less after start of QE5.period
return QE5

/The patient underwent a procedure resulted from surgical site bleeding complication associated with THA-TKA procedure/

define “Encounter With Procedure Resulted From Surgical Site Bleeding Complications Within 30 Days Of Index Admission”:
“Qualifying Encounters Related To THA & TKA Procedures” QE6
with [Procedure: “Procedures Resulted From Surgical Site Bleeding and Other Surgical Site Complications”] SSProcedure
such that SSProcedure.status = ‘completed’
and SSProcedure.performed starts 30 days or less after start of QE6.period
return QE6

/All THA-TKA procedure related encounters must be ended at least 90 days before the end of the measurement year./

define “Qualifying Encounters Related To THA & TKA Procedures”:
( [Encounter: “Inpatient encounter CCDE”]
union [Encounter: “Encounter Hospital Outpatient”] ) Encounters
with “Primary THA-TKA Procedures” QualifyingProcedures
such that QualifyingProcedures.performed starts during Encounters.period
and Encounters.status = ‘finished’
and Encounters.period ends 90 days or more before end of “Measurement Period”

/The patient had pre-existing conditions (malignant, mechanical or fracture) within 90 days prior to surgery date./

define “Qualifying THA-TKA Procedures With Excluded Conditions”:
“Qualifying Encounters Related To THA & TKA Procedures” QEncounter
with “Diagnosed With Excluded Conditions” ExcludedConditions
such that Global.“Normalize Onset”(ExcludedConditions.onset) starts 90 days or less on or before start of QEncounter.period

/The patient was transfered from another acute care of left against medical advice./
define “Transferred From Acute Care Hospital Or Left Against Medical Advice”:
“Qualifying Encounters Related To THA & TKA Procedures” QEncounter
where QEncounter.hospitalization.admitSource in “Transfer From Acute Care Hospital”
or QEncounter.hospitalization.dischargeDisposition in “Left Against Medical Advice”

/Retrieve all Diagnosis events for the patient who experienced the AMI complication during the measurement period./
define “AMI Diagnosis”:
[Condition : “Acute Myocardial Infarction”] AMIDiagnosis
where AMIDiagnosis.clinicalStatus in ‘active’

/Retrieve all Diagnosis events for the patient with Active Bleeding complication during the measurement period./
define “Active Bleeding Diagnosis”:
[Condition : “Surgical Site Bleeding and Other Surgical Site Complications”] SSBDiagnosis
where SSBDiagnosis.clinicalStatus in ‘active’

/Retrieve all Diagnosis events for the patient who experienced Mechanical complication during the measurement period./
define “Mechanical Diagnosis”:
[Condition : “Mechanical Complications Related To Hip and Knee Procedures”] MechanicalDiagnosis
where MechanicalDiagnosis.clinicalStatus in ‘active’

/Retrieve Pneumonia Diagnosis events for the patient./
define “Pneumonia Diagnosis”:
[Condition : “Pneumonia Complications Related To Hip and Knee Procedures”] PneumoniaDiagnosis
where PneumoniaDiagnosis.clinicalStatus in ‘active’

/Retrieve Pulmonary Diagnosis events for the patient/
define “Pulmonary Diagnosis”:
[Condition : “Pulmonary Embolism Complications Related To Hip and Knee Procedures”] PulmonaryDiagnosis
where PulmonaryDiagnosis.clinicalStatus in ‘active’

/Retrieve Wound Infection Diagnosis events for the patient/
define “Wound Infection Diagnosis”:
[Condition : “Periprosthetic Joint Infection/Wound Infection and Other Wound Complications”] WIDiagnosis
where WIDiagnosis.clinicalStatus in ‘active’

/Retrieve Sepsis Diagnosis events for the patient/
define “Sepsis Diagnosis”:
[Condition : “Sepsis Complications Related To Hip and Knee Procedures”] SepsisDiagnosis
where SepsisDiagnosis.clinicalStatus in ‘active’

define function “CalendarAgeInYearAt”(BirthDateTime DateTime, AsOf DateTime):
years between ToDate(BirthDateTime)and ToDate(AsOf)