Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ValueSet as a first-class type #226

Open
cmoesel opened this issue Feb 18, 2021 · 4 comments
Open

Support ValueSet as a first-class type #226

cmoesel opened this issue Feb 18, 2021 · 4 comments

Comments

@cmoesel
Copy link
Member

cmoesel commented Feb 18, 2021

(Updated description in Oct 2022 during backlog cleanup)

The CQL ValueSet type represents a reference to a value set, allowing that value set to be passed into CQL functions without the need to do a value set expansion (as in CQL 1.4).

To demonstrate how this might work, consider the following example:

library MyLibrary version '0.0.1'
valueset MyVS: 'http://example.org/vs/myvs'
codesystem MyCS: 'http://example.org/cs/mycs'
code Foo: 'Foo' from "MyCS" display 'Foo'

define function FooInVS(vs ValueSet):
  Foo in vs

define IsFooInMyVS:
  FooInVS(MyVS)

This results in the following JSON:

[
  {
    "name": "FooInVS",
    "context": "Patient",
    "accessLevel": "Public",
    "type": "FunctionDef",
    "expression": {
      "type": "InValueSet",
      "code": {
        "name": "Foo",
        "type": "CodeRef"
      },
      "valueset": {
        "name": "vs",
        "type": "OperandRef"
      }
    },
    "operand": [
      {
        "name": "vs",
        "operandTypeSpecifier": {
          "name": "{urn:hl7-org:elm-types:r1}ValueSet",
          "type": "NamedTypeSpecifier"
        }
      }
    ]
  },
  {
    "name": "IsFooInMyVS",
    "context": "Patient",
    "accessLevel": "Public",
    "expression": {
      "name": "FooInVS",
      "type": "FunctionRef",
      "operand": [
        {
          "name": "MyVS",
          "type": "ValueSetRef"
        }
      ]
    }
  }
]

Note that the function indicates that it takes a ValueSet, but when you invoke the function, it's actually a ValueSetRef that is passed in.

Initial Zulip conversation: https://chat.fhir.org/#narrow/stream/179220-cql/topic/ValueSet.20Typing

@JSRankins
Copy link

Hi @cmoesel. We were discussing ValueSetRef and CodeSystemRef as first-class types at the Connecathon today. An update is being made to fix some issues with ValueSetRef and CodeSystemRef as first-class types in CQL with version 1.5.2. 1.5.2 correlates to CQL-to-ELM Translator 1.5.6. Bryn had mentioned this functionality wasn't available in cql-execution yet. He said a ticket needed to be created, so I volunteered. See Issue 259. I didn't see this ticket until afterward. Not sure if you want to merge tickets or, since this ticket seems to be specific to ValueSet references, leave Issue 259 open for the CodeSystem reference piece. Thoughts?

@cmoesel
Copy link
Member Author

cmoesel commented Jan 12, 2022

I think it's likely we might implement these separately (one at a time), so it probably makes sense to have one issue for VS references and one for CS references. @JSRankins - can you update #259 to be specific to CodeSystems? And also include a reference to this ticket so that at least they are linked in some way?

@cmoesel cmoesel changed the title Support ValueSet references as arguments to functions Support ValueSetRef as a first-class type Jan 12, 2022
@JSRankins
Copy link

@cmoesel Done.

@IrickNcqa
Copy link

Adding a note of support to this request from NCQA. A use case from our measures prompted this language update, and as such we are looking for engine support for the feature.

@cmoesel cmoesel changed the title Support ValueSetRef as a first-class type Support ValueSet as a first-class type Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants