dQM QICore Content Implementation Guide
2025.0.0 - CI Build

dQM QICore Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2025.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-qicore-2025/ and changes regularly. See the Directory of published versions

Library: CMS56FHIRFuncStatHipReplacement

Official URL: https://madie.cms.gov/Library/CMS56FHIRFuncStatHipReplacement Version: 1.0.000
Active as of 2025-08-20 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: CMS56FHIRFuncStatHipReplacement
Other Identifiers: https://madie.cms.gov/login#CMS56FHIRFuncStatHipReplacement (use: official, )

CMS56FHIRFuncStatHipReplacement

Metadata
Title CMS56FHIRFuncStatHipReplacement
Version 1.0.000
Identifier CMS56FHIRFuncStatHipReplacement
Steward (Publisher) Centers for Medicare & Medicaid Services (CMS)
Description

CMS56FHIRFuncStatHipReplacement

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameter Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Patient
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Resource
Parameter Name: SDE Ethnicity
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Resource
Parameter Name: SDE Payer
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Resource
Parameter Name: SDE Race
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Resource
Parameter Name: SDE Sex
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: August 1 Year Prior to the Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: dateTime
Parameter Name: Has Qualifying Encounter
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: November 1 Two Years Prior to the Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: dateTime
Parameter Name: October 31 Year Prior to the Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: dateTime
Parameter Name: Total Hip Arthroplasty Procedure
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Resource
Parameter Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Severe Cognitive Impairment
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Total Hip Arthroplasty with 1 or More Lower Body Fractures
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Partial Hip Arthroplasty Procedure
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Revision Hip Arthroplasty Procedure or Implanted Device or Prosthesis Removal Procedure
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Malignant Neoplasm of Lower and Unspecified Limbs
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has Mechanical Complication
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Has More Than One Elective Primary Total Hip Arthroplasty Performed
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Death Within 300 Days of the THA Procedure
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator Exclusions
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Date HOOS Total Assessment Completed
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: date
Parameter Name: Has THA with Initial and Follow Up HOOS Assessments
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Date HOOSJr Total Assessment Completed
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: date
Parameter Name: Has THA with Initial and Follow Up HOOSJr Assessments
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Date PROMIS10 Total Assessment Completed
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: date
Parameter Name: Has THA with Initial and Follow Up PROMIS10 Assessments
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Date VR12 Oblique Total Assessment Completed
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: date
Parameter Name: Has THA with Initial and Follow Up VR12 Oblique Assessments
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Date VR12 Orthogonal Total Assessment Completed
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: date
Parameter Name: Has THA with Initial and Follow Up VR12 Orthogonal Assessments
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Numerator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Data Requirement Type: Patient
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Must Support Elements: code
Code Filter(s):
Path: code
Code(s): SNOMED CT 702956004: Severe cognitive impairment (finding)
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
Code(s): SNOMED CT 702956004: Severe cognitive impairment (finding)
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1178
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1178
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code, performed
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1184
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code, performed
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1189
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1180
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1180
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1182
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1182
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code, id, id.value, performed
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1006
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code, performed, id, id.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1006
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72093-8: Quality of life score [HOOS]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72094-6: Sport-recreation score [HOOS]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72095-3: Activities of daily living score [HOOS]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72096-1: Symptoms score [HOOS]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72097-9: Pain score [HOOS]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code
Code Filter(s):
Path: code
Code(s): LOINC 82323-7: Total interval score [HOOSJR]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 82323-7: Total interval score [HOOSJR]
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 71969-0: PROMIS-10 Global Mental Health (GMH) score T-score
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 71971-6: PROMIS-10 Global Physical Health (GPH) score T-score
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72026-8: VR-12 Mental component summary (MCS) score - oblique method T-score
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72025-0: VR-12 Physical component summary (PCS) score - oblique method T-score
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72028-4: VR-12 Mental component summary (MCS) score - orthogonal method T-score
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment
Must Support Elements: code, effective
Code Filter(s):
Path: code
Code(s): LOINC 72027-6: VR-12 Physical component summary (PCS) score - orthogonal method T-score
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code, performed
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1006
Library Content
CQL Content
library CMS56FHIRFuncStatHipReplacement version '1.0.000'

using QICore version '6.0.0'

include FHIRHelpers version '4.4.000' called FHIRHelpers
include QICoreCommon version '4.0.000' called QICoreCommon
include SupplementalDataElements version '5.1.000' called SDE
include Hospice version '6.18.000' called Hospice
include Status version '1.15.000' called Status

codesystem "LOINC": 'http://loinc.org'
codesystem "CPT": 'http://www.ama-assn.org/go/cpt'
codesystem "SNOMEDCT": 'http://snomed.info/sct'

valueset "Lower Body Fractures Excluding Ankle and Foot": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1178'
valueset "Malignant Neoplasms of Lower and Unspecified Limbs": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1180'
valueset "Mechanical Complications Excluding Upper Body": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1182'
valueset "Office Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001'
valueset "Virtual Encounter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089'
valueset "Outpatient Consultation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008'
valueset "Partial Arthroplasty of Hip": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1184'
valueset "Primary THA Procedure": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1006'
valueset "Removal, Revision and Supplement Procedures of the Lower Body and Spine": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1189'
valueset "Telephone Visits": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080'

code "Activities of daily living score [HOOS]": '72095-3' from "LOINC" display 'Activities of daily living score [HOOS]'
code "Dead (finding)": '419099009' from "SNOMEDCT" display 'Dead (finding)'
code "Pain score [HOOS]": '72097-9' from "LOINC" display 'Pain score [HOOS]'
code "Postoperative follow-up visit, normally included in the surgical package, to indicate that an evaluation and management service was performed during a postoperative period for a reason(s) related to the original procedure": '99024' from "CPT" display 'Postoperative follow-up visit, normally included in the surgical package, to indicate that an evaluation and management service was performed during a postoperative period for a reason(s) related to the original procedure'
code "PROMIS-10 Global Mental Health (GMH) score T-score": '71969-0' from "LOINC" display 'PROMIS-10 Global Mental Health (GMH) score T-score'
code "PROMIS-10 Global Physical Health (GPH) score T-score": '71971-6' from "LOINC" display 'PROMIS-10 Global Physical Health (GPH) score T-score'
code "Quality of life score [HOOS]": '72093-8' from "LOINC" display 'Quality of life score [HOOS]'
code "Severe cognitive impairment (finding)": '702956004' from "SNOMEDCT" display 'Severe cognitive impairment (finding)'
code "Sport-recreation score [HOOS]": '72094-6' from "LOINC" display 'Sport-recreation score [HOOS]'
code "Symptoms score [HOOS]": '72096-1' from "LOINC" display 'Symptoms score [HOOS]'
code "Total interval score [HOOSJR]": '82323-7' from "LOINC" display 'Total interval score [HOOSJR]'
code "VR-12 Mental component summary (MCS) score - oblique method T-score": '72026-8' from "LOINC" display 'VR-12 Mental component summary (MCS) score - oblique method T-score'
code "VR-12 Mental component summary (MCS) score - orthogonal method T-score": '72028-4' from "LOINC" display 'VR-12 Mental component summary (MCS) score - orthogonal method T-score'
code "VR-12 Physical component summary (PCS) score - oblique method T-score": '72025-0' from "LOINC" display 'VR-12 Physical component summary (PCS) score - oblique method T-score'
code "VR-12 Physical component summary (PCS) score - orthogonal method T-score": '72027-6' from "LOINC" display 'VR-12 Physical component summary (PCS) score - orthogonal method T-score'

parameter "Measurement Period" Interval<DateTime>

context Patient

define "SDE Ethnicity":
  SDE."SDE Ethnicity"

define "SDE Payer":
  SDE."SDE Payer"

define "SDE Race":
  SDE."SDE Race"

define "SDE Sex":
  SDE."SDE Sex"

define "Initial Population":
  "Has Qualifying Encounter"
    and exists ( "Total Hip Arthroplasty Procedure" )
    and AgeInYearsAt(date from start of "Measurement Period") >= 19

define "Has Qualifying Encounter":
  exists ( ( ( [Encounter: "Outpatient Consultation"]
        union [Encounter: "Office Visit"]
        union ( [Encounter] E
            where exists ( ( E.type ) T
                where T ~ "Postoperative follow-up visit, normally included in the surgical package, to indicate that an evaluation and management service was performed during a postoperative period for a reason(s) related to the original procedure"
            )
        )
        union [Encounter: "Telephone Visits"]
        union [Encounter: "Virtual Encounter"]
    ).isEncounterPerformed ( ) ) ValidEncounters
      where ValidEncounters.period during day of Interval["August 1 Year Prior to the Measurement Period", end of "Measurement Period"]
  )

define "August 1 Year Prior to the Measurement Period":
  DateTime((year from start of "Measurement Period" - 1), 8, 1, 0, 0, 0, 0, 0)

define "Total Hip Arthroplasty Procedure":
  ( ( [Procedure: "Primary THA Procedure"] ).isProcedurePerformed ( ) ) THAProcedure
    where THAProcedure.performed.toInterval ( ) starts during day of Interval["November 1 Two Years Prior to the Measurement Period", "October 31 Year Prior to the Measurement Period"]

define "November 1 Two Years Prior to the Measurement Period":
  DateTime((year from start of "Measurement Period" - 2), 11, 1, 0, 0, 0, 0, 0)

define "October 31 Year Prior to the Measurement Period":
  DateTime((year from start of "Measurement Period" - 1), 10, 31, 23, 59, 59, 999, 0)

define "Denominator":
  "Initial Population"

define "Denominator Exclusions":
  Hospice."Has Hospice Services"
    or "Has Severe Cognitive Impairment"
    or "Has Total Hip Arthroplasty with 1 or More Lower Body Fractures"
    or "Has Partial Hip Arthroplasty Procedure"
    or "Has Revision Hip Arthroplasty Procedure or Implanted Device or Prosthesis Removal Procedure"
    or "Has Malignant Neoplasm of Lower and Unspecified Limbs"
    or "Has Mechanical Complication"
    or "Has More Than One Elective Primary Total Hip Arthroplasty Performed"
    or "Death Within 300 Days of the THA Procedure"

define "Has Severe Cognitive Impairment":
  exists ( [ConditionProblemsHealthConcerns: "Severe cognitive impairment (finding)"]
    union [ConditionEncounterDiagnosis: "Severe cognitive impairment (finding)"] ) Dementia
    where Dementia.prevalenceInterval ( ) overlaps day of "Measurement Period"

define "Has Total Hip Arthroplasty with 1 or More Lower Body Fractures":
  exists ( "Total Hip Arthroplasty Procedure" THAProcedure
      with ( [ConditionEncounterDiagnosis: "Lower Body Fractures Excluding Ankle and Foot"]
        union [ConditionProblemsHealthConcerns: "Lower Body Fractures Excluding Ankle and Foot"] ) LowerBodyFracture
        such that LowerBodyFracture.prevalenceInterval ( ) starts 48 hours or less on or before start of THAProcedure.performed.toInterval ( )
          and LowerBodyFracture.isVerified ( )
  )

define "Has Partial Hip Arthroplasty Procedure":
  exists ( ( ( [Procedure: "Partial Arthroplasty of Hip"] ).isProcedurePerformed ( ) ) PartialTHAProcedure
      with "Total Hip Arthroplasty Procedure" THAProcedure
        such that PartialTHAProcedure.performed.toInterval ( ) during day of THAProcedure.performed.toInterval ( )
  )

define "Has Revision Hip Arthroplasty Procedure or Implanted Device or Prosthesis Removal Procedure":
  exists ( "Total Hip Arthroplasty Procedure" THAProcedure
      with ( ( [Procedure: "Removal, Revision and Supplement Procedures of the Lower Body and Spine"] ).isProcedurePerformed ( ) ) RevisionTHAProcedure
        such that RevisionTHAProcedure.performed.toInterval ( ) during day of THAProcedure.performed.toInterval ( )
  )

define "Has Malignant Neoplasm of Lower and Unspecified Limbs":
  exists ( ( [ConditionProblemsHealthConcerns: "Malignant Neoplasms of Lower and Unspecified Limbs"]
      union [ConditionEncounterDiagnosis: "Malignant Neoplasms of Lower and Unspecified Limbs"] ) MalignantNeoplasm
      with "Total Hip Arthroplasty Procedure" THAProcedure
        such that MalignantNeoplasm.prevalenceInterval ( ) overlaps day of THAProcedure.performed.toInterval ( )
          and MalignantNeoplasm.isVerified ( )
  )

define "Has Mechanical Complication":
  exists ( ( [ConditionEncounterDiagnosis: "Mechanical Complications Excluding Upper Body"]
      union [ConditionProblemsHealthConcerns: "Mechanical Complications Excluding Upper Body"] ) MechanicalComplications
      with "Total Hip Arthroplasty Procedure" THAProcedure
        such that MechanicalComplications.prevalenceInterval ( ) overlaps day of THAProcedure.performed.toInterval ( )
          and MechanicalComplications.isVerified ( )
  )

define "Has More Than One Elective Primary Total Hip Arthroplasty Performed":
  exists ( "Total Hip Arthroplasty Procedure" THAProcedure
      with ( ( [Procedure: "Primary THA Procedure"] ).isProcedurePerformed ( ) ) ElectiveTHAProcedure
        such that THAProcedure.id !~ ElectiveTHAProcedure.id
          and start of ElectiveTHAProcedure.performed.toInterval ( ) during day of Interval[( start of THAProcedure.performed.toInterval ( ) ) - 1 year, ( start of THAProcedure.performed.toInterval ( ) ) + 1 year]
  )

define "Death Within 300 Days of the THA Procedure":
  exists "Total Hip Arthroplasty Procedure" THAProcedure
    where date from Patient.deceased during day of Interval[date from start of THAProcedure.performed.toInterval ( ), date from start of THAProcedure.performed.toInterval ( ) + 300 days]

define "Numerator":
  ( "Has THA with Initial and Follow Up HOOS Assessments" )
    or ( "Has THA with Initial and Follow Up HOOSJr Assessments" )
    or ( "Has THA with Initial and Follow Up PROMIS10 Assessments" )
    or ( "Has THA with Initial and Follow Up VR12 Oblique Assessments" )
    or ( "Has THA with Initial and Follow Up VR12 Orthogonal Assessments" )

define "Has THA with Initial and Follow Up HOOS Assessments":
  exists ( ( "Total Hip Arthroplasty Procedure" THAProcedure
      return THAProcedure.performed.toInterval ( ) ) TotalHip
      with "Date HOOS Total Assessment Completed" InitialHipAssessmentHOOS
        such that TotalHip starts 90 days or less on or after day of InitialHipAssessmentHOOS
      with "Date HOOS Total Assessment Completed" FollowUpHipAssessmentHOOS
        such that date from FollowUpHipAssessmentHOOS during day of Interval[date from end of TotalHip + 300 days, date from end of TotalHip + 425 days]
  )

define "Date HOOS Total Assessment Completed":
  from
    ( ( [ObservationScreeningAssessment: "Quality of life score [HOOS]"] ).isAssessmentPerformed ( ) ) HOOSLifeQuality,
    ( ( [ObservationScreeningAssessment: "Sport-recreation score [HOOS]"] ).isAssessmentPerformed ( ) ) HOOSSport,
    ( ( [ObservationScreeningAssessment: "Activities of daily living score [HOOS]"] ).isAssessmentPerformed ( ) ) HOOSActivityScore,
    ( ( [ObservationScreeningAssessment: "Symptoms score [HOOS]"] ).isAssessmentPerformed ( ) ) HOOSSymptoms,
    ( ( [ObservationScreeningAssessment: "Pain score [HOOS]"] ).isAssessmentPerformed ( ) ) HOOSPain
    let HOOSLifeQualityDate: date from start of HOOSLifeQuality.effective.toInterval ( ),
    HOOSSportDate: date from start of HOOSSport.effective.toInterval ( ),
    HOOSActivityScoreDate: date from start of HOOSActivityScore.effective.toInterval ( ),
    HOOSSymptomsDate: date from start of HOOSSymptoms.effective.toInterval ( ),
    HOOSPainDate: date from start of HOOSPain.effective.toInterval ( )
    where HOOSLifeQualityDate same day as HOOSSportDate
      and ( HOOSSport as ObservationScreeningAssessment ).value is not null
      and HOOSLifeQualityDate same day as HOOSActivityScoreDate
      and ( HOOSActivityScore as ObservationScreeningAssessment ).value is not null
      and HOOSLifeQualityDate same day as HOOSSymptomsDate
      and ( HOOSSymptoms as ObservationScreeningAssessment ).value is not null
      and HOOSLifeQualityDate same day as HOOSPainDate
      and ( HOOSPain as ObservationScreeningAssessment ).value is not null
      and ( HOOSLifeQuality as ObservationScreeningAssessment ).value is not null
    return Max({ HOOSLifeQualityDate, HOOSSportDate, HOOSActivityScoreDate, HOOSSymptomsDate, HOOSPainDate })

define "Has THA with Initial and Follow Up HOOSJr Assessments":
  exists ( ( "Total Hip Arthroplasty Procedure" THAProcedure
      return THAProcedure.performed.toInterval ( ) ) TotalHip
      with "Date HOOSJr Total Assessment Completed" InitialHipAssessment
        such that TotalHip starts 90 days or less on or after day of InitialHipAssessment
      with "Date HOOSJr Total Assessment Completed" FollowUpHipAssessment
        such that date from FollowUpHipAssessment during day of Interval[date from end of TotalHip + 300 days, date from end of TotalHip + 425 days]
  )

define "Date HOOSJr Total Assessment Completed":
  ( ( ( [ObservationScreeningAssessment: "Total interval score [HOOSJR]"] ).isAssessmentPerformed ( ) ) HOOSJr
    where ( HOOSJr as ObservationScreeningAssessment ).value is not null ) DocumentedHOOSJr
    return date from start of DocumentedHOOSJr.effective.toInterval ( )

define "Has THA with Initial and Follow Up PROMIS10 Assessments":
  exists ( ( "Total Hip Arthroplasty Procedure" THAProcedure
      return THAProcedure.performed.toInterval ( ) ) TotalHip
      with "Date PROMIS10 Total Assessment Completed" InitialHipAssessmentPROMIS10
        such that TotalHip starts 90 days or less on or after day of InitialHipAssessmentPROMIS10
      with "Date PROMIS10 Total Assessment Completed" FollowUpHipAssessmentPROMIS10
        such that date from FollowUpHipAssessmentPROMIS10 during day of Interval[date from end of TotalHip + 300 days, date from end of TotalHip + 425 days]
  )

define "Date PROMIS10 Total Assessment Completed":
  from
    ( ( [ObservationScreeningAssessment: "PROMIS-10 Global Mental Health (GMH) score T-score"] ).isAssessmentPerformed ( ) ) PROMIS10MentalScore,
    ( ( [ObservationScreeningAssessment: "PROMIS-10 Global Physical Health (GPH) score T-score"] ).isAssessmentPerformed ( ) ) PROMIS10PhysicalScore
    let PROMIS10MentalScoreDate: date from start of PROMIS10MentalScore.effective.toInterval ( ),
    PROMIS10PhysicalScoreDate: date from start of PROMIS10PhysicalScore.effective.toInterval ( )
    where PROMIS10MentalScoreDate same day as PROMIS10PhysicalScoreDate
      and ( PROMIS10PhysicalScore as ObservationScreeningAssessment ).value is not null
      and ( PROMIS10MentalScore as ObservationScreeningAssessment ).value is not null
    return Max({ PROMIS10MentalScoreDate, PROMIS10PhysicalScoreDate })

define "Has THA with Initial and Follow Up VR12 Oblique Assessments":
  exists ( ( "Total Hip Arthroplasty Procedure" THAProcedure
      return THAProcedure.performed.toInterval ( ) ) TotalHip
      with "Date VR12 Oblique Total Assessment Completed" InitialHipAssessmentOblique
        such that TotalHip starts 90 days or less on or after day of InitialHipAssessmentOblique
      with "Date VR12 Oblique Total Assessment Completed" FollowUpHipAssessmentOblique
        such that date from FollowUpHipAssessmentOblique during day of Interval[date from end of TotalHip + 300 days, date from end of TotalHip + 425 days]
  )

define "Date VR12 Oblique Total Assessment Completed":
  from
    ( ( [ObservationScreeningAssessment: "VR-12 Mental component summary (MCS) score - oblique method T-score"] ).isAssessmentPerformed ( ) ) VR12MentalAssessment,
    ( ( [ObservationScreeningAssessment: "VR-12 Physical component summary (PCS) score - oblique method T-score"] ).isAssessmentPerformed ( ) ) VR12PhysicalAssessment
    let VR12MentalAssessmentDate: date from start of VR12MentalAssessment.effective.toInterval ( ),
    VR12PhysicalAssessmentDate: date from start of VR12PhysicalAssessment.effective.toInterval ( )
    where VR12MentalAssessmentDate same day as VR12PhysicalAssessmentDate
      and ( VR12MentalAssessment as ObservationScreeningAssessment ).value is not null
      and ( VR12PhysicalAssessment as ObservationScreeningAssessment ).value is not null
    return Max({ VR12MentalAssessmentDate, VR12PhysicalAssessmentDate })

define "Has THA with Initial and Follow Up VR12 Orthogonal Assessments":
  exists ( ( "Total Hip Arthroplasty Procedure" THAProcedure
      return THAProcedure.performed.toInterval ( ) ) TotalHip
      with "Date VR12 Orthogonal Total Assessment Completed" InitialHipAssessmentOrthogonal
        such that TotalHip starts 90 days or less on or after day of InitialHipAssessmentOrthogonal
      with "Date VR12 Orthogonal Total Assessment Completed" FollowUpHipAssessmentOrthogonal
        such that date from FollowUpHipAssessmentOrthogonal during day of Interval[date from end of TotalHip + 300 days, date from end of TotalHip + 425 days]
  )

define "Date VR12 Orthogonal Total Assessment Completed":
  from
    ( ( [ObservationScreeningAssessment: "VR-12 Mental component summary (MCS) score - orthogonal method T-score"] ).isAssessmentPerformed ( ) ) VR12MentalAssessment,
    ( ( [ObservationScreeningAssessment: "VR-12 Physical component summary (PCS) score - orthogonal method T-score"] ).isAssessmentPerformed ( ) ) VR12PhysicalAssessment
    let VR12MentalAssessmentDate: date from start of VR12MentalAssessment.effective.toInterval ( ),
    VR12PhysicalAssessmentDate: date from start of VR12PhysicalAssessment.effective.toInterval ( )
    where VR12MentalAssessmentDate same day as VR12PhysicalAssessmentDate
      and ( VR12MentalAssessment as ObservationScreeningAssessment ).value is not null
      and ( VR12PhysicalAssessment as ObservationScreeningAssessment ).value is not null
    return Max({ VR12MentalAssessmentDate, VR12PhysicalAssessmentDate })
    
/*
@note: When possible, this function should be migrated to QICoreCommon.
@description: Returns true if the given Condition has a verification status of "confirmed", "unconfirmed", "provisional", or "differential"
*/


define fluent function isVerified(condition Choice<ConditionEncounterDiagnosis, ConditionProblemsHealthConcerns>):
  condition.verificationStatus is not null implies ( condition.verificationStatus ~ QICoreCommon."confirmed"
      or condition.verificationStatus ~ QICoreCommon."unconfirmed"
      or condition.verificationStatus ~ QICoreCommon."provisional"
      or condition.verificationStatus ~ QICoreCommon."differential"
  )
ELM XML Content
Encoded data (723100 characters)
ELM JSON Content
Encoded data (1504076 characters)
Generated using version 0.5.0 of the sample-content-ig Liquid templates