ONCSED04 ;Hines OIFO/SG - EDITS API (EDIT INFO) ; 9/22/06 11:58am
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;--- SOAP REQUST TO 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-GET-EDITINFO ver="2.0"
; xmlns="http://vista.domain.ext/oncology">
; <EDIT-SET> ... </EDIT-SET>
; <EDIT> ... </EDIT>
; <TEXT-WIDTH> ... </TEXT-WIDTH>
; </ED-GET-EDITINFO>
; </soap:Body >
; </soap:Envelope>
;
;--- 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">
; <NAME> ... </NAME>
; <DESCRIPTION>
; ...
; </DESCRIPTION>
; <HELP>
; ...
; </HELP>
; </ED-RESPONSE>
; <soap:Fault>
; <faultcode> ... </faultcode>
; <faultstring> ... </faultstring>
; <detail>
; <RC> ... </RC>
; </detail>
; </soap:Fault>
; </soap:Body >
; </soap:Envelope>
;
Q
;
;***** END ELEMENT CALLBACK FOR THE SAX PARSER
;
; ELMT Name of the element
;
ENDEL(ELMT) ;
N I,L,L2E,TMP
S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
D ENDEL^ONCSAPIX(ELMT)
;--- Description line
I L2E="DESCRIPTION,P" D Q
. S I=$O(@ONCXML@(ONCEDIEN,"D"," "),-1)+1
. S @ONCXML@(ONCEDIEN,"D",I)=$$TRIM^XLFSTR($G(ONCXML("TEXT")),"R")
;--- Help line
I L2E="HELP,P" D Q
. S I=$O(@ONCXML@(ONCEDIEN,"H"," "),-1)+1
. S @ONCXML@(ONCEDIEN,"H",I)=$$TRIM^XLFSTR($G(ONCXML("TEXT")),"R")
Q
;
;***** GETS EDIT INFO FROM THE SERVER IF NECESSARY
;
; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
;
; ESNAME Edit set name
;
; EDTNDX Edit index
;
; Return Values:
; <0 Error descriptor
; >0 IEN of the edit info
;
GETINFO(ONCSAPI,ESNAME,EDTNDX) ;
N ONCEDESC ; Edit descriptor
N ONCEDIEN ; IEN of the description
;
N DST,ESNSUB,ONCREQ,ONCRSP,ONCXML,SVX,SVY,URL
S ESNSUB=$E(ESNAME,1,250)
;--- Initialize constants and variables
S ONCXML=$NA(^XTMP("ONCSAPI","EDITS"))
;
;--- Check if the edit info is available
S ONCEDIEN=+$G(@ONCXML@("ES",ESNSUB,EDTNDX))
I ONCEDIEN>0 Q:$D(@ONCXML@(ONCEDIEN))>1 ONCEDIEN
S ONCRSP=$NA(^TMP("ONCSED04",$J)) K @ONCRSP
;
;--- Get the server URL
S URL=$$GETCSURL^ONCSAPIU()
;
D LOCK^DILF($NA(@ONCXML@("ES",ESNSUB,EDTNDX)))
E Q $$ERROR^ONCSAPIE(-15,,"local cache")
S SVX=$X,SVY=$Y
S RC=0 D
. ;--- Check if the info has become available
. S ONCEDIEN=+$G(@ONCXML@("ES",ESNSUB,EDTNDX))
. I ONCEDIEN>0 Q:$D(@ONCXML@(ONCEDIEN))>1
. ;
. ;--- Prepare the request data
. S DST="ONCREQ"
. D HEADER^ONCSAPIR(.DST,"ED-GET-EDITINFO")
. D PUT^ONCSAPIR(.DST,"EDIT-SET",ESNAME)
. D PUT^ONCSAPIR(.DST,"EDIT",EDTNDX)
. D PUT^ONCSAPIR(.DST,"TEXT-WIDTH",75)
. D TRAILER^ONCSAPIR(.DST)
. K DST
. ;
. ;--- Send the request and get the response
. D:$G(ONCSAPI("DEBUG"))
. . D ZW^ONCSAPIU("ONCREQ","*** 'ED-GET-EDITDESC' REQUEST ***")
. S RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ") Q:RC<0
. D:$G(ONCSAPI("DEBUG"))
. . D ZW^ONCSAPIU(ONCRSP,"*** 'ED-GET-EDITDESC' RESPONSE ***")
. ;
. ;--- Parse the response
. S ONCEDIEN=+$O(@ONCXML@(" "),-1)+1,ONCEDESC=EDTNDX
. D SETCBK(.CBK),EN^MXMLPRSE(ONCRSP,.CBK,"W")
. ;--- Check for parsing and web service errors
. S RC=$$CHKERR^ONCSAPIR(.ONCXML) Q:RC<0
. ;
. ;--- Complete the edit info
. S @ONCXML@(ONCEDIEN,0)=ONCEDESC
. S @ONCXML@("ES",ESNSUB,EDTNDX)=ONCEDIEN
S $X=SVX,$Y=SVY
L -@ONCXML@("ES",ESNSUB,EDTNDX)
;
;--- Cleanup
K @ONCRSP
Q $S(RC<0:RC,1:ONCEDIEN)
;
;***** RETURNS THE EDIT DESCRIPTION NODE (LOADS DATA IF NECESSARY)
;
; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
;
; ESNAME Edit set name
;
; EDTNDX Edit index
;
; The ^TMP("ONCSED04",$J) global node is used by this function.
;
; Return Values:
; <0 Error descriptor
; Closed root of the edit description node
;
GETEDESC(ONCSAPI,ESNAME,EDTNDX) ;
N NODE,RC
D CLEAR^ONCSAPIE()
Q:$G(EDTNDX,-1)<0 $$ERROR^ONCSAPIE(-6,,"EDTNDX",$G(EDTNDX))
S RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
Q $S(RC<0:RC,1:$NA(^XTMP("ONCSAPI","EDITS",RC,"D")))
;
;***** RETURNS THE EDIT HELP NODE (LOADS DATA IF NECESSARY)
;
; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
;
; ESNAME Edit set name
;
; EDTNDX Edit index
;
; The ^TMP("ONCSED04",$J) global node is used by this function.
;
; Return Values:
; <0 Error descriptor
; Closed root of the edit help node
;
GETEDHLP(ONCSAPI,ESNAME,EDTNDX) ;
N NODE,RC
D CLEAR^ONCSAPIE()
Q:$G(EDTNDX,-1)<0 $$ERROR^ONCSAPIE(-6,,"EDTNDX",$G(EDTNDX))
S RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
Q $S(RC<0:RC,1:$NA(^XTMP("ONCSAPI","EDITS",RC,"H")))
;
;***** SETS THE EVENT INTERFACE ENTRY POINTS
;
; .CBK Reference to the destination list
;
SETCBK(CBK) ;
;;CHARACTERS^ TEXT^ONCSED04
;;ENDELEMENT^ENDEL^ONCSED04
;
D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSED04")
Q
;
;***** TEXT CALLBACK FOR THE SAX PARSER
;
; TXT Line of unmarked text
;
TEXT(TXT) ;
N I,L,L2E,TMP
S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
;--- Text of the edit description or help
I (L2E="DESCRIPTION,P")!(L2E="HELP,P") D Q
. S ONCXML("TEXT")=$G(ONCXML("TEXT"))_TXT
;--- Edit name
I L2E="ED-RESPONSE,NAME" S $P(ONCEDESC,U,2)=$P(ONCEDESC,U,2)_TXT Q
;--- Default processing
D TEXT^ONCSAPIX(TXT)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSED04 5956 printed Nov 22, 2024@17:38:18 Page 2
ONCSED04 ;Hines OIFO/SG - EDITS API (EDIT INFO) ; 9/22/06 11:58am
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;--- SOAP REQUST TO 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-GET-EDITINFO ver="2.0"
+11 ; xmlns="http://vista.domain.ext/oncology">
+12 ; <EDIT-SET> ... </EDIT-SET>
+13 ; <EDIT> ... </EDIT>
+14 ; <TEXT-WIDTH> ... </TEXT-WIDTH>
+15 ; </ED-GET-EDITINFO>
+16 ; </soap:Body >
+17 ; </soap:Envelope>
+18 ;
+19 ;--- SOAP RESPONSE FROM THE ONCOLOGY WEB SERVICE
+20 ;
+21 ; <?xml version="1.0" encoding="utf-8"?>
+22 ; <soap:Envelope
+23 ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
+24 ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
+25 ; <soap:Body>
+26 ; <ED-RESPONSE xmlns="http://vista.domain.ext/oncology">
+27 ; <NAME> ... </NAME>
+28 ; <DESCRIPTION>
+29 ; ...
+30 ; </DESCRIPTION>
+31 ; <HELP>
+32 ; ...
+33 ; </HELP>
+34 ; </ED-RESPONSE>
+35 ; <soap:Fault>
+36 ; <faultcode> ... </faultcode>
+37 ; <faultstring> ... </faultstring>
+38 ; <detail>
+39 ; <RC> ... </RC>
+40 ; </detail>
+41 ; </soap:Fault>
+42 ; </soap:Body >
+43 ; </soap:Envelope>
+44 ;
+45 QUIT
+46 ;
+47 ;***** END ELEMENT CALLBACK FOR THE SAX PARSER
+48 ;
+49 ; ELMT Name of the element
+50 ;
ENDEL(ELMT) ;
+1 NEW I,L,L2E,TMP
+2 SET L=$LENGTH(ONCXML("PATH"),",")
SET L2E=$PIECE(ONCXML("PATH"),",",L-1,L)
+3 DO ENDEL^ONCSAPIX(ELMT)
+4 ;--- Description line
+5 IF L2E="DESCRIPTION,P"
Begin DoDot:1
+6 SET I=$ORDER(@ONCXML@(ONCEDIEN,"D"," "),-1)+1
+7 SET @ONCXML@(ONCEDIEN,"D",I)=$$TRIM^XLFSTR($GET(ONCXML("TEXT")),"R")
End DoDot:1
QUIT
+8 ;--- Help line
+9 IF L2E="HELP,P"
Begin DoDot:1
+10 SET I=$ORDER(@ONCXML@(ONCEDIEN,"H"," "),-1)+1
+11 SET @ONCXML@(ONCEDIEN,"H",I)=$$TRIM^XLFSTR($GET(ONCXML("TEXT")),"R")
End DoDot:1
QUIT
+12 QUIT
+13 ;
+14 ;***** GETS EDIT INFO FROM THE SERVER IF NECESSARY
+15 ;
+16 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
+17 ;
+18 ; ESNAME Edit set name
+19 ;
+20 ; EDTNDX Edit index
+21 ;
+22 ; Return Values:
+23 ; <0 Error descriptor
+24 ; >0 IEN of the edit info
+25 ;
GETINFO(ONCSAPI,ESNAME,EDTNDX) ;
+1 ; Edit descriptor
NEW ONCEDESC
+2 ; IEN of the description
NEW ONCEDIEN
+3 ;
+4 NEW DST,ESNSUB,ONCREQ,ONCRSP,ONCXML,SVX,SVY,URL
+5 SET ESNSUB=$EXTRACT(ESNAME,1,250)
+6 ;--- Initialize constants and variables
+7 SET ONCXML=$NAME(^XTMP("ONCSAPI","EDITS"))
+8 ;
+9 ;--- Check if the edit info is available
+10 SET ONCEDIEN=+$GET(@ONCXML@("ES",ESNSUB,EDTNDX))
+11 IF ONCEDIEN>0
if $DATA(@ONCXML@(ONCEDIEN))>1
QUIT ONCEDIEN
+12 SET ONCRSP=$NAME(^TMP("ONCSED04",$JOB))
KILL @ONCRSP
+13 ;
+14 ;--- Get the server URL
+15 SET URL=$$GETCSURL^ONCSAPIU()
+16 ;
+17 DO LOCK^DILF($NAME(@ONCXML@("ES",ESNSUB,EDTNDX)))
+18 IF '$TEST
QUIT $$ERROR^ONCSAPIE(-15,,"local cache")
+19 SET SVX=$X
SET SVY=$Y
+20 SET RC=0
Begin DoDot:1
+21 ;--- Check if the info has become available
+22 SET ONCEDIEN=+$GET(@ONCXML@("ES",ESNSUB,EDTNDX))
+23 IF ONCEDIEN>0
if $DATA(@ONCXML@(ONCEDIEN))>1
QUIT
+24 ;
+25 ;--- Prepare the request data
+26 SET DST="ONCREQ"
+27 DO HEADER^ONCSAPIR(.DST,"ED-GET-EDITINFO")
+28 DO PUT^ONCSAPIR(.DST,"EDIT-SET",ESNAME)
+29 DO PUT^ONCSAPIR(.DST,"EDIT",EDTNDX)
+30 DO PUT^ONCSAPIR(.DST,"TEXT-WIDTH",75)
+31 DO TRAILER^ONCSAPIR(.DST)
+32 KILL DST
+33 ;
+34 ;--- Send the request and get the response
+35 if $GET(ONCSAPI("DEBUG"))
Begin DoDot:2
+36 DO ZW^ONCSAPIU("ONCREQ","*** 'ED-GET-EDITDESC' REQUEST ***")
End DoDot:2
+37 SET RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ")
if RC<0
QUIT
+38 if $GET(ONCSAPI("DEBUG"))
Begin DoDot:2
+39 DO ZW^ONCSAPIU(ONCRSP,"*** 'ED-GET-EDITDESC' RESPONSE ***")
End DoDot:2
+40 ;
+41 ;--- Parse the response
+42 SET ONCEDIEN=+$ORDER(@ONCXML@(" "),-1)+1
SET ONCEDESC=EDTNDX
+43 DO SETCBK(.CBK)
DO EN^MXMLPRSE(ONCRSP,.CBK,"W")
+44 ;--- Check for parsing and web service errors
+45 SET RC=$$CHKERR^ONCSAPIR(.ONCXML)
if RC<0
QUIT
+46 ;
+47 ;--- Complete the edit info
+48 SET @ONCXML@(ONCEDIEN,0)=ONCEDESC
+49 SET @ONCXML@("ES",ESNSUB,EDTNDX)=ONCEDIEN
End DoDot:1
+50 SET $X=SVX
SET $Y=SVY
+51 LOCK -@ONCXML@("ES",ESNSUB,EDTNDX)
+52 ;
+53 ;--- Cleanup
+54 KILL @ONCRSP
+55 QUIT $SELECT(RC<0:RC,1:ONCEDIEN)
+56 ;
+57 ;***** RETURNS THE EDIT DESCRIPTION NODE (LOADS DATA IF NECESSARY)
+58 ;
+59 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
+60 ;
+61 ; ESNAME Edit set name
+62 ;
+63 ; EDTNDX Edit index
+64 ;
+65 ; The ^TMP("ONCSED04",$J) global node is used by this function.
+66 ;
+67 ; Return Values:
+68 ; <0 Error descriptor
+69 ; Closed root of the edit description node
+70 ;
GETEDESC(ONCSAPI,ESNAME,EDTNDX) ;
+1 NEW NODE,RC
+2 DO CLEAR^ONCSAPIE()
+3 if $GET(EDTNDX,-1)<0
QUIT $$ERROR^ONCSAPIE(-6,,"EDTNDX",$GET(EDTNDX))
+4 SET RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
+5 QUIT $SELECT(RC<0:RC,1:$NAME(^XTMP("ONCSAPI","EDITS",RC,"D")))
+6 ;
+7 ;***** RETURNS THE EDIT HELP NODE (LOADS DATA IF NECESSARY)
+8 ;
+9 ; [.ONCSAPI] Reference to the API descriptor (see the ^ONCSED)
+10 ;
+11 ; ESNAME Edit set name
+12 ;
+13 ; EDTNDX Edit index
+14 ;
+15 ; The ^TMP("ONCSED04",$J) global node is used by this function.
+16 ;
+17 ; Return Values:
+18 ; <0 Error descriptor
+19 ; Closed root of the edit help node
+20 ;
GETEDHLP(ONCSAPI,ESNAME,EDTNDX) ;
+1 NEW NODE,RC
+2 DO CLEAR^ONCSAPIE()
+3 if $GET(EDTNDX,-1)<0
QUIT $$ERROR^ONCSAPIE(-6,,"EDTNDX",$GET(EDTNDX))
+4 SET RC=$$GETINFO(.ONCSAPI,ESNAME,EDTNDX)
+5 QUIT $SELECT(RC<0:RC,1:$NAME(^XTMP("ONCSAPI","EDITS",RC,"H")))
+6 ;
+7 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
+8 ;
+9 ; .CBK Reference to the destination list
+10 ;
SETCBK(CBK) ;
+1 ;;CHARACTERS^ TEXT^ONCSED04
+2 ;;ENDELEMENT^ENDEL^ONCSED04
+3 ;
+4 DO SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSED04")
+5 QUIT
+6 ;
+7 ;***** TEXT CALLBACK FOR THE SAX PARSER
+8 ;
+9 ; TXT Line of unmarked text
+10 ;
TEXT(TXT) ;
+1 NEW I,L,L2E,TMP
+2 SET L=$LENGTH(ONCXML("PATH"),",")
SET L2E=$PIECE(ONCXML("PATH"),",",L-1,L)
+3 ;--- Text of the edit description or help
+4 IF (L2E="DESCRIPTION,P")!(L2E="HELP,P")
Begin DoDot:1
+5 SET ONCXML("TEXT")=$GET(ONCXML("TEXT"))_TXT
End DoDot:1
QUIT
+6 ;--- Edit name
+7 IF L2E="ED-RESPONSE,NAME"
SET $PIECE(ONCEDESC,U,2)=$PIECE(ONCEDESC,U,2)_TXT
QUIT
+8 ;--- Default processing
+9 DO TEXT^ONCSAPIX(TXT)
+10 QUIT