QA Keyword Starts vs Start - cqframework/CQL-Formatting-and-Usage-Wiki GitHub Wiki
Q&A - Keyword Starts vs Start
Question
In the Production version of Bonnie, this patient is a Denominator Exclusion, while in Bonnie Alpha, this patient is in the Denominator. To get this patient into the Denominator Exclusion, the first listed Diagnosis in the patient history needs to have an abatement date, which is not required in Bonnie Production. Should these versions of Bonnie provide consistent results?
Answer
What's happening is that the "such that" clause says "start" instead of "starts":
define "Ex1":
["Diagnosis": "Alcohol and Drug Dependence"] FAD
with ("FirstAlcoholDrugDependenceDx") FADD
such that FAD.prevalencePeriod start 60 days or less before start of FADD.prevalencePeriod
Because it's not one of the expected keywords, the parser is interpreting that as a query alias, which is basically a no-op, so it's really saying:
define "Ex1":
["Diagnosis": "Alcohol and Drug Dependence"] FAD
with ("FirstAlcoholDrugDependenceDx") FADD
such that FAD.prevalencePeriod 60 days or less before start of FADD.prevalencePeriod
And when you use an interval in a "before" like that, it chooses the end of the interval to do the comparison. So, the immediate fix is to just correct the keyword to "starts" instead of "start".