MOISSCode vs CQL
CQL (Clinical Quality Language) is the HL7 standard for expressing clinical knowledge. MOISSCode is a domain specific language focused on clinical decision support, pharmacokinetics, and biotech workflow automation. Both are clinical DSLs. They serve different use cases.
MOISSCode is professional biomedical software. All clinical outputs require independent professional validation.
Architecture Comparison
| Aspect | CQL | MOISSCode |
|---|---|---|
| Standardization | HL7 standard (normative) | Independent (BSL 1.1 license) |
| Primary use | Quality measures, clinical rules | Protocol automation, PK simulation |
| Data model | FHIR, QDM | Built in Patient type, FHIR export |
| Runtime | Requires CQL engine (e.g., cql-execution) | Self contained interpreter + Python library |
| Language style | Query/expression focused | Imperative, protocol focused |
| Built in modules | None (references external data) | 20 modules (PK, lab, scores, micro, etc.) |
| Drug databases | External | 100+ built in drug profiles |
| Lab interpretation | External | 80+ built in tests |
| Pharmacokinetics | Not included | Full PK engine with ADME |
| Python integration | Limited | Native (pip install) |
| CLI | Engine dependent | Built in (moiss run, moiss repl) |
CQL Strengths
CQL is the authoritative standard for clinical quality measures across EHR systems. If you are:
- Writing eCQMs (electronic Clinical Quality Measures) for CMS reporting
- Building CDS Hooks for production EHR integration
- Working within an HL7 FHIR ecosystem that already uses CQL
CQL is the appropriate choice. It has formal specification, vendor adoption, and regulatory acceptance.
MOISSCode Strengths
MOISSCode includes computational engines that CQL does not:
Full pharmacokinetic simulation:
protocol VancomycinDosing {
input: Patient p;
let dose = pk.calculate_dose("Vancomycin", weight_kg: p.weight);
let level = pk.plasma_concentration("Vancomycin", dose: 1000, time_min: 480, weight_kg: p.weight);
let adjustment = pk.renal_adjust("Vancomycin", gfr: 35);
if adjustment.factor < 0.75 {
alert "Significant renal dose reduction required" severity: warning;
}
}
Integrated lab + scoring + dosing pipeline:
from moisscode import StandardLibrary, Patient
lib = StandardLibrary()
p = Patient(bp=82, rr=28, gcs=12, lactate=5.1, creatinine=3.2, sex='M', age=71)
# All in one pipeline
qsofa = lib.scores.qsofa(p)
gfr = lib.lab.gfr(creatinine=3.2, age=71, sex='M')
dose = lib.pk.calculate_dose("Meropenem", weight_kg=80)
renal = lib.pk.renal_adjust("Meropenem", gfr=gfr["eGFR"])
fhir_bundle = lib.fhir.to_fhir(p)
CQL would require external services for each of these lookups. MOISSCode ships everything in one package.
When to Use Which
| Scenario | Recommended |
|---|---|
| CMS quality measure reporting | CQL |
| EHR CDS Hooks integration | CQL |
| Pharmacokinetic simulation | MOISSCode |
| Research protocol automation | MOISSCode |
| Lab panel interpretation at scale | MOISSCode |
| Drug interaction screening | MOISSCode |
| FHIR resource generation | Either |
| Production clinical rules in hospitals | CQL (regulatory path) |
| Biotech workflow automation | MOISSCode |
| Teaching clinical informatics | MOISSCode (easier syntax) |
Interoperability
MOISSCode can export FHIR R4 resources, which means its output can feed into CQL-based systems. The two are complementary: use MOISSCode for computation and simulation, then pass structured FHIR data to CQL-based quality engines.