AICDENV ; IHS/OIT/FBD&NKD - ICD-10 LOAD ENVIRONMENT CHECKS ;
;;4.0;AICD;;DEC 12, 2014;Build 7
;
;
D:'$D(IOM) HOME^%ZIS
;
; 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
;
; REQUIRED VERSION/PATCH CHECKS
S:'$$VCHK("XU","8.0") XPDQUIT=2 ; KERNEL
S:'$$VCHK("DI","22.0") XPDQUIT=2 ; FILEMAN
S:'$$VCHK("AICD","3.51") XPDQUIT=2 ; AICD
S:'$$VCHK("AUM","15.0") XPDQUIT=2 ; AUM
S:'$$PCHK("AUM","13.0","2") XPDQUIT=2 ; AUM VERSION 13.0 PATCH 2
S:'$$PCHK("LEX","2.0","1003") XPDQUIT=2 ; LEX VERSION 2.0 PATCH 1003
; END OF REQUIRED VERSION/PATCH CHECKS
;
; REQUIRED UPDATE GLOBALS
S:'$$GCHK("^AICDICD9","ICD DIAGNOSIS update global") XPDQUIT=2 ; FILE 80
S:'$$GCHK("^AICDICD0","ICD OPERATION/PROCEDURE update global") XPDQUIT=2 ; FILE 80.1
S:'$$GCHK("^AICDICDS","ICD CODING SYSTEMS update global") XPDQUIT=2 ; FILE 80.4
;
; ADDITIONAL CHECKS IF RE-INSTALLING
I $$SYSCHK() D
. D HELP^XBHELP("PREV","AICDENV") ; MESSAGE EXPRESSING CAUTION REGARDING RE-INSTALLATIONS
. Q:'+$G(XPDENV) ; ONLY MESSAGE NEEDS TO DISPLAY ON LOAD, CHECKS CAN RUN ON INSTALL
. ; REQUIRED BACKUP GLOBALS
. S:'$$GCHK("^zICD9","ICD DIAGNOSIS backup global") XPDQUIT=2 ; FILE 80
. S:'$$GCHK("^zICD0","ICD OPERATION/PROCEDURE backup global") XPDQUIT=2 ; FILE 80.1
. S:'$$GCHK("^zICD","DRG backup global") XPDQUIT=2 ; FILE 80.2
. S:'$$GCHK("^zICM","MAJOR DIAGNOSTIC CATEGORY backup global") XPDQUIT=2 ; FILE 80.3
. ; PREVENT 'ACCIDENTAL' RE-INSTALLATIONS
. I '$D(^AICDALL(0)) D MES^XPDUTL($$CJ^XLFSTR("Re-installation of AICD v4.0 not allowed!",IOM)) S XPDQUIT=2
. E I $D(^AICDALL(0)) D MES^XPDUTL($$CJ^XLFSTR("Re-installation allowed by user "_$P($G(^AICDALL(0)),U)_" on "_$$FMTE^XLFDT($P($G(^AICDALL(0)),U,2)),IOM))
;
I +$G(XPDQUIT) D SORRY(XPDQUIT)
;
; END OF ENVIRONMENT CHECK RUN LOGIC
Q
;
VCHK(AICDPRE,AICDVER,AICDPAT) ; Check patch level
N AICDV,AICDP
S AICDV=$$VERSION^XPDUTL(AICDPRE)
I (AICDV<AICDVER) K DIFQ D DISP(AICDPRE,AICDVER,$G(AICDPAT),AICDV,$G(AICDP),0) Q 0
I '$D(AICDPAT) D DISP(AICDPRE,AICDVER,$G(AICDPAT),AICDV,$G(AICDP),1) Q 1
S AICDP=+$$LAST(AICDPRE,AICDVER)
I (AICDP<AICDPAT) K DIFQ D DISP(AICDPRE,AICDVER,$G(AICDPAT),AICDVER,$G(AICDP),0) Q 0
D DISP(AICDPRE,AICDVER,$G(AICDPAT),AICDVER,$G(AICDP),1)
Q 1
;
GCHK(AICDGL,AICDMSG) ; EP - Check for global
Q:'$L($G(AICDGL)) 0
N AICDS
S AICDS="Requires "_$S('$L($G(AICDMSG)):AICDGL,1:$G(AICDMSG))_"....."
S AICDS=AICDS_$S($D(@AICDGL):"Present",1:"Not found ***FIX IT***")
D MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
Q $S($D(@AICDGL):1,1:0)
;
PCHK(PKG,VER,PAT) ; Check specific patch
N PKGIEN,VERIEN,PATIEN,AICDS
S PKG=$G(PKG),VER=$G(VER),PAT=$G(PAT)
S AICDS="Requires "_PKG_" v"_VER_" p"_PAT_"....."
D
. S PKGIEN=+$O(^DIC(9.4,"C",PKG,"")) Q:'PKGIEN
. S VERIEN=+$O(^DIC(9.4,PKGIEN,22,"B",VER,"")) Q:'VERIEN
. S PATIEN=+$O(^DIC(9.4,PKGIEN,22,VERIEN,"PAH","B",PAT,""))
S AICDS=AICDS_$S(+$G(PATIEN):"Present",1:"Not found ***FIX IT***")
D MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
Q $S(+$G(PATIEN):1,1:0)
;
DISP(AICDPRE,AICDVER,AICDPAT,AICDV,AICDP,AICDR) ; Display requirement checking results
N AICDS
S AICDS="Need at least "_$G(AICDPRE)_" v"_$G(AICDVER)_$S($G(AICDPAT)]"":" p"_$G(AICDPAT),1:"")_"....."
S AICDS=AICDS_$G(AICDPRE)_" v"_$G(AICDV)_$S($G(AICDP)]"":" p"_$G(AICDP),1:"")_" Present"
S AICDS=AICDS_$S('$G(AICDR):" ***FIX IT***",1:"")
D MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
Q
;
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
; Patch includes Seq # if Released
N PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
I $G(VER)="" S VER=$$VERSION^XPDUTL(PKG) Q:'VER -1
S PKGIEN=$O(^DIC(9.4,"C",PKG,"")) Q:'PKGIEN -1
S VERIEN=$O(^DIC(9.4,PKGIEN,22,"B",VER,"")) Q:'VERIEN -1
S LATEST=-1,PATCH=-1,SUBIEN=0
F S SUBIEN=$O(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN)) Q:SUBIEN'>0 D
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST S LATEST=$P(^(0),U,2),PATCH=$P(^(0),U)
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST,$P(^(0),U)>PATCH S PATCH=$P(^(0),U)
Q PATCH_U_LATEST
;
SORRY(X) ;
KILL DIFQ
I X=3 S XPDQUIT=2 Q
S XPDQUIT=X
D MES^XPDUTL($$LJ^XLFSTR("Aborting environment check process.",IOM))
Q
;
SYSCHK() ; EP - AICD SYSTEM VERSION DETECTION (0=ICD9, 1=ICD10)
Q:$$VERSION^XPDUTL("AICD")="4.0" 1 ; AICD PACKAGE VERSION IS 4.0
Q:($G(^DD(80,0,"VRPK"))="AICD")&($G(^DD(80,0,"VR"))="4.0") 1 ; FILE 80 DD IS AICD 4.0
Q:($G(^DD(80.1,0,"VRPK"))="AICD")&($G(^DD(80.1,0,"VR"))="4.0") 1 ; FILE 80.1 DD IS AICD 4.0
Q:($D(^ICD9(500001)))!($D(^ICD0(500001))) 1 ; DATA EXISTS IN EITHER FILE 80 OR 80.1 ICD10 IEN RANGE
Q 0
;
ALLOW ; EP - ALLOW RE-INSTALLATION OF AICD V4.0
Q:'$G(DUZ)
S ^AICDALL(0)=$G(DUZ)_U_$$NOW^XLFDT ; WHO/WHEN RE-INSTALL WAS ALLOWED
Q
;
PREV ; Text explaining previous install
;;AICD v4.0 has already been installed on this system.
;;****************************************
;;Re-installation of this application will:
;; 1) DELETE all existing ICD9 / ICD10 content
;; 2) RESTORE ICD9 content from ^zICD9,^zICD0,^zICD,^zICM
;; 3) CONVERT ICD9 content to ICD10 file structure
;; 4) INSTALL initial VA ICD10 seed file
;;****************************************
;;Use extreme caution before proceeding as this will revert
;;the ICD9 and ICD10 content to its initial state.
;;****************************************
;;To prevent an accidental re-install, the following must
;;be entered from the programmer prompt between the KIDS Load
;;and KIDS Install phases:
;;D ALLOW^AICDENV
;;****************************************
;;
;;###
AICDENV ; IHS/OIT/FBD&NKD - ICD-10 LOAD ENVIRONMENT CHECKS ;
+1 ;;4.0;AICD;;DEC 12, 2014;Build 7
+2 ;
+3 ;
+4 IF '$DATA(IOM)
DO HOME^%ZIS
+5 ;
+6 ; The following line prevents the "Disable Options..." and "Move Routines..."
+7 ; questions from being asked during the install.
+8 IF $GET(XPDENV)=1
SET (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
+9 FOR X="XPO1","XPZ1","XPZ2","XPI1"
SET XPDDIQ(X)=0
+10 ;
+11 ; REQUIRED VERSION/PATCH CHECKS
+12 ; KERNEL
IF '$$VCHK("XU","8.0")
SET XPDQUIT=2
+13 ; FILEMAN
IF '$$VCHK("DI","22.0")
SET XPDQUIT=2
+14 ; AICD
IF '$$VCHK("AICD","3.51")
SET XPDQUIT=2
+15 ; AUM
IF '$$VCHK("AUM","15.0")
SET XPDQUIT=2
+16 ; AUM VERSION 13.0 PATCH 2
IF '$$PCHK("AUM","13.0","2")
SET XPDQUIT=2
+17 ; LEX VERSION 2.0 PATCH 1003
IF '$$PCHK("LEX","2.0","1003")
SET XPDQUIT=2
+18 ; END OF REQUIRED VERSION/PATCH CHECKS
+19 ;
+20 ; REQUIRED UPDATE GLOBALS
+21 ; FILE 80
IF '$$GCHK("^AICDICD9","ICD DIAGNOSIS update global")
SET XPDQUIT=2
+22 ; FILE 80.1
IF '$$GCHK("^AICDICD0","ICD OPERATION/PROCEDURE update global")
SET XPDQUIT=2
+23 ; FILE 80.4
IF '$$GCHK("^AICDICDS","ICD CODING SYSTEMS update global")
SET XPDQUIT=2
+24 ;
+25 ; ADDITIONAL CHECKS IF RE-INSTALLING
+26 IF $$SYSCHK()
Begin DoDot:1
+27 ; MESSAGE EXPRESSING CAUTION REGARDING RE-INSTALLATIONS
DO HELP^XBHELP("PREV","AICDENV")
+28 ; ONLY MESSAGE NEEDS TO DISPLAY ON LOAD, CHECKS CAN RUN ON INSTALL
IF '+$GET(XPDENV)
QUIT
+29 ; REQUIRED BACKUP GLOBALS
+30 ; FILE 80
IF '$$GCHK("^zICD9","ICD DIAGNOSIS backup global")
SET XPDQUIT=2
+31 ; FILE 80.1
IF '$$GCHK("^zICD0","ICD OPERATION/PROCEDURE backup global")
SET XPDQUIT=2
+32 ; FILE 80.2
IF '$$GCHK("^zICD","DRG backup global")
SET XPDQUIT=2
+33 ; FILE 80.3
IF '$$GCHK("^zICM","MAJOR DIAGNOSTIC CATEGORY backup global")
SET XPDQUIT=2
+34 ; PREVENT 'ACCIDENTAL' RE-INSTALLATIONS
+35 IF '$DATA(^AICDALL(0))
DO MES^XPDUTL($$CJ^XLFSTR("Re-installation of AICD v4.0 not allowed!",IOM))
SET XPDQUIT=2
+36 IF '$TEST
IF $DATA(^AICDALL(0))
DO MES^XPDUTL($$CJ^XLFSTR("Re-installation allowed by user "_$PIECE($GET(^AICDALL(0)),U)_" on "_$$FMTE^XLFDT($PIECE($GET(^AICDALL(0)),U,2)),IOM))
End DoDot:1
+37 ;
+38 IF +$GET(XPDQUIT)
DO SORRY(XPDQUIT)
+39 ;
+40 ; END OF ENVIRONMENT CHECK RUN LOGIC
+41 QUIT
+42 ;
VCHK(AICDPRE,AICDVER,AICDPAT) ; Check patch level
+1 NEW AICDV,AICDP
+2 SET AICDV=$$VERSION^XPDUTL(AICDPRE)
+3 IF (AICDV<AICDVER)
KILL DIFQ
DO DISP(AICDPRE,AICDVER,$GET(AICDPAT),AICDV,$GET(AICDP),0)
QUIT 0
+4 IF '$DATA(AICDPAT)
DO DISP(AICDPRE,AICDVER,$GET(AICDPAT),AICDV,$GET(AICDP),1)
QUIT 1
+5 SET AICDP=+$$LAST(AICDPRE,AICDVER)
+6 IF (AICDP<AICDPAT)
KILL DIFQ
DO DISP(AICDPRE,AICDVER,$GET(AICDPAT),AICDVER,$GET(AICDP),0)
QUIT 0
+7 DO DISP(AICDPRE,AICDVER,$GET(AICDPAT),AICDVER,$GET(AICDP),1)
+8 QUIT 1
+9 ;
GCHK(AICDGL,AICDMSG) ; EP - Check for global
+1 IF '$LENGTH($GET(AICDGL))
QUIT 0
+2 NEW AICDS
+3 SET AICDS="Requires "_$SELECT('$LENGTH($GET(AICDMSG)):AICDGL,1:$GET(AICDMSG))_"....."
+4 SET AICDS=AICDS_$SELECT($DATA(@AICDGL):"Present",1:"Not found ***FIX IT***")
+5 DO MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
+6 QUIT $SELECT($DATA(@AICDGL):1,1:0)
+7 ;
PCHK(PKG,VER,PAT) ; Check specific patch
+1 NEW PKGIEN,VERIEN,PATIEN,AICDS
+2 SET PKG=$GET(PKG)
SET VER=$GET(VER)
SET PAT=$GET(PAT)
+3 SET AICDS="Requires "_PKG_" v"_VER_" p"_PAT_"....."
+4 Begin DoDot:1
+5 SET PKGIEN=+$ORDER(^DIC(9.4,"C",PKG,""))
IF 'PKGIEN
QUIT
+6 SET VERIEN=+$ORDER(^DIC(9.4,PKGIEN,22,"B",VER,""))
IF 'VERIEN
QUIT
+7 SET PATIEN=+$ORDER(^DIC(9.4,PKGIEN,22,VERIEN,"PAH","B",PAT,""))
End DoDot:1
+8 SET AICDS=AICDS_$SELECT(+$GET(PATIEN):"Present",1:"Not found ***FIX IT***")
+9 DO MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
+10 QUIT $SELECT(+$GET(PATIEN):1,1:0)
+11 ;
DISP(AICDPRE,AICDVER,AICDPAT,AICDV,AICDP,AICDR) ; Display requirement checking results
+1 NEW AICDS
+2 SET AICDS="Need at least "_$GET(AICDPRE)_" v"_$GET(AICDVER)_$SELECT($GET(AICDPAT)]"":" p"_$GET(AICDPAT),1:"")_"....."
+3 SET AICDS=AICDS_$GET(AICDPRE)_" v"_$GET(AICDV)_$SELECT($GET(AICDP)]"":" p"_$GET(AICDP),1:"")_" Present"
+4 SET AICDS=AICDS_$SELECT('$GET(AICDR):" ***FIX IT***",1:"")
+5 DO MES^XPDUTL($$CJ^XLFSTR(AICDS,IOM))
+6 QUIT
+7 ;
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
+1 ; Patch includes Seq # if Released
+2 NEW PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
+3 IF $GET(VER)=""
SET VER=$$VERSION^XPDUTL(PKG)
IF 'VER
QUIT -1
+4 SET PKGIEN=$ORDER(^DIC(9.4,"C",PKG,""))
IF 'PKGIEN
QUIT -1
+5 SET VERIEN=$ORDER(^DIC(9.4,PKGIEN,22,"B",VER,""))
IF 'VERIEN
QUIT -1
+6 SET LATEST=-1
SET PATCH=-1
SET SUBIEN=0
+7 FOR
SET SUBIEN=$ORDER(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN))
IF SUBIEN'>0
QUIT
Begin DoDot:1
+8 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST
SET LATEST=$PIECE(^(0),U,2)
SET PATCH=$PIECE(^(0),U)
+9 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST
IF $PIECE(^(0),U)>PATCH
SET PATCH=$PIECE(^(0),U)
End DoDot:1
+10 QUIT PATCH_U_LATEST
+11 ;
SORRY(X) ;
+1 KILL DIFQ
+2 IF X=3
SET XPDQUIT=2
QUIT
+3 SET XPDQUIT=X
+4 DO MES^XPDUTL($$LJ^XLFSTR("Aborting environment check process.",IOM))
+5 QUIT
+6 ;
SYSCHK() ; EP - AICD SYSTEM VERSION DETECTION (0=ICD9, 1=ICD10)
+1 ; AICD PACKAGE VERSION IS 4.0
IF $$VERSION^XPDUTL("AICD")="4.0"
QUIT 1
+2 ; FILE 80 DD IS AICD 4.0
IF ($GET(^DD(80,0,"VRPK"))="AICD")&($GET(^DD(80,0,"VR"))="4.0")
QUIT 1
+3 ; FILE 80.1 DD IS AICD 4.0
IF ($GET(^DD(80.1,0,"VRPK"))="AICD")&($GET(^DD(80.1,0,"VR"))="4.0")
QUIT 1
+4 ; DATA EXISTS IN EITHER FILE 80 OR 80.1 ICD10 IEN RANGE
IF ($DATA(^ICD9(500001)))!($DATA(^ICD0(500001)))
QUIT 1
+5 QUIT 0
+6 ;
ALLOW ; EP - ALLOW RE-INSTALLATION OF AICD V4.0
+1 IF '$GET(DUZ)
QUIT
+2 ; WHO/WHEN RE-INSTALL WAS ALLOWED
SET ^AICDALL(0)=$GET(DUZ)_U_$$NOW^XLFDT
+3 QUIT
+4 ;
PREV ; Text explaining previous install
+1 ;;AICD v4.0 has already been installed on this system.
+2 ;;****************************************
+3 ;;Re-installation of this application will:
+4 ;; 1) DELETE all existing ICD9 / ICD10 content
+5 ;; 2) RESTORE ICD9 content from ^zICD9,^zICD0,^zICD,^zICM
+6 ;; 3) CONVERT ICD9 content to ICD10 file structure
+7 ;; 4) INSTALL initial VA ICD10 seed file
+8 ;;****************************************
+9 ;;Use extreme caution before proceeding as this will revert
+10 ;;the ICD9 and ICD10 content to its initial state.
+11 ;;****************************************
+12 ;;To prevent an accidental re-install, the following must
+13 ;;be entered from the programmer prompt between the KIDS Load
+14 ;;and KIDS Install phases:
+15 ;;D ALLOW^AICDENV
+16 ;;****************************************
+17 ;;
+18 ;;###