# CQM Test Case - Quality Measure Implementation Guide v2.0.0-ballot

## Resource Profile: CQM Test Case 

 
The cqm Test Case Profile describes expectations for the definition and exchange of a measure test case, including input data and parameters, as well as expected outcome 

**Usages:**

* Examples for this Profile: [MeasureReport/testcase-example](MeasureReport-testcase-example.md)
* CapabilityStatements using this Profile: [CQF Measures Publishable Measure Repository Capability Statement](CapabilityStatement-publishable-measure-repository.md)

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

### 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-cqm-testcase.csv), [Excel](../StructureDefinition-cqm-testcase.xlsx), [Schematron](../StructureDefinition-cqm-testcase.sch) 



## Resource Content

```json
{
  "resourceType" : "StructureDefinition",
  "id" : "cqm-testcase",
  "extension" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
    "valueCode" : "cqi"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
    "valueInteger" : 4,
    "_valueInteger" : {
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
        "valueCanonical" : "http://hl7.org/fhir/uv/cqm/ImplementationGuide/hl7.fhir.uv.cqm"
      }]
    }
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
    "valueCode" : "trial-use",
    "_valueCode" : {
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
        "valueCanonical" : "http://hl7.org/fhir/uv/cqm/ImplementationGuide/hl7.fhir.uv.cqm"
      }]
    }
  }],
  "url" : "http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-testcase",
  "identifier" : [{
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:oid:2.16.840.1.113883.4.642.40.61.42.32"
  }],
  "version" : "1.0.0",
  "name" : "CQMTestCase",
  "title" : "CQM Test Case",
  "status" : "active",
  "experimental" : false,
  "date" : "2026-04-07T02:06:45+10:00",
  "publisher" : "HL7 International / Clinical Quality Information",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://www.hl7.org/Special/committees/cqi"
    }]
  }],
  "description" : "The cqm Test Case Profile describes expectations for the definition and exchange of a measure test case, including input data and parameters, as well as expected outcome",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001"
    }]
  }],
  "purpose" : "Measure authors must be able to define and communicate test cases that include expected outcomes to allow for validation of measure behavior.",
  "fhirVersion" : "4.0.1",
  "mapping" : [{
    "identity" : "w5",
    "uri" : "http://hl7.org/fhir/fivews",
    "name" : "FiveWs Pattern Mapping"
  },
  {
    "identity" : "rim",
    "uri" : "http://hl7.org/v3",
    "name" : "RIM Mapping"
  }],
  "kind" : "resource",
  "abstract" : false,
  "type" : "MeasureReport",
  "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/MeasureReport",
  "derivation" : "constraint",
  "differential" : {
    "element" : [{
      "id" : "MeasureReport",
      "path" : "MeasureReport",
      "definition" : "The Measure Test Case profile defines a test case for a specific measure, including input data and parameters, as well as expected outcome in the form of a measure report.",
      "mustSupport" : false
    },
    {
      "id" : "MeasureReport.extension:testCaseDescription",
      "path" : "MeasureReport.extension",
      "sliceName" : "testCaseDescription",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-testCaseDescription"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.extension:inputParameters",
      "path" : "MeasureReport.extension",
      "sliceName" : "inputParameters",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/cqf-inputParameters"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.extension:operation",
      "path" : "MeasureReport.extension",
      "sliceName" : "operation",
      "short" : "If an operation is not specificed, then the test case is assumed to be for $evaluate-measure.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-operation"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.extension:softwaresystem",
      "path" : "MeasureReport.extension",
      "sliceName" : "softwaresystem",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.modifierExtension:isTestCase",
      "path" : "MeasureReport.modifierExtension",
      "sliceName" : "isTestCase",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-isTestCase"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.identifier",
      "path" : "MeasureReport.identifier",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.status",
      "path" : "MeasureReport.status",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.type",
      "path" : "MeasureReport.type",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.measure",
      "path" : "MeasureReport.measure",
      "min" : 1,
      "max" : "1",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group",
      "path" : "MeasureReport.group",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.population",
      "path" : "MeasureReport.group.population",
      "constraint" : [{
        "key" : "cntq-1",
        "severity" : "error",
        "human" : "Either count or countQuantity must be provided, but not both.",
        "expression" : "(count.exists() xor extension('http://hl7.org/fhir/StructureDefinition/measurereport-countQuantity').exists())"
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.population.extension:countQuantity",
      "path" : "MeasureReport.group.population.extension",
      "sliceName" : "countQuantity",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/measurereport-countQuantity"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.population.code",
      "path" : "MeasureReport.group.population.code",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.population.count",
      "path" : "MeasureReport.group.population.count",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.measureScore",
      "path" : "MeasureReport.group.measureScore",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier",
      "path" : "MeasureReport.group.stratifier",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.code",
      "path" : "MeasureReport.group.stratifier.code",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum",
      "path" : "MeasureReport.group.stratifier.stratum",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.value",
      "path" : "MeasureReport.group.stratifier.stratum.value",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.component",
      "path" : "MeasureReport.group.stratifier.stratum.component",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.component.code",
      "path" : "MeasureReport.group.stratifier.stratum.component.code",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.component.value",
      "path" : "MeasureReport.group.stratifier.stratum.component.value",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.population",
      "path" : "MeasureReport.group.stratifier.stratum.population",
      "constraint" : [{
        "key" : "cntq-1",
        "severity" : "error",
        "human" : "Either count or countQuantity must be provided, but not both.",
        "expression" : "(count.exists() xor extension('http://hl7.org/fhir/StructureDefinition/measurereport-countQuantity').exists())"
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.population.extension:countQuantity",
      "path" : "MeasureReport.group.stratifier.stratum.population.extension",
      "sliceName" : "countQuantity",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Extension",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/measurereport-countQuantity"]
      }],
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.population.code",
      "path" : "MeasureReport.group.stratifier.stratum.population.code",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.population.count",
      "path" : "MeasureReport.group.stratifier.stratum.population.count",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.group.stratifier.stratum.measureScore",
      "path" : "MeasureReport.group.stratifier.stratum.measureScore",
      "mustSupport" : true
    },
    {
      "id" : "MeasureReport.evaluatedResource",
      "path" : "MeasureReport.evaluatedResource",
      "mustSupport" : true
    }]
  }
}

```
