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