cqframework/ecqm-content-qicore-2022

FHIRCommon.ToInterval translator error

drthyl opened this issue · 4 comments

There is a translator error with the invocation of FHIRCommon."ToInterval" in a CQL file using QICore version 4.1.1. Please see error screenshots from the VS Code CQL Plugin environment below and a zip folder (with example CQL file and test case).

define function ToInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
case
when choice is FHIR.dateTime then
Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
when choice is FHIR.Period then
FHIRHelpers.ToInterval(choice as FHIR.Period)
when choice is FHIR.instant then
Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
when choice is FHIR.Age then
Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
when choice is FHIR.Range then
Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
when choice is FHIR.Timing then
Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
when choice is FHIR.string then
Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute an interval from a String value')
else
null as Interval<DateTime>
end

Example.zip
image
image

We also had this issue with STK2 (Please see zip file for screenshots, CQL and a test case are attached).

STK-2_ForProblem#5_1.zip

Thanks @JuliaDawson ! Would you mind re-opening this issue? I don't think this issue will be resolved until the translator fix, per #7. The QICoreCommon library is a workaround for the time being. Thank you!

Sorry about this, thought I was closing my above comment.

This issue is resolved with the latest plugin