CQL WorkbenchDocs
Docs contents
Get started

Introducing CQL Workbench

CQL Workbench splits an NHI reimbursement clause into conditions that can be reviewed one by one, generates CQL from the reviewed logic, compiles it with cql-engine and verifies the result. This page covers the problem it solves, who uses it, and the steps a clause goes through from paste to export.

What it is

NHI reimbursement rules are written for people to read. Before a system can decide whether a patient meets one, the clause has to become program logic. The hard part isn’t writing the code; it’s confirming that the logic matches the clause: no condition left out, no “and” where the text says “or”, and no patient marked ineligible just because data is missing.

The workbench splits that work into steps, and each one leaves something you can check:

  • An LLM first copies verbatim quotes from the clause, then derives atomic conditions and AND / OR / NOT groups. Every condition points back to a passage in the source, and a quote that can’t be found there is flagged for review.
  • Physicians confirm each condition on the review page, comparing it with the source text rather than with code.
  • The CQL is generated from the reviewed logic, never written by hand. After cql-engine compiles it, the workbench changes each condition’s value in turn and checks that the CQL’s result matches the logic.

Who it’s for

Physicians and reviewersOn the review page they accept, reject or mark each condition not applicable, checking where it comes from in the source. If something was split wrong, they can edit the AND / OR / NOT logic directly, then sign off the whole clause. No CQL required.
Engineering and data teamsThe exported package contains the IR, CQL, ELM and an evidence contract. The CQL doesn’t query patient records: your data pipeline supplies each condition’s value, and the contract defines what true, false and null mean.

Accounts have one of three roles: reviewer can analyze, review, sign off and edit logic; viewer can only look; admin also manages LLM settings, users and settings backups. See Users and roles in the admin docs.

How a clause moves through

The workbench breaks the processing of a document into five steps, the same five shown in its progress bar. Its interface is in Chinese, so each step’s on-screen name is given in brackets.

  1. 1

    Extract text (擷取文字)

    Paste the clause when you create a document, or upload the original PDF or docx; the workbench pulls out the text first.

  2. 2

    Split into tasks (拆解任務)

    An LLM splits the document into separate reimbursement clauses, which the workbench calls tasks. You can edit a task’s title and text, or delete it; editing the text clears that task’s analysis.

  3. 3

    Analyze logic (分析邏輯)

    An LLM turns each task into an IR in stages: verbatim quotes first, then atomic conditions, then groups, with code checks between stages. Each condition is then cross-checked on its own.

    The analysis pipeline →Quote verification →Per-condition cross-check →Clauses and the IR →

  4. 4

    Review and verify (審核與驗證)

    Physicians review each condition, edit the logic if needed, and sign off the clause. Every save regenerates the CQL from the IR, compiles it with cql-engine and re-runs the ablation check; review decisions on changed conditions are invalidated.

    Per-condition review →Editing logic →Sign-off and invalidation →Parameter-based CQL →

  5. 5

    Export the package (匯出套件)

    Export one clause or the whole document as a JSON package with the IR, CQL, ELM, evidence contract and a validation summary.

    Evidence contracts →

The LLM these steps use is set up by an admin under LLM settings: you can add several, tried in priority order as fallbacks or spread by weight.

What it isn’t

Not an official tool

CQL Workbench is not a tool of the Ministry of Health and Welfare or the NHI Administration, and it doesn’t connect to their CQL platform or implementation guides. See Where CQL Workbench fits for how the two relate.

Doesn’t read patient records

The generated CQL doesn’t query FHIR data, and the workbench has no built-in adapter that reads patient records. Each condition’s value has to come from your data pipeline or a person, as the evidence contract specifies.

Doesn’t replace human review

The conditions the LLM produces are a draft for reviewers to confirm. Code can check that quotes come from the source and that the CQL matches the logic; whether the conditions are split and combined correctly is still for physicians to judge one by one.

Where to start

If you’re new, read them in this order: