source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2039.m@ 1154

Last change on this file since 1154 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 9.3 KB
Line 
1LEX2039 ; ISL/KER - Environment Check/Pre/Post Install ; 12/06/2005
2 ;;2.0;LEXICON UTILITY;**39**;Sep 23, 1996
3 ;
4 ; External References
5 ; DBIA 10015 EN^DIQ1
6 ; DBIA 10141 $$PATCH^XPDUTL
7 ; DBIA 10141 $$VERSION^XPDUTL
8 ; DBIA 10141 BMES^XPDUTL
9 ; DBIA 10141 MES^XPDUTL
10 ;
11ENV ; LEX*2.0*39 Environment Check
12 ;
13 ; General
14 ;
15 N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXG,LEXE
16 W !," Code Set Update for FY06 2nd Quarter - includes CPT/HCPCS Annual Release",!
17 D IMP S U="^"
18 ; No user
19 D:+($$UR)'>0 ET("User not defined (DUZ)")
20 ; No IO
21 D:+($$SY)'>0 ET("Undefined IO variable(s)") I $D(LEXE) D ABRT Q
22 ;
23 ; Load Distribution
24 ;
25 ; XPDENV = 0 Environment Check during Load
26 ;
27 ; Check Version (2.0)
28 I $$VERSION^XPDUTL("LEX")'="2.0" D D ABRT Q
29 . D ET("Version 2.0 not found. Please install Lexicon Utility v 2.0")
30 ;
31 ; Check Required Patches
32 D:'$L($G(LEXREQP)) IMP I $L(LEXREQP) D
33 . N LEXPAT,LEXI,LEXPN
34 . F LEXI=1:1 Q:'$L($P(LEXREQP,";",LEXI)) S LEXPAT=$P(LEXREQP,";",LEXI) D
35 . . S LEXPN=$$PATCH^XPDUTL(LEXPAT) W !," Checking for ",LEXPAT I +LEXPN>0 H 1 W " - installed"
36 . . I +LEXPN'>0 D ET((LEXPAT_" not found, please install "_LEXPAT_" before continuing"))
37 I $D(LEXE) D ABRT Q
38 S LEXG=$$RGBL
39 I $D(LEXE)&(+LEXG=0) D ABRT Q
40 I $D(LEXE)&(+LEXG<0) D ABRT Q
41 I '$D(LEXFULL)&(+($G(XPDENV))'=1) D QUIT Q
42 ;
43 ; Install Package(s)
44 ;
45 ; XPDENV = 1 Environment Check during Install
46 ;
47 ; Check Data "is installed" or "is translated"
48 N LEXIT S LEXIT=+($$CPD) I '$D(LEXFULL)&(LEXIT) D QUIT Q
49 ; Checking Global "Write" Protection
50 D:+($G(XPDENV))=1 GBLS I $D(LEXE) D ABRT Q
51 ; Check Import Global Checksum
52 D:+($G(XPDENV))=1 CS I $D(LEXE) D ABRT Q
53 ;
54 ; Quit, Exit or Abort
55 ;
56QUIT ; Quit Passed Environment Check
57 K LEXFULL D OK
58 Q
59EXIT ; Exit Failed Environment Check
60 D:$D(LEXE) ED S XPDQUIT=2 K LEXE,LEXFULL Q
61ABRT ; Abort Failed Environment Check, KILL the distribution
62 D:$D(LEXE) ED S XPDABORT=1,XPDQUIT=1,XPDQUIT("LEX*2.0*39")=1
63 S XPDQUIT("ICD*18.0*12")=1,XPDQUIT("ICPT*6.0*19")=1
64 S XPDQUIT("CTD UTIL 1.0")=1 K LEXE,LEXFULL
65 Q
66 ;
67 ; Checks
68 ;
69GBLS ; Check Write access on globals
70 N LEXE,LEXGBL,LEXRT,LEXT,LEXF,LEXI,LEXX,LEXOK,LEXCPD,LEXS,X S LEXOK=1
71 D BM(" I will now check the protection on ^LEX, ^ICPT, ^ICD and ^DIC Globals.")
72 D M(" If you get an ERROR, you will need to change the protection on these")
73 D M(" globals to allow read/write as indicated:")
74 D BM(" Owner Group World Network")
75 D M(" Cache systems RWD RW RW RWD")
76 D BM(" Checking:"),M(" ")
77 S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
78 . S LEXX="" S LEXE="S LEXX=$T(GD+"_LEXI_")" X LEXE S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
79 . S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
80 . S (LEXB1,LEXB2)="",$P(LEXB1," ",(19-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
81 . I '$D(@LEXGBL) D RGNF S LEXOK=0 D M((" <"_LEXRT_" not found>")) Q
82 . D M((" "_LEXRT_LEXB1_LEXT_LEXB2_LEXF)) S @LEXGBL=$G(@LEXGBL) H 1
83 D:LEXOK M(" --> ok") D:'LEXOK M(" ??") D M(" ")
84 Q
85RGBL(X) ; Check Write access on globals
86 N LEXCPD,LEXS,LEXI,LEXX,LEXEC,LEXGBL,LEXRT,LEXT,LEXF,LEXB1,LEXB2
87 S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
88 . S LEXX="" S LEXEC="S LEXX=$T(GD+"_LEXI_")" X LEXEC S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
89 . S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
90 . S (LEXB1,LEXB2)="",$P(LEXB1," ",(15-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
91 . I '$D(@LEXGBL) S:LEXS'[LEXRT LEXS=LEXS_", "_LEXRT S X=-1 S:LEXGBL["LEXM("&(X=1) X=0
92 I $L(LEXS),X'>0 D
93 . S:LEXS[", " LEXS=$P(LEXS,", ",1,($L(LEXS,", ")-1))_" and "_$P(LEXS,", ",$L(LEXS,", "))
94 . S:$E(LEXS,1,2)=", " LEXS=$E(LEXS,3,$L(LEXS)) S:$E(LEXS,1,7)[" and " LEXS=$P(LEXS," and ",2)
95 . D:X=-1 ET(("Global"_$S(LEXS[", "!(LEXS[" and "):"s",1:"")_" "_LEXS_" either not found or incomplete."))
96 . D:X=0 CM
97 Q X
98RGNF ; Required global not found
99 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
100 D:$G(LEXGL)["^LEX"&($G(LEXGL)'["^LEXM") ET(""),ET("Required global "_$P($G(LEXGL),"(",1)_" not found.")
101 D:$G(LEXGL)["^LEX"&($G(LEXGL)["^LEXM") CM
102 Q
103CHK ; Check the Checksum
104 D CS I $D(LEXE) D ED Q
105 D BM(" OK"),M(" ")
106 Q
107CS ; Checksum for import global
108 K LEXE
109 D BM(" Running checksum routine on the ^LEXM import global, please wait")
110 N LEXCHK,LEXNDS,LEXVER S LEXCHK=+($G(^LEXM(0,"CHECKSUM")))
111 S LEXNDS=+($G(^LEXM(0,"NODES"))),LEXVER=+($$VC(LEXCHK,LEXNDS))
112 D M(" ") D:LEXVER>0 M(" Checksum is ok"),M(" ")
113 D:LEXVER=0 CM D:LEXVER=-1 CW D:LEXVER=-2 CU D:LEXVER=-3 CF
114 Q
115VC(X,Y) ; Verify Checksum for import global
116 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF Q:'$D(^LEXM) 0
117 D IMP I $G(^LEXM(0,"BUILD"))'=$G(LEXBUILD) Q -1
118 N LEXCHK,LEXNDS,LEXCNT,LEXLC,LEXL,LEXS,LEXNC,LEXD,LEXN,LEXC,LEXGCS,LEXP,LEXT
119 S LEXCHK=+($G(X)),LEXNDS=+($G(Y))
120 Q:LEXCHK'>0!(LEXNDS'>0) -2
121 S LEXL=64,(LEXCNT,LEXLC)=0,LEXS=(+(LEXNDS\LEXL))
122 S:LEXS=0 LEXS=1 D:+($O(^LEXM(0)))>0 M("")
123 S (LEXC,LEXN)="^LEXM",(LEXNC,LEXGCS)=0 W " "
124 F S LEXN=$Q(@LEXN) Q:LEXN=""!(LEXN'[LEXC) D
125 . Q:LEXN="^LEXM(0,""CHECKSUM"")"
126 . Q:LEXN="^LEXM(0,""NODES"")"
127 . S LEXCNT=LEXCNT+1
128 . I LEXCNT'<LEXS S LEXLC=LEXLC+1 W:LEXLC'>LEXL "." S LEXCNT=0
129 . S LEXNC=LEXNC+1,LEXD=@LEXN,LEXT=LEXN_"="_LEXD
130 . F LEXP=1:1:$L(LEXT) S LEXGCS=$A(LEXT,LEXP)*LEXP+LEXGCS
131 Q:LEXNC'=LEXNDS -3
132 Q:LEXGCS'=LEXCHK -3
133 Q 1
134SY(X) ; Check System variables
135 Q:'$D(IO)!('$D(IOF))!('$D(IOM))!('$D(ION))!('$D(IOSL))!('$D(IOST)) 0
136 Q 1
137UR(X) ; Check User variables
138 Q:'$L($G(DUZ(0))) 0
139 Q:+($G(DUZ))=0!($$NOTDEF(+$G(DUZ))) 0
140 Q 1
141CPD(X) ; Check Current Patched Data is installed
142 N INS S INS=1
143 ; Check Last Lexicon Set/Kill
144 S:'$D(^LEX(757.3,"AS","I $L($$ICDONE^LEXU(+Y,+($G(LEXVDT))))!($L($$CPTONE^LEXU(+Y,+($G",2)) INS=0
145 S:$D(^LEX(757.3,"AS","I $L($$ICDONE^LEXU(+Y))!($L($$CPTONE^LEXU(+Y)))!($L($$CPCONE^LE",2)) INS=0
146 ; Check Last ICD Diagnosis Set
147 S:'$D(^ICD9(13131,0)) INS=0
148 ; Check Last CPT/HCPCS Procedures Set/Kill
149 S:'$D(^ICPT("F","V2788",108367)) INS=0
150 S:$D(^ICPT("D",78,75956)) INS=0
151 ; Check Last CPT Modifiers Set/Kill
152 S:'$D(^DIC(81.3,"M",8400001,8409999,250)) INS=0
153 S:$D(^DIC(81.3,"C","HOSP-BASED DIALYSIS TO RESIDEN",250)) INS=0
154 ; Check v2
155 S:$G(^LEX(757.3,1,1))'["LEXVDT"!($G(^LEXT(757.2,4,6))'["LEXVDT") INS=0
156 ; Check v3
157 S:$G(^ICPT(108371,0))'["0144T" INS=0
158 S X=+($G(INS))
159 Q X
160 ;
161 ; Error messages
162 ;
163CM ; Missing ^LEXM
164 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET(""),ET("Missing import global ^LEXM.") D CO
165 Q
166CW ; Wrong ^LEXM
167 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF,LEXB D IMP S LEXB=$G(^LEXM(0,"BUILD")) D ET("")
168 I $L(LEXBUILD),$L(LEXB),LEXBUILD'=LEXB D Q
169 . D ET(("Incorrect import global ^LEXM found ("_LEXB_" global).")) D CKO
170 D ET("Incorrect import global ^LEXM found.") D CKO
171 Q
172CU ; Unable to verify
173 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET(""),ET("Unable to verify checksum for import global ^LEXM (possibly corrupt).") D CKO
174 Q
175CF ; Failed checksum
176 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET("") D ET("Import global ^LEXM failed checksum.") D CKO
177 Q
178CO ; Obtain new global
179 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
180 D ET(""),ET(" Please obtain a copy of the import global ^LEXM contained in the ")
181 D ET((" global host file "_LEXIGHF_" before continuing with the "_LEXBUILD))
182 D ET((" installation."))
183 Q
184CKO ; Kill and Obtain new global
185 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
186 D ET(""),ET(" Please KILL the existing import global ^LEXM from your system")
187 D ET((" and obtain a new copy of ^LEXM contained in the global host file"))
188 D ET((" "_LEXIGHF_" before continuing with the "_LEXBUILD_" installation."))
189 Q
190ET(X) ; Error Text
191 N LEXI S LEXI=+($G(LEXE(0))),LEXI=LEXI+1,LEXE(LEXI)=" "_$G(X),LEXE(0)=LEXI
192 Q
193ED ; Error Display
194 N LEXI S LEXI=0 F S LEXI=$O(LEXE(LEXI)) Q:+LEXI=0 D M(LEXE(LEXI))
195 D M(" ") K LEXE Q
196 ;
197 ; Miscellaneous
198 ;
199IMP ; Import names
200 S LEXLREV=39,LEXREQP="LEX*2.0*37",LEXBUILD="LEX*2.0*39"
201 S LEXIGHF="LEX_2_39.GBL"
202 Q
203NOTDEF(IEN) ; Check to see if user is defined
204 N DA,DR,DIQ,LEX,DIC S DA=IEN,DR=.01,DIC=200,DIQ="LEX" D EN^DIQ1 Q '$D(LEX)
205OK ; Environment is OK
206 N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXT
207 D IMP S LEXT=" Environment "_$S($L(LEXBUILD):("for patch/build "_LEXBUILD_" "),1:"")_"is ok"
208 D BM(LEXT),M(" ")
209 Q
210BM(X) ; Blank Line with Message
211 D BMES^XPDUTL($G(X)) Q
212M(X) ; Message
213 D MES^XPDUTL($G(X)) Q
214TRIM(X) ; Trim Spaces
215 S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
216 F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
217 Q X
218 ; Exported Files
219 ;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
220 ;;^LEXT(757.2);^LEXT(757.2);Lexicon Subsets/Defaults;757.2
221 ;;^LEXC(757.9);^LEXC(*;Lexicon Change File;757.9-757.91
222 ;;^LEXM(0);^LEXM(*;Lexicon Export/Import;No File #
223 ;;^ICPT(0);^ICPT(;CPT/HCPCS;81
224 ;;^DIC(81.1,0);^DIC(81.1);CPT Category;81.1
225 ;;^DIC(81.2,0);^DIC(81.2);CPT Copyright;81.2
226 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
227 ;;^ICD9(0);^ICD9(;ICD Diagnosis;80
228 ;;^ICD0(0);^ICD0(;ICD Operation/Procedure;80.1
229 ;;^ICD(0);^ICD(;DRG Grouper;80.2
230 ;;^ICM(0);^ICM(;MAJOR DIAGNOSTIC CATEGORY;80.3
231 Q
232GD ; Global Data
233 ;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
234 ;;^ICPT(0);^ICPT(;CPT/HCPCS;81
235 ;;^ICD9(0);^ICD9(;ICD Diagnosis;80
236 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
Note: See TracBrowser for help on using the repository browser.