source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2045.m@ 1696

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

initial load of WorldVistAEHR

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