# Example Logic Library - Module Definition - Using CQL With FHIR v3.0.0-ballot

## Library: Example Logic Library - Module Definition (Experimental) 

 
This library is used as an example module definition in the Using FHIR with CQL Implementation Guide 

* Metadata: Title
  * ?: Example Logic Library - Module Definition
* Metadata: Version
  * ?: 3.0.0-ballot
* Metadata: Identifier
  * ?: EXMLogic
* Metadata: Identifier
  * ?: urn:oid:2.16.840.1.113883.4.642.40.37.28.8
* Metadata: Experimental
  * ?: true
* Metadata: Jurisdiction
  * ?: World
* Metadata: Steward (Publisher)
  * ?: HL7 International / Clinical Decision Support
* Metadata: Description
  * ?: This library is used as an example module definition in the Using FHIR with CQL Implementation Guide
* Metadata: Type
  * ?: module-definition from[http://terminology.hl7.org/CodeSystem/library-type](http://terminology.hl7.org/7.3.0/CodeSystem-library-type.html)
* Metadata: Dependency
  * ?: **Description**: QICore model information**Resource**:`http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1`**Canonical URL**:http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1
* Metadata: Dependency
  * ?: **Description**: Library FHIRHelpers**Resource**:`http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot`**Canonical URL**:http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot
* Metadata: Dependency
  * ?: **Description**: Code system Diagnosis Role**Resource**:[Diagnosis Role](http://terminology.hl7.org/7.3.0/CodeSystem-diagnosis-role.html)**Canonical URL**:http://terminology.hl7.org/CodeSystem/diagnosis-role
* Metadata: Dependency
  * ?: **Description**: Value set Emergency Department Visit**Resource**:[Emergency Department Visit](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.292-20210611)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
* Metadata: Dependency
  * ?: **Description**: Value set Psychiatric/Mental Health Patient**Resource**:[Psychiatric/Mental Health Diagnosis](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.299-20170816)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299
* Metadata: Dependency
  * ?: **Description**: Value set Hospital Settings**Resource**:[Hospital Settings](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1111.126-20200305)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126
* Metadata: Dependency
  * ?: **Description**: Value set ONC Administrative Sex**Resource**:[Administrative Sex MF](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1-20150331)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1
* Metadata: Dependency
  * ?: **Description**: Value set Race**Resource**:[Race](https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.836-20121025)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836
* Metadata: Dependency
  * ?: **Description**: Value set Ethnicity**Resource**:[Ethnicity](https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.837-20121025)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837
* Metadata: Dependency
  * ?: **Description**: Value set Payer**Resource**:[Payer Type](https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.3591-20250419)**Canonical URL**:http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
* Metadata: Data Requirement
  * ?: **Type**: Patient**Profile(s)**:`http://example.org/fhir/us/qicore/StructureDefinition/qicore-patient`**Must Support Elements**: extension('http://example.org/fhir/us/core/StructureDefinition/us-core-ethnicity')
* Metadata: Data Requirement
  * ?: **Type**: Encounter**Profile(s)**:`http://example.org/fhir/us/qicore/StructureDefinition/qicore-encounter`**Code Filter(s)**:**Path**: type**ValueSet**:[Emergency Department Visit](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.292-20210611)
* Metadata: Data Requirement
  * ?: **Type**: Condition**Profile(s)**:[Condition](http://hl7.org/fhir/R4/condition.html)**Code Filter(s)**:**Path**: id
* Metadata: Data Requirement
  * ?: **Type**: Coverage**Profile(s)**:`http://example.org/fhir/us/qicore/StructureDefinition/qicore-coverage`**Code Filter(s)**:**Path**: type**ValueSet**:[Payer Type](https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.3591-20250419)
* Metadata:  Parameters
* Metadata: 
  * ?: 
| | | | | |
| :--- | :--- | :--- | :--- | :--- |
| **Name** | **Use** | **Card.** | **Type** | **Documentation** |
| Measurement Period | In | 0..1 | Period |  |
| Patient | Out | 0..1 | Patient |  |
| Inpatient Encounter | Out | 0..* | Encounter |  |
| Initial Population | Out | 0..* | Encounter |  |
| Measure Population | Out | 0..* | Encounter |  |
| Stratifier 1 | Out | 0..* | Encounter |  |
| Stratifier 2 | Out | 0..* | Encounter |  |
| Stratifier 3 | Out | 0..* | Encounter |  |
| Stratifier 4 | Out | 0..* | Encounter |  |
| SDE Ethnicity | Out | 0..* | Coding |  |
| SDE Payer | Out | 0..* | Resource |  |
| SDE Race | Out | 0..* | Coding |  |
| SDE Sex | Out | 0..1 | Coding |  |

* Metadata: Generated using version 0.5.6-cibuild of the sample-content-ig Liquid templates



## Resource Content

```json
{
  "resourceType" : "Library",
  "id" : "module-example",
  "meta" : {
    "profile" : ["http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module"]
  },
  "url" : "http://hl7.org/fhir/uv/cql/Library/module-example",
  "identifier" : [{
    "use" : "official",
    "system" : "http://example.org/fhir/cqi/ecqm/Library/Identifier",
    "value" : "EXMLogic"
  },
  {
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:oid:2.16.840.1.113883.4.642.40.37.28.8"
  }],
  "version" : "3.0.0-ballot",
  "name" : "EXMLogicModuleDefinition",
  "title" : "Example Logic Library - Module Definition",
  "status" : "active",
  "experimental" : true,
  "type" : {
    "coding" : [{
      "system" : "http://terminology.hl7.org/CodeSystem/library-type",
      "code" : "module-definition"
    }]
  },
  "date" : "2019-09-03",
  "publisher" : "HL7 International / Clinical Decision Support",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://www.hl7.org/Special/committees/dss"
    }]
  }],
  "description" : "This library is used as an example module definition in the Using FHIR with CQL Implementation Guide",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001",
      "display" : "World"
    }]
  }],
  "relatedArtifact" : [{
    "type" : "depends-on",
    "display" : "QICore model information",
    "resource" : "http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1"
  },
  {
    "type" : "depends-on",
    "display" : "Library FHIRHelpers",
    "resource" : "http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot"
  },
  {
    "type" : "depends-on",
    "display" : "Code system Diagnosis Role",
    "resource" : "http://terminology.hl7.org/CodeSystem/diagnosis-role"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Emergency Department Visit",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Psychiatric/Mental Health Patient",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Hospital Settings",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126"
  },
  {
    "type" : "depends-on",
    "display" : "Value set ONC Administrative Sex",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Race",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Ethnicity",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837"
  },
  {
    "type" : "depends-on",
    "display" : "Value set Payer",
    "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
  }],
  "parameter" : [{
    "name" : "Measurement Period",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "type" : "Period"
  },
  {
    "name" : "Patient",
    "use" : "out",
    "min" : 0,
    "max" : "1",
    "type" : "Patient"
  },
  {
    "name" : "Inpatient Encounter",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Initial Population",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Measure Population",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Stratifier 1",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Stratifier 2",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Stratifier 3",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "Stratifier 4",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Encounter"
  },
  {
    "name" : "SDE Ethnicity",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Coding"
  },
  {
    "name" : "SDE Payer",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Resource"
  },
  {
    "name" : "SDE Race",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "type" : "Coding"
  },
  {
    "name" : "SDE Sex",
    "use" : "out",
    "min" : 0,
    "max" : "1",
    "type" : "Coding"
  }],
  "dataRequirement" : [{
    "extension" : [{
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern",
      "valueString" : "Patient?_id={{context.patientId}}"
    },
    {
      "url" : "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage",
      "valueCode" : "partial"
    }],
    "type" : "Patient",
    "profile" : ["http://example.org/fhir/us/qicore/StructureDefinition/qicore-patient"],
    "mustSupport" : ["extension('http://example.org/fhir/us/core/StructureDefinition/us-core-ethnicity')"],
    "_mustSupport" : [{
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/rendered-value",
        "valueString" : "ethnicity"
      }]
    }]
  },
  {
    "extension" : [{
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern",
      "valueString" : "Encounter?status=finished&subject=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
    },
    {
      "url" : "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage",
      "valueCode" : "partial"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-isSelective",
      "valueBoolean" : true
    },
    {
      "extension" : [{
        "url" : "path",
        "valueString" : "status"
      },
      {
        "url" : "comparator",
        "valueCode" : "eq"
      },
      {
        "url" : "value",
        "valueString" : "finished"
      }],
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-valueFilter"
    }],
    "type" : "Encounter",
    "profile" : ["http://example.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
    "codeFilter" : [{
      "path" : "type",
      "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
    }]
  },
  {
    "type" : "Condition",
    "profile" : ["http://hl7.org/fhir/StructureDefinition/Condition"],
    "codeFilter" : [{
      "path" : "id"
    }]
  },
  {
    "extension" : [{
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern",
      "valueString" : "Coverage?policy-holder=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern",
      "valueString" : "Coverage?subscriber=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern",
      "valueString" : "Coverage?beneficiary=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
    },
    {
      "url" : "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage",
      "valueCode" : "partial"
    }],
    "type" : "Coverage",
    "profile" : ["http://example.org/fhir/us/qicore/StructureDefinition/qicore-coverage"],
    "codeFilter" : [{
      "path" : "type",
      "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
    }]
  }]
}

```
