ONCSAPID ;Hines OIFO/SG - COLLABORATIVE STAGING (DEMO) ; 12/7/06 9:33am
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
Q
;
;***** DEMO ENTRY POINT
;
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
;
DEMO(ONCSAPI) ;
N DISPLAY,EXIT,I,INPUT,RC,STATUS,STORE
W !!?10,"DEMO CLIENT FOR THE COLLABORATIVE STAGING API",!
D CLEAR^ONCSAPIE(1)
;--- Check the DLL version
S RC=$$CHKVER^ONCSAPIV(.ONCSAPI)
D:RC<0 PRTERRS^ONCSAPIE()
;
;---
S EXIT=0
F D Q:EXIT
. D CLEAR^ONCSAPIE()
. ;--- Review/Edit input values
. S RC=$$INPUT(.INPUT)
. I RC<0 S EXIT=1 Q
. ;--- Call the CS API
. S RC=$$CALC^ONCSAPI3(.ONCSAPI,.INPUT,.STORE,.DISPLAY,.STATUS)
. ;--- Display the output values
. W !!,"Output values of the Collaborative Staging API",!
. I $D(STORE)>1 S I="" D W !
. . F S I=$O(STORE(I)) Q:I="" D
. . . W !?2,$NA(STORE(I))_"="""_$G(STORE(I))_""""
. . . W ?42,$NA(DISPLAY(I))_"="""_$G(DISPLAY(I))_""""
. I RC D D ZW^ONCSAPIU("STATUS")
. . W !,"$$CALC^ONCSAPI3="""_RC_"""",!
. ;--- Display formatted error messages
. D:RC<0 PRTERRS^ONCSAPIE()
. ;--- Pause the output
. S EXIT=$$PAGE^ONCSAPIU() W !
;---
Q
;
;***** USER INPUT FOR THE DEMO ENTRY POINT
;
; .ONCINP Reference to a local variable for input parameters
;
; Return values:
;
; -2 Timeout
; -1 User entered an up-arrow
; 0 Ok
;
INPUT(ONCINP) ;
;;HIST ^8000^4^Histologic Type ICD-O-3
;;SITE ^C000^4^Primary Site
;;BEHAV ^3 ^1^Behavior Code ICD-O-3
;;GRADE ^1 ^1^Grade
;;AGE ^043 ^3^Age at Diagnosis
;;SIZE ^010 ^3^CS Tumor Size^1
;;EXT ^200 ^3^CS Extension^2
;;EXTEVAL ^0 ^1^CS Size/Ext Eval^3
;;NODES ^100 ^3^CS Lymph Nodes^4
;;NODESEVAL^0 ^1^CS Reg Nodes Eval^5
;;LNPOS ^98 ^2^Regional Nodes Positive^6
;;LNEXAM ^00 ^2^Regional Nodes Examined^7
;;METS ^00 ^2^CS Mets at DX^8
;;METSEVAL ^0 ^1^CS Mets Eval^9
;;SSF1 ^001 ^3^CS Site-Specific Factor 1^10
;;SSF2 ^000 ^3^CS Site-Specific Factor 2^11
;;SSF3 ^000 ^3^CS Site-Specific Factor 3^12
;;SSF4 ^000 ^3^CS Site-Specific Factor 4^13
;;SSF5 ^000 ^3^CS Site-Specific Factor 5^14
;;SSF6 ^000 ^3^CS Site-Specific Factor 6^15
;
N DIR,DIRUT,DTOUT,DUOUT,FLDLST,ICOL,IFLD,IIF,IROW,ML,NAME,NFL,NR,ONCBUF,RC,TABLE,TMP,VAL,X,Y
W !,"Input values for Collaborative Staging API"
S RC=0
;--- Determine number of fields and load default values
F NFL=1:1 S TMP=$P($T(INPUT+NFL),";;",2) Q:TMP="" D
. S FLDESCR(NFL)=TMP,NAME=$TR($P(TMP,U)," ")
. S:'$D(ONCINP(NAME)) ONCINP(NAME)=$TR($P(TMP,U,2)," ")
S NFL=NFL-1
;
;--- Review and/or edit field values
F W ! D Q:RC
. ;--- Display current values
. S NR=NFL\2
. F IROW=1:1:NR W ! D
. . F ICOL=1,2 D
. . . S IFLD=NR*(ICOL-1)+IROW,X=(ICOL-1)*40
. . . S TMP=$P($T(INPUT+IFLD),";;",2),NAME=$TR($P(TMP,U)," ")
. . . W ?(X+2),"["_$J(IFLD,2)_"] "_$P(TMP,U,4)
. . . W ?(X+35),$G(ONCINP(NAME))
. ;
. ;--- Ask for field(s) to be edited
. K DIR
. S DIR(0)="LO^1:"_NFL_":0"
. S DIR("A")="Select a field"
. S DIR("?")="Enter field number(s), '^' to exit, or hit RETURN to call the CS API."
. W ! D ^DIR
. I $D(DTOUT) S RC=-2 Q
. I $D(DUOUT) S RC=-1 Q
. I '$G(Y) S RC=1 Q
. S FLDLST=Y
. ;
. F IIF=1:1 S IFLD=$P(FLDLST,",",IIF) Q:IFLD'>0 D Q:RC<0
. . ;--- Edit the field value
. . S TMP=$P($T(INPUT+IFLD),";;",2)
. . S NAME=$TR($P(TMP,U)," "),ML=+$TR($P(TMP,U,3)," ")
. . S TABLE=+$TR($P(TMP,U,5)," ")
. . K DIR
. . S DIR(0)="FO^1:"_ML
. . S:TABLE>0 $P(DIR(0),U,3)="D INPUT^ONCSAPI1("_TABLE_","_ML_",,$G(ONCINP(""SITE"")),$G(ONCINP(""HIST"")))"
. . S DIR("A")=$P(TMP,U,4)
. . S DIR("B")=$G(ONCINP(NAME))
. . S X=$S(ML>1:ML_" characters",1:"1 character")
. . S DIR("?")="Enter the field value ("_X_")"
. . S:TABLE>0 DIR("??")="^D HELP^ONCSAPI1("_TABLE_",,$G(ONCINP(""SITE"")),$G(ONCINP(""HIST"")))"
. . W !
. . S TMP=$$TBLTTL^ONCSAPIT(,$G(ONCINP("SITE")),$G(ONCINP("HIST")),TABLE)
. . I TMP'<0 D:$P(TMP,U,3)'="" WW^ONCSAPIU($P(TMP,U,3),75)
. . D ^DIR
. . I $D(DTOUT) S RC=-2 Q
. . I $D(DUOUT) S RC=-1 Q
. . S ONCINP(NAME)=Y
. S:(RC=-1)!(RC=-2) RC=0
;---
Q $S(RC<0:RC,1:0)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSAPID 4282 printed Nov 22, 2024@17:37:47 Page 2
ONCSAPID ;Hines OIFO/SG - COLLABORATIVE STAGING (DEMO) ; 12/7/06 9:33am
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 QUIT
+4 ;
+5 ;***** DEMO ENTRY POINT
+6 ;
+7 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
+8 ;
DEMO(ONCSAPI) ;
+1 NEW DISPLAY,EXIT,I,INPUT,RC,STATUS,STORE
+2 WRITE !!?10,"DEMO CLIENT FOR THE COLLABORATIVE STAGING API",!
+3 DO CLEAR^ONCSAPIE(1)
+4 ;--- Check the DLL version
+5 SET RC=$$CHKVER^ONCSAPIV(.ONCSAPI)
+6 if RC<0
DO PRTERRS^ONCSAPIE()
+7 ;
+8 ;---
+9 SET EXIT=0
+10 FOR
Begin DoDot:1
+11 DO CLEAR^ONCSAPIE()
+12 ;--- Review/Edit input values
+13 SET RC=$$INPUT(.INPUT)
+14 IF RC<0
SET EXIT=1
QUIT
+15 ;--- Call the CS API
+16 SET RC=$$CALC^ONCSAPI3(.ONCSAPI,.INPUT,.STORE,.DISPLAY,.STATUS)
+17 ;--- Display the output values
+18 WRITE !!,"Output values of the Collaborative Staging API",!
+19 IF $DATA(STORE)>1
SET I=""
Begin DoDot:2
+20 FOR
SET I=$ORDER(STORE(I))
if I=""
QUIT
Begin DoDot:3
+21 WRITE !?2,$NAME(STORE(I))_"="""_$GET(STORE(I))_""""
+22 WRITE ?42,$NAME(DISPLAY(I))_"="""_$GET(DISPLAY(I))_""""
End DoDot:3
End DoDot:2
WRITE !
+23 IF RC
Begin DoDot:2
+24 WRITE !,"$$CALC^ONCSAPI3="""_RC_"""",!
End DoDot:2
DO ZW^ONCSAPIU("STATUS")
+25 ;--- Display formatted error messages
+26 if RC<0
DO PRTERRS^ONCSAPIE()
+27 ;--- Pause the output
+28 SET EXIT=$$PAGE^ONCSAPIU()
WRITE !
End DoDot:1
if EXIT
QUIT
+29 ;---
+30 QUIT
+31 ;
+32 ;***** USER INPUT FOR THE DEMO ENTRY POINT
+33 ;
+34 ; .ONCINP Reference to a local variable for input parameters
+35 ;
+36 ; Return values:
+37 ;
+38 ; -2 Timeout
+39 ; -1 User entered an up-arrow
+40 ; 0 Ok
+41 ;
INPUT(ONCINP) ;
+1 ;;HIST ^8000^4^Histologic Type ICD-O-3
+2 ;;SITE ^C000^4^Primary Site
+3 ;;BEHAV ^3 ^1^Behavior Code ICD-O-3
+4 ;;GRADE ^1 ^1^Grade
+5 ;;AGE ^043 ^3^Age at Diagnosis
+6 ;;SIZE ^010 ^3^CS Tumor Size^1
+7 ;;EXT ^200 ^3^CS Extension^2
+8 ;;EXTEVAL ^0 ^1^CS Size/Ext Eval^3
+9 ;;NODES ^100 ^3^CS Lymph Nodes^4
+10 ;;NODESEVAL^0 ^1^CS Reg Nodes Eval^5
+11 ;;LNPOS ^98 ^2^Regional Nodes Positive^6
+12 ;;LNEXAM ^00 ^2^Regional Nodes Examined^7
+13 ;;METS ^00 ^2^CS Mets at DX^8
+14 ;;METSEVAL ^0 ^1^CS Mets Eval^9
+15 ;;SSF1 ^001 ^3^CS Site-Specific Factor 1^10
+16 ;;SSF2 ^000 ^3^CS Site-Specific Factor 2^11
+17 ;;SSF3 ^000 ^3^CS Site-Specific Factor 3^12
+18 ;;SSF4 ^000 ^3^CS Site-Specific Factor 4^13
+19 ;;SSF5 ^000 ^3^CS Site-Specific Factor 5^14
+20 ;;SSF6 ^000 ^3^CS Site-Specific Factor 6^15
+21 ;
+22 NEW DIR,DIRUT,DTOUT,DUOUT,FLDLST,ICOL,IFLD,IIF,IROW,ML,NAME,NFL,NR,ONCBUF,RC,TABLE,TMP,VAL,X,Y
+23 WRITE !,"Input values for Collaborative Staging API"
+24 SET RC=0
+25 ;--- Determine number of fields and load default values
+26 FOR NFL=1:1
SET TMP=$PIECE($TEXT(INPUT+NFL),";;",2)
if TMP=""
QUIT
Begin DoDot:1
+27 SET FLDESCR(NFL)=TMP
SET NAME=$TRANSLATE($PIECE(TMP,U)," ")
+28 if '$DATA(ONCINP(NAME))
SET ONCINP(NAME)=$TRANSLATE($PIECE(TMP,U,2)," ")
End DoDot:1
+29 SET NFL=NFL-1
+30 ;
+31 ;--- Review and/or edit field values
+32 FOR
WRITE !
Begin DoDot:1
+33 ;--- Display current values
+34 SET NR=NFL\2
+35 FOR IROW=1:1:NR
WRITE !
Begin DoDot:2
+36 FOR ICOL=1,2
Begin DoDot:3
+37 SET IFLD=NR*(ICOL-1)+IROW
SET X=(ICOL-1)*40
+38 SET TMP=$PIECE($TEXT(INPUT+IFLD),";;",2)
SET NAME=$TRANSLATE($PIECE(TMP,U)," ")
+39 WRITE ?(X+2),"["_$JUSTIFY(IFLD,2)_"] "_$PIECE(TMP,U,4)
+40 WRITE ?(X+35),$GET(ONCINP(NAME))
End DoDot:3
End DoDot:2
+41 ;
+42 ;--- Ask for field(s) to be edited
+43 KILL DIR
+44 SET DIR(0)="LO^1:"_NFL_":0"
+45 SET DIR("A")="Select a field"
+46 SET DIR("?")="Enter field number(s), '^' to exit, or hit RETURN to call the CS API."
+47 WRITE !
DO ^DIR
+48 IF $DATA(DTOUT)
SET RC=-2
QUIT
+49 IF $DATA(DUOUT)
SET RC=-1
QUIT
+50 IF '$GET(Y)
SET RC=1
QUIT
+51 SET FLDLST=Y
+52 ;
+53 FOR IIF=1:1
SET IFLD=$PIECE(FLDLST,",",IIF)
if IFLD'>0
QUIT
Begin DoDot:2
+54 ;--- Edit the field value
+55 SET TMP=$PIECE($TEXT(INPUT+IFLD),";;",2)
+56 SET NAME=$TRANSLATE($PIECE(TMP,U)," ")
SET ML=+$TRANSLATE($PIECE(TMP,U,3)," ")
+57 SET TABLE=+$TRANSLATE($PIECE(TMP,U,5)," ")
+58 KILL DIR
+59 SET DIR(0)="FO^1:"_ML
+60 if TABLE>0
SET $PIECE(DIR(0),U,3)="D INPUT^ONCSAPI1("_TABLE_","_ML_",,$G(ONCINP(""SITE"")),$G(ONCINP(""HIST"")))"
+61 SET DIR("A")=$PIECE(TMP,U,4)
+62 SET DIR("B")=$GET(ONCINP(NAME))
+63 SET X=$SELECT(ML>1:ML_" characters",1:"1 character")
+64 SET DIR("?")="Enter the field value ("_X_")"
+65 if TABLE>0
SET DIR("??")="^D HELP^ONCSAPI1("_TABLE_",,$G(ONCINP(""SITE"")),$G(ONCINP(""HIST"")))"
+66 WRITE !
+67 SET TMP=$$TBLTTL^ONCSAPIT(,$GET(ONCINP("SITE")),$GET(ONCINP("HIST")),TABLE)
+68 IF TMP'<0
if $PIECE(TMP,U,3)'=""
DO WW^ONCSAPIU($PIECE(TMP,U,3),75)
+69 DO ^DIR
+70 IF $DATA(DTOUT)
SET RC=-2
QUIT
+71 IF $DATA(DUOUT)
SET RC=-1
QUIT
+72 SET ONCINP(NAME)=Y
End DoDot:2
if RC<0
QUIT
+73 if (RC=-1)!(RC=-2)
SET RC=0
End DoDot:1
if RC
QUIT
+74 ;---
+75 QUIT $SELECT(RC<0:RC,1:0)