| 1 | ONCSED01 ;Hines OIFO/SG - EDITS 'RUN BATCH' REQUEST ; 11/6/06 11:48am
 | 
|---|
| 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-RUN-BATCH [edits-config="..."] ver="2.0"
 | 
|---|
| 12 |  ;       xmlns="http://vista.med.va.gov/oncology">
 | 
|---|
| 13 |  ;       <NAACCR-RECORD> ... </NAACCR-RECORD>
 | 
|---|
| 14 |  ;     </ED-RUN-BATCH>
 | 
|---|
| 15 |  ;   </soap:Body >
 | 
|---|
| 16 |  ; </soap:Envelope>
 | 
|---|
| 17 |  ;
 | 
|---|
| 18 |  ;--- ATTRIBUTES
 | 
|---|
| 19 |  ;
 | 
|---|
| 20 |  ; edits-config  Name of the configuration that should be used by
 | 
|---|
| 21 |  ;               the server to validate the data.  By default,
 | 
|---|
| 22 |  ;               the "DEFAULT" name is used.
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  Q
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 |  ;***** EXECUTES THE 'RUN BATCH' EDITS REQUEST
 | 
|---|
| 27 |  ;
 | 
|---|
| 28 |  ; [.ONCSAPI]    Reference to the API descriptor (see ^ONCSAPI)
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 |  ; .ONC8REQ      Reference to a local variable that stores the
 | 
|---|
| 31 |  ;               closed root of the request.
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  ;               Sub-nodes of the variable are used internally
 | 
|---|
| 34 |  ;               (see ^ONCSNACR and ^ONCSAPIR for details).
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 |  ; [ONC8MSG]     Closed root of the buffer for error messages. By
 | 
|---|
| 37 |  ;               default ($G(ONC8MSG)=""), the ^TMP("ONCSED01M",$J)
 | 
|---|
| 38 |  ;               global node is used.
 | 
|---|
| 39 |  ;
 | 
|---|
| 40 |  ; @ONC8MSG@(
 | 
|---|
| 41 |  ;   0)                  Result descriptor
 | 
|---|
| 42 |  ;                         ^01: Number of errors
 | 
|---|
| 43 |  ;                         ^02: Number of warnings
 | 
|---|
| 44 |  ;                         ^03: Web-service version
 | 
|---|
| 45 |  ;                         ^04: Metafile version
 | 
|---|
| 46 |  ;   set#,
 | 
|---|
| 47 |  ;     0)                Edit set descriptor
 | 
|---|
| 48 |  ;                         ^01: Number of errors
 | 
|---|
| 49 |  ;                         ^02: Number of warnings
 | 
|---|
| 50 |  ;     1)                Edit set name
 | 
|---|
| 51 |  ;     "E",
 | 
|---|
| 52 |  ;       edit#,
 | 
|---|
| 53 |  ;         0)            Edit descriptor
 | 
|---|
| 54 |  ;                         ^01: Number of errors
 | 
|---|
| 55 |  ;                         ^02: Number of warnings
 | 
|---|
| 56 |  ;                         ^03: Edit index
 | 
|---|
| 57 |  ;         1)            Edit name
 | 
|---|
| 58 |  ;         "F",
 | 
|---|
| 59 |  ;           fld#,
 | 
|---|
| 60 |  ;             0)        Field descriptor
 | 
|---|
| 61 |  ;                         ^01: Start position
 | 
|---|
| 62 |  ;           1)          Field name
 | 
|---|
| 63 |  ;           2)          Field value
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 |  ;         "M",
 | 
|---|
| 66 |  ;           msg#,
 | 
|---|
| 67 |  ;             0)        Message descriptor
 | 
|---|
| 68 |  ;                         ^01: Code
 | 
|---|
| 69 |  ;                         ^02: Type
 | 
|---|
| 70 |  ;             1)        Message text
 | 
|---|
| 71 |  ;
 | 
|---|
| 72 |  ;   "ES",
 | 
|---|
| 73 |  ;     edit#)            set#
 | 
|---|
| 74 |  ;
 | 
|---|
| 75 |  ; The ^TMP("ONCSED01R",$J) and ^TMP("ONCSED01M",$J) global nodes
 | 
|---|
| 76 |  ; are used by this function.
 | 
|---|
| 77 |  ;
 | 
|---|
| 78 |  ; Return values:
 | 
|---|
| 79 |  ;
 | 
|---|
| 80 |  ;       <0  Error Descriptor (see ^ONCSAPI for details)
 | 
|---|
| 81 |  ;           For example:
 | 
|---|
| 82 |  ;             "-6^Parameter 'ONC8REQ' has an invalid value: ''^
 | 
|---|
| 83 |  ;              RBQEXEC+3^ONCSED01"
 | 
|---|
| 84 |  ;
 | 
|---|
| 85 |  ;        0  Ok
 | 
|---|
| 86 |  ;
 | 
|---|
| 87 |  ;        1  EDITS Warnings
 | 
|---|
| 88 |  ;
 | 
|---|
| 89 |  ;        2  EDITS Errors
 | 
|---|
| 90 |  ;
 | 
|---|
| 91 | RBQEXEC(ONCSAPI,ONC8REQ,ONC8MSG) ;
 | 
|---|
| 92 |  N ONC8RDAT,RC,TMP,URL,X
 | 
|---|
| 93 |  ;--- Validate parameters
 | 
|---|
| 94 |  Q:$G(ONC8REQ)?." " $$ERROR^ONCSAPIE(-6,,"ONC8REQ",$G(ONC8REQ))
 | 
|---|
| 95 |  S:$G(ONC8MSG)?." " ONC8MSG=$NA(^TMP("ONCSED01M",$J))
 | 
|---|
| 96 |  ;--- Initialize variables
 | 
|---|
| 97 |  S ONC8RDAT=$NA(^TMP("ONCSED01R",$J))
 | 
|---|
| 98 |  K @ONC8RDAT,@ONC8MSG
 | 
|---|
| 99 |  ;
 | 
|---|
| 100 |  ;--- Finish preparation of the NAACCR record
 | 
|---|
| 101 |  D END^ONCSNACR(.ONC8REQ)
 | 
|---|
| 102 |  ;
 | 
|---|
| 103 |  ;--- Complete the request
 | 
|---|
| 104 |  D TRAILER^ONCSAPIR(.ONC8REQ)
 | 
|---|
| 105 |  ;
 | 
|---|
| 106 |  ;--- Get the server URL
 | 
|---|
| 107 |  S URL=$$GETCSURL^ONCSAPIU()  Q:URL<0 URL
 | 
|---|
| 108 |  ;
 | 
|---|
| 109 |  S RC=0  D
 | 
|---|
| 110 |  . ;--- Call the web service
 | 
|---|
| 111 |  . D:$G(ONCSAPI("DEBUG"))
 | 
|---|
| 112 |  . . D ZW^ONCSAPIU(ONC8REQ,"*** 'RUN BATCH' REQUEST ***")
 | 
|---|
| 113 |  . S RC=$$REQUEST^ONCSAPIR(URL,ONC8RDAT,ONC8REQ)  Q:RC<0
 | 
|---|
| 114 |  . D:$G(ONCSAPI("DEBUG"))
 | 
|---|
| 115 |  . . D ZW^ONCSAPIU(ONC8RDAT,"*** 'RUN BATCH' RESPONSE ***")
 | 
|---|
| 116 |  . ;--- Parse the response
 | 
|---|
| 117 |  . S RC=$$PARSE^ONCSED02(.ONCSAPI,ONC8RDAT,ONC8MSG)
 | 
|---|
| 118 |  ;
 | 
|---|
| 119 |  ;--- Cleanup
 | 
|---|
| 120 |  K ^TMP("ONCSED01R",$J)
 | 
|---|
| 121 |  D:RC'<0
 | 
|---|
| 122 |  . S TMP=$G(@ONC8MSG@(0))
 | 
|---|
| 123 |  . S RC=$S($P(TMP,U,1)>0:2,$P(TMP,U,2)>0:1,1:0)
 | 
|---|
| 124 |  Q RC
 | 
|---|
| 125 |  ;
 | 
|---|
| 126 |  ;***** STARTS PREPARATION OF THE 'RUN BATCH' EDITS REQUEST
 | 
|---|
| 127 |  ;
 | 
|---|
| 128 |  ; [.ONCSAPI]    Reference to the API descriptor (see ^ONCSAPI)
 | 
|---|
| 129 |  ;
 | 
|---|
| 130 |  ; .ONC8REQ      Reference to a local variable that stores the
 | 
|---|
| 131 |  ;               closed root of the buffer for the request.
 | 
|---|
| 132 |  ;
 | 
|---|
| 133 |  ;               Sub-nodes of the variable are used internally
 | 
|---|
| 134 |  ;               (see ^ONCSNACR and ^ONCSAPIR for details).
 | 
|---|
| 135 |  ;
 | 
|---|
| 136 |  ; [CFGNAME]     Name of the configuration that should be used by
 | 
|---|
| 137 |  ;               the server to validate the data.  By default,
 | 
|---|
| 138 |  ;               the default configuration is used.
 | 
|---|
| 139 |  ;
 | 
|---|
| 140 |  ; Return values:
 | 
|---|
| 141 |  ;
 | 
|---|
| 142 |  ;       <0  Error Descriptor (see ^ONCSAPI for details)
 | 
|---|
| 143 |  ;           For example:
 | 
|---|
| 144 |  ;             "-6^Parameter 'ONC8REQ' has an invalid value: ''^
 | 
|---|
| 145 |  ;              RBQPREP+3^ONCSED01"
 | 
|---|
| 146 |  ;
 | 
|---|
| 147 |  ;        0  Ok
 | 
|---|
| 148 |  ;
 | 
|---|
| 149 | RBQPREP(ONCSAPI,ONC8REQ,CFGNAME) ;
 | 
|---|
| 150 |  N ATTS
 | 
|---|
| 151 |  D CLEAR^ONCSAPIE()
 | 
|---|
| 152 |  ;--- Validate parameters
 | 
|---|
| 153 |  Q:$G(ONC8REQ)?." " $$ERROR^ONCSAPIE(-6,,"ONC8REQ",$G(ONC8REQ))
 | 
|---|
| 154 |  ;
 | 
|---|
| 155 |  ;--- Standard request header
 | 
|---|
| 156 |  S:'($G(CFGNAME)?." ") ATTS("edits-config")=CFGNAME
 | 
|---|
| 157 |  D HEADER^ONCSAPIR(.ONC8REQ,"ED-RUN-BATCH",.ATTS)
 | 
|---|
| 158 |  ;
 | 
|---|
| 159 |  ;--- Start preparation of the NAACCR record
 | 
|---|
| 160 |  D BEGIN^ONCSNACR(.ONC8REQ)
 | 
|---|
| 161 |  ;---
 | 
|---|
| 162 |  Q 0
 | 
|---|
| 163 |  ;
 | 
|---|
| 164 |  ;***** PRINTS 'EDITS' REPORT ON THE CURRENT DEVICE
 | 
|---|
| 165 |  ;
 | 
|---|
| 166 |  ; [.ONCSAPI]    Reference to the API descriptor (see ^ONCSAPI)
 | 
|---|
| 167 |  ;
 | 
|---|
| 168 |  ; ONC8MSG       Closed root of the list of parsed error messages
 | 
|---|
| 169 |  ;               (generated by the RBQEXEC^ONCSED0101)
 | 
|---|
| 170 |  ;
 | 
|---|
| 171 |  ; [FLAGS]       Flags that control the output (can be combined):
 | 
|---|
| 172 |  ;                 M  Include messages
 | 
|---|
| 173 |  ;                 T  Include totals
 | 
|---|
| 174 |  ;
 | 
|---|
| 175 |  ; Return values:
 | 
|---|
| 176 |  ;
 | 
|---|
| 177 |  ;       <0  Error Descriptor (see ^ONCSAPI for details)
 | 
|---|
| 178 |  ;           For example:
 | 
|---|
| 179 |  ;             "-6^Parameter 'ONC8REQ' has an invalid value: ''^
 | 
|---|
| 180 |  ;              RBQEXEC+3^ONCSED01"
 | 
|---|
| 181 |  ;
 | 
|---|
| 182 |  ;        0  Ok
 | 
|---|
| 183 |  ;
 | 
|---|
| 184 |  ;        1  Timeout
 | 
|---|
| 185 |  ;        2  User canceled the output ('^' was entered) 
 | 
|---|
| 186 |  ;
 | 
|---|
| 187 | REPORT(ONCSAPI,ONC8MSG,FLAGS) ;
 | 
|---|
| 188 |  N RC,TMP
 | 
|---|
| 189 |  S TMP=$G(@ONC8MSG@(0))
 | 
|---|
| 190 |  Q:($P(TMP,U,1)'>0)&($P(TMP,U,2)'>0) 0
 | 
|---|
| 191 |  S FLAGS=$G(FLAGS)
 | 
|---|
| 192 |  I $TR(FLAGS,"MT")'=FLAGS  W:$E(IOST,1,2)="C-" @IOF
 | 
|---|
| 193 |  ;--- EDITS messages
 | 
|---|
| 194 |  I FLAGS["M"  D  Q:RC RC
 | 
|---|
| 195 |  . S RC=$$MESSAGES^ONCSED03(.ONCSAPI,ONC8MSG,FLAGS)
 | 
|---|
| 196 |  ;--- EDITS totals
 | 
|---|
| 197 |  I FLAGS["T"  D  Q:RC RC
 | 
|---|
| 198 |  . S RC=$$TOTALS^ONCSED03(.ONCSAPI,ONC8MSG,FLAGS)
 | 
|---|
| 199 |  ;---
 | 
|---|
| 200 |  Q 0
 | 
|---|