CMS FHIR Prototype Measure Calculation Tool IG
0.1.0 - CI Build

CMS FHIR Prototype Measure Calculation Tool IG, published by HL7 International - [Some] Work Group. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/mct-ig/ and changes regularly. See the Directory of published versions

## : QiCore Common - TTL Representation

Draft as of 2026-02-27

Raw ttl | Download

    @prefix fhir: <http://hl7.org/fhir/> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

    # - resource -------------------------------------------------------------------

     a fhir:Library ;
      fhir:nodeRole fhir:treeRoot ;
      fhir:id [ fhir:v "QICoreCommon"] ; #
      fhir:text [
    fhir:status [ fhir:v "extensions" ] ;
    fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n    <table class=\"grid dict\">\n        \n        <tr>\n            <th scope=\"row\"><b>Id: </b></th>\n            <td style=\"padding-left: 4px;\">QICoreCommon</td>\n        </tr>\n        \n        \n        <tr>\n            <th scope=\"row\"><b>Url: </b></th>\n            <td style=\"padding-left: 4px;\"><a href=\"Library-QICoreCommon.html\">QiCore Common</a></td>\n        </tr>\n        \n        \n        <tr>\n            <th scope=\"row\"><b>Version: </b></th>\n            <td style=\"padding-left: 4px;\">0.1.0</td>\n        </tr>\n        \n        \n        \n        <tr>\n            <th scope=\"row\"><b>Name: </b></th>\n            <td style=\"padding-left: 4px;\">QICoreCommon</td>\n        </tr>\n        \n        \n        <tr>\n            <th scope=\"row\"><b>Title: </b></th>\n            <td style=\"padding-left: 4px;\">QiCore Common</td>\n        </tr>\n        \n        \n        \n        <tr>\n            <th scope=\"row\"><b>Status: </b></th>\n            <td style=\"padding-left: 4px;\">draft</td>\n        </tr>\n        \n        \n        \n        <tr>\n            <th scope=\"row\"><b>Type: </b></th>\n            <td style=\"padding-left: 4px;\">\n                \n                    \n                        \n                        <p style=\"margin-bottom: 5px;\">\n                            <b>system: </b> <span><a href=\"http://terminology.hl7.org/7.0.1/CodeSystem-library-type.html\">http://terminology.hl7.org/CodeSystem/library-type</a></span>\n                        </p>\n                        \n                        \n                        <p style=\"margin-bottom: 5px;\">\n                            <b>code: </b> <span>logic-library</span>\n                        </p>\n                        \n                        \n                    \n                \n                \n            </td>\n        </tr>\n        \n        \n        \n        <tr>\n            <th scope=\"row\"><b>Date: </b></th>\n            <td style=\"padding-left: 4px;\">2026-02-27 18:11:00+0000</td>\n        </tr>\n        \n        \n        <tr>\n            <th scope=\"row\"><b>Publisher: </b></th>\n            <td style=\"padding-left: 4px;\">HL7 International - [Some] Work Group</td>\n        </tr>\n        \n        \n        \n        \n        \n        \n        <tr>\n            <th scope=\"row\"><b>Jurisdiction: </b></th>\n            <td style=\"padding-left: 4px;\">US</td>\n        </tr>\n        \n        \n        \n        \n        \n        \n        \n        \n        \n        \n        \n        \n        <tr>\n          <td colspan=\"2\">\n            <table>\n              <tr><th><a id=\"cql-content\"><b>Content: </b></a> text/cql</th></tr>\n              <tr><td><pre><code class=\"language-cql\">/*#xD;\n@author: Stan Rankins#xD;\n@description: Common terminologies and functions used in QI-Core-based CQL artifacts#xD;\n@update: Fashioned after FHIRCommon Version 4.0.012 for use in ecqm-content-qicore-2022 repos#xD;\n*/#xD;\nlibrary QICoreCommon version '1.0.000'#xD;\n#xD;\nusing QICore version '4.1.1'#xD;\n#xD;\ninclude FHIRHelpers version '4.0.013'#xD;\n#xD;\ncodesystem &amp;quot;LOINC&amp;quot;: 'http://loinc.org'#xD;\ncodesystem &amp;quot;SNOMEDCT&amp;quot;: 'http://snomed.info/sct'#xD;\ncodesystem &amp;quot;ICD10CM&amp;quot;: 'http://hl7.org/fhir/sid/icd-10-cm'#xD;\ncodesystem &amp;quot;RoleCode&amp;quot;: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode'#xD;\ncodesystem &amp;quot;Diagnosis Role&amp;quot;: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'#xD;\ncodesystem &amp;quot;RequestIntent&amp;quot;: 'http://terminology.hl7.org/CodeSystem/request-intent'#xD;\ncodesystem &amp;quot;MedicationRequestCategory&amp;quot;: 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'#xD;\ncodesystem &amp;quot;ConditionClinicalStatusCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/condition-clinical'#xD;\ncodesystem &amp;quot;ConditionVerificationStatusCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/condition-ver-status'#xD;\ncodesystem &amp;quot;AllergyIntoleranceClinicalStatusCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical'#xD;\ncodesystem &amp;quot;AllergyIntoleranceVerificationStatusCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification'#xD;\ncodesystem &amp;quot;ConditionCategoryCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/condition-category'#xD;\ncodesystem &amp;quot;ObservationCategoryCodes&amp;quot;: 'http://terminology.hl7.org/CodeSystem/observation-category'#xD;\n#xD;\nvalueset &amp;quot;Active Condition&amp;quot;: 'http://fhir.org/guides/cqf/common/ValueSet/active-condition'#xD;\nvalueset &amp;quot;Inactive Condition&amp;quot;: 'http://fhir.org/guides/cqf/common/ValueSet/inactive-condition'#xD;\n#xD;\ncode &amp;quot;Birthdate&amp;quot;: '21112-8' from &amp;quot;LOINC&amp;quot; display 'Birth date'#xD;\ncode &amp;quot;Dead&amp;quot;: '419099009' from &amp;quot;SNOMEDCT&amp;quot; display 'Dead'#xD;\ncode &amp;quot;ER&amp;quot;: 'ER' from &amp;quot;RoleCode&amp;quot; display 'Emergency room'#xD;\ncode &amp;quot;ICU&amp;quot;: 'ICU' from &amp;quot;RoleCode&amp;quot; display 'Intensive care unit'#xD;\ncode &amp;quot;Billing&amp;quot;: 'billing' from &amp;quot;Diagnosis Role&amp;quot; display 'Billing'#xD;\n#xD;\n// Condition Clinical Status Codes - Consider value sets for these#xD;\ncode &amp;quot;active&amp;quot;: 'active' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;recurrence&amp;quot;: 'recurrence' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;relapse&amp;quot;: 'relapse' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;inactive&amp;quot;: 'inactive' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;remission&amp;quot;: 'remission' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;resolved&amp;quot;: 'resolved' from &amp;quot;ConditionClinicalStatusCodes&amp;quot;#xD;\n#xD;\n// Condition Verification Status Codes - Consider value sets for these#xD;\ncode &amp;quot;unconfirmed&amp;quot;: 'unconfirmed' from ConditionVerificationStatusCodes#xD;\ncode &amp;quot;provisional&amp;quot;: 'provisional' from ConditionVerificationStatusCodes#xD;\ncode &amp;quot;differential&amp;quot;: 'differential' from ConditionVerificationStatusCodes#xD;\ncode &amp;quot;confirmed&amp;quot;: 'confirmed' from ConditionVerificationStatusCodes#xD;\ncode &amp;quot;refuted&amp;quot;: 'refuted' from ConditionVerificationStatusCodes#xD;\ncode &amp;quot;entered-in-error&amp;quot;: 'entered-in-error' from ConditionVerificationStatusCodes#xD;\n#xD;\ncode &amp;quot;allergy-active&amp;quot;: 'active' from &amp;quot;AllergyIntoleranceClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;allergy-inactive&amp;quot;: 'inactive' from &amp;quot;AllergyIntoleranceClinicalStatusCodes&amp;quot;#xD;\ncode &amp;quot;allergy-resolved&amp;quot;: 'resolved' from &amp;quot;AllergyIntoleranceClinicalStatusCodes&amp;quot;#xD;\n#xD;\n// Allergy/Intolerance Verification Status Codes - Consider value sets for these#xD;\ncode &amp;quot;allergy-unconfirmed&amp;quot;: 'unconfirmed' from AllergyIntoleranceVerificationStatusCodes#xD;\ncode &amp;quot;allergy-confirmed&amp;quot;: 'confirmed' from AllergyIntoleranceVerificationStatusCodes#xD;\ncode &amp;quot;allergy-refuted&amp;quot;: 'refuted' from AllergyIntoleranceVerificationStatusCodes#xD;\n#xD;\n// MedicationRequest Category Codes#xD;\ncode &amp;quot;Community&amp;quot;: 'community' from &amp;quot;MedicationRequestCategory&amp;quot; display 'Community'#xD;\ncode &amp;quot;Discharge&amp;quot;: 'discharge' from &amp;quot;MedicationRequestCategory&amp;quot; display 'Discharge'#xD;\n#xD;\n// Diagnosis Role Codes#xD;\ncode &amp;quot;AD&amp;quot;: 'AD' from &amp;quot;Diagnosis Role&amp;quot; display 'Admission diagnosis'#xD;\ncode &amp;quot;DD&amp;quot;: 'DD' from &amp;quot;Diagnosis Role&amp;quot; display 'Discharge diagnosis'#xD;\ncode &amp;quot;CC&amp;quot;: 'CC' from &amp;quot;Diagnosis Role&amp;quot; display 'Chief complaint'#xD;\ncode &amp;quot;CM&amp;quot;: 'CM' from &amp;quot;Diagnosis Role&amp;quot; display 'Comorbidity diagnosis'#xD;\ncode &amp;quot;pre-op&amp;quot;: 'pre-op' from &amp;quot;Diagnosis Role&amp;quot; display 'pre-op diagnosis'#xD;\ncode &amp;quot;post-op&amp;quot;: 'post-op' from &amp;quot;Diagnosis Role&amp;quot; display 'post-op diagnosis'#xD;\ncode &amp;quot;billing&amp;quot;: 'billing' from &amp;quot;Diagnosis Role&amp;quot; display 'billing diagnosis'#xD;\n#xD;\n// Observation Category Codes#xD;\ncode &amp;quot;social-history&amp;quot;: 'social-history' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Social History'#xD;\ncode &amp;quot;vital-signs&amp;quot;: 'vital-signs' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Vital Signs'#xD;\ncode &amp;quot;imaging&amp;quot;: 'imaging' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Imaging'#xD;\ncode &amp;quot;laboratory&amp;quot;: 'laboratory' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Laboratory'#xD;\ncode &amp;quot;procedure&amp;quot;: 'procedure' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Procedure'#xD;\ncode &amp;quot;survey&amp;quot;: 'survey' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Survey'#xD;\ncode &amp;quot;exam&amp;quot;: 'exam' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Exam'#xD;\ncode &amp;quot;therapy&amp;quot;: 'therapy' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Therapy'#xD;\ncode &amp;quot;activity&amp;quot;: 'activity' from &amp;quot;ObservationCategoryCodes&amp;quot; display 'Activity'#xD;\n#xD;\n// Condition Category Codes#xD;\ncode &amp;quot;problem-list-item&amp;quot;: 'problem-list-item' from &amp;quot;ConditionCategoryCodes&amp;quot; display 'Problem List Item'#xD;\ncode &amp;quot;encounter-diagnosis&amp;quot;: 'encounter-diagnosis' from &amp;quot;ConditionCategoryCodes&amp;quot; display 'Encounter Diagnosis'#xD;\n#xD;\ncontext Patient#xD;\n#xD;\n/*#xD;\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval#xD;\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval&amp;lt;DateTime&amp;gt;, or Interval&amp;lt;Quantity&amp;gt; types#xD;\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible#xD;\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.#xD;\n#xD;\nThe input can be provided as a DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt; or Interval&amp;lt;Quantity&amp;gt;.#xD;\nThe intent of this function is to provide a clear and concise mechanism to treat single#xD;\nelements that have multiple possible representations as intervals so that logic doesn't have to account#xD;\nfor the variability. More complex calculations (such as medication request period or dispense period#xD;\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but#xD;\nthe focus of this function is on single element calculations where the semantics are unambiguous.#xD;\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.#xD;\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, #xD;\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.#xD;\nIf the input is a DateTime Interval, the result is the input.#xD;\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result#xD;\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending #xD;\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.#xD;\nAny other input will reslt in a null DateTime Interval#xD;\n*/#xD;\ndefine function ToInterval(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt;):#xD;\n  case#xD;\n	  when choice is DateTime then#xD;\n    	Interval[choice as DateTime, choice as DateTime]#xD;\n		when choice is Interval&amp;lt;DateTime&amp;gt; then#xD;\n  		choice as Interval&amp;lt;DateTime&amp;gt;#xD;\n		when choice is Quantity then#xD;\n		  Interval[Patient.birthDate + (choice as Quantity),#xD;\n			  Patient.birthDate + (choice as Quantity) + 1 year)#xD;\n		when choice is Interval&amp;lt;Quantity&amp;gt; then#xD;\n		  Interval[Patient.birthDate + (choice.low as Quantity),#xD;\n			  Patient.birthDate + (choice.high as Quantity) + 1 year)#xD;\n		else#xD;\n			null as Interval&amp;lt;DateTime&amp;gt;#xD;\n	end#xD;\n#xD;\n/*#xD;\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval#xD;\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval&amp;lt;DateTime&amp;gt;, or Interval&amp;lt;Quantity&amp;gt; types#xD;\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible#xD;\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.#xD;\n#xD;\nThe input can be provided as a DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt; or Interval&amp;lt;Quantity&amp;gt;.#xD;\nThe intent of this function is to provide a clear and concise mechanism to treat single#xD;\nelements that have multiple possible representations as intervals so that logic doesn't have to account#xD;\nfor the variability. More complex calculations (such as medication request period or dispense period#xD;\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but#xD;\nthe focus of this function is on single element calculations where the semantics are unambiguous.#xD;\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.#xD;\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, #xD;\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.#xD;\nIf the input is a DateTime Interval, the result is the input.#xD;\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result#xD;\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending #xD;\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.#xD;\nAny other input will reslt in a null DateTime Interval#xD;\n*/#xD;\ndefine fluent function toInterval(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt;):#xD;\n  case#xD;\n	  when choice is DateTime then#xD;\n    	Interval[choice as DateTime, choice as DateTime]#xD;\n		when choice is Interval&amp;lt;DateTime&amp;gt; then#xD;\n  		choice as Interval&amp;lt;DateTime&amp;gt;#xD;\n		when choice is Quantity then#xD;\n		  Interval[Patient.birthDate + (choice as Quantity),#xD;\n			  Patient.birthDate + (choice as Quantity) + 1 year)#xD;\n		when choice is Interval&amp;lt;Quantity&amp;gt; then#xD;\n		  Interval[Patient.birthDate + (choice.low as Quantity),#xD;\n			  Patient.birthDate + (choice.high as Quantity) + 1 year)#xD;\n		else#xD;\n			null as Interval&amp;lt;DateTime&amp;gt;#xD;\n	end#xD;\n#xD;\n/*#xD;\n@description: Returns an interval representing the normalized abatement of a given Condition.#xD;\n@comment: If the abatement element of the Condition is represented as a DateTime, the result#xD;\nis an interval beginning and ending on that DateTime.#xD;\nIf the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The#xD;\nresult is an interval from the date the patient turned that age to immediately before one year later.#xD;\nIf the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during#xD;\nwhich the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately#xD;\nbefore one year later than the date the patient turned the ending age of the quantity interval.#xD;\n*/#xD;\ndefine function ToAbatementInterval(condition Condition):#xD;\n	if condition.abatement is DateTime then#xD;\n	  Interval[condition.abatement as DateTime, condition.abatement as DateTime]#xD;\n	else if condition.abatement is Quantity then#xD;\n		Interval[Patient.birthDate + (condition.abatement as Quantity),#xD;\n			Patient.birthDate + (condition.abatement as Quantity) + 1 year)#xD;\n	else if condition.abatement is Interval&amp;lt;Quantity&amp;gt; then#xD;\n	  Interval[Patient.birthDate + (condition.abatement.low as Quantity),#xD;\n		  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)#xD;\n	else if condition.abatement is Interval&amp;lt;DateTime&amp;gt; then#xD;\n	  Interval[condition.abatement.low, condition.abatement.high)#xD;\n	else null as Interval&amp;lt;DateTime&amp;gt;#xD;\n#xD;\n/*#xD;\n@description: Returns an interval representing the normalized abatement of a given Condition.#xD;\n@comment: If the abatement element of the Condition is represented as a DateTime, the result#xD;\nis an interval beginning and ending on that DateTime.#xD;\nIf the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The#xD;\nresult is an interval from the date the patient turned that age to immediately before one year later.#xD;\nIf the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during#xD;\nwhich the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately#xD;\nbefore one year later than the date the patient turned the ending age of the quantity interval.#xD;\n*/#xD;\ndefine fluent function toAbatementInterval(condition Condition):#xD;\n	if condition.abatement is DateTime then#xD;\n	  Interval[condition.abatement as DateTime, condition.abatement as DateTime]#xD;\n	else if condition.abatement is Quantity then#xD;\n		Interval[Patient.birthDate + (condition.abatement as Quantity),#xD;\n			Patient.birthDate + (condition.abatement as Quantity) + 1 year)#xD;\n	else if condition.abatement is Interval&amp;lt;Quantity&amp;gt; then#xD;\n	  Interval[Patient.birthDate + (condition.abatement.low as Quantity),#xD;\n		  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)#xD;\n	else if condition.abatement is Interval&amp;lt;DateTime&amp;gt; then#xD;\n	  Interval[condition.abatement.low, condition.abatement.high)#xD;\n	else null as Interval&amp;lt;DateTime&amp;gt;#xD;\n#xD;\n/*#xD;\n@description: Returns an interval representing the normalized prevalence period of a given Condition.#xD;\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from#xD;\nonset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have#xD;\na closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.#xD;\n*/#xD;\ndefine function ToPrevalenceInterval(condition Condition):#xD;\nif condition.clinicalStatus ~ &amp;quot;active&amp;quot;#xD;\n  or condition.clinicalStatus ~ &amp;quot;recurrence&amp;quot;#xD;\n  or condition.clinicalStatus ~ &amp;quot;relapse&amp;quot; then#xD;\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]#xD;\nelse#xD;\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))#xD;\n#xD;\n/*#xD;\n@description: Returns an interval representing the normalized prevalence period of a given Condition.#xD;\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from#xD;\nonset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have#xD;\na closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.#xD;\n*/#xD;\ndefine fluent function toPrevalenceInterval(condition Condition):#xD;\nif condition.clinicalStatus ~ &amp;quot;active&amp;quot;#xD;\n  or condition.clinicalStatus ~ &amp;quot;recurrence&amp;quot;#xD;\n  or condition.clinicalStatus ~ &amp;quot;relapse&amp;quot; then#xD;\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]#xD;\nelse#xD;\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))#xD;\n#xD;\n/*#xD;\n@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).#xD;\n@comment: This function can be used to determine the logical id of a given resource. It can be used in#xD;\na single-server environment to trace references. However, this function does not attempt to resolve#xD;\nor distinguish the base of the given url, and so cannot be used safely in multi-server environments.#xD;\n*/#xD;\ndefine function GetId(uri String ):#xD;\n  Last(Split(uri, '/'))#xD;\n#xD;\n/*#xD;\n@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).#xD;\n@comment: This function can be used to determine the logical id of a given resource. It can be used in#xD;\na single-server environment to trace references. However, this function does not attempt to resolve#xD;\nor distinguish the base of the given url, and so cannot be used safely in multi-server environments.#xD;\n*/#xD;\ndefine fluent function getId(uri String):#xD;\n  Last(Split(uri, '/'))#xD;\n#xD;\n/*#xD;\n@description: Given an interval, return true if the interval has a starting boundary specified #xD;\n(i.e. the start of the interval is not null and not the minimum DateTime value)#xD;\n*/#xD;\ndefine function &amp;quot;HasStart&amp;quot;(period Interval&amp;lt;DateTime&amp;gt; ):#xD;\n  not ( start of period is null#xD;\n      or start of period = minimum DateTime#xD;\n  )#xD;\n#xD;\n/*#xD;\n@description: Given an interval, return true if the interval has a starting boundary specified #xD;\n(i.e. the start of the interval is not null and not the minimum DateTime value)#xD;\n*/#xD;\ndefine fluent function hasStart(period Interval&amp;lt;DateTime&amp;gt; ):#xD;\n  not ( start of period is null#xD;\n      or start of period = minimum DateTime#xD;\n  )#xD;\n#xD;\n/*#xD;\n@description: Given an interval, returns true if the interval has an ending boundary specified #xD;\n(i.e. the end of the interval is not null and not the maximum DateTime value)#xD;\n*/#xD;\ndefine function &amp;quot;HasEnd&amp;quot;(period Interval&amp;lt;DateTime&amp;gt; ):#xD;\n  not (#xD;\n    end of period is null#xD;\n      or end of period = maximum DateTime#xD;\n  )#xD;\n#xD;\n/*#xD;\n@description: Given an interval, returns true if the interval has an ending boundary specified #xD;\n(i.e. the end of the interval is not null and not the maximum DateTime value)#xD;\n*/#xD;\ndefine fluent function hasEnd(period Interval&amp;lt;DateTime&amp;gt; ):#xD;\n  not (#xD;\n    end of period is null#xD;\n      or end of period = maximum DateTime#xD;\n  )#xD;\n#xD;\n/*#xD;\n@description: Given an interval, returns the ending point if the interval has an ending boundary specified, #xD;\notherwise, returns the starting point#xD;\n*/#xD;\ndefine function &amp;quot;Latest&amp;quot;(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt; ):#xD;\n  (choice.toInterval()) period#xD;\n    return#xD;\n      if (HasEnd(period)) then end of period#xD;\n      else start of period#xD;\n#xD;\n/*#xD;\n@description: Given an interval, returns the ending point if the interval has an ending boundary specified, #xD;\notherwise, returns the starting point#xD;\n*/#xD;\ndefine fluent function latest(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt; ):#xD;\n  (choice.toInterval()) period#xD;\n    return#xD;\n      if (HasEnd(period)) then end of period#xD;\n      else start of period#xD;\n#xD;\n/*#xD;\n@description: Given an interval, return the starting point if the interval has a starting boundary specified, #xD;\notherwise, return the ending point#xD;\n*/#xD;\ndefine function &amp;quot;Earliest&amp;quot;(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt; ):#xD;\n  (choice.toInterval()) period#xD;\n    return#xD;\n      if (HasStart(period)) then start of period#xD;\n      else end of period#xD;\n#xD;\n/*#xD;\n@description: Given an interval, return the starting point if the interval has a starting boundary specified, #xD;\notherwise, return the ending point#xD;\n*/#xD;\ndefine fluent function earliest(choice Choice&amp;lt;DateTime, Quantity, Interval&amp;lt;DateTime&amp;gt;, Interval&amp;lt;Quantity&amp;gt;&amp;gt; ):#xD;\n  (choice.toInterval()) period#xD;\n    return#xD;\n      if (HasStart(period)) then start of period#xD;\n      else end of period#xD;\n#xD;\n/*#xD;\n@description: Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for#xD;\nthe final day if it is less than 24 hours. This also includes the first 24 hour period.#xD;\n*/#xD;\ndefine function &amp;quot;Interval To Day Numbers&amp;quot;(Period Interval&amp;lt;DateTime&amp;gt;):#xD;\n  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayNumber#xD;\n    return end of DayNumber#xD;\n#xD;\n/*#xD;\n@description: Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for#xD;\nthe final day if it is less than 24 hours. This also includes the first 24 hour period.#xD;\n*/#xD;\ndefine fluent function toDayNumbers(Period Interval&amp;lt;DateTime&amp;gt;):#xD;\n  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayNumber#xD;\n    return end of DayNumber#xD;\n#xD;\n/*#xD;\n@description: Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.#xD;\nNote that the result will include intervals that are closed at the beginning and open at the end#xD;\n*/#xD;\ndefine function &amp;quot;Days In Period&amp;quot;(Period Interval&amp;lt;DateTime&amp;gt;):#xD;\n  ( &amp;quot;Interval To Day Numbers&amp;quot;(Period)) DayIndex#xD;\n    let startPeriod: start of Period + (24 hours * (DayIndex - 1)),#xD;\n    endPeriod: if (hours between startPeriod and end of Period &amp;lt; 24) then startPeriod#xD;\n      else start of Period + (24 hours * DayIndex)#xD;\n    return Tuple {#xD;\n      dayIndex: DayIndex,#xD;\n      dayPeriod: Interval[startPeriod, endPeriod)#xD;\n    }#xD;\n#xD;\n/*#xD;\n@description: Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.#xD;\nNote that the result will include intervals that are closed at the beginning and open at the end#xD;\n*/#xD;\ndefine fluent function daysInPeriod(Period Interval&amp;lt;DateTime&amp;gt;):#xD;\n  ( &amp;quot;Interval To Day Numbers&amp;quot;(Period)) DayIndex#xD;\n    let startPeriod: start of Period + (24 hours * (DayIndex - 1)),#xD;\n    endPeriod: if (hours between startPeriod and end of Period &amp;lt; 24) then startPeriod#xD;\n      else start of Period + (24 hours * DayIndex)#xD;\n    return Tuple {#xD;\n      dayIndex: DayIndex,#xD;\n      dayPeriod: Interval[startPeriod, endPeriod)#xD;\n    }</code></pre></td></tr>\n            </table>\n          </td>\n        </tr>\n        \n        \n        \n    </table>\n</div>"^^rdf:XMLLiteral ]
      ] ; #
      fhir:extension ( [
    fhir:url [
    fhir:v "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem"^^xsd:anyURI ;
    fhir:l <http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem>     ] ;
    fhir:value [
    a fhir:Reference ;
    fhir:l fhir:Device/cqf-tooling ;
    fhir:reference [ fhir:v "Device/cqf-tooling" ]     ]
      ] ) ; #
      fhir:url [
    fhir:v "http://cms.gov/fhir/mct/Library/QICoreCommon"^^xsd:anyURI ;
    fhir:l <http://cms.gov/fhir/mct/Library/QICoreCommon>
      ] ; #
      fhir:version [ fhir:v "0.1.0"] ; #
      fhir:name [ fhir:v "QICoreCommon"] ; #
      fhir:title [ fhir:v "QiCore Common"] ; #
      fhir:status [ fhir:v "draft"] ; #
      fhir:type [
        ( fhir:coding [
    fhir:system [
    fhir:v "http://terminology.hl7.org/CodeSystem/library-type"^^xsd:anyURI ;
    fhir:l <http://terminology.hl7.org/CodeSystem/library-type>       ] ;
    fhir:code [ fhir:v "logic-library" ]     ] )
      ] ; #
      fhir:date [ fhir:v "2026-02-27T18:11:00+00:00"^^xsd:dateTime] ; #
      fhir:publisher [ fhir:v "HL7 International - [Some] Work Group"] ; #
      fhir:contact ( [
        ( fhir:telecom [
    fhir:system [ fhir:v "url" ] ;
    fhir:value [ fhir:v "http://hl7.org/Special/committees/[something]" ]     ] )
      ] ) ; #
      fhir:jurisdiction ( [
        ( fhir:coding [
    fhir:system [
    fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ;
    fhir:l <urn:iso:std:iso:3166>       ] ;
    fhir:code [ fhir:v "US" ]     ] )
      ] ) ; #
      fhir:content ( [
    fhir:contentType [ fhir:v "text/cql" ] ;
    fhir:data [ fhir:v " "^^xsd:base64Binary ]
      ] ) . #