# Sexually Transmitted Infection (STI) Testing for People with HIVFHIR - eCQM QICore Content Implementation Guide v2023.0.0

* [**Table of Contents**](toc.md)
* [**Artifacts Summary**](artifacts.md)
* **Sexually Transmitted Infection (STI) Testing for People with HIVFHIR**

## Measure: Sexually Transmitted Infection (STI) Testing for People with HIVFHIR 

| | |
| :--- | :--- |
| *Official URL*:http://ecqi.healthit.gov/ecqms/Measure/HIVSTITestingFHIR | *Version*:0.1.000 |
| Draft as of 2023-10-27 | *Responsible:*[Health Resources & Services Administration/a>  *Computable Name*: HIVSTITestingFHIR    *Other Identifiers:* Short Name (use: usual, ), UUID:6f66ca77-1a2c-489c-b0d8-730da6e5a763 (use: official, ), UUID:2c92808287dd6f640188b07c4a8a1f35 (use: official, ), Publisher (use: official, )    **Usage:**Program: EP/EC    **Copyright/Legal**: This measure was developed by the Health Resources & Services Administration (HRSA) of the U.S. Department of Health & Human Services (HHS). It is in the public domain. Citation of HRSA as the source of the original measure is appreciated. Any modified versions may not be represented as approved, endorsed, or authorized by HRSA or HHS. 42 U.S.C. Section 1320b-10. Users of modified versions should clearly explain how they deviate from HRSA’s original measure. Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. CPT(R) contained in the Measure specifications is copyright 2004-2022 American Medical Association. LOINC(R) is copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 is copyright 2022 World Health Organization. All Rights Reserved. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].     Percentage of patients 13 years of age and older with a diagnosis of HIV who had tests for syphilis, gonorrhea, and chlamydia performed within the measurement period   UNKNOWN    
* **Logic Definitions:**: **Id: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: HIVSTITestingFHIR
* **Logic Definitions:**: **Download cql: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: [HIVSTITestingFHIR.cql](Library-HIVSTITestingFHIR.cql)
* **Logic Definitions:**: **Version: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 0.1.000
* **Logic Definitions:**: **Url: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: [Sexually Transmitted Infection (STI) Testing for People with HIVFHIR](Measure-HIVSTITestingFHIR.md)
* **Logic Definitions:**: ** short-name identifier: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````:  CMS1188FHIR 
* **Logic Definitions:**: ** version-independent identifier: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````:  urn:uuid:6f66ca77-1a2c-489c-b0d8-730da6e5a763 
* **Logic Definitions:**: ** version-specific identifier: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````:  urn:uuid:2c92808287dd6f640188b07c4a8a1f35 
* **Logic Definitions:**: ** publisher (CMS) identifier: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````:  1188FHIR 
* **Logic Definitions:**: **Effective Period: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 2024-01-01 ..2024-12-31
* **Logic Definitions:**: **Status: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: draft
* **Logic Definitions:**: **Date: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 2023-10-27 08:12:32+0000
* **Logic Definitions:**: **Approval Date: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 2023-08-11
* **Logic Definitions:**: **Last Review Date: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 2023-08-11
* **Logic Definitions:**: **Name: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: HIVSTITestingFHIR
* **Logic Definitions:**: **Publisher: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: Health Resources & Services Administration
* **Logic Definitions:**: **Author: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: Health Resources & Services Administration:[ https://www.hrsa.gov/]( https://www.hrsa.gov/)
* **Logic Definitions:**: **Description: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: Percentage of patients 13 years of age and older with a diagnosis of HIV who had tests for syphilis, gonorrhea, and chlamydia performed within the measurement period
* **Logic Definitions:**: **Purpose: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: UNKNOWN
* **Logic Definitions:**: **Copyright: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: This measure was developed by the Health Resources & Services Administration (HRSA) of the U.S. Department of Health & Human Services (HHS). It is in the public domain.Citation of HRSA as the source of the original measure is appreciated. Any modified versions may not be represented as approved, endorsed, or authorized by HRSA or HHS. 42 U.S.C. Section 1320b-10. Users of modified versions should clearly explain how they deviate from HRSA's original measure.Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.CPT(R) contained in the Measure specifications is copyright 2004-2022 American Medical Association. LOINC(R) is copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 is copyright 2022 World Health Organization. All Rights Reserved.Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].
* **Logic Definitions:**: **Disclaimer: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications.THE MEASURES AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].
* **Logic Definitions:**: **Rationale: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: The rates of syphilis, gonorrhea, and chlamydia cases per 100,000 in the United States have steadily risen over the last decade and increased 11.2%, 5.9%, and 2.8%, respectively, from 2018 to 2019 (DHHS, 2021). People with HIV are at an increased risk of bacterial sexually transmitted infections (STIs), including chlamydia, gonorrhea, and syphilis (CDC, 2004). However, early detection and treatment of bacterial STIs in people with HIV can lead to a reduction in HIV transmission (CDC, 2004). Despite guidelines for at least annual screening among sexually active persons with HIV, only an estimated 55% received a syphilis test in the past year, 23% received a gonorrhea test in the past year, and 24% received a chlamydia test in the past year based on a nationally-representative survey of adults with HIV receiving medical care in the United States (Flagg et al., 2015). This measure will help providers focus their attention and quality improvement efforts towards testing and treating sexually transmitted infections in patients with HIV, thus reducing the complications to long-term syphilis infection and reducing STI incidence (Patel et al., 2012).
* **Logic Definitions:**: **Clinical recommendation statement: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: "Routine serologic screening for syphilis is recommended at least annually for all persons with HIV infection who are sexually active, with more frequent screening (i.e., every 3-6 months) for those who have multiple or anonymous partners" (Panel on Opportunistic Infections in Adults and Adolescents with HIV, 2022, p. Y-3)."Patients undergoing screening or treatment for syphilis also should be evaluated for other sexually transmitted diseases such as chlamydia and gonorrhea at anatomic sites of exposure in men and for chlamydia, gonorrhea, and trichomonas in women" (Panel on Opportunistic Infections in Adults and Adolescents with HIV, 2022, p. Y-3)."The USPSTF recommends screening for syphilis in persons who are at increased risk for infection. When deciding which persons to screen for syphilis, clinicians should consider the prevalence of infection in the communities they serve, as well as other sociodemographic and behavioral factors that may be associated with increased risk of syphilis infection. For example, prevalence of syphilis is higher in men, men who have sex with men, persons with HIV infection, young adults, and persons with a history of incarceration, sex work, or military service…. Optimal screening frequency for persons who are at increased risk for syphilis infection is not well established. Men who have sex with men or persons with HIV infection may benefit from screening at least annually or more frequently (e.g., every 3 to 6 months) if they continue to be at high risk" (USPSTF, 2022, p. 1244-1246)."At the initial HIV care visit, providers should screen all sexually active persons for syphilis, gonorrhea, and chlamydia, and perform screening for these infections at least annually during the course of HIV care. Specific testing includes syphilis serology and [a nucleic acid amplification test] NAAT for N. gonorrhoeae and C. trachomatis at the anatomic site of exposure" (Workowski et al., 2021, p. 26).
* **Logic Definitions:**: **Guidance (Usage): **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: This eCQM is a patient-based measure. This FHIR-based measure has been derived from the QDM-based measure: CMS1188v1. Please refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html).
* **Logic Definitions:**: **Libraries: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: 
| |
| :--- |
| [HIVSTITestingFHIR](Library-HIVSTITestingFHIR.md) |

* **Logic Definitions:**: **Related Artifact Dependencies: **
  * * **Group**: 64998bd84c79454c026f7483
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Chlamydia Testing
* **Library Name**: 
  * **Name**: ````define "Has Chlamydia Testing": exists ["Observation": "Chlamydia Screening"] ChlamydiaTest where ChlamydiaTest.value is not null and QICoreCommon."Latest" ( ChlamydiaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Gonorrhea Testing
* **Library Name**: 
  * **Name**: ````define "Has Gonorrhea Testing": exists ["Observation": "Gonorrhea Screening"] GonorrheaTest where GonorrheaTest.value is not null and QICoreCommon."Latest" ( GonorrheaTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Syphilis Testing
* **Library Name**: 
  * **Name**: ````define "Has Syphilis Testing": exists ["Observation": "Syphilis Tests"] SyphilisTest where SyphilisTest.value is not null and QICoreCommon."Latest" ( SyphilisTest.effective ) during day of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "Has Chlamydia Testing" and "Has Gonorrhea Testing" and "Has Syphilis Testing"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has Qualifying Encounter During Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has Qualifying Encounter During Measurement Period": exists ( ( ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Annual Wellness Visit"] union ["Encounter": "Face-to-Face Interaction"] union ["Encounter": "Home Healthcare Services"] union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"] union ["Encounter": "Preventive Care Services, Initial Office Visit, 0 to 17"] union ["Encounter": "Preventive Care, Established Office Visit, 0 to 17"] union ["Encounter": "Telephone Visits"] union ["Encounter": "Preventive Care Services - Other"] ) QualifyingEncounter where QualifyingEncounter.period during day of "Measurement Period" )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Has HIV Diagnosis Before End of Measurement Period
* **Library Name**: 
  * **Name**: ````define "Has HIV Diagnosis Before End of Measurement Period": exists ["Condition": "HIV"] HIVDx where QICoreCommon."ToPrevalenceInterval" ( HIVDx ) starts on or before day of end of "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": AgeInYearsAt(date from start of "Measurement Period") >= 13 and "Has Qualifying Encounter During Measurement Period" and "Has HIV Diagnosis Before End of Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: HIVSTITestingFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: Latest
* **Library Name**: 
  * **Name**: ````/* @description: Given an interval, returns the ending point if the interval has an ending boundary specified, otherwise, returns the starting point @deprecated: This function is deprecated. Use the fluent function `latest()` instead */ define function "Latest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ): (choice.toInterval()) period return if (HasEnd(period)) then end of period else start of period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: toInterval
* **Library Name**: 
  * **Name**: ````/* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in QICore, allowing this function to be used across any resource. The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime. If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age, and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later. If the input is a DateTime Interval, the result is the input. If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending immediately before one year later than the date the patient turned the age given as the end of the quantity interval. Any other input will reslt in a null DateTime Interval */ define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>): case when choice is DateTime then Interval[choice as DateTime, choice as DateTime] when choice is Interval<DateTime> then choice as Interval<DateTime> when choice is Quantity then Interval[Patient.birthDate + (choice as Quantity), Patient.birthDate + (choice as Quantity) + 1 year) when choice is Interval<Quantity> then Interval[Patient.birthDate + (choice.low as Quantity), Patient.birthDate + (choice.high as Quantity) + 1 year) else null as Interval<DateTime> end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: ToPrevalenceInterval
* **Library Name**: 
  * **Name**: ````/* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))````: * [FHIRHelpers](Library-FHIRHelpers.md) version: 4.3.000
* [QICoreCommon](Library-QICoreCommon.md) version: 1.5.000
* [Chlamydia Screening](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.110.12.1052/expansion)
* [Gonorrhea Screening](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1258.1-20250208)
* [Syphilis Tests](https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1166.117-20230708)
* [Office Visit](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1001/expansion)
* [Outpatient Consultation](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1008/expansion)
* [Annual Wellness Visit](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.1240/expansion)
* [Face-to-Face Interaction](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1048/expansion)
* [Home Healthcare Services](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1016/expansion)
* [Preventive Care Services - Established Office Visit, 18 and Up](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1025/expansion)
* [Preventive Care Services-Initial Office Visit, 18 and Up](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1023/expansion)
* [Preventive Care Services, Initial Office Visit, 0 to 17](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1022/expansion)
* [Preventive Care, Established Office Visit, 0 to 17](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1024/expansion)
* [Telephone Visits](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1080/expansion)
* [Preventive Care Services - Other](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.11.1150/expansion)
* [HIV](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.120.12.1003/expansion)


                                 ]( https://www.hrsa.gov/) |



## Resource Content

```json
{
  "resourceType" : "Measure",
  "id" : "HIVSTITestingFHIR",
  "meta" : {
    "profile" : ["http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm",
    "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/publishable-measure-cqfm",
    "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/executable-measure-cqfm"]
  },
  "contained" : [{
    "resourceType" : "Library",
    "id" : "effective-data-requirements",
    "extension" : [{
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Has Chlamydia Testing"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Has Chlamydia Testing\":\n  exists [\"Observation\": \"Chlamydia Screening\"] ChlamydiaTest\n    where ChlamydiaTest.value is not null\n      and QICoreCommon.\"Latest\" ( ChlamydiaTest.effective ) during day of \"Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 0
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Has Gonorrhea Testing"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Has Gonorrhea Testing\":\n  exists [\"Observation\": \"Gonorrhea Screening\"] GonorrheaTest\n    where GonorrheaTest.value is not null\n      and QICoreCommon.\"Latest\" ( GonorrheaTest.effective ) during day of \"Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 1
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Has Syphilis Testing"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Has Syphilis Testing\":\n  exists [\"Observation\": \"Syphilis Tests\"] SyphilisTest\n    where SyphilisTest.value is not null\n      and QICoreCommon.\"Latest\" ( SyphilisTest.effective ) during day of \"Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 2
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Numerator"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Numerator\":\n  \"Has Chlamydia Testing\"\n    and \"Has Gonorrhea Testing\"\n    and \"Has Syphilis Testing\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 3
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Has Qualifying Encounter During Measurement Period"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Has Qualifying Encounter During Measurement Period\":\n  exists ( ( [\"Encounter\": \"Office Visit\"]\n      union [\"Encounter\": \"Outpatient Consultation\"]\n      union [\"Encounter\": \"Annual Wellness Visit\"]\n      union [\"Encounter\": \"Face-to-Face Interaction\"]\n      union [\"Encounter\": \"Home Healthcare Services\"]\n      union [\"Encounter\": \"Preventive Care Services Established Office Visit, 18 and Up\"]\n      union [\"Encounter\": \"Preventive Care Services Initial Office Visit, 18 and Up\"]\n      union [\"Encounter\": \"Preventive Care Services, Initial Office Visit, 0 to 17\"]\n      union [\"Encounter\": \"Preventive Care, Established Office Visit, 0 to 17\"]\n      union [\"Encounter\": \"Telephone Visits\"]\n      union [\"Encounter\": \"Preventive Care Services - Other\"] ) QualifyingEncounter\n      where QualifyingEncounter.period during day of \"Measurement Period\"\n  )"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 4
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Has HIV Diagnosis Before End of Measurement Period"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Has HIV Diagnosis Before End of Measurement Period\":\n  exists [\"Condition\": \"HIV\"] HIVDx\n    where QICoreCommon.\"ToPrevalenceInterval\" ( HIVDx ) starts on or before day of end of \"Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 5
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Initial Population"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Initial Population\":\n  AgeInYearsAt(date from start of \"Measurement Period\") >= 13\n    and \"Has Qualifying Encounter During Measurement Period\"\n    and \"Has HIV Diagnosis Before End of Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 6
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "HIVSTITestingFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Denominator"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Denominator\":\n  \"Initial Population\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 7
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "QICoreCommon"
      },
      {
        "url" : "name",
        "valueString" : "Latest"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Given an interval, returns the ending point if the interval has an ending boundary specified,\notherwise, returns the starting point\n@deprecated: This function is deprecated. Use the fluent function `latest()` instead\n*/\ndefine function \"Latest\"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):\n  (choice.toInterval()) period\n    return\n      if (HasEnd(period)) then end of period\n      else start of period"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 8
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "QICoreCommon"
      },
      {
        "url" : "name",
        "valueString" : "toInterval"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nAny other input will reslt in a null DateTime Interval\n*/\ndefine fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval<DateTime> then\n  \t\tchoice as Interval<DateTime>\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval<Quantity> then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\telse\n\t\t\tnull as Interval<DateTime>\n\tend"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 9
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "QICoreCommon"
      },
      {
        "url" : "name",
        "valueString" : "ToPrevalenceInterval"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Returns an interval representing the normalized prevalence period of a given Condition.\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from\nonset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have\na closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.\n@deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead\n*/\ndefine function ToPrevalenceInterval(condition Condition):\nif condition.clinicalStatus ~ \"active\"\n  or condition.clinicalStatus ~ \"recurrence\"\n  or condition.clinicalStatus ~ \"relapse\" then\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]\nelse\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 10
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    }],
    "status" : "active",
    "type" : {
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "module-definition"
      }]
    },
    "relatedArtifact" : [{
      "type" : "depends-on",
      "display" : "Library FHIRHelpers",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/FHIRHelpers|4.3.000"
    },
    {
      "type" : "depends-on",
      "display" : "Library QICoreCommon",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/QICoreCommon|1.5.000"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Chlamydia Screening",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1052"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Gonorrhea Screening",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1258.1"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Syphilis Tests",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1166.117"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Office Visit",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Outpatient Consultation",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Annual Wellness Visit",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1240"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Face-to-Face Interaction",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1048"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Home Healthcare Services",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1016"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Preventive Care Services Established Office Visit, 18 and Up",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1025"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Preventive Care Services Initial Office Visit, 18 and Up",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1023"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Preventive Care Services, Initial Office Visit, 0 to 17",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1022"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Preventive Care, Established Office Visit, 0 to 17",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1024"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Telephone Visits",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Preventive Care Services - Other",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.11.1150"
    },
    {
      "type" : "depends-on",
      "display" : "Value set HIV",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.120.12.1003"
    }],
    "parameter" : [{
      "name" : "Measurement Period",
      "use" : "in",
      "min" : 0,
      "max" : "1",
      "type" : "Period"
    },
    {
      "name" : "Numerator",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "boolean"
    },
    {
      "name" : "Denominator",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "boolean"
    },
    {
      "name" : "Initial Population",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "boolean"
    }],
    "dataRequirement" : [{
      "type" : "Patient",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient"]
    },
    {
      "type" : "Observation",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"],
      "mustSupport" : ["code", "value", "effective"],
      "codeFilter" : [{
        "path" : "code",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1052"
      }]
    },
    {
      "type" : "Observation",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"],
      "mustSupport" : ["code", "value", "effective"],
      "codeFilter" : [{
        "path" : "code",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1258.1"
      }]
    },
    {
      "type" : "Observation",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"],
      "mustSupport" : ["code", "value", "effective"],
      "codeFilter" : [{
        "path" : "code",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1166.117"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1240"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1048"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1016"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1025"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1023"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1022"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1024"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.11.1150"
      }]
    },
    {
      "type" : "Condition",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition"],
      "mustSupport" : ["code"],
      "codeFilter" : [{
        "path" : "code",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.120.12.1003"
      }]
    }]
  }],
  "extension" : [{
    "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem",
    "valueReference" : {
      "reference" : "Device/cqf-tooling"
    }
  },
  {
    "id" : "effective-data-requirements",
    "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements",
    "valueReference" : {
      "reference" : "#effective-data-requirements"
    }
  }],
  "url" : "http://ecqi.healthit.gov/ecqms/Measure/HIVSTITestingFHIR",
  "identifier" : [{
    "use" : "usual",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "short-name"
      }]
    },
    "system" : "https://madie.cms.gov/measure/shortName",
    "value" : "CMS1188FHIR"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "version-independent"
      }]
    },
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:uuid:6f66ca77-1a2c-489c-b0d8-730da6e5a763"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "version-specific"
      }]
    },
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:uuid:2c92808287dd6f640188b07c4a8a1f35"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "publisher"
      }]
    },
    "system" : "https://madie.cms.gov/measure/cmsId",
    "value" : "1188FHIR",
    "assigner" : {
      "display" : "CMS"
    }
  }],
  "version" : "0.1.000",
  "name" : "HIVSTITestingFHIR",
  "title" : "Sexually Transmitted Infection (STI) Testing for People with HIVFHIR",
  "status" : "draft",
  "experimental" : false,
  "date" : "2023-10-27T08:12:32+00:00",
  "publisher" : "Health Resources & Services Administration",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : " https://www.hrsa.gov/"
    }]
  }],
  "description" : "Percentage of patients 13 years of age and older with a diagnosis of HIV who had tests for syphilis, gonorrhea, and chlamydia performed within the measurement period",
  "useContext" : [{
    "code" : {
      "system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
      "code" : "program"
    },
    "valueCodeableConcept" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/quality-programs",
        "code" : "ep-ec",
        "display" : "EP/EC"
      }]
    }
  }],
  "purpose" : "UNKNOWN",
  "usage" : "This eCQM is a patient-based measure.\n\nThis FHIR-based measure has been derived from the QDM-based measure: CMS1188v1.\n\nPlease refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html).",
  "copyright" : "This measure was developed by the Health Resources & Services Administration (HRSA) of the U.S. Department of Health & Human Services (HHS). It is in the public domain.\n \nCitation of HRSA as the source of the original measure is appreciated. Any modified versions may not be represented as approved, endorsed, or authorized by HRSA or HHS. 42 U.S.C. Section 1320b-10. Users of modified versions should clearly explain how they deviate from HRSA's original measure.\n\nLimited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. \n\nCPT(R) contained in the Measure specifications is copyright 2004-2022 American Medical Association. LOINC(R) is copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 is copyright 2022 World Health Organization. All Rights Reserved.\n\nDue to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].",
  "approvalDate" : "2023-08-11",
  "lastReviewDate" : "2023-08-11",
  "effectivePeriod" : {
    "start" : "2024-01-01",
    "end" : "2024-12-31"
  },
  "author" : [{
    "name" : "Health Resources & Services Administration",
    "telecom" : [{
      "system" : "url",
      "value" : " https://www.hrsa.gov/"
    }]
  }],
  "library" : ["http://ecqi.healthit.gov/ecqms/Library/HIVSTITestingFHIR"],
  "disclaimer" : "These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications.\n\nTHE MEASURES AND SPECIFICATIONS ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND.\n\nDue to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].",
  "rationale" : "The rates of syphilis, gonorrhea, and chlamydia cases per 100,000 in the United States have steadily risen over the last decade and increased 11.2%, 5.9%, and 2.8%, respectively, from 2018 to 2019 (DHHS, 2021). People with HIV are at an increased risk of bacterial sexually transmitted infections (STIs), including chlamydia, gonorrhea, and syphilis (CDC, 2004). However, early detection and treatment of bacterial STIs in people with HIV can lead to a reduction in HIV transmission (CDC, 2004). Despite guidelines for at least annual screening among sexually active persons with HIV, only an estimated 55% received a syphilis test in the past year, 23% received a gonorrhea test in the past year, and 24% received a chlamydia test in the past year based on a nationally-representative survey of adults with HIV receiving medical care in the United States (Flagg et al., 2015). This measure will help providers focus their attention and quality improvement efforts towards testing and treating sexually transmitted infections in patients with HIV, thus reducing the complications to long-term syphilis infection and reducing STI incidence (Patel et al., 2012).",
  "clinicalRecommendationStatement" : "\"Routine serologic screening for syphilis is recommended at least annually for all persons with HIV infection who are sexually active, with more frequent screening (i.e., every 3-6 months) for those who have multiple or anonymous partners\" (Panel on Opportunistic Infections in Adults and Adolescents with HIV, 2022, p. Y-3).\n\n\"Patients undergoing screening or treatment for syphilis also should be evaluated for other sexually transmitted diseases such as chlamydia and gonorrhea at anatomic sites of exposure in men and for chlamydia, gonorrhea, and trichomonas in women\" (Panel on Opportunistic Infections in Adults and Adolescents with HIV, 2022, p. Y-3).\n\n\"The USPSTF recommends screening for syphilis in persons who are at increased risk for infection. When deciding which persons to screen for syphilis, clinicians should consider the prevalence of infection in the communities they serve, as well as other sociodemographic and behavioral factors that may be associated with increased risk of syphilis infection. For example, prevalence of syphilis is higher in men, men who have sex with men, persons with HIV infection, young adults, and persons with a history of incarceration, sex work, or military service…. Optimal screening frequency for persons who are at increased risk for syphilis infection is not well established. Men who have sex with men or persons with HIV infection may benefit from screening at least annually or more frequently (e.g., every 3 to 6 months) if they continue to be at high risk\" (USPSTF, 2022, p. 1244-1246).\n\n\"At the initial HIV care visit, providers should screen all sexually active persons for syphilis, gonorrhea, and chlamydia, and perform screening for these infections at least annually during the course of HIV care. Specific testing includes syphilis serology and [a nucleic acid amplification test] NAAT for N. gonorrhoeae and C. trachomatis at the anatomic site of exposure\" (Workowski et al., 2021, p. 26).",
  "group" : [{
    "id" : "64998bd84c79454c026f7483",
    "extension" : [{
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring",
      "valueCodeableConcept" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-scoring",
          "code" : "proportion",
          "display" : "Proportion"
        }]
      }
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
      "valueCode" : "boolean"
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type",
      "valueCodeableConcept" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-type",
          "code" : "process",
          "display" : "Process"
        }]
      }
    }],
    "population" : [{
      "id" : "250DDEF3-2C5A-44DA-BFB9-69734554ACF4",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "initial-population",
          "display" : "Initial Population"
        }]
      },
      "description" : "All patients 13 years of age and older at the start of the measurement period with a diagnosis of HIV before the end of the measurement period with an eligible encounter during the measurement period",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Initial Population"
      }
    },
    {
      "id" : "10249168-FCAB-4E5C-AE8E-3D94C9E5BEE7",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator",
          "display" : "Denominator"
        }]
      },
      "description" : "Equals Initial Population",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Denominator"
      }
    },
    {
      "id" : "5e85b046-832f-4cea-9d3c-f7d35dda4faf",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator-exclusion",
          "display" : "Denominator Exclusion"
        }]
      },
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    },
    {
      "id" : "3C47B2A0-999A-43F1-AF6E-359AC843FD67",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "numerator",
          "display" : "Numerator"
        }]
      },
      "description" : "Patients who were tested for each of the following at least once during the measurement period: syphilis, gonorrhea, and chlamydia",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Numerator"
      }
    },
    {
      "id" : "192f31c2-58e6-4192-8d4d-eb0dc07a1cfd",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "numerator-exclusion",
          "display" : "Numerator Exclusion"
        }]
      },
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    },
    {
      "id" : "3e946d98-08c5-4a41-a3fc-cba39eaabda7",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator-exception",
          "display" : "Denominator Exception"
        }]
      },
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    }]
  }]
}

```
