Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGPMUAD2

BGPMUAD2.m

Go to the documentation of this file.
  1. BGPMUAD2 ; IHS/MSC/MGH - Print MU measure NQF0031,NQF0032,NQF0034 ;01-Mar-2011 15:41;MGH
  1. ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
  1. ;Delimeted output for these measures
  1. COLON ;EP
  1. D P1
  1. ;I BGPMUDET="D" D P2
  1. K ^TMP("BGPMU0034",$J)
  1. Q
  1. P1 ;Write individual measure
  1. N X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRN,PRD1,PRD2,PRN1,PRN2
  1. S STRING1=$$0034("C")
  1. S STRING2=$$0034("P")
  1. S STRING3=$$0034("B")
  1. D SUM34^BGPMUAP2
  1. S PRD=$P(STRING1,U,4)-$P(STRING2,U,4)
  1. S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
  1. S PRD2=$P(STRING1,U,7)-$P(STRING2,U,7)
  1. S PRN=$P(STRING1,U,4)-$P(STRING3,U,4)
  1. S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
  1. S PRN2=$P(STRING1,U,7)-$P(STRING3,U,7)
  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"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="Pts 50-70"_U_($P(STRING1,U,1)+$P(STRING1,U,6))_U_U_($P(STRING2,U,1)+$P(STRING2,U,6))_U_U_U_($P(STRING3,U,1)+$P(STRING3,U,6)) D S^BGPMUDEL(X,2,1)
  1. S X="# Excluded (Exc)"_U_$P(STRING1,U,6)_U_U_$P(STRING2,U,6)_U_U_U_$P(STRING3,U,6) D S^BGPMUDEL(X,1,1)
  1. S X="Pts 50-74 less Exc"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1) D S^BGPMUDEL(X,1,1)
  1. S X="# w/colon screen"_U_$P(STRING1,U,2)_U_$P(STRING1,U,4)_U_$P(STRING2,U,2)_U_$P(STRING2,U,4)_U_$FN(PRD,",+",1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,4)_U_$FN(PRN,",+",1)
  1. D S^BGPMUDEL(X,2,1)
  1. S X="# w/o colon screen"_U_$P(STRING1,U,3)_U_$P(STRING1,U,5)_U_$P(STRING2,U,3)_U_$P(STRING2,U,5)_U_$FN(PRD1,",+",1)_U_$P(STRING3,U,3)_U_$P(STRING3,U,5)_U_$FN(PRN1,",+",1)
  1. D S^BGPMUDEL(X,1,1)
  1. I $D(BGPLIST(BGPIC)) D P2
  1. Q
  1. 0034(TF) ;Get the numbers for this measure
  1. N ARRAY,DEN,NUM,PC1,PC2,PC3,EXC
  1. S (ARRAY,PC1,PC2,PC3)=""
  1. S DEN=+$G(^TMP("BGPMU0034",$J,TF,"DEN"))
  1. S NUM=+$G(^TMP("BGPMU0034",$J,TF,"NUM"))
  1. S EXC=+$G(^TMP("BGPMU0034",$J,TF,"EXC"))
  1. S NOT=+$G(^TMP("BGPMU0034",$J,TF,"NOT"))
  1. I DEN=0 S (PC1,PC2,PC3)=0
  1. I DEN>0 D
  1. .S PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
  1. .S PC2=$$ROUND^BGPMUA01((NOT/DEN),3)*100
  1. .S PC3=$$ROUND^BGPMUA01((EXC/DEN),3)*100
  1. S ARRAY=DEN_U_NUM_U_NOT_U_PC1_U_PC2_U_EXC_U_PC3
  1. Q ARRAY
  1. P2 ;Do the Details
  1. N PT,NODE,NAME,VST,COLON,FOL,PTCT
  1. S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT *****" D S^BGPMUDEL(X,2,1)
  1. S X="Patients 50-74 with at least 1 encounter with the EP within the last 2 years" D S^BGPMUDEL(X,2,1)
  1. S X="who have never had a total colectomy, with documented colorectal cancer screening," D S^BGPMUDEL(X,1,1)
  1. S X="if any." D S^BGPMUDEL(X,1,1)
  1. S X="Patients who do not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,2,1)
  1. S X="followed by patients who do meet the numerator criteria (M:)." D S^BGPMUDEL(X,1,1)
  1. S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,2,1)
  1. S X="columns: " D S^BGPMUDEL(X,1,1)
  1. S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
  1. S X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
  1. S PTCT=0
  1. I BGPLIST="D"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0034"","_$J_",""PAT"",""C"",""DEN"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. I BGPLIST="N"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0034"","_$J_",""PAT"",""C"",""NUM"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. I BGPLIST="A" D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0034"","_$J_",""PAT"",""C"",""EXC"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
  1. Q
  1. ;Print results of breast cancer screen
  1. BREAST ;EP
  1. D B1
  1. ;I BGPMUDET="D" D B2
  1. K ^TMP("BGPMU0031",$J)
  1. Q
  1. B1 ;Write individual measure
  1. N X,Y,Z,DEN,NUM,PC,STRING1,STRING2,STRING3,PRD,PRN,PRD1,PRN1
  1. S STRING1=$$0031("C")
  1. S STRING2=$$0031("P")
  1. S STRING3=$$0031("B")
  1. D SUM31^BGPMUAP2
  1. S PRD=$P(STRING1,U,4)-$P(STRING2,U,4)
  1. S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
  1. S PRN=$P(STRING1,U,4)-$P(STRING3,U,4)
  1. S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
  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"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="Pts 41-68"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1) D S^BGPMUDEL(X,2,1)
  1. S X="# w/mammogram"_U_$P(STRING1,U,2)_U_$P(STRING1,U,4)_U_$P(STRING2,U,2)_U_$P(STRING2,U,4)_U_$FN(PRD,"+,",1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,4)_U_$FN(PRN,"+,",1)
  1. D S^BGPMUDEL(X,2,1)
  1. S X="# w/o mammogram"_U_$P(STRING1,U,3)_U_$P(STRING1,U,5)_U_$P(STRING2,U,3)_U_$P(STRING2,U,5)_U_$FN(PRD1,"+,",1)_U_$P(STRING3,U,3)_U_$P(STRING3,U,5)_U_$FN(PRN1,"+,",1)
  1. D S^BGPMUDEL(X,1,1)
  1. I $D(BGPLIST(BGPIC)) D B2
  1. Q
  1. 0031(TF) ;Get the numbers for this measure
  1. N ARRAY,DEN,NUM,NNUM,PC1,PC2
  1. S DEN=+$G(^TMP("BGPMU0031",$J,TF,"DEN"))
  1. S NUM=+$G(^TMP("BGPMU0031",$J,TF,"NUM"))
  1. S NOT=+$G(^TMP("BGPMU0031",$J,TF,"NOT"))
  1. S NNUM=DEN-NUM
  1. I DEN=0 S (PC1,PC2)=0
  1. I DEN>0 D
  1. .S PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
  1. .S PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
  1. S ARRAY=DEN_U_NUM_U_NNUM_U_PC1_U_PC2
  1. Q ARRAY
  1. B2 ;Do the Details
  1. N PT,NODE,NAME,VST,BREAST,PTCT
  1. S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT *****"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="Female patients 41-68 with at least 1 encounter with the EP within 2 years of"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="the reporting period end date and who have never had a bilateral mastectomy or 2"
  1. D S^BGPMUDEL(X,1,1)
  1. S X="unilateral mastectomies, with documented mammogram, if any."
  1. D S^BGPMUDEL(X,1,1)
  1. S X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="by patients who do meet the numerator criteria (M:)."
  1. D S^BGPMUDEL(X,1,1)
  1. S X="The following are the abbreviations used in the denominator column:"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="EN=Encounter"
  1. D S^BGPMUDEL(X,1,1)
  1. S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
  1. D S^BGPMUDEL(X,2,1)
  1. S PTCT=0
  1. I BGPLIST="D"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0031"","_$J_",""PAT"",""C"",""NOT"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. I BGPLIST="N"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0031"","_$J_",""PAT"",""C"",""NUM"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
  1. Q
  1. ;
  1. DATA(NODE) ;GET DATA
  1. N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,DEN1,DEN2
  1. S DFN=$P(NODE,U,1)
  1. S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,22)
  1. S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
  1. S AGE=$$AGE^AUPNPAT(DFN,BGPED)
  1. S DEN=$P(NODE,U,4)
  1. S NUM=$P(NODE,U,5)
  1. S COMM=$$GET1^DIQ(9000001,DFN,1118)
  1. S SEX=$P(^DPT(DFN,0),U,2)
  1. S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_"EN:"_$P($$FMTE^XLFDT(DEN,2),".",1)_U_$S(NUM="":"NM: ",1:"M: "_$P(NUM,";",1)_" "_$P($$FMTE^XLFDT($P(NUM,";",2),2),".",1))
  1. D S^BGPMUDEL(X,1,1)
  1. Q
  1. ;Get results of cervical cancer screen
  1. PAP ;EP
  1. D C1
  1. ;I BGPMUDET="D" D C2
  1. K ^TMP("BGPMU0032",$J)
  1. Q
  1. C1 ;Write individual measure
  1. N X,Y,Z,DEN,NUM,PC,STRING1,STRING2,STRING3,PRD,PRN,PRN1,PRD1
  1. S STRING1=$$0032("C")
  1. S STRING2=$$0032("P")
  1. S STRING3=$$0032("B")
  1. D SUM32^BGPMUAP2
  1. S PRD=$P(STRING1,U,4)-$P(STRING2,U,4)
  1. S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
  1. S PRN=$P(STRING1,U,4)-$P(STRING3,U,4)
  1. S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
  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"
  1. D S^BGPMUDEL(X,2,1)
  1. S X="Pts 23-63:"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1) D S^BGPMUDEL(X,2,1)
  1. S X="# w/pap test"_U_$P(STRING1,U,2)_U_$P(STRING1,U,4)_U_$P(STRING2,U,2)_U_$P(STRING2,U,4)_U_$FN(PRD,",+",1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,4)_U_$FN(PRN,",+",1)
  1. D S^BGPMUDEL(X,2,1)
  1. S X="# w/o pap test"_U_$P(STRING1,U,3)_U_$P(STRING1,U,5)_U_$P(STRING2,U,3)_U_$P(STRING2,U,5)_U_$FN(PRD1,",+",1)_U_$P(STRING3,U,3)_U_$P(STRING3,U,5)_U_$FN(PRN1,",+",1)
  1. D S^BGPMUDEL(X,1,1)
  1. I $D(BGPLIST(BGPIC)) D C2
  1. Q
  1. 0032(TF) ;Get the numbers for this measure
  1. N ARRAY,DEN,NUM,PC1,PC2,NNUM
  1. S DEN=+$G(^TMP("BGPMU0032",$J,TF,"DEN"))
  1. S NUM=+$G(^TMP("BGPMU0032",$J,TF,"NUM"))
  1. S NNUM=DEN-NUM
  1. I DEN=0 S (PC1,PC2)=0
  1. I DEN>0 D
  1. .S PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
  1. .S PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
  1. S ARRAY=DEN_U_NUM_U_NNUM_U_PC1_U_PC2
  1. Q ARRAY
  1. C2 ;Do the Details
  1. N PT,NODE,NAME,VST,CERV,PTCT
  1. S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT *****" D S^BGPMUDEL(X,2,1)
  1. S X="Female patients 23-63 with at least 1 encounter with the EP within the last" D S^BGPMUDEL(X,2,1)
  1. S X="2 years who have never had a hysterectomy, with documented pap test, if any." D S^BGPMUDEL(X,1,1)
  1. S X="Patients who do not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,2,1)
  1. S X="followed by patients who do meet the numerator criteria (M:)." D S^BGPMUDEL(X,1,1)
  1. S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,2,1)
  1. S X="columns: " D S^BGPMUDEL(X,1,1)
  1. S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
  1. S X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
  1. S PTCT=0
  1. I BGPLIST="D"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0032"","_$J_",""PAT"",""C"",""DEN"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. I BGPLIST="N"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0032"","_$J_",""PAT"",""C"",""NUM"")")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D DATA(NODE)
  1. S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
  1. Q
  1. XML0032 ;Ouptut the XML for the PAP smear logic
  1. ; BGPXML(i)=Population Number^Numerator Number^Denominator Count^Numerator Count
  1. N STRING
  1. S STRING=$$0032("C")
  1. S BGPXML(1)="NQF_0032"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)
  1. K ^TMP("BGPMU0032",$J)
  1. Q
  1. XML0031 ;Output the XML for the Mammogram logic
  1. ; BGPXML(i)=Population Number^Numerator Number^Denominator Count
  1. N STRING
  1. S STRING=$$0031("C")
  1. S BGPXML(1)="112"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)
  1. K ^TMP("BGPMU0031",$J)
  1. Q
  1. XML0034 ;Output the XML for the Colon Cancer logic
  1. ; BGPXML(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exception
  1. N STRING
  1. S STRING=$$0034("C")
  1. S BGPXML(1)="113"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)_U_+$P(STRING,U,6) Q
  1. K ^TMP("BGPMU0034",$J)
  1. Q