ONCWEBP2 ;HINES OIFO/RTK - PARSER DISPLAY FOR CLOUD SERVER ; 2/5/24 1:07pm
;;2.2;ONCOLOGY;**19**;Jul 31, 2013;Build 4
;
Q
;
;--- CS SCHEMA RESPONSE FROM THE CLOUD WEB SERVICE
;
; <CsGetSchemaResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema...
; <IsRequestValid>false</IsRequestValid>
; <Schema>106</Schema>
; <SchemaName>Breast</SchemaName>
; <Discriminator />
; </CsGetSchemaResponse>
;
;
PARSESCR ;parse CS Schema response message from cloud server
;
;Supported IA #3561 reference to ^MXMLDOM
;
;ONCRHDL = response handle from the MXML parser
;ONCTAG1 = 1st level tags
;ONCPARR = array of server response values; ^TMP("ONCPARSE" = errors
;ERRFLG SET = 0 if NO CS errors, if there are CS errors set = 1
N ONCRHDL,ONCTAG1
S ONCCSSCH="E",ONCCSSNM=""
S ERRFLG=0 S ONCRHDL=$$EN^MXMLDOM($NA(^TMP("ONCSCRSP",$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)
.N OUT S OUT=""
.N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT,"TXT") OUT=TXT(1)
.S ONCPARR(ONCTAG1)=OUT
.I ONCTAG1="Schema" S ONCCSSCH=OUT
.I ONCTAG1="SchemaName" S ONCCSSNM=OUT
.Q
D DELETE^MXMLDOM(ONCRHDL)
K ONCRHDL
Q
;
;--- CS TABLE RESPONSE FROM THE CLOUD WEB SERVICE
;
; <CsGetSchemaResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema...
; <IsRequestValid></IsRequestValid>
; <CrResponse></CrResponse>
; <SCHEMA></SCHEMA>
; <TABLE>
; <ROWS>
; <ROW>
; <CODE>
; <DESCR>
; <ACS>
; . . .
; <NUMBER></NUMBER>
; <PATTERN></PATTERN>
; <SUBTITLE></SUBTITLE>
; <TITLE></TITLE>
; <NOTES>
; <TNS>
; <TN>
; . . .
; </TNS>
; <FNS/>
; </NOTES>
; </TABLE>
; </CrResponse>
;</TableRecordCompleteResponse>
;
;
PARSETBR ;parse CS Table 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, if there are EDITs errors set = 1
N ONCRHDL,ONCTAG1,ONCTAG2,ONCTAG3,ONCTAG4,ONCTAG5
S ERRFLG=0 S ONCRHDL=$$EN^MXMLDOM($NA(^TMP("ONCTBRSP",$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,ONCVLARR,^TMP("ONCPARSE",$J)
N CT,NUM,NOTE S NUM=0,NOTE=1
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 S 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
..;--- Traverse third level child(ren) nodes
..N CT3 S CT3=1 F S CT3=$$CHILD^MXMLDOM(ONCRHDL,CT2,CT3) Q:CT3=0 D
...N ONCTAG3 S ONCTAG3=$$NAME^MXMLDOM(ONCRHDL,CT3)
...N OUT S OUT=""
...N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT3,"TXT") OUT=TXT(1)
...S ONCPARR(ONCTAG3)=OUT
...;--- Traverse fourth level child(ren) nodes
...N CT4 S CT4=1 F S CT4=$$CHILD^MXMLDOM(ONCRHDL,CT3,CT4) Q:CT4=0 D
....N ONCTAG4 S ONCTAG4=$$NAME^MXMLDOM(ONCRHDL,CT4)
....N OUT S OUT=""
....N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT4,"TXT") OUT=TXT(1)
....I ONCTAG4="ROW" S NUM=NUM+1
....;--- Traverse fifth level child(ren) nodes
....N CT5 S CT5=1 F S CT5=$$CHILD^MXMLDOM(ONCRHDL,CT4,CT5) Q:CT5=0 D
.....N ONCTAG5 S ONCTAG5=$$NAME^MXMLDOM(ONCRHDL,CT5)
.....N OUT S OUT=""
.....N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT5,"TXT") OUT=TXT(1)
.....I ONCTAG5="CODE" S ^TMP("ONCPARSE",$J,NUM,"CODE")=OUT D
......I OUT?3N1"-"3N D RANGE Q
......I OUT="000" S ONCVLARR(0)=""
......S ONCVLARR(OUT)=""
.....I ONCTAG5="DESCR" S ^TMP("ONCPARSE",$J,NUM,"DESCR")=OUT ;txt runs 1 line?
.....I ONCTAG5="TN" S ^TMP("ONCPARSE",$J,"NOTE",NOTE)=OUT,NOTE=NOTE+1
...Q
..Q
.Q
D DELETE^MXMLDOM(ONCRHDL)
K ONCRHDL
Q
;
;--- CS COMPUTE COLLABORATIVE STAGE RESPONSE FROM THE CLOUD WEB SERVICE
;
; CS ERRORS
; <CsCalculateResponse xmlns:xsi="http://www.w3.org/2001/...XMLSchema">
; <NumberOfError>0</NumberOfError>
; <IsRequestValid>false</IsRequestValid>
; <Message>Lookup of codes (988, 988, 988) in Serum Tumor Marker S Value Table
; Based on CS SSF 1, 2, 3 returns "ERROR".
; </Message>
; </CsCalculateResponse>
;
; CS SUCCESS
; <CsCalculateResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema-inst...
; <NumberOfError>0</NumberOfError>
; <IsRequestValid>true</IsRequestValid>
; <CS-STOR>
; <T>30</T>
; <TDESCR>p</TDESCR>
; <N>00</N>
; <NDESCR>c</NDESCR>
; <M>00</M>
; <MDESCR>c</MDESCR>
; <AJCC>30</AJCC>
; <AJCC7-T></AJCC7-T>
; <AJCC7-TDESCR></AJCC7-TDESCR>
; <AJCC7-N></AJCC7-N>
; <AJCC7-NDESCR></AJCC7-NDESCR>
; <AJCC7-M></AJCC7-M>
; <AJCC7-MDESCR></AJCC7-MDESCR>
; <AJCC7-STAGE></AJCC7-STAGE>
; <SS1977>2</SS1977>
; <SS2000>2</SS2000>
; </CS-STOR>
; <CS-DISP>
; <T>T3</T>
; <TDESCR>p</TDESCR>
; <N>N0</N>
; <NDESCR>c</NDESCR>
; <M>M0</M>
; <MDESCR>c</MDESCR>
; <AJCC>II</AJCC>
; <AJCC7-T></AJCC7-T>
; <AJCC7-TDESCR></AJCC7-TDESCR>
; <AJCC7-N></AJCC7-N>
; <AJCC7-NDESCR></AJCC7-NDESCR>
; <AJCC7-M></AJCC7-M>
; <AJCC7-MDESCR></AJCC7-MDESCR>
; <AJCC7-STAGE></AJCC7-STAGE>
; <SS1977>RE</SS1977>
; <SS2000>RE</SS2000>
; </CS-DISP>
; <APIVER>020550</APIVER>
; <VERSION>2.00P</VERSION>
; </CS-RESPONSE>
;
PARSECS ;parse CS Schema 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
;ONCPARR = array of server response tags and values
;ONCSTORE = array for derived values to store in 165.5, returned if successful
;ONCDISPL = array for derived values to display, returned if successful
;ONCCSERR = array of error messages, returned if unsuccessful
;ONCAPIVR = CS version number, ONCVERSN = version
;ERRFLG SET = 0 if NO CS errors, success
; = 1 if there are CS errors set
; = 2 if there is XML request/response failure
N ONCRHDL,ONCTAG1
S ONCCSSCH="E",ONCCSSNM=""
S ERRFLG=0 S ONCRHDL=$$EN^MXMLDOM($NA(^TMP("ONCCSRSP",$J)),"W")
I $D(^TMP("MXMLERR",$J)) D Q
.S ERRFLG=2
.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
.K ONCRHDL,^TMP("ONCCSRSP",$J)
;--- Traverse top level child(ren) nodes
K ONCPARR,ONCSTORE,ONCDISPL,ONCAPIVR,ONCVERSN,ONCCSERR
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)
.N OUT S OUT=""
.N TXT S:$$TEXT^MXMLDOM(ONCRHDL,CT,"TXT") OUT=TXT(1)
.;W !?2,"onctag1=",ONCTAG1,"---> out=",OUT
.S ONCPARR(ONCTAG1)=OUT
.;I ONCTAG1="IsRequestValid",OUT="false" S ERRFLG=1
.I ONCTAG1="Message" S ONCCSERR(ONCTAG1)=OUT S ERRFLG=1 Q
.I ONCTAG1="ErrorMessage" S ONCCSERR(ONCTAG1)=OUT S ERRFLG=1 Q
.;--- Traverse second level child(ren) nodes
.N CT2 S 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)
..;W !,?8,"onctag2=",ONCTAG2,": ",OUT
..S ONCPARR(ONCTAG2)=OUT
..I ONCTAG1="CsStor" S ONCSTORE(ONCTAG2)=OUT
..I ONCTAG1="CsDisp" S ONCDISPL(ONCTAG2)=OUT
..Q
.I ONCTAG1="Apiver" S ONCAPIVR=OUT
.I ONCTAG1="Version" S ONCVERSN=OUT
D DELETE^MXMLDOM(ONCRHDL)
K ONCRHDL,^TMP("ONCCSRSP",$J)
Q
;
DISERR ;
I $D(ONCPARR("Message")) W !?3,ONCPARR("Message"),!!
I $D(ONCPARR("ErrorMessage")) W !?3,ONCPARR("ErrorMessage"),!!
; W N N F N=1:1 S N=$O(ONCCSERR(N)) W !,N
Q
;
RANGE ;
N LOW,HIGH,Z
S LOW=$P(OUT,"-",1),HIGH=$P(OUT,"-",2)
F Z=LOW:1:HIGH S ONCVLARR(Z)=""
Q
;
DISPLAY ; display CS table codes, descriptions and notes
;
K ^UTILITY($J,"W")
S PG=0,EX="",LINE=$S($E(IOST,1,2)="C-":IOSL-2,1:IOSL-6)
W @IOF
I $D(ONCPARR("TITLE")) W !?4,ONCPARR("TITLE")
I $D(ONCPARR("SUBTITLE")) W !?4,ONCPARR("SUBTITLE")
W !
N CODE,DESCR S CODE="",DESCR=""
F N=0:0 S N=$O(^TMP("ONCPARSE",$J,N)) Q:N'>0 D
.S CODE=^TMP("ONCPARSE",$J,N,"CODE"),DESCR=^TMP("ONCPARSE",$J,N,"DESCR")
.N X S X=CODE_" "_DESCR S DIWL=3,DIWR=77 D ^DIWP,^DIWW D P Q:EX=U
F N=0:0 S N=$O(^TMP("ONCPARSE",$J,"NOTE",N)) Q:N'>0 D
.W ! N X S X=^TMP("ONCPARSE",$J,"NOTE",N)
.S DIWL=3,DIWR=77 D ^DIWP,^DIWW D P Q:EX=U
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
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCWEBP2 9632 printed Oct 16, 2024@18:29:56 Page 2
ONCWEBP2 ;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 QUIT
+4 ;
+5 ;--- CS SCHEMA RESPONSE FROM THE CLOUD WEB SERVICE
+6 ;
+7 ; <CsGetSchemaResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema...
+8 ; <IsRequestValid>false</IsRequestValid>
+9 ; <Schema>106</Schema>
+10 ; <SchemaName>Breast</SchemaName>
+11 ; <Discriminator />
+12 ; </CsGetSchemaResponse>
+13 ;
+14 ;
PARSESCR ;parse CS Schema 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
+6 ;ONCPARR = array of server response values; ^TMP("ONCPARSE" = errors
+7 ;ERRFLG SET = 0 if NO CS errors, if there are CS errors set = 1
+8 NEW ONCRHDL,ONCTAG1
+9 SET ONCCSSCH="E"
SET ONCCSSNM=""
+10 SET ERRFLG=0
SET ONCRHDL=$$EN^MXMLDOM($NAME(^TMP("ONCSCRSP",$JOB)),"W")
+11 IF $DATA(^TMP("MXMLERR",$JOB))
Begin DoDot:1
+12 NEW HDL
SET HDL=^TMP("MXMLERR",$JOB)
+13 WRITE !!?3,"XML message",!
+14 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"MSG")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+15 WRITE !?3,"XML error",!
+16 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"XML")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+17 SET ERRFLG=2
End DoDot:1
QUIT
+18 ;--- Traverse top level child(ren) nodes
+19 KILL ONCPARR,^TMP("ONCPARSE",$JOB)
+20 NEW CT
SET CT=1
FOR
SET CT=$$CHILD^MXMLDOM(ONCRHDL,1,CT)
if CT=0
QUIT
Begin DoDot:1
+21 NEW ONCTAG1
SET ONCTAG1=$$NAME^MXMLDOM(ONCRHDL,CT)
+22 NEW OUT
SET OUT=""
+23 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT,"TXT")
SET OUT=TXT(1)
+24 SET ONCPARR(ONCTAG1)=OUT
+25 IF ONCTAG1="Schema"
SET ONCCSSCH=OUT
+26 IF ONCTAG1="SchemaName"
SET ONCCSSNM=OUT
+27 QUIT
End DoDot:1
+28 DO DELETE^MXMLDOM(ONCRHDL)
+29 KILL ONCRHDL
+30 QUIT
+31 ;
+32 ;--- CS TABLE RESPONSE FROM THE CLOUD WEB SERVICE
+33 ;
+34 ; <CsGetSchemaResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema...
+35 ; <IsRequestValid></IsRequestValid>
+36 ; <CrResponse></CrResponse>
+37 ; <SCHEMA></SCHEMA>
+38 ; <TABLE>
+39 ; <ROWS>
+40 ; <ROW>
+41 ; <CODE>
+42 ; <DESCR>
+43 ; <ACS>
+44 ; . . .
+45 ; <NUMBER></NUMBER>
+46 ; <PATTERN></PATTERN>
+47 ; <SUBTITLE></SUBTITLE>
+48 ; <TITLE></TITLE>
+49 ; <NOTES>
+50 ; <TNS>
+51 ; <TN>
+52 ; . . .
+53 ; </TNS>
+54 ; <FNS/>
+55 ; </NOTES>
+56 ; </TABLE>
+57 ; </CrResponse>
+58 ;</TableRecordCompleteResponse>
+59 ;
+60 ;
PARSETBR ;parse CS Table 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, if there are EDITs errors set = 1
+8 NEW ONCRHDL,ONCTAG1,ONCTAG2,ONCTAG3,ONCTAG4,ONCTAG5
+9 SET ERRFLG=0
SET ONCRHDL=$$EN^MXMLDOM($NAME(^TMP("ONCTBRSP",$JOB)),"W")
+10 IF $DATA(^TMP("MXMLERR",$JOB))
Begin DoDot:1
+11 NEW HDL
SET HDL=^TMP("MXMLERR",$JOB)
+12 WRITE !!?3,"XML message",!
+13 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"MSG")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+14 WRITE !?3,"XML error",!
+15 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"XML")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+16 SET ERRFLG=2
End DoDot:1
QUIT
+17 ;--- Traverse top level child(ren) nodes
+18 KILL ONCPARR,ONCVLARR,^TMP("ONCPARSE",$JOB)
+19 NEW CT,NUM,NOTE
SET NUM=0
SET NOTE=1
+20 SET CT=1
FOR
SET CT=$$CHILD^MXMLDOM(ONCRHDL,1,CT)
if CT=0
QUIT
Begin DoDot:1
+21 NEW ONCTAG1
SET ONCTAG1=$$NAME^MXMLDOM(ONCRHDL,CT)
+22 ;--- Traverse second level child(ren) nodes
+23 NEW CT2
SET CT2=1
FOR
SET CT2=$$CHILD^MXMLDOM(ONCRHDL,CT,CT2)
if CT2=0
QUIT
Begin DoDot:2
+24 NEW ONCTAG2
SET ONCTAG2=$$NAME^MXMLDOM(ONCRHDL,CT2)
+25 NEW OUT
SET OUT=""
+26 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT2,"TXT")
SET OUT=TXT(1)
+27 ;S ONCPARR(ONCTAG2)=OUT
+28 ;--- Traverse third level child(ren) nodes
+29 NEW CT3
SET CT3=1
FOR
SET CT3=$$CHILD^MXMLDOM(ONCRHDL,CT2,CT3)
if CT3=0
QUIT
Begin DoDot:3
+30 NEW ONCTAG3
SET ONCTAG3=$$NAME^MXMLDOM(ONCRHDL,CT3)
+31 NEW OUT
SET OUT=""
+32 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT3,"TXT")
SET OUT=TXT(1)
+33 SET ONCPARR(ONCTAG3)=OUT
+34 ;--- Traverse fourth level child(ren) nodes
+35 NEW CT4
SET CT4=1
FOR
SET CT4=$$CHILD^MXMLDOM(ONCRHDL,CT3,CT4)
if CT4=0
QUIT
Begin DoDot:4
+36 NEW ONCTAG4
SET ONCTAG4=$$NAME^MXMLDOM(ONCRHDL,CT4)
+37 NEW OUT
SET OUT=""
+38 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT4,"TXT")
SET OUT=TXT(1)
+39 IF ONCTAG4="ROW"
SET NUM=NUM+1
+40 ;--- Traverse fifth level child(ren) nodes
+41 NEW CT5
SET CT5=1
FOR
SET CT5=$$CHILD^MXMLDOM(ONCRHDL,CT4,CT5)
if CT5=0
QUIT
Begin DoDot:5
+42 NEW ONCTAG5
SET ONCTAG5=$$NAME^MXMLDOM(ONCRHDL,CT5)
+43 NEW OUT
SET OUT=""
+44 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT5,"TXT")
SET OUT=TXT(1)
+45 IF ONCTAG5="CODE"
SET ^TMP("ONCPARSE",$JOB,NUM,"CODE")=OUT
Begin DoDot:6
+46 IF OUT?3N1"-"3N
DO RANGE
QUIT
+47 IF OUT="000"
SET ONCVLARR(0)=""
+48 SET ONCVLARR(OUT)=""
End DoDot:6
+49 ;txt runs 1 line?
IF ONCTAG5="DESCR"
SET ^TMP("ONCPARSE",$JOB,NUM,"DESCR")=OUT
+50 IF ONCTAG5="TN"
SET ^TMP("ONCPARSE",$JOB,"NOTE",NOTE)=OUT
SET NOTE=NOTE+1
End DoDot:5
End DoDot:4
+51 QUIT
End DoDot:3
+52 QUIT
End DoDot:2
+53 QUIT
End DoDot:1
+54 DO DELETE^MXMLDOM(ONCRHDL)
+55 KILL ONCRHDL
+56 QUIT
+57 ;
+58 ;--- CS COMPUTE COLLABORATIVE STAGE RESPONSE FROM THE CLOUD WEB SERVICE
+59 ;
+60 ; CS ERRORS
+61 ; <CsCalculateResponse xmlns:xsi="http://www.w3.org/2001/...XMLSchema">
+62 ; <NumberOfError>0</NumberOfError>
+63 ; <IsRequestValid>false</IsRequestValid>
+64 ; <Message>Lookup of codes (988, 988, 988) in Serum Tumor Marker S Value Table
+65 ; Based on CS SSF 1, 2, 3 returns "ERROR".
+66 ; </Message>
+67 ; </CsCalculateResponse>
+68 ;
+69 ; CS SUCCESS
+70 ; <CsCalculateResponse xmlns:xsi=""http://www.w3.org/2001/XMLSchema-inst...
+71 ; <NumberOfError>0</NumberOfError>
+72 ; <IsRequestValid>true</IsRequestValid>
+73 ; <CS-STOR>
+74 ; <T>30</T>
+75 ; <TDESCR>p</TDESCR>
+76 ; <N>00</N>
+77 ; <NDESCR>c</NDESCR>
+78 ; <M>00</M>
+79 ; <MDESCR>c</MDESCR>
+80 ; <AJCC>30</AJCC>
+81 ; <AJCC7-T></AJCC7-T>
+82 ; <AJCC7-TDESCR></AJCC7-TDESCR>
+83 ; <AJCC7-N></AJCC7-N>
+84 ; <AJCC7-NDESCR></AJCC7-NDESCR>
+85 ; <AJCC7-M></AJCC7-M>
+86 ; <AJCC7-MDESCR></AJCC7-MDESCR>
+87 ; <AJCC7-STAGE></AJCC7-STAGE>
+88 ; <SS1977>2</SS1977>
+89 ; <SS2000>2</SS2000>
+90 ; </CS-STOR>
+91 ; <CS-DISP>
+92 ; <T>T3</T>
+93 ; <TDESCR>p</TDESCR>
+94 ; <N>N0</N>
+95 ; <NDESCR>c</NDESCR>
+96 ; <M>M0</M>
+97 ; <MDESCR>c</MDESCR>
+98 ; <AJCC>II</AJCC>
+99 ; <AJCC7-T></AJCC7-T>
+100 ; <AJCC7-TDESCR></AJCC7-TDESCR>
+101 ; <AJCC7-N></AJCC7-N>
+102 ; <AJCC7-NDESCR></AJCC7-NDESCR>
+103 ; <AJCC7-M></AJCC7-M>
+104 ; <AJCC7-MDESCR></AJCC7-MDESCR>
+105 ; <AJCC7-STAGE></AJCC7-STAGE>
+106 ; <SS1977>RE</SS1977>
+107 ; <SS2000>RE</SS2000>
+108 ; </CS-DISP>
+109 ; <APIVER>020550</APIVER>
+110 ; <VERSION>2.00P</VERSION>
+111 ; </CS-RESPONSE>
+112 ;
PARSECS ;parse CS Schema 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
+6 ;ONCPARR = array of server response tags and values
+7 ;ONCSTORE = array for derived values to store in 165.5, returned if successful
+8 ;ONCDISPL = array for derived values to display, returned if successful
+9 ;ONCCSERR = array of error messages, returned if unsuccessful
+10 ;ONCAPIVR = CS version number, ONCVERSN = version
+11 ;ERRFLG SET = 0 if NO CS errors, success
+12 ; = 1 if there are CS errors set
+13 ; = 2 if there is XML request/response failure
+14 NEW ONCRHDL,ONCTAG1
+15 SET ONCCSSCH="E"
SET ONCCSSNM=""
+16 SET ERRFLG=0
SET ONCRHDL=$$EN^MXMLDOM($NAME(^TMP("ONCCSRSP",$JOB)),"W")
+17 IF $DATA(^TMP("MXMLERR",$JOB))
Begin DoDot:1
+18 SET ERRFLG=2
+19 NEW HDL
SET HDL=^TMP("MXMLERR",$JOB)
+20 WRITE !!?3,"XML message",!
+21 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"MSG")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+22 WRITE !?3,"XML error",!
+23 NEW X
SET X=^TMP("MXMLERR",$JOB,HDL,"XML")
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
+24 KILL ONCRHDL,^TMP("ONCCSRSP",$JOB)
End DoDot:1
QUIT
+25 ;--- Traverse top level child(ren) nodes
+26 KILL ONCPARR,ONCSTORE,ONCDISPL,ONCAPIVR,ONCVERSN,ONCCSERR
+27 NEW CT
SET CT=1
FOR
SET CT=$$CHILD^MXMLDOM(ONCRHDL,1,CT)
if CT=0
QUIT
Begin DoDot:1
+28 NEW ONCTAG1
SET ONCTAG1=$$NAME^MXMLDOM(ONCRHDL,CT)
+29 NEW OUT
SET OUT=""
+30 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT,"TXT")
SET OUT=TXT(1)
+31 ;W !?2,"onctag1=",ONCTAG1,"---> out=",OUT
+32 SET ONCPARR(ONCTAG1)=OUT
+33 ;I ONCTAG1="IsRequestValid",OUT="false" S ERRFLG=1
+34 IF ONCTAG1="Message"
SET ONCCSERR(ONCTAG1)=OUT
SET ERRFLG=1
QUIT
+35 IF ONCTAG1="ErrorMessage"
SET ONCCSERR(ONCTAG1)=OUT
SET ERRFLG=1
QUIT
+36 ;--- Traverse second level child(ren) nodes
+37 NEW CT2
SET CT2=1
FOR
SET CT2=$$CHILD^MXMLDOM(ONCRHDL,CT,CT2)
if CT2=0
QUIT
Begin DoDot:2
+38 NEW ONCTAG2
SET ONCTAG2=$$NAME^MXMLDOM(ONCRHDL,CT2)
+39 NEW OUT
SET OUT=""
+40 NEW TXT
if $$TEXT^MXMLDOM(ONCRHDL,CT2,"TXT")
SET OUT=TXT(1)
+41 ;W !,?8,"onctag2=",ONCTAG2,": ",OUT
+42 SET ONCPARR(ONCTAG2)=OUT
+43 IF ONCTAG1="CsStor"
SET ONCSTORE(ONCTAG2)=OUT
+44 IF ONCTAG1="CsDisp"
SET ONCDISPL(ONCTAG2)=OUT
+45 QUIT
End DoDot:2
+46 IF ONCTAG1="Apiver"
SET ONCAPIVR=OUT
+47 IF ONCTAG1="Version"
SET ONCVERSN=OUT
End DoDot:1
+48 DO DELETE^MXMLDOM(ONCRHDL)
+49 KILL ONCRHDL,^TMP("ONCCSRSP",$JOB)
+50 QUIT
+51 ;
DISERR ;
+1 IF $DATA(ONCPARR("Message"))
WRITE !?3,ONCPARR("Message"),!!
+2 IF $DATA(ONCPARR("ErrorMessage"))
WRITE !?3,ONCPARR("ErrorMessage"),!!
+3 ; W N N F N=1:1 S N=$O(ONCCSERR(N)) W !,N
+4 QUIT
+5 ;
RANGE ;
+1 NEW LOW,HIGH,Z
+2 SET LOW=$PIECE(OUT,"-",1)
SET HIGH=$PIECE(OUT,"-",2)
+3 FOR Z=LOW:1:HIGH
SET ONCVLARR(Z)=""
+4 QUIT
+5 ;
DISPLAY ; display CS table codes, descriptions and notes
+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)
+4 WRITE @IOF
+5 IF $DATA(ONCPARR("TITLE"))
WRITE !?4,ONCPARR("TITLE")
+6 IF $DATA(ONCPARR("SUBTITLE"))
WRITE !?4,ONCPARR("SUBTITLE")
+7 WRITE !
+8 NEW CODE,DESCR
SET CODE=""
SET DESCR=""
+9 FOR N=0:0
SET N=$ORDER(^TMP("ONCPARSE",$JOB,N))
if N'>0
QUIT
Begin DoDot:1
+10 SET CODE=^TMP("ONCPARSE",$JOB,N,"CODE")
SET DESCR=^TMP("ONCPARSE",$JOB,N,"DESCR")
+11 NEW X
SET X=CODE_" "_DESCR
SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
DO P
if EX=U
QUIT
End DoDot:1
+12 FOR N=0:0
SET N=$ORDER(^TMP("ONCPARSE",$JOB,"NOTE",N))
if N'>0
QUIT
Begin DoDot:1
+13 WRITE !
NEW X
SET X=^TMP("ONCPARSE",$JOB,"NOTE",N)
+14 SET DIWL=3
SET DIWR=77
DO ^DIWP
DO ^DIWW
DO P
if EX=U
QUIT
End DoDot:1
+15 QUIT
+16 ;
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 QUIT