You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing rule that use external valuesets. In my expression, I need to union valuesets together, ideally into a list of codes. However, I discoved that the union operator on valuesets throws a Null error. I am using cql-execution version 3.1.0 with the vsac.CodeService() to resolve valuesets from NLM. All valuesets in the CQL do resolve successfully and are not null.
This is the CQL rule that I am using:
library "Union issue" version '1.0.0'
using FHIR version '4.0.1'
codesystem "Snomed": 'http://snomed.info/sct'
codesystem "CVX": 'http://hl7.org/fhir/sid/cvx'
code "Single Pregnancy": '237244005' from "Snomed" display 'Single Pregnancy'
code "Pregnant woman": '255409004' from "Snomed" display 'Pregnant woman'
valueset "Pregnant State VS": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.4055'
valueset "Pregnancy VS": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1078.264'
// Does not work
define "Union on valuesets":
"Pregnant State VS" union "Pregnancy VS" // Here is the issue
// Does work
define "Union on codes":
"Single Pregnancy" union "Pregnant woman"
// Does work
define "Union on numbers":
1 union 3
// Does work
define "Union on strings":
'hello' union 'world'
This is the error message:
Error Message: Cannot read properties of null (reading 'execute')
CQL Library: Union issue|1.0.0
Expression: Union
at Union.execute (projectPath\node_modules\cql-execution\src\elm\expression.ts:49:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ExpressionDef.exec (projectPath\node_modules\cql-execution\src\elm\reusable.ts:18:45)
at ExpressionDef.execute (projectPath\node_modules\cql-execution\src\elm\expression.ts:41:27)
at Executor.exec_patient_context (projectPath\node_modules\cql-execution\src\runtime\executor.ts:99:28)
at Executor.exec (projectPath\node_modules\cql-execution\src\runtime\executor.ts:60:15)
at executeCql (projectPath\src\cdss-module.js:253:20)
at Object.<anonymous> (projectPath\src\test\debug.test.js:34:22)
Does the union operator have an implementation to deal with valuesets? I seem to recall that it did work in the near past.
The text was updated successfully, but these errors were encountered:
If you look at the ELM that CQL-to-ELM produces for the example above, you'll notice that performing a union on two value sets results in calls to ExpandValueSet for each value set. Unfortunately, cql-execution does not currently support the ExpandValueSet operator (which is marked as trial-use in CQL 1.5). I apologize that the error it produces doesn't convey what's really happening.
In practice, I've avoided this issue by doing unions of retrieve statements instead. In other words, instead of:
define "Union of Pregnancy VS":
"Pregnant State VS" union "Pregnancy VS"
define PregnancyOperations: [Observation: "Union of Pregnancy VS"]
you can do:
define PregnancyOperations: [Observation: "Pregnant State VS"] union [Observation: "Pregnancy VS"]
We'd also be glad to accept a PR for this if you'd like to consider taking a crack at implementing it yourself.
Good afternoon.
I am developing rule that use external valuesets. In my expression, I need to
union
valuesets together, ideally into a list of codes. However, I discoved that the union operator on valuesets throws a Null error. I am using cql-execution version 3.1.0 with thevsac.CodeService()
to resolve valuesets from NLM. All valuesets in the CQL do resolve successfully and are notnull
.This is the CQL rule that I am using:
This is the error message:
Does the union operator have an implementation to deal with valuesets? I seem to recall that it did work in the near past.
The text was updated successfully, but these errors were encountered: