library DRCommunicationWithPhysicianManagingDiabetesFHIR version '0.0.003' using QICore version '4.1.1' /*This spec aligns with AU2022/PY2023 QDM version*/ include FHIRHelpers version '4.1.000' called FHIRHelpers include SupplementalDataElements version '3.1.000' called SDE include CQMCommon version '1.0.000' called CQMCommon include QICoreCommon version '1.2.000' called QICoreCommon include FHIRCommon version '4.1.000' called FHIRCommon codesystem "SNOMEDCT": 'http://snomed.info/sct' codesystem "ActCode": 'http://terminology.hl7.org/CodeSystem/v3-ActCode' valueset "Care Services in Long-Term Residential Facility": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1014' valueset "Diabetic Retinopathy": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.327' valueset "Level of Severity of Retinopathy Findings": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1283' valueset "Macular Edema Findings Present": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1320' valueset "Macular Exam": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1251' valueset "Medical Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1007' valueset "Nursing Facility Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1012' valueset "Office Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001' valueset "Ophthalmological Services": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1285' valueset "Outpatient Consultation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008' valueset "Patient Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1008' code "Healthcare professional (occupation)": '223366009' from "SNOMEDCT" display 'Healthcare professional (occupation)' code "Medical practitioner (occupation)": '158965000' from "SNOMEDCT" display 'Medical practitioner (occupation)' code "Ophthalmologist (occupation)": '422234006' from "SNOMEDCT" display 'Ophthalmologist (occupation)' code "Optometrist (occupation)": '28229004' from "SNOMEDCT" display 'Optometrist (occupation)' code "Physician (occupation)": '309343006' from "SNOMEDCT" display 'Physician (occupation)' code "virtual": 'VR' from "ActCode" display 'virtual' code "Macular edema absent (situation)": '428341000124108' from "SNOMEDCT" display 'Macular edema absent (situation)' code "AMB" : 'AMB' from "ActCode" display 'Ambulatory' parameter "Measurement Period" Interval 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": AgeInYearsAt(date from start of "Measurement Period")>= 18 and exists "Diabetic Retinopathy Encounter" define "Denominator": "Initial Population" and exists "Macular Exam Performed" define "Numerator": exists "Level of Severity of Retinopathy Findings Communicated" and ( exists "Macular Edema Absence Communicated" or exists "Macular Edema Presence Communicated" ) define "Denominator Exceptions": exists "Medical or Patient Reason for Not Communicating Level of Severity of Retinopathy" or exists "Medical or Patient Reason for Not Communicating Absence of Macular Edema" or exists "Medical or Patient Reason for Not Communicating Presence of Macular Edema" define "Qualifying Encounter During Measurement Period": ( ["Encounter": "Office Visit"] union ["Encounter": "Ophthalmological Services"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Care Services in Long-Term Residential Facility"] union ["Encounter": "Nursing Facility Visit"] ) QualifyingEncounter where QualifyingEncounter.period during "Measurement Period" and QualifyingEncounter.status = 'finished' and QualifyingEncounter.class !~ "virtual" and QualifyingEncounter.class ~ "AMB" define "Diabetic Retinopathy Encounter": "Qualifying Encounter During Measurement Period" ValidQualifyingEncounter with ["Condition": "Diabetic Retinopathy"] DiabeticRetinopathy such that QICoreCommon."ToPrevalenceInterval" ( DiabeticRetinopathy ) overlaps ValidQualifyingEncounter.period define "Macular Exam Performed": ["Observation": "Macular Exam"] MacularExam with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that QICoreCommon."ToInterval" (MacularExam.effective) during EncounterDiabeticRetinopathy.period where MacularExam.value is not null define "Results of Dilated Macular or Fundus Exam Communicated": exists "Level of Severity of Retinopathy Findings Communicated" and ( exists "Macular Edema Absence Communicated" or exists "Macular Edema Presence Communicated" ) define "Level of Severity of Retinopathy Findings Communicated": ["Communication": "Level of Severity of Retinopathy Findings"] LevelOfSeverityCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that LevelOfSeverityCommunicated.sent after start of EncounterDiabeticRetinopathy.period where LevelOfSeverityCommunicated.status = 'completed' define "Macular Edema Absence Communicated": ["Communication": "Macular edema absent (situation)"] MacularEdemaAbsentCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that MacularEdemaAbsentCommunicated.sent after start of EncounterDiabeticRetinopathy.period where MacularEdemaAbsentCommunicated.status = 'completed' define "Macular Edema Presence Communicated": ["Communication": "Macular Edema Findings Present"] MacularEdemaPresentCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that MacularEdemaPresentCommunicated.sent after start of EncounterDiabeticRetinopathy.period where MacularEdemaPresentCommunicated.status = 'completed' define "Medical or Patient Reason for Not Communicating Level of Severity of Retinopathy": [CommunicationNotDone: "Level of Severity of Retinopathy Findings"] LevelOfSeverityNotCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that LevelOfSeverityNotCommunicated.recorded during EncounterDiabeticRetinopathy.period where ( LevelOfSeverityNotCommunicated.statusReason in "Medical Reason" or LevelOfSeverityNotCommunicated.statusReason in "Patient Reason" ) define "Medical or Patient Reason for Not Communicating Presence of Macular Edema": [CommunicationNotDone: "Macular Edema Findings Present"] MacularEdemaPresentNotCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that MacularEdemaPresentNotCommunicated.recorded during EncounterDiabeticRetinopathy.period where ( MacularEdemaPresentNotCommunicated.statusReason in "Medical Reason" or MacularEdemaPresentNotCommunicated.statusReason in "Patient Reason" ) define "Medical or Patient Reason for Not Communicating Absence of Macular Edema": [CommunicationNotDone] MacularEdemaAbsentNotCommunicated with "Diabetic Retinopathy Encounter" EncounterDiabeticRetinopathy such that MacularEdemaAbsentNotCommunicated.recorded during EncounterDiabeticRetinopathy.period where ( MacularEdemaAbsentNotCommunicated.reasonCode = "Macular edema absent (situation)" or "Macular edema absent (situation)" in MacularEdemaAbsentNotCommunicated.reasonCode) and (MacularEdemaAbsentNotCommunicated.statusReason in "Medical Reason" or MacularEdemaAbsentNotCommunicated.statusReason in "Patient Reason") /*https://oncprojectracking.healthit.gov/support/browse/BONNIEMAT-1420*/