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

BGP5DCI.m

Go to the documentation of this file.
BGP5DCI ; IHS/CMI/LAB - IHS area GPRA 10 Dec 2006 9:12 AM ; 19 Feb 2015  11:04 AM
 ;;15.1;IHS CLINICAL REPORTING;;MAY 06, 2015;Build 143
 ;
CALCIND ;EP - CALCULATE ALL MEASURES
 S BGPIC=0 F  S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC'=+BGPIC  D
 .I BGPRTYPE=1,$P(^BGPINDK(BGPIC,0),U,7)'=1 Q  ;national gpra report
 .I BGPRTYPE=7,$P($G(^BGPINDK(BGPIC,12)),U,1)'=1 Q  ;OTHER NATIONAL
 .K BGPSTOP,BGPVAL,BGPVALUE,BGPVALUD,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z,BGPVALUD
 .K BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPN7,BGPN8,BGPN9,BGPN10,BGPN11,BGPN12,BGPN13,BGPN14,BGPN15,BGPN16,BGPN17,BGPN18,BGPN19,BGPN20,BGPN21,BGPN22,BGPN23,BGPN24,BGPN25,BGPN26,BGPN27,BGPN28,BGPN29,BGPN30
 .K BGPN31,BGPN32,BGPN33,BGPN34,BGPN35,BGPN36,BGPN37,BGPN38,BGPN39,BGPN40,BGPN41,BGPN42,BGPN43,BGPN44,BGPN45,BGPN46,BGPN50,BGPN51,BGPN52,BGPN60,BGPN61,BGPN62,BGPN70,BGPN71,BGPN72,BGPN80,BGPN81,BGPN82
 .K BGPD1,BGPD2,BGPD3,BGPD4,BGPD5,BGPD6,BGPD7,BGPD8,BGPD9,BGPD10,BGPD11,BGPD12,BGPD13
 .K BGPNUMV
 .K ^TMP($J)
 .I $D(^BGPINDK(BGPIC,1)) X ^BGPINDK(BGPIC,1)
 .K BGPVAL,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
 .K ^TMP($J)
 .;Set up global for iCare
 .I $G(BQIGREF)'="",$D(BGPSTOP) S @BQIGREF@(DFN,BGPIC)=$P(^BGPINDK(BGPIC,0),U,3)_"^N/A" Q
 .I $D(BGPSTOP) Q  ;no need to set since no num/denom
 .;loop each individual to set numerator and denominator
 .S BGPI=0 F  S BGPI=$O(^BGPINDKC("B",BGPIC,BGPI)) Q:BGPI'=+BGPI  D
 ..S (BGPNUM,BGPDEN)=0
 ..X ^BGPINDKC(BGPI,1)
 ..X ^BGPINDKC(BGPI,2) ;denominator 1 or 0
 ..;set field counter
 ..S BGPNF=$P(^BGPINDKC(BGPI,0),U,9)
 ..S BGPN=$P(^DD(90554.03,BGPNF,0),U,4)
 ..S N=$P(BGPN,";"),P=$P(BGPN,";",2)
 ..D S(BGPRPT,BGPGBL,N,P,BGPNUM),S1("N",BGPNUM)
 ..S BGPDF=$P(^BGPINDKC(BGPI,0),U,8)
 ..S BGPN=$P(^DD(90554.03,BGPDF,0),U,4),N=$P(BGPN,";"),P=$P(BGPN,";",2)
 ..I BGPDEN'="NO" D S(BGPRPT,BGPGBL,N,P,BGPDEN),S1("D",BGPDEN)
 ..I $G(BGPCPPL) D CPL
 .I $D(BGPLIST(BGPIC)) D STMP^BGP5UTL
 .I $G(BGPNPL) D NPL
 K BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPN7,BGPN8,BGPN9,BGPN10,BGPN11,BGPN12,BGPN13,BGPN14,BGPN15,BGPN16,BGPN17,BGPN18,BGPN19,BGPN20,BGPN21,BGPN22,BGPN23,BGPN24,BGPN25,BGPN26
 Q
 ;
CPL ;comprehensive pat list check and set xtmp
 I BGPLIST="P",$P(^AUPNPAT(DFN,0),U,14)'=BGPLPRV Q  ;not this provider
 Q:BGPTIME'=1
 Q:$P($G(^BGPINDKC(BGPI,12)),U,1)=""
 X ^BGPINDKC(BGPI,3) Q:'$T
 S C=$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN")
 S S=$P(^DPT(DFN,0),U,2)
 S D=$P(BGPVALUE,"|||")
 S F=$P($G(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN)),"|||")
 I D["UP" S $P(F,"$$",1)="UP"
 I D["AC" S $P(F,"$$",2)="AC"
 I D["AD" S $P(F,"$$",3)="AD"
 I D["AAD" S $P(F,"$$",4)="AAD"
 I D["PREG" S $P(F,"$$",5)="PREG"
 I D["IMM" S $P(F,"$$",6)="IMM"
 I D["IHD" S $P(F,"$$",7)="IHD"
 I '$D(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN)) D  Q
 .S ^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN)=F_"|||"_$P(^BGPINDKC(BGPI,12),U),BGPCPLC=BGPCPLC+1
 S $P(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN),"|||")=F
 S $P(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN),"|||",2)=$P(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",C,S,BGPAGEB,DFN),"|||",2)_"#"_$P(^BGPINDKC(BGPI,12),U)
 Q
NPL ;
 Q:BGPTIME'=1
 Q:'$D(BGPINDL(BGPIC))  ;not a selected topic
 NEW A
 S BGPX=0 F  S BGPX=$O(BGPINDL(BGPIC,BGPX)) Q:BGPX'=+BGPX  D
 .I BGPLIST="P",$P(^AUPNPAT(DFN,0),U,14)'=BGPLPRV Q
 .S BGPORD=$P($G(^BGPINDK(BGPIC,12)),U,6)
 .X ^BGPNPLK(BGPX,12) K ^TMP($J) Q:'$T
 .S BGPINDL(BGPIC,BGPX)=$G(BGPINDL(BGPIC,BGPX))+1
 .I $G(BGPYNPLT) S ^XTMP("BGP5DNP",BGPJ,BGPH,"LIST",BGPORD,BGPIC,BGPX,DFN)="" Q
 .S BGPO=$S(BGPRTYPE=7:$P(^BGPNPLK(BGPX,0),U,6),1:$P(^BGPNPLK(BGPX,0),U,5))
 .S A=""
 .I $P(^BGPINDK(BGPIC,0),U,2)=151 S A=BGPAGEE G SL
 .I $P(^BGPINDK(BGPIC,0),U,2)=171 S A=BGPAGEE G SL
 .S A=BGPAGEB
SL .I $P(^BGPNPLK(BGPX,0),U,7)=9,$G(BGPVALUD)]"" S BGPVALUE=BGPVALUD
 .S ^XTMP("BGP5DNP",BGPJ,BGPH,"LIST",BGPORD,BGPIC,BGPO,BGPX,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),A,DFN)=$G(BGPVALUE)
 K BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPN7,BGPN8,BGPN9,BGPN10,BGPN11,BGPN12,BGPN13,BGPN14,BGPN15,BGPN16,BGPN17,BGPN18,BGPN19,BGPN20,BGPN21,BGPN22,BGPN23,BGPN24,BGPN25,BGPN26,BGPX,A
 Q
S(R,G,N,P,V) ;
 I 'V Q  ;no value to add
 S $P(@(G_R_","_N_")"),U,P)=$P($G(@(G_R_","_N_")")),U,P)+V
 Q
D(D) ;
 I D="" Q ""
 Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_(1700+$E(D,1,3))
 ;
S1(BQITYP,BQIVAL) ; Return data by patient for iCare into global reference BQIGREF
 ;Input Variables
 ;  BQITYP - Type of value
 ;           D = Denominator
 ;           N = Numerator
 ;  BQIVAL - Value of the type; 0 or 1
 ;Assumed variables
 ;  BGPVALUE - the measure value
 ;  BQIGREF  - global reference where data will be stored temporarily
 ;  BGPIC    - Indicator IEN
 ;  BGPI     - Individual Indicator IEN
 ;  DFN      - Patient IEN
 ;
 ; If no value of BQIGREF, then it's the regular GPRA report calling the code
 ; and nothing needs to be set for iCare.
 Q:$G(BQIGREF)=""
 ;
 ; If no denominator or numerator value, then it doesn't need to be set for iCare
 I '$G(BQIVAL) Q
 ;
 NEW BQITIT,BQILTIT,BQILTIT1,BQILTIT2,BQILTIT3,BQILDTI1,BQILDTI2
 NEW BQIDTIT,BQIFTIT,BQITWEN,BQICURR,BQIIDTA,BQIDTA,BQILDTI3
 S BQIIDTA=$G(^BGPINDKC(BGPI,0))
 S BQIDTA=$G(^BGPINDKC(BGPI,14))
 ;
 ; Get the Individual Indicator TITLE (1404) 
 S BQITIT=$P(BQIDTA,U,4)
 ;
 ; Get the Individual Indicator LINE TITLE 1 (.15)
 S BQILTIT1=$P(BQIIDTA,U,15)
 I BQILTIT1="" Q
 ; Get the Individual Indicator LINE TITLE 2 and 3 (.16,.19) 
 S BQILTIT2=$P(BQIIDTA,U,16)
 S BQILTIT3=$P(BQIIDTA,U,19)
 S BQILTIT=BQILTIT1_" "_BQILTIT2_" "_BQILTIT3
 ;
 ; Get the Individual Indicator LOCAL DENOM TITLE 1, 2, and 3 (.17,.18,.21)
 S BQILDTI1=$P(BQIIDTA,U,17)
 S BQILDTI2=$P(BQIIDTA,U,18)
 S BQILDTI3=$P(BQIIDTA,U,21)
 S BQIDTIT=BQILDTI1_" "_BQILDTI2_" "_BQILDTI3
 ;
 ;  Full title is all title fields
 S BQIFTIT=BQITIT_" "_BQILTIT_" "_BQIDTIT
 S $P(@BQIGREF@(DFN,BGPIC,BGPI),"^",1)=BQIFTIT
 ;
 ;  Get the GOAL 2015 value and the GOAL 06 value
 S BQITWEN=$P(BQIDTA,U,3)
 S BQICURR=$P(BQIDTA,U,8)
 ;
 I BQITYP="N" S $P(@BQIGREF@(DFN,BGPIC,BGPI),"^",2)=$G(BQIVAL)
 ;
 I BQITYP="D" S $P(@BQIGREF@(DFN,BGPIC,BGPI),"^",3)=$G(BQIVAL)
 ;
 ;  Set the Indicator TITLE (.03)
 S $P(@BQIGREF@(DFN,BGPIC),U,1)=$P(^BGPINDK(BGPIC,0),U,3)
 S $P(@BQIGREF@(DFN,BGPIC),U,2)=$G(BGPVALUE)
 I BQITWEN'="" S $P(@BQIGREF@(DFN,BGPIC),U,3)=BQITWEN
 I BQICURR'="" S $P(@BQIGREF@(DFN,BGPIC),U,4)=BQICURR
 Q