Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ONCSAPI3

ONCSAPI3.m

Go to the documentation of this file.
  1. ONCSAPI3 ;Hines OIFO/SG - COLLABORATIVE STAGING (CALCULATE) ;06/23/10
  1. ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
  1. ;
  1. ;--- SOAP REQUST TO THE COLLABORATIVE STAGING WEB SERVICE
  1. ;
  1. ; <?xml version="1.0" encoding="utf-8"?>
  1. ; <soap:Envelope
  1. ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
  1. ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  1. ; <soap:Body>
  1. ; <CS-CALCULATE xmlns="http://vista.domain.ext/oncology">
  1. ; <HIST> ... </HIST>
  1. ; <SITE> ... </SITE>
  1. ; <DIAGNOSIS_YEAR> ... </DIAGNOSIS_YEAR>
  1. ; <CSVER_ORIGINAL> ... </CSVER_ORIGINAL>
  1. ; <BEHAV> ... </BEHAV>
  1. ; <GRADE> ... </GRADE>
  1. ; <AGE> ... </AGE>
  1. ; <LVI> ... </LVI>
  1. ; <SIZE> ... </SIZE>
  1. ; <EXT> ... </EXT>
  1. ; <EXTEVAL> ... </EXTEVAL>
  1. ; <NODES> ... </NODES>
  1. ; <NODESEVAL> ... </NODESEVAL>
  1. ; <LNPOS> ... </LNPOS>
  1. ; <LNEXAM> ... </LNEXAM>
  1. ; <METS> ... </METS>
  1. ; <METSEVAL> ... </METSEVAL>
  1. ; <SSF1> ... </SSF1>
  1. ; <SSF2> ... </SSF2>
  1. ; <SSF3> ... </SSF3>
  1. ; <SSF4> ... </SSF4>
  1. ; <SSF5> ... </SSF5>
  1. ; <SSF6> ... </SSF6>
  1. ; <SSF7> ... </SSF7>
  1. ; <SSF8> ... </SSF8>
  1. ; <SSF9> ... </SSF9>
  1. ; <SSF10> ... </SSF10>
  1. ; <SSF11> ... </SSF11>
  1. ; <SSF12> ... </SSF12>
  1. ; <SSF13> ... </SSF13>
  1. ; <SSF14> ... </SSF14>
  1. ; <SSF15> ... </SSF15>
  1. ; <SSF16> ... </SSF16>
  1. ; <SSF17> ... </SSF17>
  1. ; <SSF18> ... </SSF18>
  1. ; <SSF19> ... </SSF19>
  1. ; <SSF20> ... </SSF20>
  1. ; <SSF21> ... </SSF21>
  1. ; <SSF22> ... </SSF22>
  1. ; <SSF23> ... </SSF23>
  1. ; <SSF24> ... </SSF24>
  1. ; <SSF25> ... </SSF25>
  1. ; </CS-CALCULATE>
  1. ; </soap:Body >
  1. ; </soap:Envelope>
  1. ;
  1. ;--- SOAP RESPONSE FROM THE COLLABORATIVE STAGING WEB SERVICE
  1. ;
  1. ; <?xml version="1.0" encoding="utf-8"?>
  1. ; <soap:Envelope
  1. ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
  1. ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  1. ; <soap:Body>
  1. ; <CS-RESPONSE xmlns="http://vista.domain.ext/oncology">
  1. ; <CS-STOR>
  1. ; <T> ... </T>
  1. ; <TDESCR> ... </TDESCR>
  1. ; <N> ... </N>
  1. ; <NDESCR> ... </NDESCR>
  1. ; <M> ... </M>
  1. ; <MDESCR> ... </MDESCR>
  1. ; <AJCC> ... </AJCC>
  1. ; <AJCC7-T> ... </AJCC7-T>
  1. ; <AJCC7-TDESCR> ... </AJCC7-TDESCR>
  1. ; <AJCC7-N> ... </AJCC7-N>
  1. ; <AJCC7-NDESCR> ... </AJCC7-NDESCR>
  1. ; <AJCC7-M> ... </AJCC7-M>
  1. ; <AJCC7-MDESCR> ... </AJCC7-MDESCR>
  1. ; <AJCC7-STAGE> ... </AJCC7-STAGE>
  1. ; <SS1977> ... </SS1977>
  1. ; <SS2000> ... </SS2000>
  1. ; </CS-STOR>
  1. ; <CS-DISP>
  1. ; <T> ... </T>
  1. ; <TDESCR> ... </TDESCR>
  1. ; <N> ... </N>
  1. ; <NDESCR> ... </NDESCR>
  1. ; <M> ... </M>
  1. ; <MDESCR> ... </MDESCR>
  1. ; <AJCC> ... </AJCC>
  1. ; <AJCC7-T> ... </AJCC7-T>
  1. ; <AJCC7-TDESCR> ... </AJCC7-TDESCR>
  1. ; <AJCC7-N> ... </AJCC7-N>
  1. ; <AJCC7-NDESCR> ... </AJCC7-NDESCR>
  1. ; <AJCC7-M> ... </AJCC7-M>
  1. ; <AJCC7-MDESCR> ... </AJCC7-MDESCR>
  1. ; <AJCC7-STAGE> ... </AJCC7-STAGE>
  1. ; <SS1977> ... </SS1977>
  1. ; <SS2000> ... </SS2000>
  1. ; </CS-DISP>
  1. ; <APIVER> ... </APIVER>
  1. ; <VERSION> ... </VERSION>
  1. ; </CS-RESPONSE>
  1. ; <soap:Fault>
  1. ; <faultcode> ... </faultcode>
  1. ; <faultstring> ... </faultstring>
  1. ; <detail>
  1. ; <ERROR> ... </ERROR>
  1. ; <MSG>
  1. ; ...
  1. ; </MSG>
  1. ; <RC> ... </RC>
  1. ; </detail>
  1. ; </soap:Fault>
  1. ; </soap:Body >
  1. ; </soap:Envelope>
  1. ;
  1. Q
  1. ;
  1. ;***** CALLS THE COLLABORATIVE STAGING WEB SERVICE
  1. ;
  1. ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
  1. ;
  1. ; .INPUT( Reference to a local variable containing
  1. ; input parameters.
  1. ;
  1. ; "AGE") Age at Diagnosis
  1. ; "BEHAV") Behavior Code ICD-O-3
  1. ; "CSVER_ORIGINAL") CS Version Original
  1. ; "DIAGNOSIS_YEAR") Year of Diagnosis
  1. ; "EXT") CS Extension
  1. ; "EXTEVAL") CS Size/Ext Eval
  1. ; "GRADE") Grade
  1. ; "HIST") Histologic Type ICD-O-3
  1. ; "LNPOS") Regional Nodes Positive
  1. ; "LNEXAM") Regional Nodes Examined
  1. ; "LVI") Lymph-vascular invasion
  1. ; "METS") CS Mets at DX
  1. ; "METSEVAL") CS Mets Eval
  1. ; "NODES") CS Lymph Nodes
  1. ; "NODESEVAL") CS Reg Nodes Eval
  1. ; "SITE") Primary site
  1. ; "SIZE") CS Tumor Size
  1. ; "SSF1") CS Site-Specific Factor 1
  1. ; "SSF2") CS Site-Specific Factor 2
  1. ; "SSF3") CS Site-Specific Factor 3
  1. ; "SSF4") CS Site-Specific Factor 4
  1. ; "SSF5") CS Site-Specific Factor 5
  1. ; "SSF6") CS Site-Specific Factor 6
  1. ; "SSF7") CS Site-Specific Factor 7
  1. ; "SSF8") CS Site-Specific Factor 8
  1. ; "SSF9") CS Site-Specific Factor 9
  1. ; "SSF10") CS Site-Specific Factor 10
  1. ; "SSF11") CS Site-Specific Factor 11
  1. ; "SSF12") CS Site-Specific Factor 12
  1. ; "SSF13") CS Site-Specific Factor 13
  1. ; "SSF14") CS Site-Specific Factor 14
  1. ; "SSF15") CS Site-Specific Factor 15
  1. ; "SSF16") CS Site-Specific Factor 16
  1. ; "SSF17") CS Site-Specific Factor 17
  1. ; "SSF18") CS Site-Specific Factor 18
  1. ; "SSF19") CS Site-Specific Factor 19
  1. ; "SSF20") CS Site-Specific Factor 20
  1. ; "SSF21") CS Site-Specific Factor 21
  1. ; "SSF22") CS Site-Specific Factor 22
  1. ; "SSF23") CS Site-Specific Factor 23
  1. ; "SSF24") CS Site-Specific Factor 24
  1. ; "SSF25") CS Site-Specific Factor 25
  1. ;
  1. ; .ONCSTOR( Reference to a local variable where output
  1. ; storage values are returned.
  1. ;
  1. ; "AJCC-6") 6th Edition Derived AJCC Stage Group
  1. ; "N-6") 6th Edition Derived AJCC N
  1. ; "NDESCR-6") 6th Edition Derived AJCC N Descriptor
  1. ; "M-6") 6th Edition Derived AJCC M
  1. ; "MDESCR-6") 6th Edition Derived AJCC M Descriptor
  1. ; "AJCC-7") 7th Edition Derived AJCC Stage Group
  1. ; "N-7") 7th Edition Derived AJCC N
  1. ; "NDESCR-7") 7th Edition Derived AJCC N Descriptor
  1. ; "M-7") 7th Edition Derived AJCC M
  1. ; "MDESCR-7") 7th Edition Derived AJCC M Descriptor
  1. ; "SS1977") Derived SS1977
  1. ; "SS2000") Derived SS2000
  1. ; "T-6") 6th Edition Derived AJCC T
  1. ; "TDESCR-6") 6th Edition Derived AJCC T Descriptor
  1. ; "T-7") 7th Edition Derived AJCC T
  1. ; "TDESCR-7") 7th Edition Derived AJCC T Descriptor
  1. ;
  1. ; .ONCDISP( Reference to a local variable where output
  1. ; display values are returned.
  1. ;
  1. ; "AJCC-6") 6th Edition Derived AJCC Stage Group
  1. ; "N-6") 6th Edition Derived AJCC N
  1. ; "NDESCR-6") 6th Edition Derived AJCC N Descriptor
  1. ; "M-6") 6th Edition Derived AJCC M
  1. ; "MDESCR-6") 6th Edition Derived AJCC M Descriptor
  1. ; "AJCC-7") 7th Edition Derived AJCC Stage Group
  1. ; "N-7") 7th Edition Derived AJCC N
  1. ; "NDESCR-7") 7th Edition Derived AJCC N Descriptor
  1. ; "M-7") 7th Edition Derived AJCC M
  1. ; "MDESCR-7") 7th Edition Derived AJCC M Descriptor
  1. ; "SS1977") Derived SS1977
  1. ; "SS2000") Derived SS2000
  1. ; "T-6") 6th Edition Derived AJCC T
  1. ; "TDESCR-6") 6th Edition Derived AJCC T Descriptor
  1. ; "T-7") 7th Edition Derived AJCC T
  1. ; "TDESCR-7") 7th Edition Derived AJCC T Descriptor
  1. ;
  1. ; .ONCSTAT( Reference to a local variable where status
  1. ; values are returned.
  1. ;
  1. ; "APIVER") Version of the CS API
  1. ;
  1. ; "ERROR", Error Code
  1. ; Name) Symbolic names of error bits (see
  1. ; the INVLDINP^ONCSAPI3 for details)
  1. ;
  1. ; "MSG",
  1. ; i) Error message returned by the CStage_calculate
  1. ;
  1. ; "RC") Error code returned by the CS web-service
  1. ;
  1. ; "VERSION") Version of the service
  1. ;
  1. ; The ^TMP("ONCSAPI3",$J) global node is used by this function.
  1. ;
  1. ; Note: Patch XT*7.3*67 (VistA XML Parser)) is required for this
  1. ; API to work.
  1. ;
  1. ; Return values:
  1. ;
  1. ; <0 Error Descriptor (see ^ONCSAPI for details)
  1. ; For example:
  1. ; "-1^Missing input parameters^CALC+4^ONCSAPI"
  1. ;
  1. ; 0 Ok
  1. ;
  1. ; 1 Probably Ok (warnings)
  1. ;
  1. CALC(ONCSAPI,INPUT,ONCSTOR,ONCDISP,ONCSTAT) ;
  1. N ONCCBK,ONCRDAT,ONCSDAT,ONCXML,RC,TMP,URL,X
  1. D CLEAR^ONCSAPIE()
  1. S ONCRDAT=$NA(^TMP("ONCSAPI3",$J))
  1. K ONCDISP,ONCSTAT,ONCSTOR,@ONCRDAT
  1. 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
  1. . S (ONCSTOR(X),ONCDISP(X))=""
  1. Q:$D(INPUT)<10 $$ERROR^ONCSAPIE(-1)
  1. ;
  1. ;--- Get the server URL
  1. S URL=$$GETCSURL^ONCSAPIU() Q:URL<0 URL
  1. ;
  1. ;--- Prepare the request parameters
  1. S RC=$$PARAMS^ONCSAPIR("ONCSDAT","CS-CALCULATE",.INPUT)
  1. Q:RC<0 RC
  1. ;
  1. S RC=0 D
  1. . ;--- Call the web service
  1. . D:$G(ONCSAPI("DEBUG"))
  1. . . D ZW^ONCSAPIU("ONCSDAT","*** 'CALCULATE' REQUEST ***")
  1. . S RC=$$REQUEST^ONCSAPIR(URL,ONCRDAT,"ONCSDAT") Q:RC<0
  1. . D:$G(ONCSAPI("DEBUG"))
  1. . . D ZW^ONCSAPIU(ONCRDAT,"*** 'CALCULATE' RESPONSE ***")
  1. . ;--- Parse the results
  1. . D SETCBK(.ONCCBK),EN^MXMLPRSE(ONCRDAT,.ONCCBK,"W")
  1. . ;--- Check the CS error codes
  1. . S:$G(ONCXML("RC"))<0 ONCSTAT("RC")=ONCXML("RC")
  1. . D INVLDINP(.STATUS)
  1. . ;--- Check for parsing and web-service errors
  1. . S RC=$$CHKERR^ONCSAPIR(.ONCXML,$NA(ONCSTAT("MSG")))
  1. ;
  1. ;--- Cleanup
  1. K ^TMP("ONCSAPI3",$J)
  1. Q $S(RC<0:RC,$D(ONCSTAT("MSG"))>1:1,1:0)
  1. ;
  1. ;***** COMPILES A LIST OF SYMBOLIC ERROR CODES
  1. ;
  1. ; .STATUS Reference to a local variable where the list
  1. ; of invalid input parameters is created.
  1. ;
  1. INVLDINP(STATUS) ;
  1. ;;01^ NONFAILMSG ^
  1. ;;02^ EXTAJCCFAIL ^ CS Extension
  1. ;;03^ NODESAJCCFAIL ^ CS Lymph Nodes
  1. ;;04^ METSAJCCFAIL ^ CS Mets at DX
  1. ;;05^ EXTEVALFAIL ^ Ext Eval
  1. ;;06^ NODESEVALFAIL ^ Nodes Eval
  1. ;;07^ METSEVALFAIL ^ Mets Eval
  1. ;;08^ STAGEAJCCFAIL ^ Stage Group
  1. ;;09^ EXT77FAIL ^ SEER 77 Ext
  1. ;;10^ NODES77FAIL ^ SEER 77 Nodes
  1. ;;11^ METS77FAIL ^ SEER 77 Mets
  1. ;;12^ STAGE77FAIL ^ SEER Summary Stage 77
  1. ;;13^ EXT2000FAIL ^ SEER 2000 Ext
  1. ;;14^ NODES2000FAIL ^ SEER 2000 Nodes
  1. ;;15^ METS2000FAIL ^ SEER 2000 Mets
  1. ;;16^ STAGE2000FAIL ^ SEER Summary Stage 2000
  1. ;;17^ SITEFAIL ^ Primary Site
  1. ;;18^ HISTFAIL ^ Histology
  1. ;
  1. N ERR,IB,IN,NLST,TMP
  1. S ERR=+$G(STATUS("ERROR")) Q:'ERR
  1. S ERR=$REVERSE($$CNV^XLFUTL(ERR,2))
  1. ;--- Analyze separate bits of the error code
  1. F IB=1:1:18 D:$E(ERR,IB)
  1. . S NLST=$TR($P($T(INVLDINP+IB),U,2)," ")
  1. . F IN=1:1 S TMP=$P(NLST,",",IN) Q:TMP="" D
  1. . . S STATUS("ERROR",TMP)=""
  1. Q
  1. ;
  1. ;***** SETS THE EVENT INTERFACE ENTRY POINTS
  1. SETCBK(ONCCBK) ;
  1. ;;CHARACTERS^TEXT^ONCSAPI3
  1. ;
  1. D SETCBK^ONCSAPIX(.ONCCBK,"SETCBK^ONCSAPI3")
  1. Q
  1. ;
  1. ;***** TEXT CALLBACK FOR THE SAX PARSER
  1. ;
  1. ; TXT Line of unmarked text
  1. ;
  1. TEXT(TXT) ;
  1. N ELMT,L,SECT
  1. ;--- Individual elements
  1. S L=$L(ONCXML("PATH"),","),ELMT=$P(ONCXML("PATH"),",",L-1,L)
  1. I ELMT="detail,MSG" D Q
  1. . S ONCSTAT("MSG",$O(ONCSTAT("MSG"," "),-1)+1)=$TR(TXT,U,"~")
  1. I ELMT="CS-RESPONSE,APIVER" D Q
  1. . S ONCSTAT("APIVER")=$G(ONCSTAT("APIVER"))_TXT
  1. I ELMT="CS-RESPONSE,VERSION" D Q
  1. . S ONCSTAT("VERSION")=$G(ONCSTAT("VERSION"))_TXT
  1. ;--- Sections
  1. S SECT=$P(ONCXML("PATH"),",",L-1),ELMT=$P(ONCXML("PATH"),",",L)
  1. I SECT="CS-DISP" D Q
  1. . S ONCDISP(ELMT)=$G(ONCDISP(ELMT))_TXT
  1. I SECT="CS-STOR" D Q
  1. . S ONCSTOR(ELMT)=$G(ONCSTOR(ELMT))_TXT
  1. I SECT="detail","ERROR"[ELMT D Q
  1. . S ONCSTAT(ELMT)=$G(ONCSTAT(ELMT))_TXT
  1. ;--- Default processing
  1. D TEXT^ONCSAPIX(TXT)
  1. Q