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

BGP8D75.m

Go to the documentation of this file.
BGP8D75 ; IHS/CMI/LAB - measure 31 ;
 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
 ;
 ;
IAMT ;EP
 S (BGPD1,BGPD2,BGPD3,BGPD4,BGPD5,BGPD6,BGPD7,BGPD8,BGPD9)=0
 S (BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPN7,BGPN8,BGPN9,BGPN10,BGPN11,BGPN12,BGPN13,BGPN14,BGPN15,BGPN16,BGPN17)=0
 S BGPVALUE="" K BGPBETA
 I BGPAGEB<35 S BGPSTOP=1 Q
 I 'BGPACTCL S BGPSTOP=1 Q
 S BGPAMI=$$AMIH(DFN,BGPBDATE,$$FMADD^XLFDT(BGPBDATE,(51*7)))
 I '$P(BGPAMI,U) S BGPSTOP=1 Q  ;no ami
 I $$READM(DFN,$P(BGPAMI,U,4),$P(BGPAMI,U,3)) S BGPSTOP=1 Q
 S BGPV=$P(BGPAMI,U,3)
 S BGPD1=1
 I $P(^DPT(DFN,0),U,2)="M" S BGPD2=1
 I $P(^DPT(DFN,0),U,2)="F" S BGPD3=1
 K BGPBETA
 S BGPBETA("RX")=$$RX7(DFN,$$FMADD^XLFDT($P(BGPAMI,U,2),-180),$$FMADD^XLFDT($P(BGPAMI,U,4),7),$P(BGPAMI,U,4),$O(^ATXAX("B","BGP PQA BETA BLOCKER MEDS",0)),,,$O(^ATXAX("B","BGP PQA BETA BLOCKER NDC",0)))
 I BGPBETA("RX") S BGPN2=1,BGPN3=0,BGPN4=0
 ;I 'BGPN2 S BGPBETA("REF")=$$BETAREF^BGP8D721(DFN,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPBETA("REF") S BGPN3=1
 I 'BGPN2 S BGPBETA("CONTRA")=$$BETACONT^BGP8D721(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPBETA("CONTRA") S BGPN4=1 ;beta Contraindication
 I 'BGPN2,'BGPN4 S BGPBETA("ADR")=$$BETAALG1^BGP8D72(DFN,BGPEDATE) I BGPBETA("ADR") S BGPN4=1
 I (BGPN2+BGPN4) S BGPN1=1
 ;
 K BGPASA
 S C=$O(^ATXAX("B","BGP CMS ANTI-PLATELET CLASS",0))
 S BGPASA("RX")=$$RX7(DFN,$$FMADD^XLFDT($P(BGPAMI,U,2),-180),$$FMADD^XLFDT($P(BGPAMI,U,4),7),$P(BGPAMI,U,4),$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),,,,C)
 I BGPASA("RX") S BGPN6=1
 ;I 'BGPN6 S BGPASA("REF")=$$ASAREF^BGP8D721(DFN,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPASA("REF") S BGPN7=1
 I 'BGPN6 S BGPASA("CONTRA")=$$ASACONTR(DFN,BGPBDATE,BGPEDATE,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPASA("CONTRA") S BGPN8=1 ;beta Contraindication
 I 'BGPN6 S BGPASA("ADR")=$$ASAALLEG^BGP8D721(DFN,BGPEDATE) I BGPASA("ADR") S BGPN8=1
 I (BGPN6+BGPN8) S BGPN5=1
 K BGPACE
 S T=$O(^ATXAX("B","BGP HEDIS ACEI MEDS",0))
 S BGPACE("RX")=$$RX7(DFN,$$FMADD^XLFDT($P(BGPAMI,U,2),-180),$$FMADD^XLFDT($P(BGPAMI,U,4),7),$P(BGPAMI,U,4),T,,$O(^ATXAX("B","BGP HEDIS ACEI NDC",0)),$O(^ATXAX("B","BGP HEDIS ARB MEDS",0)),$O(^ATXAX("B","BGP HEDIS ARB NDC",0)))
 I BGPACE("RX") S BGPN10=1
 ;I 'BGPN10 S BGPACE("REF")=$$ACEREF^BGP8D722(DFN,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPACE("REF") S BGPN11=1
 I 'BGPN10 S BGPACE("CONTRA")=$$ACECONT(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7),BGPBDATE) I BGPACE("CONTRA") S BGPN12=1 ;beta Contraindication
 I 'BGPN10 S BGPACE("ADR")=$$ACEALG^BGP8D722(DFN,BGPBDATE,BGPEDATE) I BGPACE("ADR") S BGPN12=1
 I (BGPN10+BGPN12) S BGPN9=1
 K BGPSTAT
 S BGPSTAT("RX")=$$RX7(DFN,$$FMADD^XLFDT($P(BGPAMI,U,2),-180),$$FMADD^XLFDT($P(BGPAMI,U,4),7),$P(BGPAMI,U,4),$O(^ATXAX("B","BGP PQA STATIN MEDS",0)),,,$O(^ATXAX("B","BGP HEDIS STATIN NDC",0)))
 I BGPSTAT("RX") S BGPN14=1
 I 'BGPN14 S BGPSTAT("CONTRA")=$$STATCON^BGP8D722(DFN,BGPBDATE,BGPEDATE,$P(BGPAMI,U,2),$$FMADD^XLFDT($P(BGPAMI,U,4),7)) I BGPSTAT("CONTRA") S BGPN16=1 ;beta Contraindication
 I 'BGPN14 S BGPSTAT("ADR")=$$STATALG^BGP8D722(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,BGPBDATE,BGPEDATE) I BGPSTAT("ADR") S BGPN16=1
 I (BGPN14+BGPN16) S BGPN13=1
 I BGPN1,BGPN5,BGPN9,BGPN13 S BGPN17=1
 S BGPVALUE="AC|||"
 S BGPVALUE=BGPVALUE_$S(BGPN17:"ALL MEDS: ",1:"")
 I BGPN2!(BGPN3)!(BGPN4) S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":" ",1:"") S BGPVALUE=BGPVALUE_"BETA: " F X="RX","REF","CONTRA","ADR" I $P($G(BGPBETA(X)),U,1),$P($G(BGPBETA(X)),U,2)]"" D
 .S BGPVALUE=BGPVALUE_$P(BGPBETA(X),U,2)_$S($P(BGPBETA(X),U,3)]"":" "_$P(BGPBETA(X),U,3),1:"")
 I BGPN6!(BGPN7)!(BGPN8) S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:"") S BGPVALUE=BGPVALUE_"ASA: " F X="RX","REF","CONTRA","ADR" I $P($G(BGPASA(X)),U,1),$P($G(BGPASA(X)),U,2)]"" D
 .S BGPVALUE=BGPVALUE_$P(BGPASA(X),U,2)_$S($P(BGPASA(X),U,3)]"":" "_$P(BGPASA(X),U,3),1:"")
 I BGPN10!(BGPN11)!(BGPN12) S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:"") S BGPVALUE=BGPVALUE_"ACEI/ARB: " F X="RX","REF","CONTRA","ADR" I $P($G(BGPACE(X)),U,1),$P($G(BGPACE(X)),U,2)]"" D
 .S BGPVALUE=BGPVALUE_$P(BGPACE(X),U,2)_$S($P(BGPACE(X),U,3)]"":" "_$P(BGPACE(X),U,3),1:"")
 I BGPN14!(BGPN15)!(BGPN16) S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:"") S BGPVALUE=BGPVALUE_"STATIN: " F X="RX","REF","CONTRA","ADR" I $P($G(BGPSTAT(X)),U,1),$P($G(BGPSTAT(X)),U,2)]"" D
 .S BGPVALUE=BGPVALUE_$P(BGPSTAT(X),U,2)_$S($P(BGPSTAT(X),U,3)]"":" "_$P(BGPSTAT(X),U,3),1:"")
 K BGPIHD,BGPBETA,BGPMEDS1,BGPASA,BGPACE,BGPSTAT
 K ^TMP($J)
 Q
AMIH(P,BDATE,EDATE) ;
 ;look for any H with AMI discharge dx
 K ^TMP($J,"A"),G
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q 0  ;no HOSP
 S T=$O(^ATXAX("B","BGP AMI DXS PAMT",0))
 S (BGPX,G,M,D,E)=0 F  S BGPX=$O(^TMP($J,"A",BGPX)) Q:BGPX'=+BGPX  S V=$P(^TMP($J,"A",BGPX),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:$P(^AUPNVSIT(V,0),U,7)'="H"
 .;Q:"CV"[$P(^AUPNVSIT(V,0),U,3)
 .S H=0
 .S H=$O(^AUPNVINP("AD",V,0)) D  Q:'B
 ..S B=0
 ..I 'H Q
 ..Q:$P($P(^AUPNVINP(H,0),U),".")>EDATE
 ..Q:$$AMA(H)  ;ama
 ..Q:$$TRANS(H)  ;transferred
 ..Q:$$EXPIRED(H)  ;died
 ..S B=1
 .S (D,Y)=0 F  S Y=$O(^AUPNVPOV("AD",V,Y)) Q:Y'=+Y!(D)  I $D(^AUPNVPOV(Y,0)) D
 ..S %=$P(^AUPNVPOV(Y,0),U) Q:'$$ICD^BGP8UTL2(%,T,9)
 ..I $P(^AUPNVPOV(Y,0),U,6)]"",$P(^AUPNVPOV(Y,0),U,6)'="F" Q  ;modifier
 ..S N=$$VAL^XBDIQ1(9000010.07,Y,.04)
 ..S N=$$UP^XLFSTR(N)
 ..I $E(N,1,8)="CONSIDER" Q
 ..I $E(N,1,8)="DOUBTFUL" Q
 ..I $E(N,1,5)="MAYBE" Q
 ..I $E(N,1,8)="POSSIBLE" Q
 ..I $E(N,1,7)="PERHAPS" Q
 ..I $E(N,1,8)="RULE OUT" Q
 ..I $E(N,1,3)="R/O" Q
 ..I $E(N,1,8)="PROBABLE" Q
 ..I $E(N,1,8)="RESOLVED" Q
 ..I $E(N,1,7)="SUSPECT" Q
 ..I $E(N,1,10)="SUSPICIOUS" Q
 ..I $E(N,1,11)="STATUS POST" Q
 ..S D=1
 .I D S G=G+1,G($P($P(^AUPNVSIT(V,0),U),"."))=V ;got one visit
 I 'G Q G
 S D=$O(G(0)),V=G(D),H=$O(^AUPNVINP("AD",V,0))
 Q 1_U_$O(G(0))_U_V_U_$S(H:$P($P(^AUPNVINP(H,0),U),"."),1:"")_U_H
READM(P,D,PV) ;EP
 NEW ED,G,X,V,E
 S ED=$$FMADD^XLFDT(D,7),G=0,D1=$$FMADD^XLFDT(D,1)
 S X=0,V=0 F  S X=$O(^AUPNVSIT("AAH",P,X)) Q:X'=+X  D
 .S V=0 F  S V=$O(^AUPNVSIT("AAH",P,X,V)) Q:V'=+V  D
 ..Q:V=PV  ;same visit
 ..S E=$P($P($G(^AUPNVSIT(V,0)),U),".")
 ..Q:E<D
 ..Q:E>ED
 ..S G=1
 Q G
AMA(H) ;EP
 S X=$P(^AUPNVINP(H,0),U,6)
 I X="" Q 0
 S X=$P($G(^DG(405.1,X,"IHS")),U,1)
 I X=3 Q 1
 Q 0
EXPIRED(H) ;
 S X=$P(^AUPNVINP(H,0),U,6)
 I X="" Q 0
 S X=$P($G(^DG(405.1,X,"IHS")),U,1)
 I X=4!(X=5)!(X=6)!(X=7) Q 1
 Q 0
DSCH(H) ;
 Q $P($P(^AUPNVINP(H,0),U),".")
TRANS(H) ;
 S X=$P(^AUPNVINP(H,0),U,6)
 I X="" Q 0
 S X=$P($G(^DG(405.1,X,"IHS")),U,1)
 I X=2 Q 1
 Q 0
RX7(P,BDATE,EDATE,BGPDD,BGPTD1,BGPTD2,BGPTD3,BGPTN1,BGPTN2,BGPTN3,BGPTC1,BGPTC2,BGPTC3,BGPDN1,BGPDN2) ;
 ;see if there ACTIVE PRESCRIPTION of these meds in time window
 K BGPMEDS1
 S K=0,R="",BGPG=""
 D GETMEDS^BGP8UTL2(P,BDATE,EDATE,,,,,.BGPMEDS1)
 I '$D(BGPMEDS1) Q ""
 S BGPG="",X=0 F  S X=$O(BGPMEDS1(X)) Q:X'=+X!($P(BGPG,U))  S Y=+$P(BGPMEDS1(X),U,4) D
 .Q:'$D(^AUPNVMED(Y,0))
 .Q:$$UP^XLFSTR($P($G(^AUPNVMED(Y,11)),U))["RETURNED TO STOCK"
 .S G=0
 .S D=$P(^AUPNVMED(Y,0),U)
 .I $G(BGPTD1),$D(^ATXAX(BGPTD1,21,"B",D)) S G=1 G RX71
 .I $G(BGPTD2),$D(^ATXAX(BGPTD2,21,"B",D)) S G=1 G RX71
 .I $G(BGPTD3),$D(^ATXAX(BGPTD3,21,"B",D)) S G=1 G RX71
 .S N=$P($G(^PSDRUG(D,2)),U,4)
 .I N]"",$G(BGPTN1),$D(^ATXAX(BGPTN1,21,"B",N)) S G=1 G RX71
 .I N]"",$G(BGPTN2),$D(^ATXAX(BGPTN2,21,"B",N)) S G=1 G RX71
 .I N]"",$G(BGPTN3),$D(^ATXAX(BGPTN3,21,"B",N)) S G=1 G RX71
 .S C=$P($G(^PSDRUG(D,0)),U,2)
 .I C]"",$G(BGPTC1),$D(^ATXAX(BGPTC1,21,"B",C)) S G=1 G RX71
 .I C]"",$G(BGPTC2),$D(^ATXAX(BGPTC2,21,"B",C)) S G=1 G RX71
 .I C]"",$G(BGPTC3),$D(^ATXAX(BGPTC3,21,"B",C)) S G=1 G RX71
 .S N=$P($G(^PSDRUG(D,0)),U,1)
 .I $G(BGPDN1)]"",N[BGPDN1 S G=1 G RX71
 .I $G(BGPDN2)]"",N[BGPDN2 S G=1 G RX71
 .Q:'G  ;NOT A DRUG OF INTEREST
RX71 .;
 .S J=$P(^AUPNVMED(Y,0),U,8)
 .S V=$P(^AUPNVMED(Y,0),U,3)
 .Q:'V
 .Q:'$D(^AUPNVSIT(V,0))
 .;S IS DAYS SUPPLY, J IS DATE DISCONTINUED
 .I J]"" Q:J<EDATE  ;discontinued W/IN 7 days of discharge date
 .S S=$P(^AUPNVMED(Y,0),U,7)
 .S Z=$$FMDIFF^XLFDT(EDATE,$P($P(^AUPNVSIT(V,0),U),"."))
 .I S>Z S BGPG=1_U_$$DATE^BGP8UTL($P($P(^AUPNVSIT(V,0),U),"."))_U_$P(^PSDRUG(D,0),U)
 .Q
 Q BGPG
ASACONTR(P,BDATE,EDATE,BGPADM,BGPDD) ;does patient have an aspirin allergy
 K BGPMEDS1
 S K=0,R="",BGPG=""
 D GETMEDS^BGP8UTL2(P,$$FMADD^XLFDT(BGPADM,-180),BGPDD,,,,,.BGPMEDS1)
 I '$D(BGPMEDS1) G HEM
 S T=$O(^ATXAX("B","BGP CMS WARFARIN MEDS",0))
 S X=0 F  S X=$O(BGPMEDS1(X)) Q:X'=+X!(BGPG)  S Y=+$P(BGPMEDS1(X),U,4) D
 .Q:'$D(^AUPNVMED(Y,0))
 .Q:$$UP^XLFSTR($P($G(^AUPNVMED(Y,11)),U))["RETURNED TO STOCK"
 .S G=0
 .S D=$P(^AUPNVMED(Y,0),U)
 .I T,$D(^ATXAX(T,21,"B",D)) S G=1 G WAR71
 .S N=$P($G(^PSDRUG(D,0)),U,1)
 .I N["WARFARIN" S G=1 G WAR71
 .I $$VAPI^BGP8D81(D,$O(^ATXAX("B","BGP CMS WARFARIN VAPI",0))) S G=1 G WAR71
 .Q:'G
WAR71 .;
 .S J=$P(^AUPNVMED(Y,0),U,8)
 .S V=$P(^AUPNVMED(Y,0),U,3)
 .Q:'V
 .Q:'$D(^AUPNVSIT(V,0))
 .;S IS DAYS SUPPLY, J IS DATE DISCONTINUED
 .I J]"" Q:J<BGPDD  ;discontinued W/IN 7 days of discharge date
 .S S=$P(^AUPNVMED(Y,0),U,7)
 .S E=$P($P(^AUPNVSIT(V,0),U),".")
 .;was it prescribed on discharge date?  if so, a hit
 .I E=BGPDD S BGPG=1_U_$$DATE^BGP8UTL($P($P(^AUPNVSIT(V,0),U),"."))_U_$P(^PSDRUG(D,0),U) Q
 .S Z=$$FMDIFF^XLFDT(BGPDD,$P($P(^AUPNVSIT(V,0),U),"."))
 .I S>Z S BGPG=1_U_$$DATE^BGP8UTL($P($P(^AUPNVSIT(V,0),U),"."))_U_$P(^PSDRUG(D,0),U)
 .Q
 I BGPG Q 1_U_$P(BGPG,U,2)_" Contra warfarin rx "_$P(BGPG,U,3)
HEM ;now check for dx 459
 K BGPG S BGPG=$$LASTDX^BGP8UTL1(P,"BGP HEMORRHAGE DXS",$$DOB^AUPNPAT(P),EDATE)
 I BGPG Q 1_U_"asa Contra "_$P(BGPG,U,2)_" "_$$DATE^BGP8UTL($P(BGPG,U,3))
 S X=$$PLTAXND^BGP8DU(P,"BGP HEMORRHAGE DXS",EDATE) I X Q 1_U_"Contra "_$P(X,U,2)_" "_$$DATE^BGP8UTL($P(X,U,3))   ;V17
 S X=$$IPLSNOND^BGP8DU(P,"PXRM BGP HEMORRHAGE",EDATE) I X Q 1_U_"Contra "_$P(X,U,2)_" "_$$DATE^BGP8UTL($P(X,U,3))_U_$P(X,U,2)   ;V17
 ;
 ;nmi in Refusal file for aspirin
 S BGPG=""
 S T=$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0))
 S X=0 F  S X=$O(^AUPNPREF("AA",P,50,X)) Q:X'=+X  D
 .Q:'$D(^ATXAX(T,21,"B",X))  ;not an aspirin
 .S D=0 F  S D=$O(^AUPNPREF("AA",P,50,X,D)) Q:D'=+D  D
 ..I Y<BGPADM Q  ;before admission
 ..I Y>BGPDD Q  ;documented EDATE OF REPORT PERIOD
 ..S N=0 F  S N=$O(^AUPNPREF("AA",P,50,X,D,N)) Q:N'=+N  D
 ...Q:$P($G(^AUPNPREF(N,0)),U,7)'="N"
 ...S BGPG=1_U_$$DATE^BGP8UTL($P(^AUPNPREF(N,0),U,3))_" Contra NMI Aspirin "_$$VAL^XBDIQ1(9000022,N,.04)  ;_" "__" "_$$VAL^XBDIQ1(9000022,X,1101)
 ..Q
 .Q
 I BGPG Q BGPG
 ;now check for CPT code G8008
 S X=$$CPTI^BGP8DU(P,BGPADM,BGPDD,+$$CODEN^ICPTCOD("G8008"))
 I X Q 1_U_$$DATE^BGP8UTL($P(X,U,2))_" Contra CPT G8008"
 S X=$$TRANI^BGP8DU(P,BGPADM,BGPDD,+$$CODEN^ICPTCOD("G8008"))
 I X Q 1_U_$$DATE^BGP8UTL($P(X,U,2))_" Contra Tran G8008"
 Q ""
ACECONT(P,BDATE,EDATE,NMIB,NMIE,RPBD) ;EP does patient have an ACEI Contra
 NEW ED,BD,BGPG,BGPC,X,Y,Z,N,E,SN
 S RPBD=$G(RPBD)
 K BGPG S Y="BGPG(",X=P_"^LAST DX [BGP CMS AORTIC STENOSIS DXS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
 I $D(BGPG(1)) Q 1_U_$$DATE^BGP8UTL($P(BGPG(1),U))_" Contra POV "_$P(BGPG(1),U,2)  ;_"]"  ;_$$VAL^XBDIQ1(9000010.07,+$P(BGPG(1),U,4),.04)
 S X=$$PLTAXND^BGP8DU(P,"BGP CMS AORTIC STENOSIS DXS",EDATE) I X Q 1_U_$$DATE^BGP8UTL($P(X,U,3))_U_"Contra "_$P(X,U,2)   ;V17
 S X=$$IPLSNOND^BGP8DU(P,"PXRM BGP MOD SEV AORTIC STEN",EDATE) I X Q 1_U_$$DATE^BGP8UTL($P(X,U,3))_U_"Contra "_$P(X,U,2)   ;V17
 ;
 ;nmi in Refusal
 S BGPG=""
 S T=$O(^ATXAX("B","BGP HEDIS ACEI MEDS",0))
 S X=0 F  S X=$O(^AUPNPREF("AA",P,50,X)) Q:X'=+X  D
 .Q:'$D(^ATXAX(T,21,"B",X))  ;not an ACEI
 .S D=0 F  S D=$O(^AUPNPREF("AA",P,50,X,D)) Q:D'=+D  D
 ..S Y=9999999-D I Y<NMIB Q
 ..I Y>NMIE Q
 ..S N=0 F  S N=$O(^AUPNPREF("AA",P,50,X,D,N)) Q:N'=+N  D
 ...Q:$P($G(^AUPNPREF(N,0)),U,7)'="N"
 ...S BGPG=1_U_$$DATE^BGP8UTL($P(^AUPNPREF(N,0),U,3))_" Contra NMI "_$$VAL^XBDIQ1(9000022,N,.04)  ;_"   "__"  "_$$VAL^XBDIQ1(9000022,X,1101)
 ..Q
 .Q
 I BGPG Q BGPG
 ;nmi
 S BGPG=""
 S T=$O(^ATXAX("B","BGP HEDIS ARB MEDS",0))
 S X=0 F  S X=$O(^AUPNPREF("AA",P,50,X)) Q:X'=+X  D
 .Q:'$D(^ATXAX(T,21,"B",X))  ;not an ACEI
 .S D=0 F  S D=$O(^AUPNPREF("AA",P,50,X,D)) Q:D'=+D  D
 ..S Y=9999999-D I Y<NMIB Q
 ..I Y>NMIE Q
 ..S N=0 F  S N=$O(^AUPNPREF("AA",P,50,X,D,N)) Q:N'=+N  D
 ...Q:$P($G(^AUPNPREF(N,0)),U,7)'="N"
 ...S BGPG=1_U_$$DATE^BGP8UTL($P(^AUPNPREF(N,0),U,3))_" Contra NMI "_$$VAL^XBDIQ1(9000022,N,.04)  ;_"   "_"  "_$$VAL^XBDIQ1(9000022,X,1101)
 ..Q
 .Q
 I BGPG Q BGPG
 ;PREGNANCY
 S X=$$PREG^BGP8D715(P,$S($G(RPBD):RPBD,1:NMIB),EDATE,0,1,,RPBD,EDATE) I X Q 1_U_"Contra pregnant"  ;V17.1 CMI/LAB ADDED DATES FOR CURRENTLY PREGNANT
 ;breastfeeding
 K BGPG S Y="BGPG(",X=P_"^LAST DX [BGP BREASTFEEDING DXS;DURING "_$$FMTE^XLFDT($S(RPBD:RPBD,1:NMIB))_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
 I $D(BGPG(1)) Q 1_U_$$DATE^BGP8UTL($P(BGPG(1),U))_" Contra POV "_$P(BGPG(1),U,2)  ;_"]"  ;_$$VAL^XBDIQ1(9000010.07,+$P(BGPG(1),U,4),.04)
 K BGPG
 S Y="BGPG("
 S X=P_"^ALL EDUC;DURING "_$$FMTE^XLFDT($S(RPBD:RPBD,1:NMIB))_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
 S SN=$O(^BGPSNOMR("B","BREASTFEEDING PATIENT ED",0))
 S (X,D)=0,%="",T="" F  S X=$O(BGPG(X)) Q:X'=+X!(%]"")  D
 .S T=$P(^AUPNVPED(+$P(BGPG(X),U,4),0),U)
 .Q:'T
 .Q:'$D(^AUTTEDT(T,0))
 .S T=$P(^AUTTEDT(T,0),U,2)
 .I T="BF-BC" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-BP" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-CS" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-EQ" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-FU" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-HC" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-ON" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-M" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-MK" S %=T_U_$P(BGPG(X),U) Q
 .I T="BF-N" S %=T_U_$P(BGPG(X),U) Q
 .I $P(T,"-")]"",$D(^BGPSNOMR(SN,11,"B",$P(T,"-"))) S %=T_U_$P(BGPG(X),U) Q
 I %]"" Q 1_U_$$DATE^BGP8UTL($P(%,U,2))_" Contra "_$P(%,U,1)
 Q ""