ONCSAPI1 ;Hines OIFO/SG - COLLABORATIVE STAGING (DD TOOLS) ;06/23/10
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
Q
;
;***** DISPLAYS THE ERRORS
ERRORS(MODE,ERRCODE) ;
S ERRCODE=+$G(ERRCODE)
;--- Display the explanations (for the user)
I MODE="HLP" D:(ERRCODE=-10)
. D ERROR^ONCSAPIE(-19,"Please try later.")
E I MODE="INP" D:(ERRCODE'=-2)
. D ERROR^ONCSAPIE(-20,"Please inform IRM about the problem.")
E I MODE="CDN" D:(ERRCODE=-10)
. D ERROR^ONCSAPIE(-21,"Please try later.")
;--- Display the error stack (for the IRM)
D PRTERRS^ONCSAPIE()
Q
;
;***** DISPLAYS THE HELP FOR A FIELD
;
; TABLE Table number (see the ^ONCSAPI routine)
;
; [IEN] IEN of the record in the file #165.5
;
; [SITE] Primary site
; [HIST] Histology
;
; Either the IEN or both the SITE and HIST must be provided.
;
HELP(TABLE,IEN,SITE,HIST) ;
N DISCRIM,EXIT,I,MNL,NODE,NOTE,ONCMSG,ONCSAPI,RC,ROW,SHNS,TBLIEN,TMP
S SHNS=$S($G(X)="":1,1:X="??")
D CLEAR^ONCSAPIE(1)
D:$G(IEN)>0
. S SITE=$TR($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
. S HIST=$E($$HIST^ONCFUNC(IEN),1,4)
. S DISCRIM=$$GET1^DIQ(165.5,IEN,240)
I ($G(SITE)="")&($G(HIST)="") D Q
. S TMP=""
. S:$D(IEN)#10 TMP=TMP_", IEN="_IEN
. S:$D(SITE)#10 TMP=TMP_", SITE="_SITE
. S:$D(HIST)#10 TMP=TMP_", HIST="_HIST
. S TMP=$P(TMP,", ",2,999)
. D PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,TMP,"IEN, SITE, HIST"))
;---
L +^XTMP("ONCSAPI","TABLES","JOB",$J):5 E D Q
. D ERROR^ONCSAPIE(-15,,"access control node")
. D ERRORS("HLP")
;
S RC=0 D
. ;--- Get the table IEN
. S TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
. I TBLIEN<0 S RC=TBLIEN Q
. ;--- Initialize constants and variables
. S NODE=$NA(^XTMP("ONCSAPI","TABLES",TBLIEN))
. S MNL=$S($G(IOSL)>3:IOSL-3,1:20),$Y=0
. ;--- Display the title and optional subtitle
. S TMP=$G(@NODE@(0))
. D WW^ONCSAPIU($P(TMP,U,5))
. D:$P(TMP,U,6)'="" WW^ONCSAPIU($P(TMP,U,6))
. ;--- Display top notes
. I SHNS D I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. . S (EXIT,NOTE)=0
. . F S NOTE=$O(@NODE@("TN",NOTE)) Q:NOTE'>0 D Q:EXIT
. . . D EN^DDIOL(" ")
. . . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. . . S I=0
. . . F S I=$O(@NODE@("TN",NOTE,I)) Q:I'>0 D Q:EXIT
. . . . D EN^DDIOL(@NODE@("TN",NOTE,I))
. . . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
. ;--- Display the table
. D EN^DDIOL(" ")
. S (EXIT,ROW)=0
. F S ROW=$O(@NODE@(ROW)) Q:ROW'>0 D Q:EXIT
. . D EN^DDIOL($J($P(@NODE@(ROW,1),U),7))
. . D:$D(@NODE@(ROW,3,1)) EN^DDIOL(@NODE@(ROW,3,1),,"?9")
. . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. . S I=1
. . F S I=$O(@NODE@(ROW,3,I)) Q:I="" D Q:EXIT
. . . D EN^DDIOL(@NODE@(ROW,3,I),,"!?9")
. . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
. ;--- Display footnotes
. I SHNS D I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. . S (EXIT,NOTE)=0
. . F S NOTE=$O(@NODE@("FN",NOTE)) Q:NOTE'>0 D Q:EXIT
. . . D EN^DDIOL(" ")
. . . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. . . S I=0
. . . F S I=$O(@NODE@("FN",NOTE,I)) Q:I'>0 D Q:EXIT
. . . . D EN^DDIOL(@NODE@("FN",NOTE,I))
. . . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
. . D EN^DDIOL(" ")
;
L -^XTMP("ONCSAPI","TABLES","JOB",$J)
D:RC<0 ERRORS("HLP",RC)
Q
;
;***** VALIDATES AND TRANSFORMS THE INPUT (CODES)
;
; X Input value should be assigned to the X local
; variable before calling this procedure. The
; variable is KILL'ed if it has an invalid value.
;
; TABLE Table number (see the ^ONCSAPI routine)
;
; CODELEN Valid length of the code
;
; [IEN] IEN of the record in the file #165.5
;
; [SITE] Primary site
; [HIST] Histology
;
; [SILENT] Silent mode flags (can be combined):
; D Do not display code description
; E Do not display error messages
;
; Either the IEN or both the SITE and HIST must be provided.
;
INPUT(TABLE,CODELEN,IEN,SITE,HIST,SILENT) ;
N CODE,ONCBUF,ONCSAPI,RC,TBLIEN,TMP
S X=$$TRIM^XLFSTR($G(X))
I X'?@(CODELEN_"N") K X Q
S:'($D(SILENT)#10) SILENT=$S($G(DIUTIL)="VERIFY FIELDS":"DE",1:"")
D CLEAR^ONCSAPIE(1)
;---
D:$G(IEN)>0
. S SITE=$TR($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
. S HIST=$E($$HIST^ONCFUNC(IEN),1,4)
. S DISCRIM=$$GET1^DIQ(165.5,IEN,240)
I ($G(SITE)="")&($G(HIST)="") D K X Q
. D PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,,"IEN, SITE, HIST"))
;---
L +^XTMP("ONCSAPI","TABLES","JOB",$J):5 E D K X Q
. D ERROR^ONCSAPIE(-15,,"access control node")
. D ERRORS("INP")
;
S RC=0 D
. ;--- Get the table IEN
. S TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
. I TBLIEN<0 S RC=TBLIEN Q
. ;--- Check the single code
. S CODE=+$G(X)
. Q:$D(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE))
. ;--- Check the interval
. S TMP=$O(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE),-1)
. I TMP'="" D Q:CODE'>$P(TMP,U,2)
. . S TMP=$G(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",TMP))
. ;--- Invalid value
. K X
;
I $D(X)&(RC'<0) D:SILENT'["D"
. Q:$$CODEDESC^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE,X,"ONCBUF")<0
. I ONCBUF(1)["OBSOLETE" K X W " OBSOLETE code" Q
. S TMP=""
. F S TMP=$O(ONCBUF(TMP)) Q:TMP="" S ONCBUF(TMP,"F")="!?2"
. D EN^DDIOL(.ONCBUF),EN^DDIOL(" ")
;
L -^XTMP("ONCSAPI","TABLES","JOB",$J)
I RC<0 D:SILENT'["E" ERRORS("INP",RC) K X
Q
;
CLEANUP ;Cleanup
K DIUTIL
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSAPI1 5511 printed Dec 13, 2024@02:27:43 Page 2
ONCSAPI1 ;Hines OIFO/SG - COLLABORATIVE STAGING (DD TOOLS) ;06/23/10
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 QUIT
+4 ;
+5 ;***** DISPLAYS THE ERRORS
ERRORS(MODE,ERRCODE) ;
+1 SET ERRCODE=+$GET(ERRCODE)
+2 ;--- Display the explanations (for the user)
+3 IF MODE="HLP"
if (ERRCODE=-10)
Begin DoDot:1
+4 DO ERROR^ONCSAPIE(-19,"Please try later.")
End DoDot:1
+5 IF '$TEST
IF MODE="INP"
if (ERRCODE'=-2)
Begin DoDot:1
+6 DO ERROR^ONCSAPIE(-20,"Please inform IRM about the problem.")
End DoDot:1
+7 IF '$TEST
IF MODE="CDN"
if (ERRCODE=-10)
Begin DoDot:1
+8 DO ERROR^ONCSAPIE(-21,"Please try later.")
End DoDot:1
+9 ;--- Display the error stack (for the IRM)
+10 DO PRTERRS^ONCSAPIE()
+11 QUIT
+12 ;
+13 ;***** DISPLAYS THE HELP FOR A FIELD
+14 ;
+15 ; TABLE Table number (see the ^ONCSAPI routine)
+16 ;
+17 ; [IEN] IEN of the record in the file #165.5
+18 ;
+19 ; [SITE] Primary site
+20 ; [HIST] Histology
+21 ;
+22 ; Either the IEN or both the SITE and HIST must be provided.
+23 ;
HELP(TABLE,IEN,SITE,HIST) ;
+1 NEW DISCRIM,EXIT,I,MNL,NODE,NOTE,ONCMSG,ONCSAPI,RC,ROW,SHNS,TBLIEN,TMP
+2 SET SHNS=$SELECT($GET(X)="":1,1:X="??")
+3 DO CLEAR^ONCSAPIE(1)
+4 if $GET(IEN)>0
Begin DoDot:1
+5 SET SITE=$TRANSLATE($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
+6 SET HIST=$EXTRACT($$HIST^ONCFUNC(IEN),1,4)
+7 SET DISCRIM=$$GET1^DIQ(165.5,IEN,240)
End DoDot:1
+8 IF ($GET(SITE)="")&($GET(HIST)="")
Begin DoDot:1
+9 SET TMP=""
+10 if $DATA(IEN)#10
SET TMP=TMP_", IEN="_IEN
+11 if $DATA(SITE)#10
SET TMP=TMP_", SITE="_SITE
+12 if $DATA(HIST)#10
SET TMP=TMP_", HIST="_HIST
+13 SET TMP=$PIECE(TMP,", ",2,999)
+14 DO PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,TMP,"IEN, SITE, HIST"))
End DoDot:1
QUIT
+15 ;---
+16 LOCK +^XTMP("ONCSAPI","TABLES","JOB",$JOB):5
IF '$TEST
Begin DoDot:1
+17 DO ERROR^ONCSAPIE(-15,,"access control node")
+18 DO ERRORS("HLP")
End DoDot:1
QUIT
+19 ;
+20 SET RC=0
Begin DoDot:1
+21 ;--- Get the table IEN
+22 SET TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
+23 IF TBLIEN<0
SET RC=TBLIEN
QUIT
+24 ;--- Initialize constants and variables
+25 SET NODE=$NAME(^XTMP("ONCSAPI","TABLES",TBLIEN))
+26 SET MNL=$SELECT($GET(IOSL)>3:IOSL-3,1:20)
SET $Y=0
+27 ;--- Display the title and optional subtitle
+28 SET TMP=$GET(@NODE@(0))
+29 DO WW^ONCSAPIU($PIECE(TMP,U,5))
+30 if $PIECE(TMP,U,6)'=""
DO WW^ONCSAPIU($PIECE(TMP,U,6))
+31 ;--- Display top notes
+32 IF SHNS
Begin DoDot:2
+33 SET (EXIT,NOTE)=0
+34 FOR
SET NOTE=$ORDER(@NODE@("TN",NOTE))
if NOTE'>0
QUIT
Begin DoDot:3
+35 DO EN^DDIOL(" ")
+36 IF $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
+37 SET I=0
+38 FOR
SET I=$ORDER(@NODE@("TN",NOTE,I))
if I'>0
QUIT
Begin DoDot:4
+39 DO EN^DDIOL(@NODE@("TN",NOTE,I))
+40 if $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
End DoDot:4
if EXIT
QUIT
End DoDot:3
if EXIT
QUIT
End DoDot:2
IF $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
+41 ;--- Display the table
+42 DO EN^DDIOL(" ")
+43 SET (EXIT,ROW)=0
+44 FOR
SET ROW=$ORDER(@NODE@(ROW))
if ROW'>0
QUIT
Begin DoDot:2
+45 DO EN^DDIOL($JUSTIFY($PIECE(@NODE@(ROW,1),U),7))
+46 if $DATA(@NODE@(ROW,3,1))
DO EN^DDIOL(@NODE@(ROW,3,1),,"?9")
+47 IF $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
+48 SET I=1
+49 FOR
SET I=$ORDER(@NODE@(ROW,3,I))
if I=""
QUIT
Begin DoDot:3
+50 DO EN^DDIOL(@NODE@(ROW,3,I),,"!?9")
+51 if $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
End DoDot:3
if EXIT
QUIT
End DoDot:2
if EXIT
QUIT
+52 ;--- Display footnotes
+53 IF SHNS
Begin DoDot:2
+54 SET (EXIT,NOTE)=0
+55 FOR
SET NOTE=$ORDER(@NODE@("FN",NOTE))
if NOTE'>0
QUIT
Begin DoDot:3
+56 DO EN^DDIOL(" ")
+57 IF $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
+58 SET I=0
+59 FOR
SET I=$ORDER(@NODE@("FN",NOTE,I))
if I'>0
QUIT
Begin DoDot:4
+60 DO EN^DDIOL(@NODE@("FN",NOTE,I))
+61 if $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
End DoDot:4
if EXIT
QUIT
End DoDot:3
if EXIT
QUIT
+62 DO EN^DDIOL(" ")
End DoDot:2
IF $Y'<MNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
End DoDot:1
+63 ;
+64 LOCK -^XTMP("ONCSAPI","TABLES","JOB",$JOB)
+65 if RC<0
DO ERRORS("HLP",RC)
+66 QUIT
+67 ;
+68 ;***** VALIDATES AND TRANSFORMS THE INPUT (CODES)
+69 ;
+70 ; X Input value should be assigned to the X local
+71 ; variable before calling this procedure. The
+72 ; variable is KILL'ed if it has an invalid value.
+73 ;
+74 ; TABLE Table number (see the ^ONCSAPI routine)
+75 ;
+76 ; CODELEN Valid length of the code
+77 ;
+78 ; [IEN] IEN of the record in the file #165.5
+79 ;
+80 ; [SITE] Primary site
+81 ; [HIST] Histology
+82 ;
+83 ; [SILENT] Silent mode flags (can be combined):
+84 ; D Do not display code description
+85 ; E Do not display error messages
+86 ;
+87 ; Either the IEN or both the SITE and HIST must be provided.
+88 ;
INPUT(TABLE,CODELEN,IEN,SITE,HIST,SILENT) ;
+1 NEW CODE,ONCBUF,ONCSAPI,RC,TBLIEN,TMP
+2 SET X=$$TRIM^XLFSTR($GET(X))
+3 IF X'?@(CODELEN_"N")
KILL X
QUIT
+4 if '($DATA(SILENT)#10)
SET SILENT=$SELECT($GET(DIUTIL)="VERIFY FIELDS":"DE",1:"")
+5 DO CLEAR^ONCSAPIE(1)
+6 ;---
+7 if $GET(IEN)>0
Begin DoDot:1
+8 SET SITE=$TRANSLATE($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
+9 SET HIST=$EXTRACT($$HIST^ONCFUNC(IEN),1,4)
+10 SET DISCRIM=$$GET1^DIQ(165.5,IEN,240)
End DoDot:1
+11 IF ($GET(SITE)="")&($GET(HIST)="")
Begin DoDot:1
+12 DO PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,,"IEN, SITE, HIST"))
End DoDot:1
KILL X
QUIT
+13 ;---
+14 LOCK +^XTMP("ONCSAPI","TABLES","JOB",$JOB):5
IF '$TEST
Begin DoDot:1
+15 DO ERROR^ONCSAPIE(-15,,"access control node")
+16 DO ERRORS("INP")
End DoDot:1
KILL X
QUIT
+17 ;
+18 SET RC=0
Begin DoDot:1
+19 ;--- Get the table IEN
+20 SET TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
+21 IF TBLIEN<0
SET RC=TBLIEN
QUIT
+22 ;--- Check the single code
+23 SET CODE=+$GET(X)
+24 if $DATA(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE))
QUIT
+25 ;--- Check the interval
+26 SET TMP=$ORDER(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE),-1)
+27 IF TMP'=""
Begin DoDot:2
+28 SET TMP=$GET(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",TMP))
End DoDot:2
if CODE'>$PIECE(TMP,U,2)
QUIT
+29 ;--- Invalid value
+30 KILL X
End DoDot:1
+31 ;
+32 IF $DATA(X)&(RC'<0)
if SILENT'["D"
Begin DoDot:1
+33 if $$CODEDESC^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE,X,"ONCBUF")<0
QUIT
+34 IF ONCBUF(1)["OBSOLETE"
KILL X
WRITE " OBSOLETE code"
QUIT
+35 SET TMP=""
+36 FOR
SET TMP=$ORDER(ONCBUF(TMP))
if TMP=""
QUIT
SET ONCBUF(TMP,"F")="!?2"
+37 DO EN^DDIOL(.ONCBUF)
DO EN^DDIOL(" ")
End DoDot:1
+38 ;
+39 LOCK -^XTMP("ONCSAPI","TABLES","JOB",$JOB)
+40 IF RC<0
if SILENT'["E"
DO ERRORS("INP",RC)
KILL X
+41 QUIT
+42 ;
CLEANUP ;Cleanup
+1 KILL DIUTIL