ONCSED02 ;Hines OIFO/SG - EDITS 'RUN BATCH' (PARSER) ; 8/16/06 1:07pm
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;--- SOAP RESPONSE FROM THE ONCOLOGY 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>
; <ED-RESPONSE xmlns="http://vista.domain.ext/oncology">
; <EDIT-SET NAME="..." ECNT="...">
; <EDIT INDEX="..." NAME="..." ECNT="..." WCNT="...">
; <FLD NAME="..." POS="..."> ... </FLD>
; ...
; <MSG CODE="..." TYPE="..."> ... </MSG>
; ...
; </EDIT>
; </EDIT-SET>
; <METAVER> ... </METAVER>
; <VERSION> ... </VERSION>
; </ED-RESPONSE>
; <soap:Fault>
; <faultcode> ... </faultcode>
; <faultstring> ... </faultstring>
; <detail>
; <RC> ... </RC>
; </detail>
; </soap:Fault>
; </soap:Body >
; </soap:Envelope>
;
;--- ATTRIBUTES
;
; TYPE E - Error, W - Warning, M - Message
;
Q
;
;***** END ELEMENT CALLBACK FOR THE SAX PARSER
;
; ELMT Name of the element
;
ENDEL(ELMT) ;
N L,LAST2
S L=$L(ONCXML("PATH"),","),LAST2=$P(ONCXML("PATH"),",",L-1,L)
D ENDEL^ONCSAPIX(ELMT)
;---
I LAST2="EDIT,FLD" D Q
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,2)=$G(ONCXML("TEXT"))
;---
I LAST2="EDIT,MSG" D Q
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,"M",ONCMIEN,1)=$G(ONCXML("TEXT"))
;---
I LAST2="ED-RESPONSE,METAVER" D Q
. S $P(@ONCXML@(0),U,4)=$G(ONCXML("TEXT"))
;---
I LAST2="ED-RESPONSE,VERSION" D Q
. S $P(@ONCXML@(0),U,3)=$G(ONCXML("TEXT"))
Q
;
;***** PARSES THE RESPONSE FROM THE EDITS API
;
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
;
; ONC8RDAT Closed root of the XML response
;
; ONCXML Closed root of the output buffer.
;
PARSE(ONCSAPI,ONC8RDAT,ONCXML) ;
N ONCEDIEN ; Current edit IEN
N ONCESIEN ; Current edit set IEN
N ONCFIEN ; Current field IEN
N ONCMIEN ; Current message IEN
;
N CBK,EDIEN,ESIEN,ESTOTALS,I,RC,TMP,TOTALS
D SETCBK(.CBK),EN^MXMLPRSE(ONC8RDAT,.CBK,"W")
D:$G(ONCSAPI("DEBUG"))
. D ZW^ONCSAPIU(ONCXML,"*** PARSED 'RUN BATCH' RESPONSE ***")
;--- Calculate the totals
S ESIEN=0
F S ESIEN=$O(@ONCXML@(ESIEN)) Q:ESIEN'>0 D
. S EDIEN=0 K ESTOTALS
. F S EDIEN=$O(@ONCXML@(ESIEN,"E",EDIEN)) Q:EDIEN'>0 D
. . S TMP=$G(@ONCXML@(ESIEN,"E",EDIEN,0))
. . F I=1,2 S ESTOTALS(I)=$G(ESTOTALS(I))+$P(TMP,U,I)
. F I=1,2 S TOTALS(I)=$G(TOTALS(I))+$G(ESTOTALS(I))
. S $P(@ONCXML@(ESIEN,0),U,1,2)=$G(ESTOTALS(1),0)_U_$G(ESTOTALS(2),0)
S $P(@ONCXML@(0),U,1,2)=$G(TOTALS(1),0)_U_$G(TOTALS(2),0)
;--- Check for parsing and web-service errors
Q $$CHKERR^ONCSAPIR(.ONCXML)
;
;***** SETS THE EVENT INTERFACE ENTRY POINTS
SETCBK(CBK) ;
;;CHARACTERS ^ TEXT^ONCSED02
;;ENDELEMENT ^ ENDEL^ONCSED02
;;STARTELEMENT^STARTEL^ONCSED02
;
D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSED02")
Q
;
;***** START ELEMENT CALLBACK FOR THE SAX PARSER
;
; ELMT Name of the element
;
; .ATTR List of attributes and their values
;
STARTEL(ELMT,ATTR) ;
N L,LAST2,TMP
D STARTEL^ONCSAPIX(ELMT,.ATTR)
S L=$L(ONCXML("PATH"),","),LAST2=$P(ONCXML("PATH"),",",L-1,L)
;--- Field
I LAST2="EDIT,FLD" D Q
. S ONCFIEN=$G(ONCFIEN)+1
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,0)=$G(ATTR("POS"))
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,1)=$G(ATTR("NAME"))
;--- Message
I LAST2="EDIT,MSG" D Q
. S ONCMIEN=$G(ONCMIEN)+1
. S TMP=$G(ATTR("CODE"))_U_$G(ATTR("TYPE"))
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,"M",ONCMIEN,0)=TMP
;--- Edit
I LAST2="EDIT-SET,EDIT" D Q
. S ONCEDIEN=$G(ONCEDIEN)+1,(ONCFIEN,ONCMIEN)=0
. S TMP=$G(ATTR("ECNT"))_U_$G(ATTR("WCNT"))_U_$G(ATTR("INDEX"))
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,0)=TMP
. S @ONCXML@(ONCESIEN,"E",ONCEDIEN,1)=$G(ATTR("NAME"))
. S @ONCXML@("ES",ONCEDIEN)=ONCESIEN
;--- Edit Set
I LAST2="ED-RESPONSE,EDIT-SET" D Q
. S ONCESIEN=$G(ONCESIEN)+1
. S @ONCXML@(ONCESIEN,0)=$G(ATTR("ECNT"))_U_$G(ATTR("WCNT"))
. S @ONCXML@(ONCESIEN,1)=$G(ATTR("NAME"))
Q
;
;***** TEXT CALLBACK FOR THE SAX PARSER
;
; TXT Line of unmarked text
;
TEXT(TXT) ;
S ONCXML("TEXT")=$G(ONCXML("TEXT"))_TXT
;--- Default processing
D TEXT^ONCSAPIX(TXT)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSED02 4498 printed Nov 22, 2024@17:38:16 Page 2
ONCSED02 ;Hines OIFO/SG - EDITS 'RUN BATCH' (PARSER) ; 8/16/06 1:07pm
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;--- SOAP RESPONSE FROM THE ONCOLOGY 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 ; <ED-RESPONSE xmlns="http://vista.domain.ext/oncology">
+11 ; <EDIT-SET NAME="..." ECNT="...">
+12 ; <EDIT INDEX="..." NAME="..." ECNT="..." WCNT="...">
+13 ; <FLD NAME="..." POS="..."> ... </FLD>
+14 ; ...
+15 ; <MSG CODE="..." TYPE="..."> ... </MSG>
+16 ; ...
+17 ; </EDIT>
+18 ; </EDIT-SET>
+19 ; <METAVER> ... </METAVER>
+20 ; <VERSION> ... </VERSION>
+21 ; </ED-RESPONSE>
+22 ; <soap:Fault>
+23 ; <faultcode> ... </faultcode>
+24 ; <faultstring> ... </faultstring>
+25 ; <detail>
+26 ; <RC> ... </RC>
+27 ; </detail>
+28 ; </soap:Fault>
+29 ; </soap:Body >
+30 ; </soap:Envelope>
+31 ;
+32 ;--- ATTRIBUTES
+33 ;
+34 ; TYPE E - Error, W - Warning, M - Message
+35 ;
+36 QUIT
+37 ;
+38 ;***** END ELEMENT CALLBACK FOR THE SAX PARSER
+39 ;
+40 ; ELMT Name of the element
+41 ;
ENDEL(ELMT) ;
+1 NEW L,LAST2
+2 SET L=$LENGTH(ONCXML("PATH"),",")
SET LAST2=$PIECE(ONCXML("PATH"),",",L-1,L)
+3 DO ENDEL^ONCSAPIX(ELMT)
+4 ;---
+5 IF LAST2="EDIT,FLD"
Begin DoDot:1
+6 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,2)=$GET(ONCXML("TEXT"))
End DoDot:1
QUIT
+7 ;---
+8 IF LAST2="EDIT,MSG"
Begin DoDot:1
+9 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,"M",ONCMIEN,1)=$GET(ONCXML("TEXT"))
End DoDot:1
QUIT
+10 ;---
+11 IF LAST2="ED-RESPONSE,METAVER"
Begin DoDot:1
+12 SET $PIECE(@ONCXML@(0),U,4)=$GET(ONCXML("TEXT"))
End DoDot:1
QUIT
+13 ;---
+14 IF LAST2="ED-RESPONSE,VERSION"
Begin DoDot:1
+15 SET $PIECE(@ONCXML@(0),U,3)=$GET(ONCXML("TEXT"))
End DoDot:1
QUIT
+16 QUIT
+17 ;
+18 ;***** PARSES THE RESPONSE FROM THE EDITS API
+19 ;
+20 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
+21 ;
+22 ; ONC8RDAT Closed root of the XML response
+23 ;
+24 ; ONCXML Closed root of the output buffer.
+25 ;
PARSE(ONCSAPI,ONC8RDAT,ONCXML) ;
+1 ; Current edit IEN
NEW ONCEDIEN
+2 ; Current edit set IEN
NEW ONCESIEN
+3 ; Current field IEN
NEW ONCFIEN
+4 ; Current message IEN
NEW ONCMIEN
+5 ;
+6 NEW CBK,EDIEN,ESIEN,ESTOTALS,I,RC,TMP,TOTALS
+7 DO SETCBK(.CBK)
DO EN^MXMLPRSE(ONC8RDAT,.CBK,"W")
+8 if $GET(ONCSAPI("DEBUG"))
Begin DoDot:1
+9 DO ZW^ONCSAPIU(ONCXML,"*** PARSED 'RUN BATCH' RESPONSE ***")
End DoDot:1
+10 ;--- Calculate the totals
+11 SET ESIEN=0
+12 FOR
SET ESIEN=$ORDER(@ONCXML@(ESIEN))
if ESIEN'>0
QUIT
Begin DoDot:1
+13 SET EDIEN=0
KILL ESTOTALS
+14 FOR
SET EDIEN=$ORDER(@ONCXML@(ESIEN,"E",EDIEN))
if EDIEN'>0
QUIT
Begin DoDot:2
+15 SET TMP=$GET(@ONCXML@(ESIEN,"E",EDIEN,0))
+16 FOR I=1,2
SET ESTOTALS(I)=$GET(ESTOTALS(I))+$PIECE(TMP,U,I)
End DoDot:2
+17 FOR I=1,2
SET TOTALS(I)=$GET(TOTALS(I))+$GET(ESTOTALS(I))
+18 SET $PIECE(@ONCXML@(ESIEN,0),U,1,2)=$GET(ESTOTALS(1),0)_U_$GET(ESTOTALS(2),0)
End DoDot:1
+19 SET $PIECE(@ONCXML@(0),U,1,2)=$GET(TOTALS(1),0)_U_$GET(TOTALS(2),0)
+20 ;--- Check for parsing and web-service errors
+21 QUIT $$CHKERR^ONCSAPIR(.ONCXML)
+22 ;
+23 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
SETCBK(CBK) ;
+1 ;;CHARACTERS ^ TEXT^ONCSED02
+2 ;;ENDELEMENT ^ ENDEL^ONCSED02
+3 ;;STARTELEMENT^STARTEL^ONCSED02
+4 ;
+5 DO SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSED02")
+6 QUIT
+7 ;
+8 ;***** START ELEMENT CALLBACK FOR THE SAX PARSER
+9 ;
+10 ; ELMT Name of the element
+11 ;
+12 ; .ATTR List of attributes and their values
+13 ;
STARTEL(ELMT,ATTR) ;
+1 NEW L,LAST2,TMP
+2 DO STARTEL^ONCSAPIX(ELMT,.ATTR)
+3 SET L=$LENGTH(ONCXML("PATH"),",")
SET LAST2=$PIECE(ONCXML("PATH"),",",L-1,L)
+4 ;--- Field
+5 IF LAST2="EDIT,FLD"
Begin DoDot:1
+6 SET ONCFIEN=$GET(ONCFIEN)+1
+7 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,0)=$GET(ATTR("POS"))
+8 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,"F",ONCFIEN,1)=$GET(ATTR("NAME"))
End DoDot:1
QUIT
+9 ;--- Message
+10 IF LAST2="EDIT,MSG"
Begin DoDot:1
+11 SET ONCMIEN=$GET(ONCMIEN)+1
+12 SET TMP=$GET(ATTR("CODE"))_U_$GET(ATTR("TYPE"))
+13 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,"M",ONCMIEN,0)=TMP
End DoDot:1
QUIT
+14 ;--- Edit
+15 IF LAST2="EDIT-SET,EDIT"
Begin DoDot:1
+16 SET ONCEDIEN=$GET(ONCEDIEN)+1
SET (ONCFIEN,ONCMIEN)=0
+17 SET TMP=$GET(ATTR("ECNT"))_U_$GET(ATTR("WCNT"))_U_$GET(ATTR("INDEX"))
+18 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,0)=TMP
+19 SET @ONCXML@(ONCESIEN,"E",ONCEDIEN,1)=$GET(ATTR("NAME"))
+20 SET @ONCXML@("ES",ONCEDIEN)=ONCESIEN
End DoDot:1
QUIT
+21 ;--- Edit Set
+22 IF LAST2="ED-RESPONSE,EDIT-SET"
Begin DoDot:1
+23 SET ONCESIEN=$GET(ONCESIEN)+1
+24 SET @ONCXML@(ONCESIEN,0)=$GET(ATTR("ECNT"))_U_$GET(ATTR("WCNT"))
+25 SET @ONCXML@(ONCESIEN,1)=$GET(ATTR("NAME"))
End DoDot:1
QUIT
+26 QUIT
+27 ;
+28 ;***** TEXT CALLBACK FOR THE SAX PARSER
+29 ;
+30 ; TXT Line of unmarked text
+31 ;
TEXT(TXT) ;
+1 SET ONCXML("TEXT")=$GET(ONCXML("TEXT"))_TXT
+2 ;--- Default processing
+3 DO TEXT^ONCSAPIX(TXT)
+4 QUIT