Using CQL with FHIR
1.0.0-snapshot - Snapshot International flag

This page is part of the Using CQL with FHIR Implementation Guide (v1.0.0-snapshot: STU1 Draft) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions

: CQL Example - JSON Representation

Active as of 2024-04-06

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.3.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.0.0-snapshot",
  "name" : "CQLExample",
  "title" : "CQL Example",
  "status" : "active",
  "experimental" : true,
  "type" : {
    "coding" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "logic-library"
      }
    ]
  },
  "date" : "2024-04-06T09:37:49+11: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=="
    }
  ]
}