source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCSAPI3.m@ 846

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

initial load of WorldVistAEHR

File size: 8.2 KB
Line 
1ONCSAPI3 ;Hines OIFO/SG - COLLABORATIVE STAGING (CALCULATE) ; 5/18/04 9:47am
2 ;;2.11;ONCOLOGY;**40**;Mar 07, 1995
3 ;
4 ;--- SOAP REQUST TO THE COLLABORATIVE STAGING 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 ; <CS-CALCULATE xmlns="http://vista.med.va.gov/oncology">
12 ; <HIST> ... </HIST>
13 ; <SITE> ... </SITE>
14 ; <BEHAV> ... </BEHAV>
15 ; <GRADE> ... </GRADE>
16 ; <AGE> ... </AGE>
17 ; <SIZE> ... </SIZE>
18 ; <EXT> ... </EXT>
19 ; <EXTEVAL> ... </EXTEVAL>
20 ; <NODES> ... </NODES>
21 ; <NODESEVAL> ... </NODESEVAL>
22 ; <LNPOS> ... </LNPOS>
23 ; <LNEXAM> ... </LNEXAM>
24 ; <METS> ... </METS>
25 ; <METSEVAL> ... </METSEVAL>
26 ; <SSF1> ... </SSF1>
27 ; <SSF2> ... </SSF2>
28 ; <SSF3> ... </SSF3>
29 ; <SSF4> ... </SSF4>
30 ; <SSF5> ... </SSF5>
31 ; <SSF6> ... </SSF6>
32 ; </CS-CALCULATE>
33 ; </soap:Body >
34 ; </soap:Envelope>
35 ;
36 ;--- SOAP RESPONSE FROM THE COLLABORATIVE STAGING WEB SERVICE
37 ;
38 ; <?xml version="1.0" encoding="utf-8"?>
39 ; <soap:Envelope
40 ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
41 ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
42 ; <soap:Body>
43 ; <CS-RESPONSE xmlns="http://vista.med.va.gov/oncology">
44 ; <CS-STOR>
45 ; <AJCC> ... </AJCC>
46 ; <N> ... </N>
47 ; <NDESCR> ... </NDESCR>
48 ; <M> ... </M>
49 ; <MDESCR> ... </MDESCR>
50 ; <SS1977> ... </SS1977>
51 ; <SS2000> ... </SS2000>
52 ; <T> ... </T>
53 ; <TDESCR> ... </TDESCR
54 ; </CS-STOR>
55 ; <CS-DISP>
56 ; <AJCC> ... </AJCC>
57 ; <N> ... </N>
58 ; <NDESCR> ... </NDESCR>
59 ; <M> ... </M>
60 ; <MDESCR> ... </MDESCR>
61 ; <SS1977> ... </SS1977>
62 ; <SS2000> ... </SS2000>
63 ; <T> ... </T>
64 ; <TDESCR> ... </TDESCR>
65 ; </CS-DISP>
66 ; <APIVER> ... </APIVER>
67 ; <VERSION> ... </VERSION>
68 ; </CS-RESPONSE>
69 ; <soap:Fault>
70 ; <faultcode> ... </faultcode>
71 ; <faultstring> ... </faultstring>
72 ; <detail>
73 ; <ERROR> ... </ERROR>
74 ; <MSG>
75 ; ...
76 ; </MSG>
77 ; <RC> ... </RC>
78 ; </detail>
79 ; </soap:Fault>
80 ; </soap:Body >
81 ; </soap:Envelope>
82 ;
83 Q
84 ;
85 ;***** CALLS THE COLLABORATIVE STAGING WEB SERVICE
86 ;
87 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
88 ;
89 ; .INPUT( Reference to a local variable containg
90 ; input parameters.
91 ;
92 ; "AGE") Age at Diagnosis
93 ; "BEHAV") Behavior Code ICD-O-3
94 ; "EXT") CS Extension
95 ; "EXTEVAL") CS Size/Ext Eval
96 ; "GRADE") Grade
97 ; "HIST") Histologic Type ICD-O-3
98 ; "LNPOS") Regional Nodes Positive
99 ; "LNEXAM") Regional Nodes Examined
100 ; "METS") CS Mets at DX
101 ; "METSEVAL") CS Mets Eval
102 ; "NODES") CS Lymph Nodes
103 ; "NODESEVAL") CS Reg Nodes Eval
104 ; "SITE") Primary site
105 ; "SIZE") CS Tumor Size
106 ; "SSF1") CS Site-Specific Factor 1
107 ; "SSF2") CS Site-Specific Factor 2
108 ; "SSF3") CS Site-Specific Factor 3
109 ; "SSF4") CS Site-Specific Factor 4
110 ; "SSF5") CS Site-Specific Factor 5
111 ; "SSF6") CS Site-Specific Factor 6
112 ;
113 ; .ONCSTOR( Reference to a local variable where output
114 ; storage values are returned.
115 ;
116 ; "AJCC") Derived AJCC Stage Group
117 ; "N") Derived AJCC N
118 ; "NDESCR") Derived AJCC N Descriptor
119 ; "M") Derived AJCC M
120 ; "MDESCR") Derived AJCC M Descriptor
121 ; "SS1977") Derived SS1977
122 ; "SS2000") Derived SS2000
123 ; "T") Derived AJCC T
124 ; "TDESCR") Derived AJCC T Descriptor
125 ;
126 ; .ONCDISP( Reference to a local variable where output
127 ; display values are returned.
128 ;
129 ; "AJCC") Derived AJCC Stage Group
130 ; "N") Derived AJCC N
131 ; "NDESCR") Derived AJCC N Descriptor
132 ; "M") Derived AJCC M
133 ; "MDESCR") Derived AJCC M Descriptor
134 ; "SS1977") Derived SS1977
135 ; "SS2000") Derived SS2000
136 ; "T") Derived AJCC T
137 ; "TDESCR") Derived AJCC T Descriptor
138 ;
139 ; .ONCSTAT( Reference to a local variable where status
140 ; values are returned.
141 ;
142 ; "APIVER") Version of the CS API
143 ;
144 ; "ERROR", Error Code
145 ; Name) Symbolic names of error bits (see
146 ; the INVLDINP^ONCSAPI3 for details)
147 ;
148 ; "MSG",
149 ; i) Error message returned by the CStage_calculate
150 ;
151 ; "RC") Error code returned by the CS web-service
152 ;
153 ; "VERSION") Version of the service
154 ;
155 ; The ^TMP("ONCSAPI3",$J) global node is used by this function.
156 ;
157 ; Note: Patch XT*7.3*67 (VistA XML Parser)) is required for this
158 ; API to work.
159 ;
160 ; Return values:
161 ;
162 ; <0 Error Descriptor (see ^ONCSAPI for details)
163 ; For example:
164 ; "-1^Missing input parameters^CALC+4^ONCSAPI"
165 ;
166 ; 0 Ok
167 ;
168 ; 1 Probably Ok (warnings)
169 ;
170CALC(ONCSAPI,INPUT,ONCSTOR,ONCDISP,ONCSTAT) ;
171 N CBK,ONCRDAT,ONCSDAT,ONCXML,RC,TMP,URL,X
172 D CLEAR^ONCSAPIE()
173 S ONCRDAT=$NA(^TMP("ONCSAPI3",$J))
174 K ONCDISP,ONCSTAT,ONCSTOR,@ONCRDAT
175 F X="AJCC","N","NDESCR","M","MDESCR","SS1977","SS2000","T","TDESCR" D
176 . S (ONCSTOR(X),ONCDISP(X))=""
177 Q:$D(INPUT)<10 $$ERROR^ONCSAPIE(-1)
178 ;
179 ;--- Get the server URL
180 S URL=$$GETCSURL^ONCSAPIU() Q:URL<0 URL
181 ;
182 ;--- Prepare the request parameters
183 S RC=$$PARAMS^ONCSAPIR("ONCSDAT","CS-CALCULATE",.INPUT)
184 Q:RC<0 RC
185 ;
186 S RC=0 D
187 . ;--- Call the web service
188 . D:$G(ONCSAPI("DEBUG"))
189 . . D ZW^ONCSAPIU("ONCSDAT","*** 'CALCULATE' REQUEST ***")
190 . S RC=$$REQUEST^ONCSAPIR(URL,ONCRDAT,"ONCSDAT") Q:RC<0
191 . D:$G(ONCSAPI("DEBUG"))
192 . . D ZW^ONCSAPIU(ONCRDAT,"*** 'CALCULATE' RESPONSE ***")
193 . ;--- Parse the results
194 . D SETCBK(.CBK),EN^MXMLPRSE(ONCRDAT,.CBK,"W")
195 . ;--- Check the CS error codes
196 . S:$G(ONCXML("RC"))<0 ONCSTAT("RC")=ONCXML("RC")
197 . D INVLDINP(.STATUS)
198 . ;--- Check for parsing and web-service errors
199 . S RC=$$CHKERR^ONCSAPIR(.ONCXML,$NA(ONCSTAT("MSG")))
200 ;
201 ;--- Cleanup
202 K ^TMP("ONCSAPI3",$J)
203 Q $S(RC<0:RC,$D(ONCSTAT("MSG"))>1:1,1:0)
204 ;
205 ;***** COMPILES A LIST OF SYMBOLIC ERROR CODES
206 ;
207 ; .STATUS Reference to a local variable where the list
208 ; of invalid input parameters is created.
209 ;
210INVLDINP(STATUS) ;
211 ;;01^ NONFAILMSG ^
212 ;;02^ EXTAJCCFAIL ^ CS Extension
213 ;;03^ NODESAJCCFAIL ^ CS Lymph Nodes
214 ;;04^ METSAJCCFAIL ^ CS Mets at DX
215 ;;05^ EXTEVALFAIL ^ Ext Eval
216 ;;06^ NODESEVALFAIL ^ Nodes Eval
217 ;;07^ METSEVALFAIL ^ Mets Eval
218 ;;08^ STAGEAJCCFAIL ^ Stage Group
219 ;;09^ EXT77FAIL ^ SEER 77 Ext
220 ;;10^ NODES77FAIL ^ SEER 77 Nodes
221 ;;11^ METS77FAIL ^ SEER 77 Mets
222 ;;12^ STAGE77FAIL ^ SEER Summary Stage 77
223 ;;13^ EXT2000FAIL ^ SEER 2000 Ext
224 ;;14^ NODES2000FAIL ^ SEER 2000 Nodes
225 ;;15^ METS2000FAIL ^ SEER 2000 Mets
226 ;;16^ STAGE2000FAIL ^ SEER Summary Stage 2000
227 ;;17^ SITEFAIL ^ Primary Site
228 ;;18^ HISTFAIL ^ Histology
229 ;
230 N ERR,IB,IN,NLST,TMP
231 S ERR=+$G(STATUS("ERROR")) Q:'ERR
232 S ERR=$REVERSE($$CNV^XLFUTL(ERR,2))
233 ;--- Analyze separate bits of the error code
234 F IB=1:1:18 D:$E(ERR,IB)
235 . S NLST=$TR($P($T(INVLDINP+IB),U,2)," ")
236 . F IN=1:1 S TMP=$P(NLST,",",IN) Q:TMP="" D
237 . . S STATUS("ERROR",TMP)=""
238 Q
239 ;
240 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
241SETCBK(CBK) ;
242 ;;CHARACTERS^TEXT^ONCSAPI3
243 ;
244 D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSAPI3")
245 Q
246 ;
247 ;***** TEXT CALLBACK FOR THE SAX PARSER
248 ;
249 ; TXT Line of unmarked text
250 ;
251TEXT(TXT) ;
252 N ELMT,L,SECT
253 ;--- Individual elements
254 S L=$L(ONCXML("PATH"),","),ELMT=$P(ONCXML("PATH"),",",L-1,L)
255 I ELMT="detail,MSG" D Q
256 . S ONCSTAT("MSG",$O(ONCSTAT("MSG"," "),-1)+1)=$TR(TXT,U,"~")
257 I ELMT="CS-RESPONSE,APIVER" D Q
258 . S ONCSTAT("APIVER")=$G(ONCSTAT("APIVER"))_TXT
259 I ELMT="CS-RESPONSE,VERSION" D Q
260 . S ONCSTAT("VERSION")=$G(ONCSTAT("VERSION"))_TXT
261 ;--- Sections
262 S SECT=$P(ONCXML("PATH"),",",L-1),ELMT=$P(ONCXML("PATH"),",",L)
263 I SECT="CS-DISP" D Q
264 . S ONCDISP(ELMT)=$G(ONCDISP(ELMT))_TXT
265 I SECT="CS-STOR" D Q
266 . S ONCSTOR(ELMT)=$G(ONCSTOR(ELMT))_TXT
267 I SECT="detail","ERROR"[ELMT D Q
268 . S ONCSTAT(ELMT)=$G(ONCSTAT(ELMT))_TXT
269 ;--- Default processing
270 D TEXT^ONCSAPIX(TXT)
271 Q
Note: See TracBrowser for help on using the repository browser.