cqframework / cqframework/cql-execution

Support ValueSet as a first-class type

Open
#226 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
84
Forks
38
Avg merge
1d 20h
Merged PRs (30d)
1

Description

(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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CQL ValueSet example in the issue and read the linked CQL reference plus the initial Zulip conversation to clarify the intended typing semantics. Trace how function parameters and ValueSetRef arguments are represented and executed; done means the example supports a first-class ValueSet parameter without requiring value set expansion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.