# CQL Module - Using CQL With FHIR v3.0.0-ballot

## Resource Profile: CQL Module 

 
The CQL Module profile describes the elements used to provide a structured representation of the declarations and data requirements of a logic library or operation 

**Usages:**

* Examples for this Profile: [EXMLogicModuleDefinition](Library-module-example.md)
* CapabilityStatements using this Profile: [CQL Evaluation Service](CapabilityStatement-cql-evaluation-service.md)

You can also check for [usages in the FHIR IG Statistics](https://packages2.fhir.org/xig/resource/hl7.fhir.uv.cql|current/StructureDefinition/StructureDefinition-cql-module.json)

### Formal Views of Profile Content

 [Description Differentials, Snapshots, and other representations](http://build.fhir.org/ig/FHIR/ig-guidance/readingIgs.html#structure-definitions). 

 

Other representations of profile: [CSV](../StructureDefinition-cql-module.csv), [Excel](../StructureDefinition-cql-module.xlsx), [Schematron](../StructureDefinition-cql-module.sch) 



## Resource Content

```json
{
  "resourceType" : "StructureDefinition",
  "id" : "cql-module",
  "extension" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
    "valueInteger" : 3
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
    "valueCode" : "cds"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
    "valueCode" : "trial-use"
  }],
  "url" : "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module",
  "identifier" : [{
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:oid:2.16.840.1.113883.4.642.40.37.42.12"
  }],
  "version" : "3.0.0-ballot",
  "name" : "CQLModule",
  "title" : "CQL Module",
  "status" : "active",
  "experimental" : false,
  "date" : "2026-08-14T03:31:27+10:00",
  "publisher" : "HL7 International / Clinical Decision Support",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://www.hl7.org/Special/committees/dss"
    }]
  }],
  "description" : "The CQL Module profile describes the elements used to provide a structured representation of the declarations and data requirements of a logic library or operation",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001",
      "display" : "World"
    }]
  }],
  "fhirVersion" : "4.0.1",
  "mapping" : [{
    "identity" : "rim",
    "uri" : "http://hl7.org/v3",
    "name" : "RIM Mapping"
  },
  {
    "identity" : "workflow",
    "uri" : "http://hl7.org/fhir/workflow",
    "name" : "Workflow Pattern"
  },
  {
    "identity" : "w5",
    "uri" : "http://hl7.org/fhir/fivews",
    "name" : "FiveWs Pattern Mapping"
  },
  {
    "identity" : "objimpl",
    "uri" : "http://hl7.org/fhir/object-implementation",
    "name" : "Object Implementation Information"
  }],
  "kind" : "resource",
  "abstract" : false,
  "type" : "Library",
  "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/Library",
  "derivation" : "constraint",
  "differential" : {
    "element" : [{
      "id" : "Library",
      "path" : "Library",
      "mustSupport" : false
    },
    {
      "id" : "Library.extension:directReferenceCode",
      "path" : "Library.extension",
      "sliceName" : "directReferenceCode",
      "requirements" : "A module definition library must describe the direct-reference codes it uses.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.extension:logicDefinition",
      "path" : "Library.extension",
      "sliceName" : "logicDefinition",
      "requirements" : "A module definition library must be able to describe the logic definitions it uses.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.extension:inputParameters",
      "path" : "Library.extension",
      "sliceName" : "inputParameters",
      "short" : "What parameters were input",
      "definition" : "The cqf-inputParameters extension is used to provide the actual parameters given to an operation (i.e. when the module is the result of a $data-requirements operation, what were the parameters to the operation). As opposed to the Library.parameter element, which provides the definition of parameters for the module.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-inputParameters"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.extension:selectivity",
      "path" : "Library.extension",
      "sliceName" : "selectivity",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/cql/StructureDefinition/cql-selectivity"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.type",
      "path" : "Library.type",
      "min" : 1,
      "max" : "1",
      "mustSupport" : true
    },
    {
      "id" : "Library.subject[x]",
      "path" : "Library.subject[x]",
      "requirements" : "A module definition library must report the subject it operates on.",
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact",
      "path" : "Library.relatedArtifact",
      "slicing" : {
        "discriminator" : [{
          "type" : "value",
          "path" : "type"
        }],
        "rules" : "open"
      },
      "short" : "Dependencies used by the artifact",
      "definition" : "Any referenced dependencies including other logic libraries, model definitions, or terminologies.",
      "requirements" : "A module definition library must describe the dependencies it requires.",
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact:dependency",
      "path" : "Library.relatedArtifact",
      "sliceName" : "dependency",
      "short" : "What dependencies are referenced",
      "definition" : "A canonical resource (such as a Library, CodeSystem, or ValueSet) referenced by any artifact in the release, or any dependency of any artifact in the release, recursively.",
      "comment" : "This is the full list of dependencies of all artifacts used in the specification.",
      "requirements" : "Artifacts must be able to unambiguously specify the versions of all dependencies used by artifacts in a specification. The version of each dependency SHALL be included in the canonical reference to the dependency.",
      "min" : 0,
      "max" : "*",
      "constraint" : [{
        "key" : "mnf-2",
        "severity" : "error",
        "human" : "Dependency reference must be either a resourceReference (referencing a canonical promotion) or a canonical (referencing a canonical resource), but not both",
        "expression" : "resource.exists() xor extension('http://hl7.org/fhir/5.0/StructureDefinition/extension-RelatedArtifact.resourceReference').exists()"
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact:dependency.extension:resourceReference",
      "path" : "Library.relatedArtifact.extension",
      "sliceName" : "resourceReference",
      "short" : "A reference to the dependency artifact (for canonical promotions)",
      "definition" : "A reference to a canonical promotion of a FHIR resource (i.e. a non-canonical resource that has been promoted to a canonical resource so it can be used in definitional contexts).",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/5.0/StructureDefinition/extension-RelatedArtifact.resourceReference"]
      }],
      "condition" : ["mnf-2"],
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact:dependency.type",
      "path" : "Library.relatedArtifact.type",
      "min" : 1,
      "max" : "1",
      "type" : [{
        "code" : "code"
      }],
      "fixedCode" : "depends-on",
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact:dependency.display",
      "path" : "Library.relatedArtifact.display",
      "min" : 0,
      "max" : "1",
      "mustSupport" : true
    },
    {
      "id" : "Library.relatedArtifact:dependency.resource",
      "path" : "Library.relatedArtifact.resource",
      "short" : "A reference to the dependency artifact (for canonical resources)",
      "min" : 0,
      "max" : "1",
      "condition" : ["mnf-2"],
      "mustSupport" : true
    },
    {
      "id" : "Library.parameter",
      "path" : "Library.parameter",
      "short" : "Provides the definition of parameters for the module.",
      "requirements" : "A module definition library must define any input and output parameters.",
      "mustSupport" : true
    },
    {
      "id" : "Library.parameter.extension:defaultValue",
      "path" : "Library.parameter.extension",
      "sliceName" : "defaultValue",
      "short" : "cqf-defaultValue is used if the parameter definition has a default to provide the expected value of the default. Note that the value is provided according to the FHIR Type Mapping",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-defaultValue"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.parameter.extension:cqlType",
      "path" : "Library.parameter.extension",
      "sliceName" : "cqlType",
      "short" : "cqf-cqlType is used to ensure that the type of the parameter can be unambiguously provided, given that the FHIR Type Mapping is potentially ambiguous (for the Period type specifically)",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-cqlType"]
      }]
    },
    {
      "id" : "Library.parameter.extension:cqlAccessModifier",
      "path" : "Library.parameter.extension",
      "sliceName" : "cqlAccessModifier",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-cqlAccessModifier"]
      }]
    },
    {
      "id" : "Library.parameter.extension:targetConstraint",
      "path" : "Library.parameter.extension",
      "sliceName" : "targetConstraint",
      "short" : "Allowed values for the parameter",
      "definition" : "A targetConstraint defining the allowed values for the parameter. The constraint expression is expected to be evaluated in the context of the library.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/targetConstraint"]
      }]
    },
    {
      "id" : "Library.dataRequirement",
      "path" : "Library.dataRequirement",
      "requirements" : "A module definition library must declare any data requirements.",
      "mustSupport" : true
    },
    {
      "id" : "Library.dataRequirement.extension:isSelective",
      "path" : "Library.dataRequirement.extension",
      "sliceName" : "isSelective",
      "short" : "specifies whether a given DataRequirement is \"selective\"",
      "definition" : "specifies whether a given DataRequirement is \"selective\", meaning that it can be used, along with other selective requirements, to determine whether an artifact is applicable to a particular subject.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-isSelective"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.dataRequirement.extension:valueFilter",
      "path" : "Library.dataRequirement.extension",
      "sliceName" : "valueFilter",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-valueFilter"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "Library.dataRequirement.extension:fhirQueryPattern",
      "path" : "Library.dataRequirement.extension",
      "sliceName" : "fhirQueryPattern",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern"]
      }],
      "mustSupport" : false
    },
    {
      "id" : "Library.dataRequirement.extension:fhirQueryPatternCoverage",
      "path" : "Library.dataRequirement.extension",
      "sliceName" : "fhirQueryPatternCoverage",
      "short" : "How completely the query patterns cover the data requirement",
      "definition" : "Describes the extent to which the FHIR query patterns given for the data requirement cover the criteria of that data requirement. If this extension is not present, consumers assume a coverage of partial.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage"]
      }],
      "mustSupport" : false
    },
    {
      "id" : "Library.dataRequirement.extension:relatedDataRequirement",
      "path" : "Library.dataRequirement.extension",
      "sliceName" : "relatedDataRequirement",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-relatedRequirement"]
      }],
      "mustSupport" : false
    }]
  }
}

```
