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

BGP4PDL.m

Go to the documentation of this file.
BGP4PDL ; IHS/CMI/LAB - IHS gpra print 01 Jul 2010 8:02 PM ;
 ;;14.1;IHS CLINICAL REPORTING;;MAY 29, 2014;Build 114
 ;
 ;
DEL ;
 K ^TMP($J)
 S ^TMP($J,"BGPDEL",0)=0
 K BGPSUMP
 D ^BGP4PDLH
 D DEL1
 I BGPRTYPE=1 D NONSUM^BGP4PDLN
 I BGPRTYPE=1 D DEVSUM^BGP4PDLD
 ;I BGPRTYPE=1 D SUMMARY
 I BGPRTYPE=1 D SDP^BGP4PDLN
 I BGPRTYPE=1 D SDP^BGP4PDLD
 ;I BGPRTYPE=1 D SDP
 I BGPRTYPE=7 D OTHSUM^BGP4PDLO
 D ^BGP4PDLS ;print lists to delimited file
 I $G(BGPCPPL) D CPPL1^BGP4DCLD
 ;if screen selected do screen
 ;
SAVEDEL ;EP
 I $G(BGPSUMON) D SUMONLY Q  ;NEW FOR 09, SUMMARY ONLY
 I BGPDELT="S" D SCREEN,EXIT Q
 ;call xbgsave to create output file
 S XBGL="BGPDATA"
 L +^BGPDATA:300 E  W:'$D(ZTQUEUED) "Unable to lock global" Q
 K ^TMP($J,"SUMMARYDEL")
 K ^BGPDATA ;global for saving
 S X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)'="ENDCOVERPAGE" S ^BGPDATA(X)=^TMP($J,"BGPDEL",X)
 I '$D(BGPGUI) D
 .;I $P($G(^BGPSITE(DUZ(2),0)),U,14) S XBUF=$P(^BGPSITE(DUZ(2),0),U,14)
 .S XBFLT=1,XBFN=BGPDELF_".txt",XBMED="F",XBTLE="GPRA 11 DELIMITED OUTPUT",XBQ="N",XBF=0
 .D ^XBGSAVE
 .K XBFLT,XBFN,XBMED,XBTLE,XBE,XBF
 I $D(BGPGUI) D
 .S (C,X)=0 F  S X=$O(^BGPDATA(X)) Q:X'=+X  S C=C+1,^BGPGUIJ(BGPGIEN,12,C,0)=^BGPDATA(X)
 .S ^BGPGUIJ(BGPGIEN,12,0)="^90552.1912^"_C_"^"_C_"^"_DT
 L -^BGPDATA
 K ^BGPDATA ;export global
 D EXIT
 Q
SUMONLY ;
 ;if screen selected do screen
 I BGPDELT="S" D SCREENSO,EXIT Q
 ;call xbgsave to create output file
 S XBGL="BGPDATA"
 L +^BGPDATA:300 E  W:'$D(ZTQUEUED) "Unable to lock global" Q
 K ^TMP($J,"SUMMARYDEL")
 K ^BGPDATA ;global for saving
 S X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(^TMP($J,"BGPDEL",X)="ENDCOVERPAGE")  S ^BGPDATA(X)=^TMP($J,"BGPDEL",X),BGPLX=X
 ;GET STARTING POINT
 S BGPSTP=0,X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)="GPRA DEVELOPMENTAL CLINICAL PERFORMANCE SUMMARY" S BGPSTP=X
 S X=BGPSTP-1,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(BGPDEVE)  S BGPLX=BGPLX+1 S ^BGPDATA(BGPLX)=^TMP($J,"BGPDEL",X) I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPDEVE=X
 I $G(BGPAREAA) D
 .S BGPSTP=0,X=BGPDEVE F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPSTP=X
 .S X=BGPDEVE,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(BGPDEVE)  S BGPLX=BGPLX+1 S ^BGPDATA(BGPLX)=^TMP($J,"BGPDEL",X) I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPDEVE=X
 S BGPSTP=0,X=BGPDEVE F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)="SELECTED NON-GPRA MEASURES CLINICAL PERFORMANCE SUMMARY" S BGPSTP=X
 S X=BGPSTP-1,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  S BGPLX=BGPLX+1 S ^BGPDATA(BGPLX)=^TMP($J,"BGPDEL",X)
 I '$D(BGPGUI) D
 .;I $P($G(^BGPSITE(DUZ(2),0)),U,14) ;S XBUF=$P(^BGPSITE(DUZ(2),0),U,14)
 .S XBFLT=1,XBFN=BGPDELF_".txt",XBMED="F",XBTLE="GPRA 10 DELIMITED OUTPUT",XBQ="N",XBF=0
 .D ^XBGSAVE
 .K XBFLT,XBFN,XBMED,XBTLE,XBE,XBF
 I $D(BGPGUI) D
 .S (C,X)=0 F  S X=$O(^BGPDATA(X)) Q:X'=+X  S C=C+1,^BGPGUIJ(BGPGIEN,12,C,0)=^BGPDATA(X)
 .S ^BGPGUIJ(BGPGIEN,12,0)="^90552.1912^"_C_"^"_C_"^"_DT
 L -^BGPDATA
 K ^BGPDATA ;export global
 D EXIT
 Q
SCREENSO ;
 S X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(^TMP($J,"BGPDEL",X)="ENDCOVERPAGE")  W !,^TMP($J,"BGPDEL",X) S BGPLX=X
 S BGPSTP=0,X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)["GPRA DEVELOPMENTAL CLINICAL PERFORMANCE SUMMARY" S BGPSTP=X
 S X=BGPSTP-1,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(BGPDEVE)  S BGPLX=BGPLX+1 W !,^TMP($J,"BGPDEL",X) I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPDEVE=X
 I $G(BGPAREAA) D
 .S BGPSTP=0,X=BGPDEVE F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPSTP=X
 .S X=BGPDEVE,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X!(BGPDEVE)  S BGPLX=BGPLX+1 W !,^TMP($J,"BGPDEL",X) I ^TMP($J,"BGPDEL",X)="refusals with respect to GPRA Developmental measure." S BGPDEVE=X
 S BGPSTP=0,X=BGPDEVE F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  I ^TMP($J,"BGPDEL",X)["SELECTED NON-GPRA MEASURES CLINICAL PERFORMANCE SUMMARY" S BGPSTP=X
 S X=BGPSTP-1,BGPLX=BGPLX+1,BGPDEVE=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  S BGPLX=BGPLX+1 W !,^TMP($J,"BGPDEL",X)
 Q
 ;
SCREEN ;
 S X=0 F  S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X  W:^TMP($J,"BGPDEL",X)'="ENDCOVERPAGE" !,^TMP($J,"BGPDEL",X)
 Q
DEL1 ;EP
 S BGPIC=0 F  S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC=""  D
 .D PRINT2
 .I $G(BGPNPL),$D(BGPINDL(BGPIC)),'$D(BGPYNPLT) S BGPINDJ=BGPIC D NPL1^BGP4NPLP ;printed nat gpra list
 .I $G(BGPNPL),$D(BGPINDL(BGPIC)),$D(BGPYNPLT) S BGPINDJ=BGPIC D CT^BGP4DSTM ;printed nat gpra SEARCH TEMPLATE
 Q:BGPQUIT
 I BGPRTYPE'=1 G PRINT3
 ;now print gpra dev measures
 S BGPGDEV=1,BGPRTYPE=9  ;control variable
 S BGPIC=0 F  S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC=""!(BGPQUIT)  I $P(^BGPINDJ(BGPIC,0),U,14) D PRINT2 D
 .Q:BGPQUIT
 .I $G(BGPNPL),$D(BGPINDL(BGPIC)),'$D(BGPYNPLT) S BGPINDJ=BGPIC D NPL1^BGP4NPLP ;printed nat gpra list
 .I $G(BGPNPL),$D(BGPINDL(BGPIC)),$D(BGPYNPLT) S BGPINDJ=BGPIC D CT^BGP4DSTM ;printed nat gpra SEARCH TEMPLATE
 Q:BGPQUIT
 ;set back to report 1
 S BGPRTYPE=1
PRINT3 ;
 Q
PRINT2 ;
 D
 .S X=" " D S(X,1,1),S(X,1,1)
 .S X=$P(^BGPINDJ(BGPIC,0),U,3) D S(X,1,1)
 .S X=" " D S(X,1,1)
 .S X="Denominator(s):" D S(X,1,1)
 .S BGPNODE=$S(BGPRTYPE=1:81,BGPRTYPE=4:61,BGPRTYPE=7:83,BGPRTYPE=9:85,1:61)
 .S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,BGPNODE,"B",BGPX)) Q:BGPX'=+BGPX  D
 ..S BGPY=0 F  S BGPY=$O(^BGPINDJ(BGPIC,BGPNODE,"B",BGPX,BGPY)) Q:BGPY'=+BGPY  D
 ...;I $P(^BGPINDJ(BGPIC,61,BGPY,0),U,2)'[BGPRTYPE Q  ;not a denom def for this report
 ...;I '$D(^BGPINDJ(BGPIC,61,BGPY,11,"B",BGPRTYPE)) Q
 ...I BGPRTYPE=4,'$D(^BGPINDJ(BGPIC,BGPNODE,BGPY,12,"B",BGPINDJ)) Q
 ...S BGPZ=0 F  S BGPZ=$O(^BGPINDJ(BGPIC,BGPNODE,BGPY,1,BGPZ)) Q:BGPZ'=+BGPZ  D
 ....S Y=^BGPINDJ(BGPIC,BGPNODE,BGPY,1,BGPZ,0) D S(Y,1,1)
 ....Q
 ...Q
 ..Q
 .S X=" " D S(X,1,1)
 .S X="Numerator(s):" D S(X,1,1)
 .S BGPNODE=$S(BGPRTYPE=1:82,BGPRTYPE=4:62,BGPRTYPE=7:84,BGPRTYPE=9:86,1:62)
 .S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,BGPNODE,"B",BGPX)) Q:BGPX'=+BGPX  D
 ..S BGPY=0 F  S BGPY=$O(^BGPINDJ(BGPIC,BGPNODE,"B",BGPX,BGPY)) Q:BGPY'=+BGPY  D
 ...;I $P(^BGPINDJ(BGPIC,62,BGPY,0),U,2)'[BGPRTYPE Q  ;not a denom def for this report
 ...;I BGPRTYPE=4,BGPINDJ'="S",$P(^BGPINDJ(BGPIC,62,BGPY,0),U,3)'[BGPINDJ Q  ;don't display
 ...;I '$D(^BGPINDJ(BGPIC,62,BGPY,11,"B",BGPRTYPE)) Q  ;not this report type
 ...I BGPRTYPE=4,'$D(^BGPINDJ(BGPIC,BGPNODE,BGPY,12,"B",BGPINDJ)) Q
 ...S BGPZ=0 F  S BGPZ=$O(^BGPINDJ(BGPIC,BGPNODE,BGPY,1,BGPZ)) Q:BGPZ'=+BGPZ  D
 ....S X=^BGPINDJ(BGPIC,BGPNODE,BGPY,1,BGPZ,0) D S(X,1,1)
 ....Q
 ...Q
 ..Q
 .S X=" " D S(X,1,1)
 .S BGPNODE=11
 .I BGPRTYPE=1,$O(^BGPINDJ(BGPIC,54,0)) S BGPNODE=54
 .I BGPRTYPE=7,$O(^BGPINDJ(BGPIC,56,0)) S BGPNODE=56
 .I BGPRTYPE=9,$O(^BGPINDJ(BGPIC,58,0)) S BGPNODE=58
 .S X="Logic:" D S(X,1,1)
 .S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,BGPNODE,BGPX)) Q:BGPX'=+BGPX  D
 ..S X=^BGPINDJ(BGPIC,BGPNODE,BGPX,0) D S(X,1,1)
 .I BGPRTYPE=9 G CALC
 .S X=" " D S(X,1,1) S X="Performance Measure Description:" D S(X,1,1) S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,$S($G(BGPNGR09):57,1:51),BGPX)) Q:BGPX'=+BGPX  D
 ..S X=^BGPINDJ(BGPIC,$S($G(BGPNGR09):57,1:51),BGPX,0) D S(X,1,1)
 .I $O(^BGPINDJ(BGPIC,52,0)) S X=" " D S(X,1,1) S X="Past Performance and/or Target:" D S(X,1,1) S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,52,BGPX)) Q:BGPX'=+BGPX  D
 ..S X=^BGPINDJ(BGPIC,52,BGPX,0) D S(X,1,1)
 .I $O(^BGPINDJ(BGPIC,55,0)) S X=" " D S(X,1,1) S X="Source:" D S(X,1,1) S BGPX=0 F  S BGPX=$O(^BGPINDJ(BGPIC,55,BGPX)) Q:BGPX'=+BGPX  D
 ..S X=^BGPINDJ(BGPIC,55,BGPX,0) D S(X,1,1)
 .I '$O(^BGPINDJ(BGPIC,55,0)) D S(" ",1,1)
CALC .X ^BGPINDJ(BGPIC,4)
 Q
 S Y=$P(^VA(200,DUZ,0),U,2),$E(Y,35)=$$FMTE^XLFDT(DT) D S(Y,1,1)
 I BGPRTYPE=7 S Y="*** IHS 2014 Other National Measures Report ***" D S(Y,1,1)
 I BGPRTYPE=4 S Y="*** IHS 2014 Clinical Performance Report ***" D S(Y,1,1)
 I BGPRTYPE=1,'$G(BGPNGR09) S Y="*** IHS 2014 National GPRA/GPRAMA Report ***" D S(Y,1,1)
 I BGPRTYPE=1,$G(BGPNGR09) S Y="*** IHS 2014 National GPRA/GPRAMA Report, Run Using 2014 Logic ***" D S(Y,1,1)
 I $G(BGPAREAA) S Y="AREA AGGREGATE" D S(Y,1,1)
 I '$G(BGPAREAA) S Y=$P(^DIC(4,DUZ(2),0),U) D S(Y,1,1)
 ;S X=$$RPTVER^BGP4BAN D S(X,1,1)
 S X="Report Period:  "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) D S(X,1,1)
 S X="Previous Year Period:  "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED) D S(X,1,1)
 S X="Baseline Period:  "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED) D S(X,1,1)
 S X=" " D S(X,1,1)
 Q:$G(BGPSUMP)
 I BGPRTYPE=1 S X="Measures: GPRA, GPRA Developmental, and PART Denominators and Numerators and Selected Other Clinical Denominators and Numerators" D S(X,1,1)
 S X=" " D S(X,1,1)
 I BGPRTYPE=1 S X="Population:  AI/AN Only (Classification 01)" D S(X,1,1)
 S X=" " D S(X,1,1)
 S BGPI=$O(^BGPCTRL("B",2014,0))
 S BGPX=0 F  S BGPX=$O(^BGPCTRL(BGPI,14,BGPX)) Q:BGPX'=+BGPX  D
 .S X=^BGPCTRL(BGPI,14,BGPX,0) D S(X,1,1)
 I $G(BGPEXPT) S X="A file will be created called BG141"_$P(^AUTTLOC(DUZ(2),0),U,10)_"."_BGPRPT_"." D S(X,1,1)
 S X="It will reside in the public/export directory.  This file should be sent to your Area Office." D S(X,1,1)
 S X=" " D S(X,1,1)
 I $G(BGPALLPT) S X="All Communities Included." D S(X,1,1)
 I '$G(BGPALLPT),'$G(BGPSEAT) S X="Community Taxonomy Name: "_$P(^ATXAX(BGPTAXI,0),U) D S(X,1,1)
 I '$G(BGPALLPT),'$G(BGPSEAT) S X="The following communities are included in this report:" D S(X,1,1) D
 .S BGPZZ="",N=0,Y="" F  S BGPZZ=$O(BGPTAX(BGPZZ)) Q:BGPZZ=""  S N=N+1,Y=Y_$S(N=1:"",1:";")_BGPZZ
 .S BGPZZ=0,C=0 F BGPZZ=1:3:N D
 ..S X=$E($P(Y,";",BGPZZ),1,20),$E(X,3)=$E($P(Y,";",(BGPZZ+1)),1,20),$E(X,60)=$E($P(Y,";",(BGPZZ+2)),1,20)
 ..Q
 I $G(BGPMFITI) S X="MFI Location Taxonomy Name: "_$P(^ATXAX(BGPMFITI,0),U) D S(X,1,1)
 I $G(BGPMFITI) S X="The following locations are used for patient visits in this report:" D S(X,1,1) D
 .S BGPZZ="",N=0,Y="" F  S BGPZZ=$O(^ATXAX(BGPMFITI,21,"B",BGPZZ)) Q:BGPZZ=""  S N=N+1,Y=Y_$S(N=1:"",1:";")_$P($G(^DIC(4,BGPZZ,0)),U)
 .S BGPZZ=0,C=0 F BGPZZ=1:3:N D
 ..S X=$E($P(Y,";",BGPZZ),1,20),$E(X,3)=$E($P(Y,";",(BGPZZ+1)),1,20),$E(X,60)=$E($P(Y,";",(BGPZZ+2)),1,20)
 ..Q
 K BGPX,BGPQUIT
 S X=$TR($J(""," ","-"),80) D S(X,1,1)
 Q
EXIT ;
 K ^TMP($J)
 Q
CTR(X,Y) ;EP - Center
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------
USR() ;EP - Return user
 Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
 ;----------
S(Y,F,P) ;EP set up array
 I '$G(F) S F=0
 S %=$P(^TMP($J,"BGPDEL",0),U)+F,$P(^TMP($J,"BGPDEL",0),U)=%
 I '$D(^TMP($J,"BGPDEL",%)) S ^TMP($J,"BGPDEL",%)=""
 S $P(^TMP($J,"BGPDEL",%),U,P)=Y
 Q
C(X,X2,X3) ;
 D COMMA^%DTC
 Q X