source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCSED04.m@ 619

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1ONCSED04 ;Hines OIFO/SG - EDITS API (EDIT INFO) ; 9/22/06 11:58am
2 ;;2.11;ONCOLOGY;**47**;Mar 07, 1995;Build 19
3 ;
4 ;--- SOAP REQUST TO THE ONCOLOGY WEB SERVICE
5 ;
6 ; <?xml version="1.0" encoding="utf-8"?>
7 ; <soap:Envelope
8 ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
9 ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
10 ; <soap:Body>
11 ; <ED-GET-EDITINFO ver="2.0"
12 ; xmlns="http://vista.med.va.gov/oncology">
13 ; <EDIT-SET> ... </EDIT-SET>
14 ; <EDIT> ... </EDIT>
15 ; <TEXT-WIDTH> ... </TEXT-WIDTH>
16 ; </ED-GET-EDITINFO>
17 ; </soap:Body >
18 ; </soap:Envelope>
19 ;
20 ;--- SOAP RESPONSE FROM THE ONCOLOGY WEB SERVICE
21 ;
22 ; <?xml version="1.0" encoding="utf-8"?>
23 ; <soap:Envelope
24 ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
25 ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
26 ; <soap:Body>
27 ; <ED-RESPONSE xmlns="http://vista.med.va.gov/oncology">
28 ; <NAME> ... </NAME>
29 ; <DESCRIPTION>
30 ; ...
31 ; </DESCRIPTION>
32 ; <HELP>
33 ; ...
34 ; </HELP>
35 ; </ED-RESPONSE>
36 ; <soap:Fault>
37 ; <faultcode> ... </faultcode>
38 ; <faultstring> ... </faultstring>
39 ; <detail>
40 ; <RC> ... </RC>
41 ; </detail>
42 ; </soap:Fault>
43 ; </soap:Body >
44 ; </soap:Envelope>
45 ;
46 Q
47 ;
48 ;***** END ELEMENT CALLBACK FOR THE SAX PARSER
49 ;
50 ; ELMT Name of the element
51 ;
52ENDEL(ELMT) ;
53 N I,L,L2E,TMP
54 S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
55 D ENDEL^ONCSAPIX(ELMT)
56 ;--- Description line
57 I L2E="DESCRIPTION,P" D Q
58 . S I=$O(@ONCXML@(ONCEDIEN,"D"," "),-1)+1
59 . S @ONCXML@(ONCEDIEN,"D",I)=$$TRIM^XLFSTR($G(ONCXML("TEXT")),"R")
60 ;--- Help line
61 I L2E="HELP,P" D Q
62 . S I=$O(@ONCXML@(ONCEDIEN,"H"," "),-1)+1
63 . S @ONCXML@(ONCEDIEN,"H",I)=$$TRIM^XLFSTR($G(ONCXML("TEXT")),"R")
64 Q
65 ;
66 ;***** GETS EDIT INFO FROM THE SERVER IF NECESSARY
67 ;
68 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
69 ;
70 ; ESNAME Edit set name
71 ;
72 ; EDTNDX Edit index
73 ;
74 ; Return Values:
75 ; <0 Error descriptor
76 ; >0 IEN of the edit info
77 ;
78GETINFO(ONCSAPI,ESNAME,EDTNDX) ;
79 N ONCEDESC ; Edit descriptor
80 N ONCEDIEN ; IEN of the description
81 ;
82 N DST,ESNSUB,ONCREQ,ONCRSP,ONCXML,SVX,SVY,URL
83 S ESNSUB=$E(ESNAME,1,250)
84 ;--- Initialize constants and variables
85 S ONCXML=$NA(^XTMP("ONCSAPI","EDITS"))
86 ;
87 ;--- Check if the edit info is available
88 S ONCEDIEN=+$G(@ONCXML@("ES",ESNSUB,EDTNDX))
89 I ONCEDIEN>0 Q:$D(@ONCXML@(ONCEDIEN))>1 ONCEDIEN
90 S ONCRSP=$NA(^TMP("ONCSED04",$J)) K @ONCRSP
91 ;
92 ;--- Get the server URL
93 S URL=$$GETCSURL^ONCSAPIU()
94 ;
95 D LOCK^DILF($NA(@ONCXML@("ES",ESNSUB,EDTNDX)))
96 E Q $$ERROR^ONCSAPIE(-15,,"local cache")
97 S SVX=$X,SVY=$Y
98 S RC=0 D
99 . ;--- Check if the info has become available
100 . S ONCEDIEN=+$G(@ONCXML@("ES",ESNSUB,EDTNDX))
101 . I ONCEDIEN>0 Q:$D(@ONCXML@(ONCEDIEN))>1
102 . ;
103 . ;--- Prepare the request data
104 . S DST="ONCREQ"
105 . D HEADER^ONCSAPIR(.DST,"ED-GET-EDITINFO")
106 . D PUT^ONCSAPIR(.DST,"EDIT-SET",ESNAME)
107 . D PUT^ONCSAPIR(.DST,"EDIT",EDTNDX)
108 . D PUT^ONCSAPIR(.DST,"TEXT-WIDTH",75)
109 . D TRAILER^ONCSAPIR(.DST)
110 . K DST
111 . ;
112 . ;--- Send the request and get the response
113 . D:$G(ONCSAPI("DEBUG"))
114 . . D ZW^ONCSAPIU("ONCREQ","*** 'ED-GET-EDITDESC' REQUEST ***")
115 . S RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ") Q:RC<0
116 . D:$G(ONCSAPI("DEBUG"))
117 . . D ZW^ONCSAPIU(ONCRSP,"*** 'ED-GET-EDITDESC' RESPONSE ***")
118 . ;
119 . ;--- Parse the response
120 . S ONCEDIEN=+$O(@ONCXML@(" "),-1)+1,ONCEDESC=EDTNDX
121 . D SETCBK(.CBK),EN^MXMLPRSE(ONCRSP,.CBK,"W")
122 . ;--- Check for parsing and web service errors
123 . S RC=$$CHKERR^ONCSAPIR(.ONCXML) Q:RC<0
124 . ;
125 . ;--- Complete the edit info
126 . S @ONCXML@(ONCEDIEN,0)=ONCEDESC
127 . S @ONCXML@("ES",ESNSUB,EDTNDX)=ONCEDIEN
128 S $X=SVX,$Y=SVY
129 L -@ONCXML@("ES",ESNSUB,EDTNDX)
130 ;
131 ;--- Cleanup
132 K @ONCRSP
133 Q $S(RC<0:RC,1:ONCEDIEN)
134 ;
135 ;***** RETURNS THE EDIT DESCRIPTION NODE (LOADS DATA IF NECESSARY)
136 ;
137 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
138 ;
139 ; ESNAME Edit set name
140 ;
141 ; EDTNDX Edit index
142 ;
143 ; The ^TMP("ONCSED04",$J) global node is used by this function.
144 ;
145 ; Return Values:
146 ; <0 Error descriptor
147 ; Closed root of the edit description node
148 ;
149GETEDESC(ONCSAPI,ESNAME,EDTNDX) ;
150 N NODE,RC
151 D CLEAR^ONCSAPIE()
152 Q:$G(EDTNDX,-1)<0 $$ERROR^ONCSAPIE(-6,,"EDTNDX",$G(EDTNDX))
153 S RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
154 Q $S(RC<0:RC,1:$NA(^XTMP("ONCSAPI","EDITS",RC,"D")))
155 ;
156 ;***** RETURNS THE EDIT HELP NODE (LOADS DATA IF NECESSARY)
157 ;
158 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
159 ;
160 ; ESNAME Edit set name
161 ;
162 ; EDTNDX Edit index
163 ;
164 ; The ^TMP("ONCSED04",$J) global node is used by this function.
165 ;
166 ; Return Values:
167 ; <0 Error descriptor
168 ; Closed root of the edit help node
169 ;
170GETEDHLP(ONCSAPI,ESNAME,EDTNDX) ;
171 N NODE,RC
172 D CLEAR^ONCSAPIE()
173 Q:$G(EDTNDX,-1)<0 $$ERROR^ONCSAPIE(-6,,"EDTNDX",$G(EDTNDX))
174 S RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
175 Q $S(RC<0:RC,1:$NA(^XTMP("ONCSAPI","EDITS",RC,"H")))
176 ;
177 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
178 ;
179 ; .CBK Reference to the destination list
180 ;
181SETCBK(CBK) ;
182 ;;CHARACTERS^ TEXT^ONCSED04
183 ;;ENDELEMENT^ENDEL^ONCSED04
184 ;
185 D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSED04")
186 Q
187 ;
188 ;***** TEXT CALLBACK FOR THE SAX PARSER
189 ;
190 ; TXT Line of unmarked text
191 ;
192TEXT(TXT) ;
193 N I,L,L2E,TMP
194 S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
195 ;--- Text of the edit description or help
196 I (L2E="DESCRIPTION,P")!(L2E="HELP,P") D Q
197 . S ONCXML("TEXT")=$G(ONCXML("TEXT"))_TXT
198 ;--- Edit name
199 I L2E="ED-RESPONSE,NAME" S $P(ONCEDESC,U,2)=$P(ONCEDESC,U,2)_TXT Q
200 ;--- Default processing
201 D TEXT^ONCSAPIX(TXT)
202 Q
Note: See TracBrowser for help on using the repository browser.