Stream: cql
Topic: Invalid invocation target: org.hl7.elm.r1.ExpressionRef
Andy Stevens (Feb 03 2022 at 16:49):
So I'm trying to use the $cql operation on CQF ruler to validate some CQL before persisting it, but when I POST, it returns 3 errors saying
Invalid invocation target: org.hl7.elm.r1.ExpressionRef
. Looking at the locations in the CQL, it looks like it's referring to defines where i've used fluent functions. This is my library I'm testing my validation stuff with:
library demographics version '1.0'
using FHIR version '4.0.0'
context Patient
define "first_name": Patient.name[0].given[0]
define "last_name": Patient.name[0].family
define "date_of_birth": Patient.birthDate
define "age": AgeInYears()
define "gender": Patient.gender
define "race": Patient.valueOmbCategoryRace()
define "ethnicity": Patient.valueOmbCategoryEthnicity()
define "birthsex": Patient.valueUSCoreBirthSex()
define "zip": Patient.address.postalCode[0]
define "state": Patient.address.state[0]
// Helper Functions from FHIRCommon
define function Extensions(domainResource DomainResource, url String):
domainResource.extension E
where E.url = url
return E
define function Extensions(element Element, url String):
element.extension E
where E.url = url
return E
define function Extension(domainResource DomainResource, url String):
singleton from "Extensions"(domainResource, url)
define function Extension(element Element, url String):
singleton from Extensions(element, url)
define fluent function valueOmbCategoryRace(patient Patient):
Extension(Extension(patient, 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'), 'ombCategory').value
define fluent function valueOmbCategoryEthnicity(patient Patient):
Extension(Extension(patient, 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'), 'ombCategory').value
define fluent function valueUSCoreBirthSex(patient Patient):
Extension(patient, 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex').value
However, this library is already stored in CQF Ruler and runs perfectly fine when using the $evaluate operation. Is this error in relation to how the two operations operate? or is there something else wrong I'm not seeing?
Bryn Rhodes (Feb 04 2022 at 15:22):
@Andy Stevens , trying this in my local IDE, with the library addition above, I get errors in the comparison of the url
attribute in the Extensions
function definitions that I need to include FHIRHelpers. Once I include that it compiles. Is that include declaration missing here?
Last updated: Apr 12 2022 at 19:14 UTC