Skip to content

Add CQL execution library for SDC and clinical reasoning #26

Description

@cursor

Summary

HAIstack SDC currently models cqf-library metadata and defines a CQLProvider / CQLExpressions adapter in pkg/sdc, but there is no CQL runtime. Questionnaires that depend on CQL expressions cannot be evaluated today.

Problem

  • SDC supports CQL in expressions (language: application/x-cql) per the SDC IG
  • pkg/sdc only evaluates FHIRPath by default (FHIRPathExpressions, NewSDCFHIRPathEngine)
  • CQLExpressions fails with an unavailable-expression diagnostic when no provider is installed
  • cqf-library extensions are round-tripped as metadata only

Proposed scope

Create a dedicated library (suggested: pkg/cql or separate module) that:

  1. Loads CQL libraries (from canonical references / contained resources / terminology store)
  2. Evaluates CQL expressions against a context (subject, launch context, questionnaire variables)
  3. Integrates with SDC via the existing CQLProvider interface
  4. Documents boundaries vs FHIRPath (when to use each)

Integration points

  • pkg/sdc: CQLProvider, CQLExpressions, population/validation/render expression providers
  • pkg/runtime / pkg/http: wire default provider when libraries are available
  • modules/sdc: example questionnaires using CQL

Out of scope (initial)

  • Full CQF Measure evaluation
  • Clinical quality reporting pipelines

Acceptance criteria

  • CQL library can evaluate a simple expression against a Patient context
  • SDC $populate / $validate / Render can use CQL when CQLProvider is wired
  • Clear error when library or context is missing
  • Tests and README for adapter wiring

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions