Closed JSRankins closed 8 years ago
I believe that this is by design, in order to ensure type safety. If you look at the signature for union in the appendix of the specification, you'll see:
union(left List<T>, right List<T>) List<T>
The arguments as well as the return are all lists of T
-- meaning that the contained objects must have the same type.
It's probably worth looking at the measure to see if creating a union of these different types really is the best approach. It may be that CQL provides a better path to achieve what the measure needs. That's the first thing I'd do.
If that isn't possible, or if creating a union like this is really best, then you may be able to union these together by casting the list elements to QDM.QDMBaseType
first. I can't remember if you can cast a whole list at once, or if you'd have to use a query to transform the list into a list of casted objects. Either way, you'd end up unioning two lists of QDM.QDMBaseType
, resulting in a list of QDM.QDMBaseType
.
Thanks Chris. I'll try both approaches. Ultimately, I think the Measure Stewards are going to need to know this for their measures. It might be a good thing to send to @brynrhodes for one of the Cooking With CQL trainings. Bryn, what do you think?
Yep, this would be a great example for inclusion in a measure training, I'll add it to my list. As far as casting, there isn't a list-based cast, you'd have to do a query and return the resulting type. Another option is to shape each operand so that they both contain the same columns, then you wouldn't need to cast. Am I okay to close this issue?
Yes.
Bryn Rhodes notifications@github.com 8/15/2016 1:44 PM >>>
Yep, this would be a great example for inclusion in a measure training, I'll add it to my list. As far as casting, there isn't a list-based cast, you'd have to do a query and return the resulting type. Another option is to shape each operand so that they both contain the same columns, then you wouldn't need to cast. Am I okay to close this issue?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/cqframework/clinical_quality_language","title":"cqframework/clinical_quality_language","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/cqframework/clinical_quality_language"}},"updates":{"snippets":[{"icon":"PERSON","message":"@brynrhodes in #60: Yep, this would be a great example for inclusion in a measure training, I'll add it to my list. As far as casting, there isn't a list-based cast, you'd have to do a query and return the resulting type. Another option is to shape each operand so that they both contain the same columns, then you wouldn't need to cast. Am I okay to close this issue?"}],"action":{"name":"View Issue","url":"https://github.com/cqframework/clinical_quality_language/issues/60#issuecomment-239890653"}}}
Sorry for just responding. You can close this issue.
Several eCQMs published in 2015 and 2016 have used "union" to group events that are of different types (CMS 100 v5, CMS 102 v5, CMS 107 v5, etc.). However, something like the following is causing an error to be thrown in the CQL-to-ELM validation:
define "Interventions": ["Intervention, Order"] union ["Intervention, Performed"]
The following error is being thrown: Could not resolve call to operator Union with signature (list<QDM.InterventionOrder>,list<QDM.InterventionPerformed>).
Is this by design, or is this an issue in the current code?