Getting Started
What is FHIR IQ CQL Builder?
FHIR IQ CQL Builder is a comprehensive tool for creating, validating, and testing Clinical Quality Language (CQL) measures. It provides both a code editor with full syntax highlighting and a visual query builder for no-code measure creation.
Quick Start
- Define Requirements: Start by describing your measure's purpose, target population, and clinical criteria.
- Generate CQL: Use AI-assisted generation or the visual builder to create your CQL code.
- Validate & Compile: Check your CQL for syntax errors and compile to ELM for execution.
- Test: Use the test harness to validate against sample patient data.
- Export: Download your measure as a FHIR Bundle for deployment.
Keyboard Shortcuts
Code Editor
Monaco Editor Features
The code editor is powered by Monaco (the same editor used in VS Code) with custom CQL syntax highlighting using the Monarch tokenizer.
Syntax Highlighting
- Keywords: library, define, context, using, include
- Types: Boolean, Integer, Decimal, DateTime, Interval
- FHIR Resources: Patient, Condition, Encounter, Observation
- Built-in Functions: AgeInYears, Count, Exists, Now, Today
- Date Literals: @2024-01-01, @T12:00:00
Editor Themes
Toggle between Clinical Dark and Clinical Light themes using the theme button.
Live Compilation Status
The status bar shows real-time compilation status, error count, warning count, and compilation time.
Visual Query Builder
No-Code CQL Creation
The Visual Query Builder lets you create CQL measures without writing code. Build queries by selecting FHIR resources and defining conditions.
Supported FHIR Resources
Building Queries
- Select the FHIR resources you need (click badges to toggle)
- Add rules using the "+ Rule" button
- Choose field, operator, and value for each rule
- Group rules with AND/OR combinators
- Preview the generated CQL in real-time
- Click "Apply to Code Editor" to use the generated CQL
Operators
=,!=- Equality comparison<,>,<=,>=- Numeric/date comparisonin- Value set membershipduring- During measurement periodis null,is not null- Null checks~- CQL equivalence for CodeableConcept
Validation & Compilation
CQL Validation
Click "Validate CQL" to check your code for syntax errors. The validator performs:
- Syntax validation (parentheses, brackets matching)
- Keyword and structure validation
- FHIR path expression validation
- Value set reference checking
ELM Compilation
Click "Compile to ELM" to translate your CQL to Expression Logical Model (ELM), the executable format used by CQL engines.
Translation Service
Compilation uses the CQL Translation Service. Multiple public endpoints are tried automatically with fallback. For production use, consider self-hosting:
- Railway.app: ~$5/month
- Render: Free tier available
- Docker:
docker run -p 8080:8080 cqframework/cql-translation-service
Auto-Fix
If validation finds errors, click "Auto-Fix Errors with AI" to automatically correct common issues like unbalanced parentheses, incorrect syntax, and type mismatches.
Test Harness
Test Panel
The Test Panel (bottom-right button) lets you run your CQL against sample patient data to verify measure logic.
Test Cases
- Create: Build test cases with the Patient Builder
- Import: Load FHIR Bundles from JSON files
- Export: Save test cases for sharing
- Duplicate: Clone existing test cases
Patient Builder
Create test patients with:
- Demographics (name, birth date, gender)
- Conditions with SNOMED codes
- Medications with RxNorm codes
- Encounters with dates and types
Expected Results
Define expected values for expressions to automatically validate test results. Failed assertions are highlighted in red.
Synthea Test Data
Generate realistic synthetic patient data with Synthea. Configure population size, state, and disease modules in the Synthea panel.
Export & FHIR Packaging
Download Options
CQL File (.cql)
Download the raw CQL source code for use in other tools.
ELM JSON (.json)
Download the compiled ELM for execution by CQL engines.
FHIR Bundle
Download a complete FHIR Bundle containing:
- Library Resource: CQL and ELM content (base64 encoded)
- Measure Resource: Population definitions and scoring
- Related Artifacts: Value set references
FHIR Library Structure
{
"resourceType": "Library",
"type": { "coding": [{ "code": "logic-library" }] },
"content": [
{ "contentType": "text/cql", "data": "<base64>" },
{ "contentType": "application/elm+json", "data": "<base64>" }
]
}VSAC Integration
Value Set Authority Center
Search and import value sets from the NLM Value Set Authority Center (VSAC).
Searching Value Sets
- Enter search terms in the VSAC Search panel
- Browse results with OIDs and descriptions
- Click to add value sets to your measure
API Key
For production use, obtain a UMLS API key from NLM UTS.
Common Value Sets
2.16.840.1.113883.3.464.1003.103.12.10012.16.840.1.113883.3.464.1003.104.12.10112.16.840.1.113883.3.464.1003.101.12.1001