-
Notifications
You must be signed in to change notification settings - Fork 24
QA Validation Error Due to Aliases in Sort By
Darren Duncan edited this page Oct 12, 2017
·
1 revision
The following definition is returning a validation error which was not showing up prior to the most recent MAT staging update.
define "Most Recent Adult Depression Screening":
Last (
["Assessment, Performed": "Adult Depression Screening"] Adultscreen
with "Depression Screening Encounter" Enc
such that Adultscreen.authorDatetime during Enc.relevantPeriod and Adultscreen.result is not null
sort by Adultscreen.authorDatetime
)
If I remove "sort by Adultscreen.authorDatetime" the definition saves without error:
define "Depression Screening Encounter":
["Encounter, Performed": "Depression Screening Encounter Codes"] Enc
where Enc.relevantPeriod during "Measurement Period"
Your sort clause is incorrect because it is evaluated on the result of the query. Aliases are used in the calculation of the results. Consider a query with a return clause, or a multi-source query, the aliases no longer have meaning once the results are produced.
Authoring Patterns - QICore v4.1.1
Authoring Patterns - QICore v5.0.0
Authoring Patterns - QICore v6.0.0
Cooking with CQL Q&A All Categories
Additional Q&A Examples
Developers Introduction to CQL
Specifying Population Criteria