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
The issue I'm encountering is that I'm getting a false value but should be getting true when checking if a code is in a ValueSet or not.
What I'm trying to do is check an Observation.code against the ValueSet via a function call. The function calls/uses fluent functions to do the check. I tried breaking down each step of the function calls to see if I can isolate the problem but was unable to.
I found that when I call the fluent function(s) directly, I get a "null" value and not sure why that is. Below is a snippet of the CQL but have also attached a zip file containing the CQL library and test case.
`library IssueObservationCode
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1' called FHIRHelpers
include IssueExpandValueSet_Concepts called Concepts
define "test fluent has": "ObservationsList"[0].code."Has"(Concepts."Garb" as System.ValueSet)
define function "Has garb"(obs List):
exists(obs."Obs garb during"())
define fluent function "Obs garb during"(observations List<FHIR.Observation>):
observations
."With any code"(Concepts."Garb" as System.ValueSet)
define fluent function "With any code"(observations List<FHIR.Observation>, codes List<System.Code>):
if observations is null or codes is null then null
else
(observations) observation
where observation.code."Has"(codes)
define fluent function "Has"(codeableConcept FHIR.CodeableConcept, codes List<System.Code>):
if codeableConcept is null or codes is null then null
else
exists(
(codeableConcept.coding) coding
where coding in codes
)`
Hi @SeenaFa, I can replicate this issue using the latest version of the extension, and it's related to #1407 (which we fixed in #1409).
The issue had to do with the imported valueset being expanded prematurely during execution. Only external valuesets were affected and not the ones defined in the library. So if I bring valueset "Garb": 'garb' into the IssueObservationCode library and re-run the CQL, I get
Patient=Patient(id=Patient1)
ObservationsList=[Observation(id=lead-observation-1)]
Observations Garb=[Observation(id=lead-observation-1)]
test function=true
test fluent=[Observation(id=lead-observation-1)]
test fluent has=true
as expected.
Once the extension is updated, external valuesets should work as intended.
The issue I'm encountering is that I'm getting a false value but should be getting true when checking if a code is in a ValueSet or not.
What I'm trying to do is check an Observation.code against the ValueSet via a function call. The function calls/uses fluent functions to do the check. I tried breaking down each step of the function calls to see if I can isolate the problem but was unable to.
I found that when I call the fluent function(s) directly, I get a "null" value and not sure why that is. Below is a snippet of the CQL but have also attached a zip file containing the CQL library and test case.
`library IssueObservationCode
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1' called FHIRHelpers
include IssueExpandValueSet_Concepts called Concepts
context Patient
define "ObservationsList": [Observation]
define "Observations Garb": [Observation: Concepts."Garb"]
define "test function": "Has garb"("ObservationsList")
define "test fluent": "ObservationsList"."Obs garb during"()
define "test fluent has": "ObservationsList"[0].code."Has"(Concepts."Garb" as System.ValueSet)
define function "Has garb"(obs List):
exists(obs."Obs garb during"())
define fluent function "Obs garb during"(observations List<FHIR.Observation>):
observations
."With any code"(Concepts."Garb" as System.ValueSet)
define fluent function "With any code"(observations List<FHIR.Observation>, codes List<System.Code>):
if observations is null or codes is null then null
else
(observations) observation
where observation.code."Has"(codes)
define fluent function "Has"(codeableConcept FHIR.CodeableConcept, codes List<System.Code>):
if codeableConcept is null or codes is null then null
else
exists(
(codeableConcept.coding) coding
where coding in codes
)`
IssueObservationCode.zip
The text was updated successfully, but these errors were encountered: