1 | TMGNDF3B ;TMG/kst/FDA Import: Set skip flag based on drug class ;03/25/06
|
---|
2 | ;;1.0;TMG-LIB;**1**;11/21/06
|
---|
3 |
|
---|
4 | ;" FDA - NATIONAL DRUG FILES COMPILING FUNCTIONS
|
---|
5 | ;" Set skip flag based on CLASS
|
---|
6 | ;"Kevin Toppenberg MD
|
---|
7 | ;"GNU General Public License (GPL) applies
|
---|
8 | ;"11-21-2006
|
---|
9 |
|
---|
10 | ;"=======================================================================
|
---|
11 | ;" API -- Public Functions.
|
---|
12 | ;"=======================================================================
|
---|
13 | ;"PickSkips -- allow user to scan for drugs by class and choose which to skip.
|
---|
14 | ;" -- NOTE: This is called from menu in TMGNDF3A
|
---|
15 |
|
---|
16 | ;"=======================================================================
|
---|
17 | ;" Private Functions.
|
---|
18 | ;"=======================================================================
|
---|
19 | ;"GetChildClasses(Array,Result) -- get a child array block showing the heirarchy of all VA DRUG classes
|
---|
20 | ;"GetRxClasses(pList,Array) -- create an array of drug classes for the input List
|
---|
21 | ;"GetMatch(RxClasses,ChildClasses,ClassIEN,Results) -- return those Drugs contained in class IEN
|
---|
22 | ;"WeedClasses(Classes,RxClasses,ChildClasses) -- remove entries from Classes that don't have any children in RxClasses
|
---|
23 | ;"NumDescendents(ClassIEN,Classes,ChildClasses,CountArray) -- return num having class, or descendent class
|
---|
24 | ;"DoWeedBySel(pList,mode) -- remove items, view all drugs, & select to remove
|
---|
25 | ;"GetInfo(IEN,array) -- get all the associated names linked to a DRUG file entry
|
---|
26 |
|
---|
27 | ;"=======================================================================
|
---|
28 | ;"=======================================================================
|
---|
29 | PickSkips
|
---|
30 | ;"Purpose: To allow user to scan for drugs by class and choose which to skip.
|
---|
31 |
|
---|
32 | new List
|
---|
33 | do GetList("List")
|
---|
34 | do WeedByClass("List")
|
---|
35 |
|
---|
36 | quit
|
---|
37 |
|
---|
38 | GetList(pList)
|
---|
39 | ;"Purpose: To create a list of records not currently marked to be skipped
|
---|
40 | ;"Input: pList -- PASS BY NAME -- an OUT PARAMETER. Format:
|
---|
41 | ;" @pList@(DrugName,IENin22706.9)=""
|
---|
42 | ;" @pList@(DrugName,IENin22706.9)=""
|
---|
43 |
|
---|
44 | new Itr,IEN
|
---|
45 | new abort set abort=0
|
---|
46 | write "Gathering names of the current imports not flagged to be SKIPPED...",!
|
---|
47 | set IEN=$$ItrInit^TMGITR(22706.9,.Itr)
|
---|
48 | do PrepProgress^TMGITR(.Itr,20,0,"IEN")
|
---|
49 | if IEN'="" for do quit:($$ItrNext^TMGITR(.Itr,.IEN)'>0)!abort
|
---|
50 | . if $$UserAborted^TMGUSRIF set abort=1 quit
|
---|
51 | . if $piece($get(^TMG(22706.9,IEN,1)),"^",4)=1 quit ;"1=SKIP
|
---|
52 | . new DrugName set DrugName=$piece($get(^TMG(22706.9,IEN,7)),"^",6)
|
---|
53 | . set @pList@(DrugName,IEN)=""
|
---|
54 | do ProgressDone^TMGITR(.Itr)
|
---|
55 |
|
---|
56 | quit
|
---|
57 |
|
---|
58 | WeedByClass(pList)
|
---|
59 | ;"Purpose: To allow the user to weed the list of drugs for addition, by drug class
|
---|
60 | ;"Input: pList -- PASS BY NAME -- list of drugs to be added, as created by FillList(pList)
|
---|
61 | ;"Output: the List will be edited.
|
---|
62 | ;"Result: none
|
---|
63 |
|
---|
64 | new Classes,ParentArray,ChildArray,IEN,RxClasses
|
---|
65 |
|
---|
66 | write "Gathering information about drug CLASSES from the imports..."
|
---|
67 | do GetClasses^TMGNDF3A(.Classes)
|
---|
68 | do KillIntro^TMGNDF3A(.Classes)
|
---|
69 | do GetChildClasses(.Classes,.ChildArray)
|
---|
70 | do GetRxClasses(pList,.RxClasses)
|
---|
71 | do WeedClasses(.Classes,.RxClasses,.ChildArray)
|
---|
72 |
|
---|
73 | new done set done=0
|
---|
74 | for do quit:(done=1)
|
---|
75 | . new classIEN
|
---|
76 | . set classIEN=$$SelectClass^TMGNDF3A(.Classes,1)
|
---|
77 | . if classIEN=0 set done=1 quit
|
---|
78 | . new Match
|
---|
79 | . do GetMatch(.RxClasses,.ChildArray,classIEN,.Match)
|
---|
80 | . if $data(Match) do
|
---|
81 | . . new delList
|
---|
82 | . . do SelRxList("Match","delList","SELECT DRUGS TO BE DELETED. [ESC][ESC] WHEN DONE")
|
---|
83 | . . do DoWeed(pList,"delList")
|
---|
84 | . . new name set name=""
|
---|
85 | . . for set name=$order(delList(name)) quit:(name="") do
|
---|
86 | . . . new IEN set IEN=""
|
---|
87 | . . . for set IEN=$order(delList(name,IEN)) quit:(+IEN'>0) do
|
---|
88 | . . . . new TMGFDA,TMGMSG
|
---|
89 | . . . . set TMGFDA(22706.9,IEN_",",6)=1 ;"1=SKIP
|
---|
90 | . . . . do FILE^DIE("K","TMGFDA","TMGMSG")
|
---|
91 | . . . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
|
---|
92 | . . . . new classIEN set classIEN=$piece($get(^TMG(22706.9,IEN,1)),"^",5)
|
---|
93 | . . . . if $data(RxClasses(classIEN,name,IEN)) do
|
---|
94 | . . . . . kill RxClasses(classIEN,name,IEN)
|
---|
95 | . . ;"kill RxClasses
|
---|
96 | . . ;"write "Gathering drug classes..."
|
---|
97 | . . ;"do GetRxClasses(pList,.RxClasses)
|
---|
98 | . . do WeedClasses(.Classes,.RxClasses,.ChildArray)
|
---|
99 | . else write "(No matches found.)",!
|
---|
100 |
|
---|
101 | ;"write "Counting drugs in list... "
|
---|
102 | ;"set @pList@(-1)=$$ListCt^TMGMISC(pList)-1 ;"recount ItemsCount node
|
---|
103 |
|
---|
104 | quit
|
---|
105 |
|
---|
106 |
|
---|
107 | GetRxClasses(pList,Array)
|
---|
108 | ;"Purpose: To create an array of drug classes for the input List
|
---|
109 | ;"Input: pList -- PASS BY NAME,
|
---|
110 | ;" format: @List@(-1)=ItemsCount <-- REMOVED
|
---|
111 | ;" @List@(DrugName,IEN)="" ;IEN is IEN in file 22706.9
|
---|
112 | ;" Array -- PASS BY REFERENCE, an OUT PARAMETER
|
---|
113 | ;" format: Array(ClassIEN,DrugName,IEN)=""
|
---|
114 | ;" Array(ClassIEN,DrugName,IEN)=""
|
---|
115 | ;" Array(ClassIEN,DrugName,IEN)=""
|
---|
116 | ;"Output: Array -- prior entries are not deleted.
|
---|
117 | ;"Result: none
|
---|
118 |
|
---|
119 | new Itr,DrugName
|
---|
120 | new IEN,ClassIEN
|
---|
121 | new abort set abort=0
|
---|
122 | set DrugName=$$ItrAInit^TMGITR(pList,.Itr)
|
---|
123 | do PrepProgress^TMGITR(.Itr,20,1,"DrugName")
|
---|
124 | write !
|
---|
125 | if DrugName'="" for do quit:($$ItrANext^TMGITR(.Itr,.DrugName)="")!abort
|
---|
126 | . if $$UserAborted^TMGUSRIF set abort=1 quit
|
---|
127 | . set IEN=0
|
---|
128 | . for set IEN=$order(@pList@(DrugName,IEN)) quit:(+IEN'>0) do
|
---|
129 | . . set ClassIEN=$piece($get(^TMG(22706.9,IEN,1)),"^",5)
|
---|
130 | . . if ClassIEN>0 set Array(ClassIEN,DrugName,IEN)=""
|
---|
131 | do ProgressDone^TMGITR(.Itr)
|
---|
132 |
|
---|
133 | quit
|
---|
134 |
|
---|
135 |
|
---|
136 |
|
---|
137 | GetChildClasses(Array,Result)
|
---|
138 | ;"Purpose: To get a child array block showing the heirarchy of all VA DRUG classes
|
---|
139 | ;"Input: Array -- PASS BY REFERENCE, array as created by GetClasses^TMGNDF3A(.Array)
|
---|
140 | ;" Array(GGF-IEN)=e.g. ""AD000^ANTIDOTES,DETERRENTS AND POISON CONTROL"
|
---|
141 | ;" Array(GGF-IEN,GF-IEN)=e.g. "AD100^ALCOHOL DETERRENTS"
|
---|
142 | ;" Array(GGF-IEN,GF-IEN,F-IEN)=e.g. "AD150^ALCOHOL DETERRENTS -- GENERAL TYPE 1"
|
---|
143 | ;" Array(GGF-IEN,GF-IEN,F-IEN,IEN)=e.g. "AD152^ALCOHOL DETERRENTS -- GENERAL TYPE 1b"
|
---|
144 | ;" Note: There are no more than 3 levels
|
---|
145 | ;" Result -- PASS BY REFERENCE, an OUT PARAMETER
|
---|
146 | ;"Output: Result filled as follows:
|
---|
147 | ;" Note: the IEN's here are IEN's in VA DRUG CLASS file
|
---|
148 | ;" Result (IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
149 | ;" Result (IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
150 | ;" Result (IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
151 | ;" Result (IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
152 | ;" e.g. ChildArray(1)= 2,3,240, means that 2,3,240 are children of 1
|
---|
153 | ;"Results: none
|
---|
154 |
|
---|
155 | new parentIEN,IEN
|
---|
156 |
|
---|
157 | new i1,i2,i3,i4
|
---|
158 | set i1=$order(Array(""))
|
---|
159 | if i1'="" for do quit:(i1="")
|
---|
160 | . set i2=$order(Array(i1,""))
|
---|
161 | . if i2'="" for do quit:(i2="")
|
---|
162 | . . if $data(Array(i1,i2))#10>0 do
|
---|
163 | . . . set Result(i1)=$get(Result(i1))_i2_","
|
---|
164 | . . set i3=$order(Array(i1,i2,""))
|
---|
165 | . . if i3'="" for do quit:(i3="")
|
---|
166 | . . . if $data(Array(i1,i2,i3))#10>0 do
|
---|
167 | . . . . set Result(i1)=$get(Result(i1))_i3_","
|
---|
168 | . . . set i3=$order(Array(i1,i2,i3))
|
---|
169 | . . set i2=$order(Array(i1,i2))
|
---|
170 | . set i1=$order(Array(i1))
|
---|
171 |
|
---|
172 | quit
|
---|
173 |
|
---|
174 |
|
---|
175 | WeedClasses(Classes,RxClasses,ChildClasses)
|
---|
176 | ;"Purpose: To removed entries from Classes that don't have any children in RxClasses
|
---|
177 | ;"Input:
|
---|
178 | ;" Classes -- PASS BY REFERENCE. Array filled as follows:
|
---|
179 | ;" Array(GGF-IEN)=e.g. ""AD000^ANTIDOTES,DETERRENTS AND POISON CONTROL"
|
---|
180 | ;" Array(GGF-IEN,GF-IEN)=e.g. "AD100^ALCOHOL DETERRENTS"
|
---|
181 | ;" Array(GGF-IEN,GF-IEN,F-IEN)=e.g. "AD150^ALCOHOL DETERRENTS -- GENERAL TYPE 1"
|
---|
182 | ;" Array(GGF-IEN,GF-IEN,F-IEN,IEN)=e.g. "AD152^ALCOHOL DETERRENTS -- GENERAL TYPE 1b"
|
---|
183 | ;" RxClasses: PASS BY REFERENCE
|
---|
184 | ;" format: Array(ClassIEN,DrugName,IEN)=""
|
---|
185 | ;" Array(ClassIEN,DrugName,IEN)=""
|
---|
186 | ;" Array(ClassIEN,DrugName,IEN)=""
|
---|
187 | ;" ChildClasses: PASS BY REFERENCE
|
---|
188 | ;" Note: the IEN's here are IEN's in VA DRUG CLASS file
|
---|
189 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
190 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
191 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
192 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
193 | ;" e.g. Array(1)= 2,3,240, means that 2,3,240 are children of 1
|
---|
194 | ;"Output: Classes Array will be edited with empty clases removed
|
---|
195 | ;"Results: none
|
---|
196 |
|
---|
197 | ;"First count all entries for each drug class IEN
|
---|
198 |
|
---|
199 | new CountArray
|
---|
200 | ;"Format: CountArray(ClassIEN)=CountOfDrugsWithThisClass
|
---|
201 |
|
---|
202 | new count
|
---|
203 | new ClassIEN set ClassIEN=$order(RxClasses(""))
|
---|
204 | if ClassIEN'="" for do quit:(ClassIEN="")
|
---|
205 | . set count=0
|
---|
206 | . new DrugName set DrugName=$order(RxClasses(ClassIEN,""))
|
---|
207 | . if DrugName'="" for do quit:(DrugName="")
|
---|
208 | . . new DrugIEN set DrugIEN=$order(RxClasses(ClassIEN,DrugName,""))
|
---|
209 | . . if DrugIEN'="" for do quit:(DrugIEN="")
|
---|
210 | . . . set count=count+1
|
---|
211 | . . . set DrugIEN=$order(RxClasses(ClassIEN,DrugName,DrugIEN))
|
---|
212 | . . set DrugName=$order(RxClasses(ClassIEN,DrugName))
|
---|
213 | . set CountArray(ClassIEN)=count
|
---|
214 | . set ClassIEN=$order(RxClasses(ClassIEN))
|
---|
215 |
|
---|
216 |
|
---|
217 | ;"Now remove all ClassIENs that don't have any entries, or children or grandchildren etc.
|
---|
218 | ;" Classes -- Array will be filled as follows:
|
---|
219 | ;" Array(GGF-IEN)=e.g. ""AD000^ANTIDOTES,DETERRENTS AND POISON CONTROL"
|
---|
220 | ;" Array(GGF-IEN,GF-IEN)=e.g. "AD100^ALCOHOL DETERRENTS"
|
---|
221 | ;" Array(GGF-IEN,GF-IEN,F-IEN)=e.g. "AD150^ALCOHOL DETERRENTS -- GENERAL TYPE 1"
|
---|
222 | ;" Array(GGF-IEN,GF-IEN,F-IEN,IEN)=e.g. "AD152^ALCOHOL DETERRENTS -- GENERAL TYPE 1b"
|
---|
223 |
|
---|
224 | new i1,i2,i3,i4
|
---|
225 | set i1=$order(Classes(""))
|
---|
226 | if i1'="" for do quit:(i1="")
|
---|
227 | . if $$NumDescendents(i1,.Classes,.ChildClasses,.CountArray)=0 do quit
|
---|
228 | . . new temp set temp=i1
|
---|
229 | . . set i1=$order(Classes(i1))
|
---|
230 | . . kill Classes(temp)
|
---|
231 | . . ;"write "Removing class ",temp,"... It doesn't have any entries or descendents",!
|
---|
232 | . set i2=$order(Classes(i1,""))
|
---|
233 | . if i2'="" for do quit:(i2="")
|
---|
234 | . . if $$NumDescendents(i2,.Classes,.ChildClasses,.CountArray)=0 do quit
|
---|
235 | . . . new temp set temp=i2
|
---|
236 | . . . set i2=$order(Classes(i1,i2))
|
---|
237 | . . . kill Classes(i1,temp)
|
---|
238 | . . . ;"write "Removing class ",temp,"... It doesn't have any entries or descendents",!
|
---|
239 | . . set i3=$order(Classes(i1,i2,""))
|
---|
240 | . . if i3'="" for do quit:(i3="")
|
---|
241 | . . . if $$NumDescendents(i3,.Classes,.ChildClasses,.CountArray)=0 do quit
|
---|
242 | . . . . new temp set temp=i3
|
---|
243 | . . . . set i3=$order(Classes(i1,i2,i3))
|
---|
244 | . . . . kill Classes(i1,i2,temp)
|
---|
245 | . . . . ;"write "Removing class ",temp,"... It doesn't have any entries or descendents",!
|
---|
246 | . . . set i3=$order(Classes(i1,i2,i3))
|
---|
247 | . . set i2=$order(Classes(i1,i2))
|
---|
248 | . set i1=$order(Classes(i1))
|
---|
249 |
|
---|
250 | quit
|
---|
251 |
|
---|
252 |
|
---|
253 | GetMatch(RxClasses,ChildClasses,ClassIEN,Results)
|
---|
254 | ;"Purpose: To return those Drugs contained in class IEN
|
---|
255 | ;"Input: RxClasses: PASS BY REFERENCE Array as created by GetRxClasses(pList,Array)
|
---|
256 | ;" -- a list of drugs arranged by class
|
---|
257 | ;" ChildClasses: PASS BY REFERENCE Array as created by GetChildClasses(Array,Result)
|
---|
258 | ;" -- a list of child class for any given class IEN
|
---|
259 | ;" ClassIEN: The IEN from file VA DRUG CLASS to match against.
|
---|
260 | ;" Results: PASS BY REFERENCE, an OUT PARAMETER
|
---|
261 | ;"Output: Results -- List of matches, if found. Format as follows:
|
---|
262 | ;" format: Results(-1)=ItemsCount <-- REMOVED
|
---|
263 | ;" Results(DrugName,IEN)=""
|
---|
264 | ;"
|
---|
265 | ;"Results: none
|
---|
266 |
|
---|
267 | ;"First get all matches for ClassIEN
|
---|
268 | merge Results=RxClasses(ClassIEN)
|
---|
269 |
|
---|
270 | ;"Now get matches for all descenents
|
---|
271 | new i,kids
|
---|
272 | set kids=$get(ChildClasses(ClassIEN))
|
---|
273 | for i=1:1:$length(kids,",") do
|
---|
274 | . new kidIEN set kidIEN=$piece(kids,",",i)
|
---|
275 | . merge Results=RxClasses(kidIEN)
|
---|
276 | quit
|
---|
277 |
|
---|
278 |
|
---|
279 | NumDescendents(ClassIEN,Classes,ChildClasses,CountArray)
|
---|
280 | ;"Purpose: For a given drug class, return the number of drugs that have this class, or one
|
---|
281 | ;" of it's descendent classes as its assigned drug class
|
---|
282 | ;"Input: ClassIEN -- the IEN to evaluate
|
---|
283 | ;" Classes -- Array will be filled as follows:
|
---|
284 | ;" Array(GGF-IEN)=e.g. ""AD000^ANTIDOTES,DETERRENTS AND POISON CONTROL"
|
---|
285 | ;" Array(GGF-IEN,GF-IEN)=e.g. "AD100^ALCOHOL DETERRENTS"
|
---|
286 | ;" Array(GGF-IEN,GF-IEN,F-IEN)=e.g. "AD150^ALCOHOL DETERRENTS -- GENERAL TYPE 1"
|
---|
287 | ;" Array(GGF-IEN,GF-IEN,F-IEN,IEN)=e.g. "AD152^ALCOHOL DETERRENTS -- GENERAL TYPE 1b"
|
---|
288 | ;" ChildClasses:
|
---|
289 | ;" Note: the IEN's here are IEN's in VA DRUG CLASS file
|
---|
290 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
291 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
292 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
293 | ;" Array(IEN)="IEN1,IEN2,IEN3,IEN4,IEN5,IEN6," a list of all child IENs
|
---|
294 | ;" e.g. Array(1)= 2,3,240, means that 2,3,240 are children of 1
|
---|
295 | ;" CountArray: Array filled with a counting of drugs using each class (pre-counted array)
|
---|
296 | ;" CountArray(ClassIEN)=CountOfDrugsWithThisClass
|
---|
297 | ;" CountArray(ClassIEN)=CountOfDrugsWithThisClass
|
---|
298 | ;" CountArray(ClassIEN)=CountOfDrugsWithThisClass
|
---|
299 | ;"Result: returns the number using this class, or a descendent class.
|
---|
300 |
|
---|
301 | new result
|
---|
302 | set result=+$get(CountArray(ClassIEN))
|
---|
303 |
|
---|
304 | new ChildList set ChildList=$get(ChildClasses(ClassIEN))
|
---|
305 | new i for i=1:1:$length(ChildList,",") do
|
---|
306 | . new subClassIEN set subClassIEN=+$piece(ChildList,",",i)
|
---|
307 | . if subClassIEN=0 quit
|
---|
308 | . set result=result+$$NumDescendents(subClassIEN,.Classes,.ChildClasses,.CountArray)
|
---|
309 |
|
---|
310 | quit result
|
---|
311 |
|
---|
312 |
|
---|
313 |
|
---|
314 | SelRxList(pList,pSelList,HdrText,mode)
|
---|
315 | ;"Purpose: To display the Drug list, and allow user to select from the list.
|
---|
316 | ;"Input: pList -- PASS BY NAME -- list of drugs to be added, as created by FillList(pList)
|
---|
317 | ;" @pList@(drugName,IEN)=""
|
---|
318 | ;" pSelList -- PASS BY NAME, an OUT PARAMETER.
|
---|
319 | ;" Returns list of selected items
|
---|
320 | ;" @pSelList@(drugName,IEN)="" ;IEN is from 22706.9
|
---|
321 | ;" @pSelList@(drugName,IEN)=""
|
---|
322 | ;" HdrText -- optional, some text to show on top of selector
|
---|
323 | ;" mode -- OPTIONAL. Default=1
|
---|
324 | ;" 1 --> Display by LONG NAME .04 name
|
---|
325 | ;" 2 --> Display by VA PRODUCT (50.68) .01 name
|
---|
326 | ;" 3 --> Display by FDA import name
|
---|
327 | ;" 4 --> Display by VA GENERIC name
|
---|
328 |
|
---|
329 | ;"Results: none
|
---|
330 |
|
---|
331 | new ref set ref="^TMP(""VEE"",$J)"
|
---|
332 | kill @ref
|
---|
333 | new count set count=1
|
---|
334 | set mode=$get(mode,1)
|
---|
335 |
|
---|
336 | new pNDCIndex
|
---|
337 | set pNDCIndex=$$GetNDCIndex^TMGNDF4A(1)
|
---|
338 |
|
---|
339 | write "Prepping to display list...",!
|
---|
340 | ;"First convert list to a display format
|
---|
341 | new name,IEN,Itr
|
---|
342 |
|
---|
343 | set name=$$ItrAInit^TMGITR(pList,.Itr)
|
---|
344 | do PrepProgress^TMGITR(.Itr,20,1,"name")
|
---|
345 | if name'="" for do quit:($$ItrANext^TMGITR(.Itr,.name)="")
|
---|
346 | . new addedArray,showName
|
---|
347 | . set IEN=0
|
---|
348 | . for set IEN=$order(@pList@(name,IEN)) quit:(IEN="") do
|
---|
349 | . . new NameInfo do GetInfo(IEN,.NameInfo)
|
---|
350 | . . new IdxName set IdxName=$get(NameInfo("MODES",mode))
|
---|
351 | . . if mode=3 do ;"Display by FDA import name
|
---|
352 | . . . set showName=""
|
---|
353 | . . . for set showName=$order(NameInfo(IdxName,showName)) quit:(showName="") do
|
---|
354 | . . . . set @ref@(count)=name_"^"_IEN_$char(9)_showName set count=count+1
|
---|
355 | . . . set showName="" ;"prevent duplicate addition below
|
---|
356 | . . else if (mode>0)&(mode<5) set showName=$order(NameInfo(IdxName,""))
|
---|
357 | . . if (showName'="") set @ref@(count)=name_"^"_IEN_$char(9)_showName set count=count+1
|
---|
358 |
|
---|
359 | set @ref@("HD")=$get(HdrText,"MENU")
|
---|
360 |
|
---|
361 | ;"Note: Rules of use:
|
---|
362 | ;" ref must=^TMP("VEE",$J)
|
---|
363 | ;" Each line should be in this format:
|
---|
364 | ;" @ref@(number)=ReturnValue_$char(9)_DisplayValue
|
---|
365 | ;" @ref@(number)=ReturnValue_$char(9)_DisplayValue
|
---|
366 | ;" @ref@(number)=ReturnValue_$char(9)_DisplayValue
|
---|
367 | ;" Results come back in:
|
---|
368 | ;" ^TMP("VPE","SELECT",$J,number)=ReturnValue_$char(9)_DisplayValue
|
---|
369 | ;" ^TMP("VPE","SELECT",$J,number)=ReturnValue_$char(9)_DisplayValue
|
---|
370 | ;" ^TMP("VPE","SELECT",$J,number)=ReturnValue_$char(9)_DisplayValue
|
---|
371 |
|
---|
372 | write !,"Passing off to Selector..."
|
---|
373 | D SELECT^%ZVEMKT(ref)
|
---|
374 |
|
---|
375 | set ref="^TMP(""VPE"",""SELECT"","_$J_")"
|
---|
376 | new number set number=""
|
---|
377 | for set number=$order(@ref@(number)) quit:(number="") do
|
---|
378 | . new ReturnValue set ReturnValue=$piece(@ref@(number),$char(9),1)
|
---|
379 | . new drugName set drugName=$piece(ReturnValue,"^",1)
|
---|
380 | . new IEN set IEN=$piece(ReturnValue,"^",2)
|
---|
381 | . set @pSelList@(drugName,IEN)=""
|
---|
382 |
|
---|
383 | quit
|
---|
384 |
|
---|
385 |
|
---|
386 | DoWeed(pList,pDelList)
|
---|
387 | ;"Purpose: To remove all items in pDelList from pList
|
---|
388 | ;"Input: pList -- PASS BY NAME-- list of drugs to be edited, as created by FillList(pList)
|
---|
389 | ;" format: @pList@(-1)=ItemsCount <-- REMOVED
|
---|
390 | ;" @pList@(DrugName,IEN)=""
|
---|
391 | ;" @pList@(DrugName,IEN)=""
|
---|
392 | ;" pDelList -- PASS BY NAME -- list of drugs to be removed, as created by UsrWeedList
|
---|
393 | ;" format: @pDelList@(DrugName,IEN)=""
|
---|
394 | ;" @pDelList@(DrugName,IEN)=""
|
---|
395 |
|
---|
396 | new % set %=2
|
---|
397 | if '$data(pDelList) goto DWDone
|
---|
398 |
|
---|
399 | write "Setting selected imports to be SKIPPED... "
|
---|
400 | new drugName
|
---|
401 | set drugName=$order(@pDelList@(0))
|
---|
402 | if drugName'="" for do quit:(drugName="")
|
---|
403 | . new IEN set IEN=$order(@pDelList@(drugName,0))
|
---|
404 | . if IEN'="" for do quit:(IEN="")
|
---|
405 | . . kill @pList@(drugName,IEN)
|
---|
406 | . . set IEN=$order(@pDelList@(drugName,IEN))
|
---|
407 | . set drugName=$order(@pDelList@(drugName))
|
---|
408 |
|
---|
409 | ;"write "Counting drugs in list... "
|
---|
410 | ;"set @pList@(-1)=$$ListCt^TMGMISC(pList)-1 ;"remove count of ItemsCount node
|
---|
411 |
|
---|
412 | DWDone
|
---|
413 | quit
|
---|
414 |
|
---|
415 |
|
---|
416 | GetInfo(IEN,array)
|
---|
417 | ;"Purpose: to get all the associated names linked to a DRUG file entry
|
---|
418 | ;"Input: IEN -- the IEN in file 22706.9
|
---|
419 | ;" array -- PASS BY REFERENCE. An OUT PARAMETER. Format:
|
---|
420 | ;" array("DRUG NAME",Name)="" NAME (.04) FROM 22706.9
|
---|
421 | ;" array("VAP NAME",Name)="" Name from VA PRODUCT file
|
---|
422 | ;" array("FDA IMPORT NAME",Names)="" Name from .05 TRADE NAME IN 22706.9
|
---|
423 | ;" array("VA GENERIC NAME",Name)="" Name from VA GENERIC file
|
---|
424 | ;" array("MODES",1)="DRUG NAME"
|
---|
425 | ;" array("MODES",2)="VAP NAME"
|
---|
426 | ;" array("MODES",3)="FDA IMPORT NAME"
|
---|
427 | ;" array("MODES",4)="VA GENERIC NAME"
|
---|
428 | ;"results: none
|
---|
429 |
|
---|
430 | new showName
|
---|
431 | kill array
|
---|
432 |
|
---|
433 | set array("MODES",1)="DRUG NAME"
|
---|
434 | set array("MODES",2)="VAP NAME"
|
---|
435 | set array("MODES",3)="FDA IMPORT NAME"
|
---|
436 | set array("MODES",4)="VA GENERIC NAME"
|
---|
437 |
|
---|
438 | ;"new vapIEN set vapIEN=+$piece($get(^PSDRUG(IEN,"ND")),"^",3)
|
---|
439 | new vapIEN set vapIEN=+$piece($get(^TMG(22706.9,IEN,6)),"^",2)
|
---|
440 | if vapIEN'=0 do
|
---|
441 | . set showName=$piece($get(^PSNDF(50.68,vapIEN,0)),"^",1)
|
---|
442 | . set:(showName'="") array("VAP NAME",showName)=""
|
---|
443 | . . else if mode=3 do ;"Display by FDA import name
|
---|
444 |
|
---|
445 | ;"new vagIEN set vagIEN=+$piece($get(^PSNDF(50.68,vapIEN,0)),"^",2)
|
---|
446 | new vagIEN set vagIEN=+$piece($get(^TMG(22706.9,IEN,1)),"^",3)
|
---|
447 | if vagIEN'=0 do
|
---|
448 | . set showName=$piece($get(^PSNDF(50.6,vagIEN,0)),"^",1)
|
---|
449 | . set:(showName'="") array("VA GENERIC NAME",showName)=""
|
---|
450 |
|
---|
451 | ;"set showName=$piece($get(^PSDRUG(IEN,0)),"^",1)
|
---|
452 | set showName=$piece($get(^TMG(22706.9,IEN,7)),"^",6) ;"7;6 = LONG NAME
|
---|
453 | set:(showName'="") array("DRUG NAME",showName)=""
|
---|
454 |
|
---|
455 | set showName=$piece($get(^TMG(22706.9,IEN,0)),"^",4) ;"0;4 = TRADENAME
|
---|
456 | set:(showName'="") array("FDA IMPORT NAME",showName)=""
|
---|
457 |
|
---|
458 | quit
|
---|
459 |
|
---|
460 |
|
---|
461 |
|
---|
462 |
|
---|