Stream: cql
Topic: Passing valueset as parameter to function
Frank Adrian (Aug 09 2020 at 18:10):
Is there any way to pass a value set as a parameter to a function?
The spec gives tantalizing hints such as the use of type names ValueSet and ValueSetRef as type names in the function documentation in section 12.8, but my language implementation doesn't seem to like these types. If it's not possible to do this, what's the rationale for not being able to pass a value set as a parameter?
Bryn Rhodes (Aug 11 2020 at 07:51):
The rationale for static declaration of terminology is to permit static analysis of data requirements, including terminology. Having said that, in the latest ballot (CQL 1.5), we did introduce terminology references as first class data types, so you can now pass valuesets and codesystems by reference. See the new Vocabulary type for more information.
Frank Adrian (Aug 11 2020 at 14:11):
So one would use a parameter of type Vocabulary, using the value set name and version and pass it into the function? And then one would reference the Vocabulary where a value set was allowed? And the same for code systems? That's great, if that's what's envisioned.
Bryn Rhodes (Aug 11 2020 at 15:39):
Yes, Vocabulary if you want to allow a CodeSystem or ValueSet, and then yes, that reference can be used anywhere a terminology reference is required.
Bryn Rhodes (Aug 11 2020 at 15:40):
The current 1.5.0-SNAPSHOT of the translator has that implemented if you want to try it out.
Last updated: Apr 12 2022 at 19:14 UTC