BGPMUGD8 ; IHS/MSC/MMT - MU EP measures NQF0088 ;09-Sep-2011 11:26;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Delimited output reports for this measure
EDEMA ;EP
D P1
K ^TMP("BGPMU0088",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
N PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
S STRING1=$$NUM88("C")
S STRING2=$$NUM88("P")
S STRING3=$$NUM88("B")
D SUMMARY1^BGPMUGP8(STRING1,STRING2,STRING3)
;population
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5) S PRD1=$FN(PRD1,",+",1)
S PRD2=$P(STRING1,U,6)-$P(STRING2,U,6) S PRD2=$FN(PRD2,",+",1)
S PRD3=$P(STRING1,U,7)-$P(STRING2,U,7) S PRD3=$FN(PRD3,",+",1)
S PRD7=$P(STRING1,U,9)-$P(STRING2,U,9) S PRD7=$FN(PRD7,",+",1)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5) S PRN1=$FN(PRN1,",+",1)
S PRN2=$P(STRING1,U,6)-$P(STRING3,U,6) S PRN2=$FN(PRN2,",+",1)
S PRN3=$P(STRING1,U,7)-$P(STRING3,U,7) S PRN3=$FN(PRN3,",+",1)
S PRN7=$P(STRING1,U,9)-$P(STRING3,U,9) S PRN7=$FN(PRN7,",+",1)
S X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
D S^BGPMUDEL(X,2,1)
S X="Pts 18+ w/diabetic retinopathy"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1)
D S^BGPMUDEL(X,1,1)
S X="# Excluded (Exc)"_U_$P(STRING1,U,4)_U_U_$P(STRING2,U,4)_U_U_U_$P(STRING3,U,4)
D S^BGPMUDEL(X,1,1)
S X="Pts 18+ w/diabetic retinopathy less Exc"_U_$P(STRING1,U,3)_U_U_$P(STRING2,U,3)_U_U_U_$P(STRING3,U,3)
D S^BGPMUDEL(X,1,1)
S X="# w/macular or fundus exam"_U_$P(STRING1,U,2)_U_$J($P(STRING1,U,5),5,1)_U_$P(STRING2,U,2)_U_$J($P(STRING2,U,5),5,1)_U_$FN(PRD1,",+",1)_U_$P(STRING3,U,2)_U_$J($P(STRING3,U,5),5,1)_U_$FN(PRN1,",+",1)
D S^BGPMUDEL(X,2,1)
S X="w/macular edema and severity"
D S^BGPMUDEL(X,1,1)
S X="of retinopathy findings"
D S^BGPMUDEL(X,1,1)
S X="# w/o macular or fundus exam"_U_$P(STRING1,U,8)_U_$J($P(STRING1,U,9),5,1)_U_$P(STRING2,U,8)_U_$J($P(STRING2,U,9),5,1)_U_$FN(PRD7,",+",1)_U_$P(STRING3,U,8)_U_$J($P(STRING3,U,9),5,1)_U_$FN(PRN7,",+",1)
D S^BGPMUDEL(X,2,1)
S X="or w/exam but no macular edema"
D S^BGPMUDEL(X,1,1)
S X="and/or no severity of retinopathy findings"
D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D P2
Q
NUM88(TF) ;Get the numbers for this measure
N ARRAY,DEN,NUM,EXC,NOT,PC1,PC11,PC2,PC14,PC21,PC13,NNUM
S DEN=+$G(^TMP("BGPMU0088",$J,TF,"DEN"))
S NUM=+$G(^TMP("BGPMU0088",$J,TF,"NUM"))
S NOT=+$G(^TMP("BGPMU0088",$J,TF,"NOT"))
S EXC=+$G(^TMP("BGPMU0088",$J,TF,"EXC"))
S NNUM=DEN-EXC
I DEN=0 S (PC1,PC11,PC13,PC14)=0
I DEN>0&(NNUM=0) D
.S (PC1,PC11,PC14)=0
.S PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
I DEN>0&(NNUM>0) D
.S PC1=$$ROUND^BGPMUA01((NUM/NNUM),3)*100
.S PC11=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
.S PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
.S PC14=$$ROUND^BGPMUA01((NOT/NNUM),3)*100
S ARRAY=DEN_U_NUM_U_NNUM_U_EXC_U_PC1_U_PC11_U_PC13_U_NOT_U_PC14
Q ARRAY
P2 ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X,PTCT
S PTCT=0
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
S X="Patients 18+ who had at least 2 office & outpatient consultation," D S^BGPMUDEL(X,1,1)
S X="ophthalmological services, nursing facility, or domiciliary encounters with" D S^BGPMUDEL(X,1,1)
S X="the EP during the reporting period AND a diagnosis of diabetic retinopathy" D S^BGPMUDEL(X,1,1)
S X="AND who had a macular or fundus exam performed which included documentation of" D S^BGPMUDEL(X,1,1)
S X="the level of severity of retinopathy and the presence or absence of macular" D S^BGPMUDEL(X,1,1)
S X="edema during 1 or more the encounters with the EP during the reporting" D S^BGPMUDEL(X,1,1)
S X="period, if any." D S^BGPMUDEL(X,1,1)
S X="Patients who did not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,2,1)
S X="followed by patients who do meet the numerator criteria (M:). Excluded patients" D S^BGPMUDEL(X,1,1)
S X="are listed last." D S^BGPMUDEL(X,1,1)
S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,2,1)
S X="columns: " D S^BGPMUDEL(X,1,1)
S X="RET=Diabetic Retinopathy Diagnosis" D S^BGPMUDEL(X,1,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="EXAM=Macular or Fundus Exam" D S^BGPMUDEL(X,1,1)
S X="ME=Macular Edema Diagnosis" D S^BGPMUDEL(X,1,1)
S X="LOS=Diabetic Retinopathy Level of Severity" D S^BGPMUDEL(X,1,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$J_",""PAT"",""C"",""NOT"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$J_",""PAT"",""C"",""NUM"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,30)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S COMM=$$GET1^DIQ(9000001,DFN,1118)
S SEX=$P(^DPT(DFN,0),U,2)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM D S^BGPMUDEL(X,1,1)
Q
BGPMUGD8 ; IHS/MSC/MMT - MU EP measures NQF0088 ;09-Sep-2011 11:26;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Delimited output reports for this measure
EDEMA ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0088",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
+3 NEW PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
+4 SET STRING1=$$NUM88("C")
+5 SET STRING2=$$NUM88("P")
+6 SET STRING3=$$NUM88("B")
+7 DO SUMMARY1^BGPMUGP8(STRING1,STRING2,STRING3)
+8 ;population
+9 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
SET PRD1=$FNUMBER(PRD1,",+",1)
+10 SET PRD2=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
SET PRD2=$FNUMBER(PRD2,",+",1)
+11 SET PRD3=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
SET PRD3=$FNUMBER(PRD3,",+",1)
+12 SET PRD7=$PIECE(STRING1,U,9)-$PIECE(STRING2,U,9)
SET PRD7=$FNUMBER(PRD7,",+",1)
+13 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
SET PRN1=$FNUMBER(PRN1,",+",1)
+14 SET PRN2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
SET PRN2=$FNUMBER(PRN2,",+",1)
+15 SET PRN3=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
SET PRN3=$FNUMBER(PRN3,",+",1)
+16 SET PRN7=$PIECE(STRING1,U,9)-$PIECE(STRING3,U,9)
SET PRN7=$FNUMBER(PRN7,",+",1)
+17 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+18 DO S^BGPMUDEL(X,2,1)
+19 SET X="Pts 18+ w/diabetic retinopathy"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
+20 DO S^BGPMUDEL(X,1,1)
+21 SET X="# Excluded (Exc)"_U_$PIECE(STRING1,U,4)_U_U_$PIECE(STRING2,U,4)_U_U_U_$PIECE(STRING3,U,4)
+22 DO S^BGPMUDEL(X,1,1)
+23 SET X="Pts 18+ w/diabetic retinopathy less Exc"_U_$PIECE(STRING1,U,3)_U_U_$PIECE(STRING2,U,3)_U_U_U_$PIECE(STRING3,U,3)
+24 DO S^BGPMUDEL(X,1,1)
+25 SET X="# w/macular or fundus exam"_U_$PIECE(STRING1,U,2)_U_$JUSTIFY($PIECE(STRING1,U,5),5,1)_U_$PIECE(STRING2,U,2)_U_$JUSTIFY($PIECE(STRING2,U,5),5,1)_U_$FNUMBER(PRD1,",+",1)_U_$PIECE(STRING3,U,2)_U_$JUSTIFY($PIECE(STRING3,U,5),5,1)_U_...
... $FNUMBER(PRN1,",+",1)
+26 DO S^BGPMUDEL(X,2,1)
+27 SET X="w/macular edema and severity"
+28 DO S^BGPMUDEL(X,1,1)
+29 SET X="of retinopathy findings"
+30 DO S^BGPMUDEL(X,1,1)
+31 SET X="# w/o macular or fundus exam"_U_$PIECE(STRING1,U,8)_U_$JUSTIFY($PIECE(STRING1,U,9),5,1)_U_$PIECE(STRING2,U,8)_U_$JUSTIFY($PIECE(STRING2,U,9),5,1)_U_$FNUMBER(PRD7,",+",1)_U_$PIECE(STRING3,U,8)_U_$JUSTIFY($PIECE(STRING3,U,9),5,1)_U_...
... $FNUMBER(PRN7,",+",1)
+32 DO S^BGPMUDEL(X,2,1)
+33 SET X="or w/exam but no macular edema"
+34 DO S^BGPMUDEL(X,1,1)
+35 SET X="and/or no severity of retinopathy findings"
+36 DO S^BGPMUDEL(X,1,1)
+37 SET X=""
DO S^BGPMUDEL(X,1,1)
+38 IF $DATA(BGPLIST(BGPIC))
DO P2
+39 QUIT
NUM88(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN,NUM,EXC,NOT,PC1,PC11,PC2,PC14,PC21,PC13,NNUM
+2 SET DEN=+$GET(^TMP("BGPMU0088",$JOB,TF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0088",$JOB,TF,"NUM"))
+4 SET NOT=+$GET(^TMP("BGPMU0088",$JOB,TF,"NOT"))
+5 SET EXC=+$GET(^TMP("BGPMU0088",$JOB,TF,"EXC"))
+6 SET NNUM=DEN-EXC
+7 IF DEN=0
SET (PC1,PC11,PC13,PC14)=0
+8 IF DEN>0&(NNUM=0)
Begin DoDot:1
+9 SET (PC1,PC11,PC14)=0
+10 SET PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
End DoDot:1
+11 IF DEN>0&(NNUM>0)
Begin DoDot:1
+12 SET PC1=$$ROUND^BGPMUA01((NUM/NNUM),3)*100
+13 SET PC11=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
+14 SET PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
+15 SET PC14=$$ROUND^BGPMUA01((NOT/NNUM),3)*100
End DoDot:1
+16 SET ARRAY=DEN_U_NUM_U_NNUM_U_EXC_U_PC1_U_PC11_U_PC13_U_NOT_U_PC14
+17 QUIT ARRAY
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,PTCT
+2 SET PTCT=0
+3 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+4 SET X="Patients 18+ who had at least 2 office & outpatient consultation,"
DO S^BGPMUDEL(X,1,1)
+5 SET X="ophthalmological services, nursing facility, or domiciliary encounters with"
DO S^BGPMUDEL(X,1,1)
+6 SET X="the EP during the reporting period AND a diagnosis of diabetic retinopathy"
DO S^BGPMUDEL(X,1,1)
+7 SET X="AND who had a macular or fundus exam performed which included documentation of"
DO S^BGPMUDEL(X,1,1)
+8 SET X="the level of severity of retinopathy and the presence or absence of macular"
DO S^BGPMUDEL(X,1,1)
+9 SET X="edema during 1 or more the encounters with the EP during the reporting"
DO S^BGPMUDEL(X,1,1)
+10 SET X="period, if any."
DO S^BGPMUDEL(X,1,1)
+11 SET X="Patients who did not meet the numerator criteria are listed first (NM:),"
DO S^BGPMUDEL(X,2,1)
+12 SET X="followed by patients who do meet the numerator criteria (M:). Excluded patients"
DO S^BGPMUDEL(X,1,1)
+13 SET X="are listed last."
DO S^BGPMUDEL(X,1,1)
+14 SET X="The following are the abbreviations used in the denominator and numerator"
DO S^BGPMUDEL(X,2,1)
+15 SET X="columns: "
DO S^BGPMUDEL(X,1,1)
+16 SET X="RET=Diabetic Retinopathy Diagnosis"
DO S^BGPMUDEL(X,1,1)
+17 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+18 SET X="EXAM=Macular or Fundus Exam"
DO S^BGPMUDEL(X,1,1)
+19 SET X="ME=Macular Edema Diagnosis"
DO S^BGPMUDEL(X,1,1)
+20 SET X="LOS=Diabetic Retinopathy Level of Severity"
DO S^BGPMUDEL(X,1,1)
+21 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,2,1)
+22 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+23 KILL BGPARR
+24 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$JOB_",""PAT"",""C"",""NOT"")")
+25 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+26 SET PTCT=PTCT+1
+27 SET NODE=$GET(BGPARR(PT))
+28 DO DATA(NODE)
End DoDot:2
End DoDot:1
+29 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+30 KILL BGPARR
+31 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$JOB_",""PAT"",""C"",""NUM"")")
+32 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+33 SET PTCT=PTCT+1
+34 SET NODE=$GET(BGPARR(PT))
+35 DO DATA(NODE)
End DoDot:2
End DoDot:1
+36 IF BGPLIST="A"
Begin DoDot:1
+37 KILL BGPARR
+38 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0088"","_$JOB_",""PAT"",""C"",""EXC"")")
+39 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+40 SET PTCT=PTCT+1
+41 SET NODE=$GET(BGPARR(PT))
+42 DO DATA(NODE)
End DoDot:2
End DoDot:1
+43 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+44 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,30)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET COMM=$$GET1^DIQ(9000001,DFN,1118)
+7 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM
DO S^BGPMUDEL(X,1,1)
+11 QUIT