BGPMUGP5 ; IHS/MSC/MMT - Print MU EP measures NQF0036 ;20-Aug-2011 11:27;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Printed output reports for this measure
ASTPHARM ;EP
D P1
K ^TMP("BGPMU0036",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,DEN2,NUM2,NUMPCT,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,SUMCT
N PRD1,PRD4,PRN1,PRN4
K STRING1,STRING2,STRING3
S SUMCT=0
D NUM36("C",.STRING1)
D NUM36("P",.STRING2)
D NUM36("B",.STRING3)
D SUMMARY1(.STRING1,.STRING2,.STRING3)
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
D P1SUB(1)
D P1SUB(2)
D P1SUB(3)
I $D(BGPLIST(BGPIC)) D P2
Q
P1SUB(POP) ;Population tabular output
S PRD1=$P(STRING1(POP),U,5)-$P(STRING2(POP),U,5)
S PRD4=$P(STRING1(POP),U,7)-$P(STRING2(POP),U,7)
S PRN1=$P(STRING1(POP),U,5)-$P(STRING3(POP),U,5)
S PRN4=$P(STRING1(POP),U,7)-$P(STRING3(POP),U,7)
I $Y>(BGPIOSL-6) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Denominator ",POP
W !!,$P($T(P1TEXT+POP),";;",2),?33,$P(STRING1(POP),U,1),?44,$P(STRING2(POP),U,1),?64,$P(STRING3(POP),U,1)
W !,"indicative of asthma"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1(POP),U,4),?44,$P(STRING2(POP),U,4),?64,$P(STRING3(POP),U,4)
I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,$P($T(P1TEXT+POP),";;",2),?33,$P(STRING1(POP),U,3),?44,$P(STRING2(POP),U,3),?64,$P(STRING3(POP),U,3)
W !,"indicative of asthma less Exc"
I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"# w/asthma medications",?33,$P(STRING1(POP),U,2),?38,$J($P(STRING1(POP),U,5),5,1),?44,$P(STRING2(POP),U,2)
W ?49,$J($P(STRING2(POP),U,5),5,1),?56,$J($FN(PRD1,",+",1),6),?64,$P(STRING3(POP),U,2),?68,$J($P(STRING3(POP),U,5),5,1),?74,$J($FN(PRN1,",+",1),6)
I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o asthma medications",?33,$P(STRING1(POP),U,6),?38,$J($P(STRING1(POP),U,7),5,1),?44,$P(STRING2(POP),U,6)
W ?49,$J($P(STRING2(POP),U,7),5,1),?56,$J($FN(PRD4,",+",1),6),?64,$P(STRING3(POP),U,6),?68,$J($P(STRING3(POP),U,7),5,1),?74,$J($FN(PRN4,",+",1),6)
Q
P1TEXT ;Text lines for output
;;Pts 5-11 w/asthma or meds
;;Pts 12-50 w/asthma or meds
;;Pts 5-50 w/asthma or meds
NUM36(TF,ARRAY) ;Get the numbers for this measure
N STRING,DENTOT,NUM,EXC,NOT,NUMPCT,FINALDEN,NOTPCT,I
F I=1:1:3 S ARRAY(I)=$$NUMSUB(I)
Q
NUMSUB(POP) ;pull numbers out of temp global
S DENTOT=+$G(^TMP("BGPMU0036",$J,TF,POP,"DEN"))
S NUM=+$G(^TMP("BGPMU0036",$J,TF,POP,"NUM"))
S NOT=+$G(^TMP("BGPMU0036",$J,TF,POP,"NOT"))
S EXC=+$G(^TMP("BGPMU0036",$J,TF,POP,"EXC"))
S FINALDEN=DENTOT-EXC
I DENTOT=0 S (NUMPCT,NOTPCT)=0
I DENTOT>0&(FINALDEN=0) D
.S (NUMPCT,NOTPCT)=0
I DENTOT>0&(FINALDEN>0) D
.S NUMPCT=$$ROUND^BGPMUA01((NUM/FINALDEN),3)*100
.S NOTPCT=$$ROUND^BGPMUA01((NOT/FINALDEN),3)*100
S STRING=DENTOT_U_NUM_U_FINALDEN_U_EXC_U_NUMPCT_U_NOT_U_NOTPCT
Q STRING
P2 ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X,PTCT,BGPARR,LINE
D HEADERL^BGPMUPH
S X="Patients 5-50 years of age with one of the following during the reporting" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="period or within 1 year before the beginning of the reporting period: (a) at" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="least 1 ED or acute inpatient encounter with the EP and a diagnosis of asthma," D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="(b) at least 4 outpatient encounters with the EP AND a diagnosis of asthma AND" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="at least 2 counts asthma medication prescribed by the EP, (c) at least 4 counts" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="of asthma medication prescribed by the EP, or (d) at least 4 counts of " D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="leukotriebe inhibitors prescribed by the EP and a diagnosis of asthma, if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="Patients who did not meet the numerator criteria are listed first (NM:)" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="followed by patients who do meet the numerator criteria (M:). Excluded patients" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="are listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="AST=Asthma Diagnosis" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="MED=Asthma Medication" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"Patients 5-11"
W !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
D LISTSUB(1)
W !!,"Patients 12-50"
W !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
D LISTSUB(2)
Q
LISTSUB(POP) ;write out patient list for given population
S PTCT=0
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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)
W !!,"Total # of patients on list: "_PTCT
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,DEN3,LINE,I,DENLEN
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,22)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S DEN=$P(NODE,U,2)
S DEN1=$P(DEN,";",1)
S NUM=$P(NODE,U,3)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S SEX=$P(^DPT(DFN,0),U,2)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN1,?65,NUM
S DENLEN=$L(DEN,";")
I DENLEN>1 F I=2:1:DENLEN W !,?50,$P(DEN,";",I)
Q
SUMMARY1(STRING1,STRING2,STRING3,CT) ;Summmary setup
N DESC,LINE
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0036^"
S DESC="5-11 # w/asthma medications"
D SUMSUB(1,DESC)
S DESC="12-50 # w/asthma medications"
D SUMSUB(2,DESC)
S DESC="5-50 # w/asthma medications"
D SUMSUB(3,DESC)
Q
SUMSUB(POP,DESC) ;create array entry for summary line
S LINE=""
S LINE="MU.EP.0036.1"_U_DESC_U_$P(STRING1(POP),U,4)_U_$P(STRING1(POP),U,1)_U_$P(STRING1(POP),U,2)_U_$P(STRING1(POP),U,5)_U_U_U_U_U
S LINE=LINE_$P(STRING2(POP),U,4)_U_$P(STRING2(POP),U,1)_U_$P(STRING2(POP),U,2)_U_$P(STRING2(POP),U,5)_U_$P(STRING3(POP),U,4)_U_$P(STRING3(POP),U,1)_U_$P(STRING3(POP),U,2)_U_$P(STRING3(POP),U,5)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,POP)=LINE
Q
XML36 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=PQRI number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF0036"_U_""_U_+$G(^TMP("BGPMU0036",$J,"C",3,"DEN"))_U_+$G(^TMP("BGPMU0036",$J,"C",3,"NUM"))_U_+$G(^TMP("BGPMU0036",$J,"C",3,"EXC"))
K ^TMP("BGPMU0036",$J)
Q
BGPMUGP5 ; IHS/MSC/MMT - Print MU EP measures NQF0036 ;20-Aug-2011 11:27;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Printed output reports for this measure
ASTPHARM ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0036",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,DEN2,NUM2,NUMPCT,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,SUMCT
+3 NEW PRD1,PRD4,PRN1,PRN4
+4 KILL STRING1,STRING2,STRING3
+5 SET SUMCT=0
+6 DO NUM36("C",.STRING1)
+7 DO NUM36("P",.STRING2)
+8 DO NUM36("B",.STRING3)
+9 DO SUMMARY1(.STRING1,.STRING2,.STRING3)
+10 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+11 DO HDRBLK^BGPMUPH
+12 DO P1SUB(1)
+13 DO P1SUB(2)
+14 DO P1SUB(3)
+15 IF $DATA(BGPLIST(BGPIC))
DO P2
+16 QUIT
P1SUB(POP) ;Population tabular output
+1 SET PRD1=$PIECE(STRING1(POP),U,5)-$PIECE(STRING2(POP),U,5)
+2 SET PRD4=$PIECE(STRING1(POP),U,7)-$PIECE(STRING2(POP),U,7)
+3 SET PRN1=$PIECE(STRING1(POP),U,5)-$PIECE(STRING3(POP),U,5)
+4 SET PRN4=$PIECE(STRING1(POP),U,7)-$PIECE(STRING3(POP),U,7)
+5 IF $Y>(BGPIOSL-6)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+6 WRITE !!,"Denominator ",POP
+7 WRITE !!,$PIECE($TEXT(P1TEXT+POP),";;",2),?33,$PIECE(STRING1(POP),U,1),?44,$PIECE(STRING2(POP),U,1),?64,$PIECE(STRING3(POP),U,1)
+8 WRITE !,"indicative of asthma"
+9 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+10 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1(POP),U,4),?44,$PIECE(STRING2(POP),U,4),?64,$PIECE(STRING3(POP),U,4)
+11 IF $Y>(BGPIOSL-4)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,$PIECE($TEXT(P1TEXT+POP),";;",2),?33,$PIECE(STRING1(POP),U,3),?44,$PIECE(STRING2(POP),U,3),?64,$PIECE(STRING3(POP),U,3)
+13 WRITE !,"indicative of asthma less Exc"
+14 IF $Y>(BGPIOSL-4)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+15 WRITE !!,"# w/asthma medications",?33,$PIECE(STRING1(POP),U,2),?38,$JUSTIFY($PIECE(STRING1(POP),U,5),5,1),?44,$PIECE(STRING2(POP),U,2)
+16 WRITE ?49,$JUSTIFY($PIECE(STRING2(POP),U,5),5,1),?56,$JUSTIFY($FNUMBER(PRD1,",+",1),6),?64,$PIECE(STRING3(POP),U,2),?68,$JUSTIFY($PIECE(STRING3(POP),U,5),5,1),?74,$JUSTIFY($FNUMBER(PRN1,",+",1),6)
+17 IF $Y>(BGPIOSL-4)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+18 WRITE !,"# w/o asthma medications",?33,$PIECE(STRING1(POP),U,6),?38,$JUSTIFY($PIECE(STRING1(POP),U,7),5,1),?44,$PIECE(STRING2(POP),U,6)
+19 WRITE ?49,$JUSTIFY($PIECE(STRING2(POP),U,7),5,1),?56,$JUSTIFY($FNUMBER(PRD4,",+",1),6),?64,$PIECE(STRING3(POP),U,6),?68,$JUSTIFY($PIECE(STRING3(POP),U,7),5,1),?74,$JUSTIFY($FNUMBER(PRN4,",+",1),6)
+20 QUIT
P1TEXT ;Text lines for output
+1 ;;Pts 5-11 w/asthma or meds
+2 ;;Pts 12-50 w/asthma or meds
+3 ;;Pts 5-50 w/asthma or meds
NUM36(TF,ARRAY) ;Get the numbers for this measure
+1 NEW STRING,DENTOT,NUM,EXC,NOT,NUMPCT,FINALDEN,NOTPCT,I
+2 FOR I=1:1:3
SET ARRAY(I)=$$NUMSUB(I)
+3 QUIT
NUMSUB(POP) ;pull numbers out of temp global
+1 SET DENTOT=+$GET(^TMP("BGPMU0036",$JOB,TF,POP,"DEN"))
+2 SET NUM=+$GET(^TMP("BGPMU0036",$JOB,TF,POP,"NUM"))
+3 SET NOT=+$GET(^TMP("BGPMU0036",$JOB,TF,POP,"NOT"))
+4 SET EXC=+$GET(^TMP("BGPMU0036",$JOB,TF,POP,"EXC"))
+5 SET FINALDEN=DENTOT-EXC
+6 IF DENTOT=0
SET (NUMPCT,NOTPCT)=0
+7 IF DENTOT>0&(FINALDEN=0)
Begin DoDot:1
+8 SET (NUMPCT,NOTPCT)=0
End DoDot:1
+9 IF DENTOT>0&(FINALDEN>0)
Begin DoDot:1
+10 SET NUMPCT=$$ROUND^BGPMUA01((NUM/FINALDEN),3)*100
+11 SET NOTPCT=$$ROUND^BGPMUA01((NOT/FINALDEN),3)*100
End DoDot:1
+12 SET STRING=DENTOT_U_NUM_U_FINALDEN_U_EXC_U_NUMPCT_U_NOT_U_NOTPCT
+13 QUIT STRING
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,PTCT,BGPARR,LINE
+2 DO HEADERL^BGPMUPH
+3 SET X="Patients 5-50 years of age with one of the following during the reporting"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="period or within 1 year before the beginning of the reporting period: (a) at"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="least 1 ED or acute inpatient encounter with the EP and a diagnosis of asthma,"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="(b) at least 4 outpatient encounters with the EP AND a diagnosis of asthma AND"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="at least 2 counts asthma medication prescribed by the EP, (c) at least 4 counts"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 SET X="of asthma medication prescribed by the EP, or (d) at least 4 counts of "
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="leukotriebe inhibitors prescribed by the EP and a diagnosis of asthma, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="Patients who did not meet the numerator criteria are listed first (NM:)"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+11 SET X="followed by patients who do meet the numerator criteria (M:). Excluded patients"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+12 SET X="are listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+14 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 SET X="AST=Asthma Diagnosis"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+16 SET X="MED=Asthma Medication"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+17 SET X="EN=Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+18 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+19 WRITE !!,"Patients 5-11"
+20 WRITE !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
+21 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+22 DO LISTSUB(1)
+23 WRITE !!,"Patients 12-50"
+24 WRITE !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
+25 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+26 DO LISTSUB(2)
+27 QUIT
LISTSUB(POP) ;write out patient list for given population
+1 SET PTCT=0
+2 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+3 KILL BGPARR
+4 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0036"","_$JOB_",""PAT"",""C"","_POP_",""NOT"")")
+5 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+6 SET PTCT=PTCT+1
+7 SET NODE=$GET(BGPARR(PT))
+8 DO DATA(NODE)
End DoDot:2
End DoDot:1
+9 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+10 KILL BGPARR
+11 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0036"","_$JOB_",""PAT"",""C"","_POP_",""NUM"")")
+12 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+13 SET PTCT=PTCT+1
+14 SET NODE=$GET(BGPARR(PT))
+15 DO DATA(NODE)
End DoDot:2
End DoDot:1
+16 IF BGPLIST="A"
Begin DoDot:1
+17 KILL BGPARR
+18 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0036"","_$JOB_",""PAT"",""C"","_POP_",""EXC"")")
+19 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+20 SET PTCT=PTCT+1
+21 SET NODE=$GET(BGPARR(PT))
+22 DO DATA(NODE)
End DoDot:2
End DoDot:1
+23 WRITE !!,"Total # of patients on list: "_PTCT
+24 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,DEN3,LINE,I,DENLEN
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,22)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET DEN=$PIECE(NODE,U,2)
+7 SET DEN1=$PIECE(DEN,";",1)
+8 SET NUM=$PIECE(NODE,U,3)
+9 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+10 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+11 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+12 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+13 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
+14 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+15 WRITE !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN1,?65,NUM
+16 SET DENLEN=$LENGTH(DEN,";")
+17 IF DENLEN>1
FOR I=2:1:DENLEN
WRITE !,?50,$PIECE(DEN,";",I)
+18 QUIT
SUMMARY1(STRING1,STRING2,STRING3,CT) ;Summmary setup
+1 NEW DESC,LINE
+2 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+3 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0036^"
+4 SET DESC="5-11 # w/asthma medications"
+5 DO SUMSUB(1,DESC)
+6 SET DESC="12-50 # w/asthma medications"
+7 DO SUMSUB(2,DESC)
+8 SET DESC="5-50 # w/asthma medications"
+9 DO SUMSUB(3,DESC)
+10 QUIT
SUMSUB(POP,DESC) ;create array entry for summary line
+1 SET LINE=""
+2 SET LINE="MU.EP.0036.1"_U_DESC_U_$PIECE(STRING1(POP),U,4)_U_$PIECE(STRING1(POP),U,1)_U_$PIECE(STRING1(POP),U,2)_U_$PIECE(STRING1(POP),U,5)_U_U_U_U_U
+3 SET LINE=LINE_$PIECE(STRING2(POP),U,4)_U_$PIECE(STRING2(POP),U,1)_U_$PIECE(STRING2(POP),U,2)_U_$PIECE(STRING2(POP),U,5)_U_$PIECE(STRING3(POP),U,4)_U_$PIECE(STRING3(POP),U,1)_U_$PIECE(STRING3(POP),U,2)_U_$PIECE(STRING3(POP),U,5)
+4 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,POP)=LINE
+5 QUIT
XML36 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=PQRI number^""^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="NQF0036"_U_""_U_+$GET(^TMP("BGPMU0036",$JOB,"C",3,"DEN"))_U_+$GET(^TMP("BGPMU0036",$JOB,"C",3,"NUM"))_U_+$GET(^TMP("BGPMU0036",$JOB,"C",3,"EXC"))
+3 KILL ^TMP("BGPMU0036",$JOB)
+4 QUIT