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

BUDEENV.m

Go to the documentation of this file.
BUDEENV ;IHS/CMI/LAB - environmental check post init;
 ;;12.0;IHS/RPMS UNIFORM DATA SYSTEM;;NOV 22, 2017;Build 75
 ;
ENV ;
 ; The following line prevents the "Disable Options..." and "Move
 ; Routines..." questions from being asked during the install.
 I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
 F X="XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0
 I $$VERSION^XPDUTL("BGP")'>"17" D MES^XPDUTL($$CJ^XLFSTR("Version 17.1 of CRS (BGP) is required.  Not installed",80)) D SORRY(2)
 I $$VERSION^XPDUTL("BUD")'>10.9 D MES^XPDUTL($$CJ^XLFSTR("Version 11.0 of UDS (BUD) is required.  Not installed",80)) D SORRY(2)
 Q
 ;
 ;
PRE ;
 ;ADD ALL OTHERS BACK IN
 ;edit package name
 S DA=$O(^DIC(9.4,"C","BUD",0))
 I DA S DIE="^DIC(9.4,",DR=".01///IHS/RPMS UNIFORM DATA SYS" D ^DIE K DA,DIE
 F DA=1:1:50 S DIK="^BUDECNTL(" D ^DIK
 F DA=1:1:50 S DIK="^BUDEIL(" D ^DIK
 F DA=1:1:50 S DIK="^BUDETFIV(" D ^DIK
 F DA=1:1:50 S DIK="^BUDETTA(" D ^DIK
 F DA=1:1:50 S DIK="^BUDELST2(" D ^DIK
 F DA=1:1:999 S DIK="^BUDETSC(" D ^DIK
 F DA=1:1:999 S DIK="^BUDETSSC(" D ^DIK
 Q
POST ;
 ;move site parameters from 04 to 05 on first time install only
 I '$O(^BUDESITE(0)) D
 .S BUDX=0 F  S BUDX=$O(^BUDDSITE(BUDX)) Q:BUDX'=+BUDX   D
 ..M ^BUDESITE(BUDX)=^BUDDSITE(BUDX)
 ..S DA=BUDX,DIK="^BUDESITE(" D IX1^DIK
 ;create and populate drug taxonomy
 D ^BUDE1
 D ^BUDE2
 D DRUG
 D LAB
 D SETICD
 Q
SETICD ;
 ;NOW DO TABLE 6B/7 LISTS
DX ;DX 11 NODE
 S BUDX=0 F  S BUDX=$O(^BUDETSSC(BUDX)) Q:BUDX'=+BUDX  D
 .S BUDY=0 F  S BUDY=$O(^BUDETSSC(BUDX,11,BUDY)) Q:BUDY'=+BUDY  D
 ..F X=2,3 S $P(^BUDETSSC(BUDX,11,BUDY,0),U,X)=""
 K ^BUDETSSC("AD")
 S BUDX=0 F  S BUDX=$O(^BUDETSSC(BUDX)) Q:BUDX'=+BUDX  D
 .S BUDY=0 F  S BUDY=$O(^BUDETSSC(BUDX,11,BUDY)) Q:BUDY'=+BUDY  D
 ..S I=$P(^BUDETSSC(BUDX,11,BUDY,0),U,1)
 ..S I=$$ICDDX^ICDEX(I,DT)
 ..S $P(^BUDETSSC(BUDX,11,BUDY,0),U,2)=$P(I,U,1)
 ..S $P(^BUDETSSC(BUDX,11,BUDY,0),U,3)=$P(I,U,20)
 ;S DIK="^BUDETSSC(" D IXALL^DIK
 ;PROC
 S BUDX=0 F  S BUDX=$O(^BUDETSSC(BUDX)) Q:BUDX'=+BUDX  D
 .S BUDY=0 F  S BUDY=$O(^BUDETSSC(BUDX,12,BUDY)) Q:BUDY'=+BUDY  D
 ..F X=2,3 S $P(^BUDETSSC(BUDX,12,BUDY,0),U,X)=""
 K ^BUDETSSC("AP")
 S BUDX=0 F  S BUDX=$O(^BUDETSSC(BUDX)) Q:BUDX'=+BUDX  D
 .S BUDY=0 F  S BUDY=$O(^BUDETSSC(BUDX,12,BUDY)) Q:BUDY'=+BUDY  D
 ..S I=$P(^BUDETSSC(BUDX,12,BUDY,0),U,1)
 ..S I=$$ICDOP^ICDEX(I,DT)
 ..S $P(^BUDETSSC(BUDX,12,BUDY,0),U,2)=$P(I,U,1)
 ..S $P(^BUDETSSC(BUDX,12,BUDY,0),U,3)=$P(I,U,15)
 S DIK="^BUDETSSC(" D IXALL^DIK
 Q
LAB ;EP
 S BUDX="BGP HIV TEST TAX" D LAB1
 S BUDX="BGP CD4 TAX" D LAB1
 S BUDX="BGP HIV VIRAL LOAD TAX" D LAB1
 Q
LAB1 ;
 S BUDDA=$O(^ATXLAB("B",BUDX,0))
 Q:BUDDA  ;taxonomy already exisits
 W !,"Creating ",BUDX," Taxonomy..."
 S X=BUDX,DIC="^ATXLAB(",DIC(0)="L",DIADD=1,DLAYGO=9002228 D ^DIC K DIC,DA,DIADD,DLAYGO,I
 I Y=-1 W !!,"ERROR IN CREATING ",BUDX," TAX" Q
 S BUDTX=+Y,$P(^ATXLAB(BUDTX,0),U,2)=BUDX,$P(^(0),U,5)=DUZ,$P(^(0),U,6)=DT,$P(^(0),U,8)="B",$P(^(0),U,9)=60
 S ^ATXLAB(BUDTX,21,0)="^9002228.02101PA^0^0"
 S DA=BUDTX,DIK="^ATXAX(" D IX1^DIK
 Q
 ;
INSTALLD(BUDSTAL) ;EP - Determine if patch BUDSTAL was installed, where
 ; BUDSTAL is the name of the INSTALL.  E.g "AG*6.0*11".
 ;
 NEW BUDY,DIC,X,Y
 S X=$P(BUDSTAL,"*",1)
 S DIC="^DIC(9.4,",DIC(0)="FM",D="C"
 D IX^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",22,",X=$P(BUDSTAL,"*",2)
 D ^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",""PAH"",",X=$P(BUDSTAL,"*",3)
 D ^DIC
 S BUDY=Y
 D IMES
 Q $S(BUDY<1:0,1:1)
IMES ;
 D MES^XPDUTL($$CJ^XLFSTR("Patch """_BUDSTAL_""" is"_$S(Y<1:" *NOT*",1:"")_" installed.",IOM))
 Q
SORRY(X) ;
 KILL DIFQ
 I X=3 S XPDQUIT=2 Q
 S XPDQUIT=X
 W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
 Q
DRUG ;EP set up drug taxonomies
 S ATXFLG=1
 S BUDX="BUD DIABETES MEDS TAX",BUDTAX="",BUDNDCT="BUD DIABETES MEDS NDC" D DRUG1
 S BUDX="BGP PQA CONTROLLER MEDS",BUDTAX="",BUDNDCT="BGP PQA CONTROLLER NDC" D DRUG1
 S BUDX="BGP HEDIS ANTIDEPRESSANT MEDS",BUDTAX="",BUDNDCT="BGP HEDIS ANTIDEPRESSANT NDC" D DRUG1
 S BUDX="BGP PQA SABA MEDS",BUDTAX="",BUDNDCT="BGP PQA SABA NDC" D DRUG1
 S BUDX="BUD LIPID LOWERING MEDS",BUDTAX="",BUDNDCT="BGPMU LIPID LOWERING NDCS" D DRUG1
 S BUDX="BUD ANTIPLATELET MEDS",BUDTAX="",BUDNDCT="BGPMU IVD ANTIPLATELET NDCS" D DRUG1
 S BUDX="BGP HEDIS ANTIDEPRESSANT MEDS",BUDTAX="",BUDNDCT="BGP HEDIS ANTIDEPRESSANT NDC" D DRUG1
 S BUDX="BGP PQA WARFARIN MEDS",BUDTAX="",BUDNDCT="BGP PQA WARFARIN NDC" D DRUG1
 S BUDX="BGP PQA NON-WARF ANTICOAG MEDS",BUDTAX="",BUDNDCT="BGP PQA NON-WARF ANTICOAG NDC" D DRUG1
 K ATXFLG,BUDX,BUDDA,BUDTX,BUDNDCT,BUDTAX
 Q
DRUG1 ;
 W !,"Creating ",BUDX," Taxonomy..."
 S BUDTX=$O(^ATXAX("B",BUDX,0))
 I 'BUDTX D  Q:Y=-1
 .S X=BUDX,DIC="^ATXAX(",DIC(0)="L",DIADD=1,DLAYGO=9002226 D ^DIC K DIC,DA,DIADD,DLAYGO,I
 .I Y=-1 W !!,"ERROR IN CREATING ",BUDX," TAX" Q
 .S BUDTX=+Y,$P(^ATXAX(BUDTX,0),U,2)=BUDX,$P(^(0),U,8)=0,$P(^(0),U,9)=DT,$P(^(0),U,12)=173,$P(^(0),U,13)=0,$P(^(0),U,15)=50,^ATXAX(BUDTX,21,0)="^9002226.02101A^0^0"
 S DA=BUDTX,DIK="^ATXAX(" D IX1^DIK
 I $G(BUDTAX)]"" D
 .S A=0,B="" F  S A=$O(^ATXAX(BUDTX,21,A)) Q:A'=+A  S B=A
 .S BUDD=B
 .S ^ATXAX(BUDTX,21,0)="^9002226.02101A^"_B_U_B
 .S Z=$O(^ATXAX("B",BUDTAX,0))
 .S J=0 F  S J=$O(^PSDRUG(J)) Q:J'=+J  S C=$P($G(^PSDRUG(J,0)),U,2) I C]"",$D(^ATXAX(Z,21,"B",C)) D
 ..Q:$D(^ATXAX(BUDTX,21,"B",J))
 ..S BUDD=BUDD+1,^ATXAX(BUDTX,21,BUDD,0)=J_U_J
 I $G(BUDNDCT)]"" D
 .S A=0,B="" F  S A=$O(^ATXAX(BUDTX,21,A)) Q:A'=+A  S B=A
 .S BUDD=B
 .S ^ATXAX(BUDTX,21,0)="^9002226.02101A^"_B_U_B
 .S Z=$O(^ATXAX("B",BUDNDCT,0))
 .S J=0 F  S J=$O(^PSDRUG(J)) Q:J'=+J  D
 ..S G=0
 ..S C=$P($G(^PSDRUG(J,2)),U,4)
 ..I C]"",$D(^ATXAX(Z,21,"B",$$STRIP^XLFSTR(C,"-"))) S G=1
 ..I C]"",$D(^ATXAX(Z,21,"B",C)) S G=1
 ..Q:'G
 ..Q:$D(^ATXAX(BUDTX,21,"B",J))
 ..S BUDD=BUDD+1,^ATXAX(BUDTX,21,BUDD,0)=J_U_J
 S DA=BUDTX,DIK="^ATXAX(" D IX1^DIK
 Q
 ;
INC ;UPDATE INCOME LEVELS
 S X=8 F  S X=$O(^BUDEIL("B",X)) Q:X'=+X  D
 .S Y=$O(^BUDEIL("B",X,0))
 .S C=X-8
 .S $P(^BUDEIL(Y,0),U,2)=(C*4180)+41320
 .S $P(^BUDEIL(Y,0),U,3)=(C*5230)+51670
 .S $P(^BUDEIL(Y,0),U,4)=(C*4810)+47530
 Q