FHIR Chat · testing parameters with atom cql plugin · cql

Stream: cql

Topic: testing parameters with atom cql plugin


view this post on Zulip Aziz Boxwala (Apr 15 2021 at 04:07):

How does one pass parameter values when testing a library in the cql plugin in Atom?

view this post on Zulip JP (Apr 15 2021 at 05:47):

Hi @Aziz Boxwala ,

Passing parameters is currently not supported in the Atom plugin but it's on the backlog. Currently the easiest workaround is to set a default parameter in the CQL directly, like so:

parameter "Measurement Period" Interval<DateTime>
  default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)

view this post on Zulip Aziz Boxwala (Apr 15 2021 at 13:37):

Thank you @JP

view this post on Zulip Vasyl Herman (Apr 16 2021 at 10:51):

Hi, I was also looking for how to pass parameter values to the cql-execution.
The only solution I found is to set a default parameter in the CQL directly before translation.

view this post on Zulip Chris Moesel (Apr 16 2021 at 12:22):

It's possible to pass parameters to cql-execution. I don't know how well it works if the parameter is a complex type from the FHIR data model, but if it's one of the CQL system types, it definitely ought to work. See: https://github.com/cqframework/cql-execution/blob/master/OVERVIEW.md#executing-cql-libraries

view this post on Zulip Chris Moesel (Apr 16 2021 at 12:22):

@Vasil Herman

view this post on Zulip Vasyl Herman (Apr 17 2021 at 12:51):

@Chris Moesel Thanks! you are amazing! I'll test it later. It's exactly what I was looking for! How could I miss it :nerd:

view this post on Zulip Chris Moesel (Apr 17 2021 at 16:48):

You're welcome. We need to improve our documentation. It's easy to look at the README and assume that's it and miss the OVERVIEW. Unfortunately, you're probably not the first person to miss it. But I'm glad it looks like it does what you need!

view this post on Zulip Aziz Boxwala (Apr 19 2021 at 22:49):

Is there a way to define a FHIR resource as a literal in CQL (for testing)? The library is used in an ECA rule. The parameter is the med request that triggers the rule. I want to use the default value for testing purposes.

view this post on Zulip Bryn Rhodes (Apr 19 2021 at 23:27):

Yes, you use an Instance selector. Here's an example from OpioidCDSR4: https://github.com/cqframework/opioid-cds-r4/blob/develop/input/pagecontent/cql/OpioidCDSREC11PatientView.cql#L69

view this post on Zulip Bryn Rhodes (Apr 19 2021 at 23:28):

And here's an example of building a Composition:

define "eICR Composition":
  Composition {
    id: id { value: 'XXX' },
    identifier:
      Identifier {
        system: uri { value: 'urn:ieft:rfc:3986' },
        value: string { value: 'xxx' }
      },
    status: CompositionStatus { value: 'final' },
    type: DocumentType,
    category: { DocumentCategory },
    subject: ReferenceTo(Patient),
    encounter: ReferenceTo(Encounter),
    date: dateTime { value: Now() },
    author: { ReferenceTo(Author) },
    title: String(DocumentType.text),
    section: {
      "History of Present Illness Section",
      "Reason for Visit Section"
    }
  }

view this post on Zulip Bryn Rhodes (Apr 19 2021 at 23:29):

You have to construct the values as FHIR types, FHIRHelpers doesn't go the other direction, so instead of just providing a string, you have to construct a FHIR string: string { value: 'the string' }

view this post on Zulip Bryn Rhodes (Apr 19 2021 at 23:29):

You could pretty easily imagine some FHIRHelpers along those lines, but I haven't built those out.

view this post on Zulip Aziz Boxwala (Apr 20 2021 at 04:18):

Thanks Bryn. This will do the trick.


Last updated: Apr 12 2022 at 19:14 UTC