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

BGPMUGP5.m

Go to the documentation of this file.
  1. 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
  1. ;Printed output reports for this measure
  1. ASTPHARM ;EP
  1. D P1
  1. K ^TMP("BGPMU0036",$J)
  1. Q
  1. P1 ;Write individual measure
  1. N X,Y,Z,LIST1,LIST2,LIST3
  1. N DEN1,NUM1,DEN2,NUM2,NUMPCT,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,SUMCT
  1. N PRD1,PRD4,PRN1,PRN4
  1. K STRING1,STRING2,STRING3
  1. S SUMCT=0
  1. D NUM36("C",.STRING1)
  1. D NUM36("P",.STRING2)
  1. D NUM36("B",.STRING3)
  1. D SUMMARY1(.STRING1,.STRING2,.STRING3)
  1. D HEADER^BGPMUPH Q:BGPQUIT
  1. D HDRBLK^BGPMUPH
  1. D P1SUB(1)
  1. D P1SUB(2)
  1. D P1SUB(3)
  1. I $D(BGPLIST(BGPIC)) D P2
  1. Q
  1. P1SUB(POP) ;Population tabular output
  1. S PRD1=$P(STRING1(POP),U,5)-$P(STRING2(POP),U,5)
  1. S PRD4=$P(STRING1(POP),U,7)-$P(STRING2(POP),U,7)
  1. S PRN1=$P(STRING1(POP),U,5)-$P(STRING3(POP),U,5)
  1. S PRN4=$P(STRING1(POP),U,7)-$P(STRING3(POP),U,7)
  1. I $Y>(BGPIOSL-6) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
  1. W !!,"Denominator ",POP
  1. W !!,$P($T(P1TEXT+POP),";;",2),?33,$P(STRING1(POP),U,1),?44,$P(STRING2(POP),U,1),?64,$P(STRING3(POP),U,1)
  1. W !,"indicative of asthma"
  1. I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
  1. W !,"# Excluded (Exc)",?33,$P(STRING1(POP),U,4),?44,$P(STRING2(POP),U,4),?64,$P(STRING3(POP),U,4)
  1. I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
  1. W !,$P($T(P1TEXT+POP),";;",2),?33,$P(STRING1(POP),U,3),?44,$P(STRING2(POP),U,3),?64,$P(STRING3(POP),U,3)
  1. W !,"indicative of asthma less Exc"
  1. I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
  1. 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)
  1. 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)
  1. I $Y>(BGPIOSL-4) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
  1. 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)
  1. 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)
  1. Q
  1. P1TEXT ;Text lines for output
  1. ;;Pts 5-11 w/asthma or meds
  1. ;;Pts 12-50 w/asthma or meds
  1. ;;Pts 5-50 w/asthma or meds
  1. NUM36(TF,ARRAY) ;Get the numbers for this measure
  1. N STRING,DENTOT,NUM,EXC,NOT,NUMPCT,FINALDEN,NOTPCT,I
  1. F I=1:1:3 S ARRAY(I)=$$NUMSUB(I)
  1. Q
  1. NUMSUB(POP) ;pull numbers out of temp global
  1. S DENTOT=+$G(^TMP("BGPMU0036",$J,TF,POP,"DEN"))
  1. S NUM=+$G(^TMP("BGPMU0036",$J,TF,POP,"NUM"))
  1. S NOT=+$G(^TMP("BGPMU0036",$J,TF,POP,"NOT"))
  1. S EXC=+$G(^TMP("BGPMU0036",$J,TF,POP,"EXC"))
  1. S FINALDEN=DENTOT-EXC
  1. I DENTOT=0 S (NUMPCT,NOTPCT)=0
  1. I DENTOT>0&(FINALDEN=0) D
  1. .S (NUMPCT,NOTPCT)=0
  1. I DENTOT>0&(FINALDEN>0) D
  1. .S NUMPCT=$$ROUND^BGPMUA01((NUM/FINALDEN),3)*100
  1. .S NOTPCT=$$ROUND^BGPMUA01((NOT/FINALDEN),3)*100
  1. S STRING=DENTOT_U_NUM_U_FINALDEN_U_EXC_U_NUMPCT_U_NOT_U_NOTPCT
  1. Q STRING
  1. P2 ;Do the Details
  1. N PT,NODE,NAME,VST,BMI,FOL,X,PTCT,BGPARR,LINE
  1. D HEADERL^BGPMUPH
  1. S X="Patients 5-50 years of age with one of the following during the reporting" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="period or within 1 year before the beginning of the reporting period: (a) at" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="least 1 ED or acute inpatient encounter with the EP and a diagnosis of asthma," D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="(b) at least 4 outpatient encounters with the EP AND a diagnosis of asthma AND" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="at least 2 counts asthma medication prescribed by the EP, (c) at least 4 counts" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="of asthma medication prescribed by the EP, or (d) at least 4 counts of " D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="leukotriebe inhibitors prescribed by the EP and a diagnosis of asthma, if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="Patients who did not meet the numerator criteria are listed first (NM:)" D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. S X="followed by patients who do meet the numerator criteria (M:). Excluded patients" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="are listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="AST=Asthma Diagnosis" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="MED=Asthma Medication" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
  1. W !!,"Patients 5-11"
  1. W !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
  1. S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. D LISTSUB(1)
  1. W !!,"Patients 12-50"
  1. W !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
  1. S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. D LISTSUB(2)
  1. Q
  1. LISTSUB(POP) ;write out patient list for given population
  1. S PTCT=0
  1. I BGPLIST="D"!(BGPLIST="A") D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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(""BGPMU0036"","_$J_",""PAT"",""C"","_POP_",""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. W !!,"Total # of patients on list: "_PTCT
  1. Q
  1. DATA(NODE) ;GET DATA
  1. N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,DEN3,LINE,I,DENLEN
  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,2)
  1. S DEN1=$P(DEN,";",1)
  1. S NUM=$P(NODE,U,3)
  1. S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
  1. S SEX=$P(^DPT(DFN,0),U,2)
  1. I $Y>(BGPIOSL-2) D
  1. .D HEADERL^BGPMUPH Q:BGPQUIT
  1. .W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?65,"NUMERATOR"
  1. .S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. W !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN1,?65,NUM
  1. S DENLEN=$L(DEN,";")
  1. I DENLEN>1 F I=2:1:DENLEN W !,?50,$P(DEN,";",I)
  1. Q
  1. SUMMARY1(STRING1,STRING2,STRING3,CT) ;Summmary setup
  1. N DESC,LINE
  1. K ^TMP("BGPMU SUMMARY",$J,BGPIC)
  1. S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0036^"
  1. S DESC="5-11 # w/asthma medications"
  1. D SUMSUB(1,DESC)
  1. S DESC="12-50 # w/asthma medications"
  1. D SUMSUB(2,DESC)
  1. S DESC="5-50 # w/asthma medications"
  1. D SUMSUB(3,DESC)
  1. Q
  1. SUMSUB(POP,DESC) ;create array entry for summary line
  1. S LINE=""
  1. 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
  1. 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)
  1. S ^TMP("BGPMU SUMMARY",$J,BGPIC,POP)=LINE
  1. Q
  1. XML36 ;Populate the BGPXML array with data for each population/numerator
  1. ; BGPXMLOUT(i)=PQRI number^""^Denominator Count^Numerator Count^Exclusion Count
  1. 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"))
  1. K ^TMP("BGPMU0036",$J)
  1. Q