ONCWEBP1 ;HINES OIFO/RTK - PARSER DISPLAY FOR CLOUD SERVER ; 2/5/24 1:07pm
;;2.2;ONCOLOGY;**19**;Jul 31, 2013;Build 4
;
;--- EDITS RESPONSE FROM THE CLOUD WEB SERVICE
;
; <EditResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance...
; <ResponseSummary>
; <RequestID>
; <RequestType>
; <NumberOfError>
; <IsSuccessful>
; <SummaryMessage>
; <IsLoadError>
; <AppVersion>
; <Version>
; <MetaFileVersion>
; <EditLibraryVersion>
; <CstageLibraryVersion>
; <Messages>
; <Message>
; ...
; <EditTag>
; <Code>
; <ErrorType>
; <ErrorMessage>
; ...
; <>
; <EngineError/>
;
;
;--- ATTRIBUTES
;
; ErrorType E - Error, W - Warning, M - Message
;
Q
;
PARSE ;parse response message from cloud server
;
;Supported IA #3561 reference to ^MXMLDOM
;
;ONCRHDL = response handle from the MXML parser
;ONCTAG1 = 1st level tags; ONCTAG2 = 2nd level tags; ONCTAG3 = 3rd level tags
;ONCPARR = array of server response values; ^TMP("ONCPARSE" = errors
;ERRFLG SET = 0 if NO EDITs errors,
; = 1 if there are EDITs errors set
; = 2 if there is XML request/response failure
N ONCRHDL,ONCTAG1,ONCTAG2,ONCTAG3
S ERRFLG=0 S ONCRHDL=$$EN^MXMLDOM($NA(^TMP("ONCSED01R",$J)),"W")
I $D(^TMP("MXMLERR",$J)) D Q
.N HDL S HDL=^TMP("MXMLERR",$J)
.W !!?3,"XML message",!
.N X S X=^TMP("MXMLERR",$J,HDL,"MSG") S DIWL=3,DIWR=77 D ^DIWP,^DIWW
.W !?3,"XML error",!
.N X S X=^TMP("MXMLERR",$J,HDL,"XML") S DIWL=3,DIWR=77 D ^DIWP,^DIWW
.S ERRFLG=2
;--- Traverse top level child(ren) nodes
K ONCPARR,^TMP("ONCPARSE",$J)
N CT S CT=1 F S CT=$$CHILD^MXMLDOM(ONCRHDL,1,CT) Q:CT=0 D
.N ONCTAG1 S ONCTAG1=$$NAME^MXMLDOM(ONCRHDL,CT)
.;--- Traverse second level child(ren) nodes
.N CT2,N1 S N1=0,CT2=1 F S CT2=$$CHILD^MXMLDOM(ONCRHDL,CT,CT2) Q:CT2=0 D
..N ONCTAG2 S ONCTAG2=$$NAME^MXMLDOM(ONCRHDL,CT2)
..N OUT S OUT=""
..N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT2,"TXT") OUT=TXT(1)
..S ONCPARR(ONCTAG2)=OUT
..I ONCTAG2="Message" S N1=N1+1
..;--- Traverse third level child(ren) nodes
..N CT3,N2 S N2=1,CT3=1 F S CT3=$$CHILD^MXMLDOM(ONCRHDL,CT2,CT3) Q:CT3=0 D
...N ONCTAG3 S ONCTAG3=$$NAME^MXMLDOM(ONCRHDL,CT3)
...N OUTPT S OUTPT=""
...N TXT1 S:$$TEXT^MXMLDOM(ONCRHDL,CT3,"TXT1") OUTPT=TXT1(1)
...S ^TMP("ONCPARSE",$J,N1,N2)=OUTPT S N2=N2+1
...Q
..Q
.Q
I $G(ONCPARR("IsSuccessful"))="false" S ERRFLG=1
D DELETE^MXMLDOM(ONCRHDL)
K ONCRHDL
Q
;
DISPLAY ; display EDITS and totals
;
K ^UTILITY($J,"W")
S PG=0,EX="",LINE=$S($E(IOST,1,2)="C-":IOSL-2,1:IOSL-6),TTLE=0,TTWRN=0
S ONCMFV=$G(ONCPARR("MetaFileVersion"))
S ONCELV=$G(ONCPARR("EditLibraryVersion"))
S ONCSUMSG=$G(ONCPARR("SummaryMessage"))
D HDR
F N1=0:0 S N1=$O(^TMP("ONCPARSE",$J,N1)) Q:N1'>0 D Q:EX=U
.S ONCEDTG=$G(^TMP("ONCPARSE",$J,N1,1)),ONCEDCD=$G(^TMP("ONCPARSE",$J,N1,2))
.S ONCEDTY=$G(^TMP("ONCPARSE",$J,N1,3)),ONCEDMG=$G(^TMP("ONCPARSE",$J,N1,4))
.W !?1,N1,". Edit Tag: ",ONCEDTG,?24,"Code: ",ONCEDCD
.I (ONCEDTY="E")!(ONCEDTY="M") S TTLE=TTLE+1
.I ONCEDTY="W" S TTWRN=TTWRN+1
.N X S X=ONCEDTY_": "_ONCEDMG S DIWL=4,DIWR=77 D ^DIWP,^DIWW D P Q:EX=U
.D P Q:EX=U
.K ONCEDTG,ONCEDCD,ONCEDTY,ONCEDMG
I TTLE=0,TTWRN=0 W !!,"Engine Error: ",ONCSUMSG,!
D TOTALS
K ONCMFV,ONCELV,ONCSUMSG,TTLE,TTMSG,TTWRN
Q
;
P ;
I ($Y'<(LINE-1)) D Q:EX=U W !
.I IOST?1"C".E W ! K DIR S DIR(0)="E",DIR("A")="Enter RETURN to continue"
.D ^DIR I 'Y S EX=U Q
.D HDR Q
Q
HDR ; Header
W @IOF S PG=PG+1
W !!,"VHA - Hosp: (Metafile Version: ",ONCMFV," Edit Library Version: ",ONCELV,")"
W !,"---------------------------------------------------------------------------"
Q
;
TOTALS ;
W !!,"Edit Set",?60,"Errors",?68,"Warnings"
W !,"-------------------------------------------------------"
W ?60,"------",?68,"--------"
W !,"VHA - Hosp: (Metafile Version: ",ONCMFV,")",?64,TTLE,?72,TTWRN,?75,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCWEBP1 4106 printed Nov 22, 2024@17:39:17 Page 2
ONCWEBP1 ;HINES OIFO/RTK - PARSER DISPLAY FOR CLOUD SERVER ; 2/5/24 1:07pm
+1 ;;2.2;ONCOLOGY;**19**;Jul 31, 2013;Build 4
+2 ;
+3 ;--- EDITS RESPONSE FROM THE CLOUD WEB SERVICE
+4 ;
+5 ; <EditResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance...
+6 ; <ResponseSummary>
+7 ; <RequestID>
+8 ; <RequestType>
+9 ; <NumberOfError>
+10 ; <IsSuccessful>
+11 ; <SummaryMessage>
+12 ; <IsLoadError>
+13 ; <AppVersion>
+14 ; <Version>
+15 ; <MetaFileVersion>
+16 ; <EditLibraryVersion>
+17 ; <CstageLibraryVersion>
+18 ; <Messages>
+19 ; <Message>
+20 ; ...
+21 ; <EditTag>
+22 ; <Code>
+23 ; <ErrorType>
+24 ; <ErrorMessage>
+25 ; ...
+26 ; <>
+27 ; <EngineError/>
+28 ;
+29 ;
+30 ;--- ATTRIBUTES
+31 ;
+32 ; ErrorType E - Error, W - Warning, M - Message
+33 ;
+34 QUIT
+35 ;
PARSE ;parse response message from cloud server
+1 ;
+2 ;Supported IA #3561 reference to ^MXMLDOM
+3 ;
+4 ;ONCRHDL = response handle from the MXML parser
+5 ;ONCTAG1 = 1st level tags; ONCTAG2 = 2nd level tags; ONCTAG3 = 3rd level tags
+6 ;ONCPARR = array of server response values; ^TMP("ONCPARSE" = errors
+7 ;ERRFLG SET = 0 if NO EDITs errors,
+8 ; = 1 if there are EDITs errors set
+9 ; = 2 if there is XML request/response failure
+10 NEW ONCRHDL,ONCTAG1,ONCTAG2,ONCTAG3
+11 SET ERRFLG=0
SET ONCRHDL=$$EN^MXMLDOM($NAME(^TMP("ONCSED01R",$JOB)),"W")
+12 IF $DATA(^TMP("MXMLERR",$JOB))
Begin DoDot:1
+13 NEW HDL
SET HDL=^TMP("MXMLERR",$JOB)
+14 WRITE !!?3,"XML message",!
+15 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"MSG")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+16 WRITE !?3,"XML error",!
+17 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"XML")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+18 SET ERRFLG=2
End DoDot:1
QUIT
+19 ;--- Traverse top level child(ren) nodes
+20 KILL ONCPARR,^TMP("ONCPARSE",$JOB)
+21 NEW CT
SET CT=1
FOR
SET CT=$$CHILD^MXMLDOM(ONCRHDL,1,CT)
if CT=0
QUIT
Begin DoDot:1
+22 NEW ONCTAG1
SET ONCTAG1=$$NAME^MXMLDOM(ONCRHDL,CT)
+23 ;--- Traverse second level child(ren) nodes
+24 NEW CT2,N1
SET N1=0
SET CT2=1
FOR
SET CT2=$$CHILD^MXMLDOM(ONCRHDL,CT,CT2)
if CT2=0
QUIT
Begin DoDot:2
+25 NEW ONCTAG2
SET ONCTAG2=$$NAME^MXMLDOM(ONCRHDL,CT2)
+26 NEW OUT
SET OUT=""
+27 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT2,"TXT")
SET OUT=TXT(1)
+28 SET ONCPARR(ONCTAG2)=OUT
+29 IF ONCTAG2="Message"
SET N1=N1+1
+30 ;--- Traverse third level child(ren) nodes
+31 NEW CT3,N2
SET N2=1
SET CT3=1
FOR
SET CT3=$$CHILD^MXMLDOM(ONCRHDL,CT2,CT3)
if CT3=0
QUIT
Begin DoDot:3
+32 NEW ONCTAG3
SET ONCTAG3=$$NAME^MXMLDOM(ONCRHDL,CT3)
+33 NEW OUTPT
SET OUTPT=""
+34 NEW TXT1
if $$TEXT^MXMLDOM(ONCRHDL,CT3,"TXT1")
SET OUTPT=TXT1(1)
+35 SET ^TMP("ONCPARSE",$JOB,N1,N2)=OUTPT
SET N2=N2+1
+36 QUIT
End DoDot:3
+37 QUIT
End DoDot:2
+38 QUIT
End DoDot:1
+39 IF $GET(ONCPARR("IsSuccessful"))="false"
SET ERRFLG=1
+40 DO DELETE^MXMLDOM(ONCRHDL)
+41 KILL ONCRHDL
+42 QUIT
+43 ;
DISPLAY ; display EDITS and totals
+1 ;
+2 KILL ^UTILITY($JOB,"W")
+3 SET PG=0
SET EX=""
SET LINE=$SELECT($EXTRACT(IOST,1,2)="C-":IOSL-2,1:IOSL-6)
SET TTLE=0
SET TTWRN=0
+4 SET ONCMFV=$GET(ONCPARR("MetaFileVersion"))
+5 SET ONCELV=$GET(ONCPARR("EditLibraryVersion"))
+6 SET ONCSUMSG=$GET(ONCPARR("SummaryMessage"))
+7 DO HDR
+8 FOR N1=0:0
SET N1=$ORDER(^TMP("ONCPARSE",$JOB,N1))
if N1'>0
QUIT
Begin DoDot:1
+9 SET ONCEDTG=$GET(^TMP("ONCPARSE",$JOB,N1,1))
SET ONCEDCD=$GET(^TMP("ONCPARSE",$JOB,N1,2))
+10 SET ONCEDTY=$GET(^TMP("ONCPARSE",$JOB,N1,3))
SET ONCEDMG=$GET(^TMP("ONCPARSE",$JOB,N1,4))
+11 WRITE !?1,N1,". Edit Tag: ",ONCEDTG,?24,"Code: ",ONCEDCD
+12 IF (ONCEDTY="E")!(ONCEDTY="M")
SET TTLE=TTLE+1
+13 IF ONCEDTY="W"
SET TTWRN=TTWRN+1
+14 NEW X
SET X=ONCEDTY_": "_ONCEDMG
SET DIWL=4
SET DIWR=77
DO ^DIWP
DO ^DIWW
DO P
if EX=U
QUIT
+15 DO P
if EX=U
QUIT
+16 KILL ONCEDTG,ONCEDCD,ONCEDTY,ONCEDMG
End DoDot:1
if EX=U
QUIT
+17 IF TTLE=0
IF TTWRN=0
WRITE !!,"Engine Error: ",ONCSUMSG,!
+18 DO TOTALS
+19 KILL ONCMFV,ONCELV,ONCSUMSG,TTLE,TTMSG,TTWRN
+20 QUIT
+21 ;
P ;
+1 IF ($Y'<(LINE-1))
Begin DoDot:1
+2 IF IOST?1"C".E
WRITE !
KILL DIR
SET DIR(0)="E"
SET DIR("A")="Enter RETURN to continue"
+3 DO ^DIR
IF 'Y
SET EX=U
QUIT
+4 DO HDR
QUIT
End DoDot:1
if EX=U
QUIT
WRITE !
+5 QUIT
HDR ; Header
+1 WRITE @IOF
SET PG=PG+1
+2 WRITE !!,"VHA - Hosp: (Metafile Version: ",ONCMFV," Edit Library Version: ",ONCELV,")"
+3 WRITE !,"---------------------------------------------------------------------------"
+4 QUIT
+5 ;
TOTALS ;
+1 WRITE !!,"Edit Set",?60,"Errors",?68,"Warnings"
+2 WRITE !,"-------------------------------------------------------"
+3 WRITE ?60,"------",?68,"--------"
+4 WRITE !,"VHA - Hosp: (Metafile Version: ",ONCMFV,")",?64,TTLE,?72,TTWRN,?75,!
+5 QUIT