Using CQL with FHIR
1.1.0-cibuild - CIBuild International flag

Using CQL with FHIR, published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 1.1.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cql-ig/ and changes regularly. See the Directory of published versions

: CQL Example - JSON Representation

Active as of 2024-06-10

Raw json | Download


{
  "resourceType" : "Library",
  "id" : "CQLExample",
  "meta" : {
    "profile" : [
      🔗 "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library"
    ]
  },
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h2>Related Artifacts</h2><table class=\"grid\"><tr><td>depends-on</td><td>FHIR model information</td><td><code>http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1</code></td></tr><tr><td>depends-on</td><td>Library FHIRHelpers</td><td><code>http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</code></td></tr><tr><td>depends-on</td><td>Code system LOINC</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-v3-loinc.html\">Logical Observation Identifiers, Names and Codes (LOINC)</a></td></tr></table><h2>Parameters</h2><table class=\"grid\"><tr><td>GlucoseThreshold</td><td>in</td><td>0</td><td>1</td><td>Quantity</td></tr><tr><td>Patient</td><td>out</td><td>0</td><td>1</td><td>Patient</td></tr><tr><td>Blood Glucose Observations</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr></table><h2>Data Requirements</h2><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a> (<a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/observation.html\">Observation</a> (<a href=\"http://hl7.org/fhir/R4/observation.html\">Observation</a>)</td></tr><tr style=\"background-color: #efefef\"><td>Filter</td><td>Value</td></tr><tr><td>code</td><td>One of these codes: <a href=\"https://loinc.org/2339-0\">Logical Observation Identifiers, Names and Codes (LOINC)</a> 2339-0: Glucose Bld-mCnc</td></tr></table><h2>Contents</h2><p><code>text/cql</code></p><pre><code class=\"language-sql\">library CQLExample\r\n\r\nusing FHIR version '4.0.1'\r\n\r\ninclude FHIRHelpers version '4.0.1'\r\n\r\ncodesystem LOINC: 'http://loinc.org'\r\ncode &quot;Blood Glucose&quot;: '2339-0' from LOINC display 'Glucose Bld-mCnc'\r\n\r\nparameter GlucoseThreshold Quantity\r\n\r\ncontext Patient\r\n\r\ndefine &quot;Blood Glucose Observations&quot;:\r\n  [Observation: &quot;Blood Glucose&quot;] BG\r\n    where BG.value &gt; GlucoseThreshold\r\n</code></pre></div>"
  },
  "contained" : [
    {
      "resourceType" : "Parameters",
      "id" : "options",
      "parameter" : [
        {
          "name" : "translatorVersion",
          "valueString" : "3.9.0"
        },
        {
          "name" : "enableAnnotations",
          "valueBoolean" : true
        },
        {
          "name" : "enableLocators",
          "valueBoolean" : true
        },
        {
          "name" : "disableListDemotion",
          "valueBoolean" : true
        },
        {
          "name" : "disableListPromotion",
          "valueBoolean" : true
        },
        {
          "name" : "format",
          "valueString" : "JSON"
        },
        {
          "name" : "format",
          "valueString" : "XML"
        },
        {
          "name" : "analyzeDataRequirements",
          "valueBoolean" : false
        },
        {
          "name" : "collapseDataRequirements",
          "valueBoolean" : true
        },
        {
          "name" : "compatibilityLevel",
          "valueString" : "1.5"
        },
        {
          "name" : "enableCqlOnly",
          "valueBoolean" : false
        },
        {
          "name" : "errorLevel",
          "valueString" : "Info"
        },
        {
          "name" : "signatureLevel",
          "valueString" : "Overloads"
        },
        {
          "name" : "validateUnits",
          "valueBoolean" : true
        },
        {
          "name" : "verifyOnly",
          "valueBoolean" : false
        }
      ]
    }
  ],
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions",
      "valueReference" : {
        "reference" : "#options"
      }
    }
  ],
  "url" : "http://hl7.org/fhir/uv/cql/Library/CQLExample",
  "identifier" : [
    {
      "system" : "urn:ietf:rfc:3986",
      "value" : "urn:oid:2.16.840.1.113883.4.642.40.37.28.2"
    }
  ],
  "version" : "1.1.0-cibuild",
  "name" : "CQLExample",
  "title" : "CQL Example",
  "status" : "active",
  "experimental" : true,
  "type" : {
    "coding" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "logic-library"
      }
    ]
  },
  "date" : "2024-06-10T16:43:49+00:00",
  "publisher" : "HL7 International / Clinical Decision Support",
  "contact" : [
    {
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://www.hl7.org/Special/committees/dss"
        }
      ]
    }
  ],
  "description" : "Example CQL Library illustrating the CQL Profile (a Library with only text/cql content)",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001",
          "display" : "World"
        }
      ]
    }
  ],
  "relatedArtifact" : [
    {
      "type" : "depends-on",
      "display" : "FHIR model information",
      "resource" : "http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Library FHIRHelpers",
      "resource" : "http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Code system LOINC",
      "resource" : "http://loinc.org"
    }
  ],
  "parameter" : [
    {
      "name" : "GlucoseThreshold",
      "use" : "in",
      "min" : 0,
      "max" : "1",
      "type" : "Quantity"
    },
    {
      "name" : "Patient",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Patient"
    },
    {
      "name" : "Blood Glucose Observations",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Observation"
    }
  ],
  "dataRequirement" : [
    {
      "type" : "Patient",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Patient"
      ]
    },
    {
      "type" : "Observation",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Observation"
      ],
      "mustSupport" : [
        "code",
        "value"
      ],
      "codeFilter" : [
        {
          "path" : "code",
          "code" : [
            {
              "system" : "http://loinc.org",
              "code" : "2339-0",
              "display" : "Glucose Bld-mCnc"
            }
          ]
        }
      ]
    }
  ],
  "content" : [
    {
      "contentType" : "text/cql",
      "data" : "bGlicmFyeSBDUUxFeGFtcGxlDQoNCnVzaW5nIEZISVIgdmVyc2lvbiAnNC4wLjEnDQoNCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjEnDQoNCmNvZGVzeXN0ZW0gTE9JTkM6ICdodHRwOi8vbG9pbmMub3JnJw0KY29kZSAiQmxvb2QgR2x1Y29zZSI6ICcyMzM5LTAnIGZyb20gTE9JTkMgZGlzcGxheSAnR2x1Y29zZSBCbGQtbUNuYycNCg0KcGFyYW1ldGVyIEdsdWNvc2VUaHJlc2hvbGQgUXVhbnRpdHkNCg0KY29udGV4dCBQYXRpZW50DQoNCmRlZmluZSAiQmxvb2QgR2x1Y29zZSBPYnNlcnZhdGlvbnMiOg0KICBbT2JzZXJ2YXRpb246ICJCbG9vZCBHbHVjb3NlIl0gQkcNCiAgICB3aGVyZSBCRy52YWx1ZSA+IEdsdWNvc2VUaHJlc2hvbGQNCg=="
    }
  ]
}