ONCOEDC ;HINES OIFO/GWB - ABSTRACT STATUS (165.5,91) Input Transform ;10/19/11
;;2.2;ONCOLOGY;**1,5,6,10,19,20**;Jul 31, 2013;Build 5
;p20 -Abstract Status change
CHECK ;Required field check
;CLASS OF CASE = 00-22
;SEQUENCE NUMBER = 00-59 or 99
;DATE DX > 12/31/95
N ABSTAT,CC,CMPLT,CNT,DCC,DCLC,DTDX,ERRFLG,EX,FDNUM,FLDNAME,FN,LINE,ONCX
N NODE0,ONCANL,ONCFILE,PAUSE,PRM,PTN,SQN
;next line added to set Abstracted By field for Accession Only cases
I X="A",$P(^ONCO(165.5,D0,7),U,3)="" S $P(^ONCO(165.5,D0,7),U,3)=DUZ
S PRM=D0
I X'=($P(^ONCO(165.5,D0,7),U,2)) S $P(^ONCO(165.5,D0,7),U,22)=DUZ,$P(^ONCO(165.5,D0,7),U,21)=DT
I (X=0)!(X=1)!(X=2)!(X="A")!(X="D") Q
S PTN=$P($G(^ONCO(165.5,D0,0)),U,2)
S CMPLT=1,NODE0=$G(^ONCO(165.5,D0,0)),ONCTYP="",ONCANL="" K LIST
S (COC,CC)=$E($$GET1^DIQ(165.5,D0,.04),1,2)
S SQN=$P(NODE0,U,6),DTDX=$P(NODE0,U,16)
S ABSTAT=$P($G(^ONCO(165.5,D0,7)),U,2)
I DTDX>3171231 D OBS2018^ONCOEDC2
I CC="" D S ONCTYP="" K X Q
.W !
.W !?5,"CLASS OF CLASS is blank."
.W !?5,"""Required"" field checking requires CLASS OF CASE."
.W !
I +CC<23,(+SQN<60)!(SQN=99),DTDX>2951231 S ONCANL=1 D CHKFLDS
;follow-up and approach fields must be entered.
N ONCFOLDT,ONCAUDT
I $D(^ONCO(160,PTN,1)) S ONCAUDT=$P(^ONCO(160,PTN,1),U,9)
S ONCFOLDT=$O(^ONCO(160,PTN,"F","B",9999999),-1)
I '$G(ONCAUDT) D
.I (ONCFOLDT="")!(ONCFOLDT<DTDX) S LIST("DATE OF LAST CONTACT OR DEATH")="" S CMPLT=0
I (DTDX>3091231),($$GET1^DIQ(165.5,PRM,234,"I")="") S CMPLT=0,LIST($P($G(^DD(165.5,234,0)),U,1))=""
;
I CMPLT=0 S ONCTYP="A" K X Q
I CMPLT=1 D
.I $G(ONCANL)=1 D
..W !!," All required data fields have been entered."
..W !!," Beginning inter-field edit checks..." Q
.W ! D ^ONCEDIT
I CMPLT=1 W !," No inter-field edit check warnings.",! D EDITS Q
I $G(OVERRIDE)="NO" G QUIT
K DIR S DIR(0)="YA"
S DIR("A",1)=" This abstract has inter-field WARNINGS."
S DIR("A")=" Do you wish to ignore them and proceed to the EDITS API? "
S DIR("B")="No" D ^DIR K DIR
I Y=1 S X=3 W ! D EDITS Q
QUIT K OVERRIDE
S EDIT="YES"
S ONCTYP="B" W ! S X=ABSTAT Q
;
CHKFLDS ;Check ONCOLOGY PRIMARY (165.5) and ONCOLOGY PATIENT (160)
S ONCFILE=165.5 D F1655^ONCOEDC1
S ONCFILE=160 D F160
Q
;
F160 ;ONCOLOGY PATIENT (160)
F FDNUM=2,3,7,8,9,10,38,43 D
.D:$$GET1^DIQ(160,PTN,FDNUM,"I")="" CMPLT
Q
;
CMPLT ;Set CMPLT = 0 and add field to list of fields needed to be filled in.
S FLDNAME=$P($G(^DD(ONCFILE,FDNUM,0)),U,1) S FDNUM=""
S CMPLT=0,LIST(FLDNAME)=""
Q
;
PRINT ;Display results
I $G(ONCTYP)="" Q
I ONCTYP="A" D REQ
I ONCTYP="B" D INTER
W !
K ONCTYP
Q
;
REQ ;Missing "required" data item list
W !," ABSTRACT STATUS may not be set to COMPLETE unless"
W !," all ""required"" data items have been entered.",!
W !," The following ""required"" data items have not been"
W !," entered for this primary:",!
S EX="",LINE=$S($E(IOST,1,2)="C-":IOSL-2,1:IOSL-6),CNT=0
S FN=""
F S FN=$O(LIST(FN)),CNT=CNT+1 Q:FN="" W !,?2,FN I CNT>14 D PCHK Q:EX=U
Q
;
INTER ;Interfield edit warnings
;W !?5,"ABSTRACT STATUS may not be set to COMPLETE until all interfield"
;W !?5,"warnings listed above have been cleared."
Q
;
PCHK ;Enter RETURN to continue or '^' to exit:
I ($Y'<(LINE-1)) D Q:EX=U W !
.W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
.W @IOF Q
Q
;
EDITS ;Call to EDITS API
; p20 do not allow completion of 2024+ cases. These comments and
; the following line will be removed in p21. X=2 because its Input Transform
I DATEDX>3231231 W !!,"THIS CASE HAS A DATE DX OF 2024 AND CANNOT BE COMPLETED YET",! S $P(^ONCO(165.5,D0,7),U,2)=2 S X=2 R !?1," press RETURN to continue->",ANSWER:DTIME Q
S ERRFLG=0
;Q:($G(ONCOEDIT)=1)
W !," Calling EDITS API..."
N ONCDST,ONCSAPI,ONCDTTIM,ONCDTEMP
D NOW^%DTC S ONCDTTIM=%
S DCC=$P($G(^ONCO(165.5,D0,7)),U,1)
S DCLC=$P($G(^ONCO(165.5,D0,7)),U,21)
I DCC="" D
.S $P(^ONCO(165.5,PRM,7),U,1)=ONCDTTIM
.S ^ONCO(165.5,"AAD",ONCDTTIM,PRM)=""
.S $P(^ONCO(165.5,PRM,7),U,3)=DUZ
.S $P(^ONCO(165.5,PRM,"EDITS"),U,3)="N"
I ABSTAT=3,$P($G(^ONCO(165.5,D0,7)),U,3)="" S $P(^ONCO(165.5,PRM,7),U,3)=DUZ
I DCC'="",$P($G(^ONCO(165.5,D0,7)),U,3)="" S $P(^ONCO(165.5,PRM,7),U,3)=DUZ
D ^ONCGENED
K EDIT
I ERRFLG'=0 D Q
.I ABSTAT=3 W !!,"EDITS errors were encountered. ABSTRACT STATUS changed to 0 (Incomplete).",!
.I ABSTAT'=3 W !!,"EDITS errors were encountered. ABSTRACT STATUS is unchanged.",!
.I DCC="" D
..S $P(^ONCO(165.5,D0,7),U,1)=""
..K ^ONCO(165.5,"AAD",ONCDTTIM,PRM)
..S $P(^ONCO(165.5,D0,7),U,3)=""
..S $P(^ONCO(165.5,D0,"EDITS"),U,3)=""
.K DIR S DIR(0)="YA"
.S DIR("A")=" Do you wish to return to the Primary Menu Options? "
.S DIR("B")="Yes" D ^DIR K DIR
.I Y=1 S EDIT="YES"
.S X=$S(ABSTAT=3:0,1:ABSTAT)
W !," No EDITS errors or warnings."
S SAVEX=3,$P(^ONCO(165.5,D0,7),U,2)=3,^ONCO(165.5,"AS",3,D0)=""
;S ONCEDC3=1,DIE="^ONCO(165.5,",DA=D0,DR="91///^S X=3" D ^DIE K ONCEDC3
I DCC'="" D
.I DCLC'="" K ^ONCO(165.5,"AAE",DCLC,PRM)
.S $P(^ONCO(165.5,PRM,7),U,21)=ONCDTTIM
.S ^ONCO(165.5,"AAE",DT,PRM)=""
.S $P(^ONCO(165.5,PRM,7),U,22)=DUZ
.S:$P(^ONCO(165.5,PRM,7),U,3)="" $P(^ONCO(165.5,PRM,7),U,3)=DUZ
W !
W !," ABSTRACT STATUS.............: ",$$GET1^DIQ(165.5,D0,91,"E")
W !," DATE CASE INITIATED.........: ",$$GET1^DIQ(165.5,D0,236,"E")
W !," INITIATED BY................: ",$$GET1^DIQ(165.5,D0,244,"E")
W !," DATE OF FIRST CONTACT.......: ",$$GET1^DIQ(165.5,D0,155,"E")
W !," DATE CASE COMPLETED.........: " S ONCDTEMP=$P($G(^ONCO(165.5,D0,7)),U,1) W $$FMTE^XLFDT(ONCDTEMP,"5P")
W !," ELAPSED DAYS TO COMPLETION..: ",$$GET1^DIQ(165.5,D0,157,"E")
;W !," ELAPSED MONTHS TO COMPLETION: ",$$GET1^DIQ(165.5,D0,157.1,"E")
W !," ABSTRACTED BY...............: ",$$GET1^DIQ(165.5,D0,92,"E")
W !," DATE CASE LAST CHANGED......: " S ONCDTEMP=$P($G(^ONCO(165.5,D0,7)),U,21) W $$FMTE^XLFDT(ONCDTEMP,"5P")
W !," CASE LAST CHANGED BY........: ",$$GET1^DIQ(165.5,D0,199,"E")
W !
S EDITS="NO" D NAACCR^ONCGENED K EDITS
S ONCDST=$NA(^TMP("ONC",$J))
D CHKSUM^ONCGENED
W ! R "Enter RETURN to continue: ",PAUSE:30
I $G(SAVEX)=3 S X=3
Q
;
CLEANUP ;Cleanup
K COC,D0,Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCOEDC 6238 printed Dec 13, 2024@02:24:54 Page 2
ONCOEDC ;HINES OIFO/GWB - ABSTRACT STATUS (165.5,91) Input Transform ;10/19/11
+1 ;;2.2;ONCOLOGY;**1,5,6,10,19,20**;Jul 31, 2013;Build 5
+2 ;p20 -Abstract Status change
CHECK ;Required field check
+1 ;CLASS OF CASE = 00-22
+2 ;SEQUENCE NUMBER = 00-59 or 99
+3 ;DATE DX > 12/31/95
+4 NEW ABSTAT,CC,CMPLT,CNT,DCC,DCLC,DTDX,ERRFLG,EX,FDNUM,FLDNAME,FN,LINE,ONCX
+5 NEW NODE0,ONCANL,ONCFILE,PAUSE,PRM,PTN,SQN
+6 ;next line added to set Abstracted By field for Accession Only cases
+7 IF X="A"
IF $PIECE(^ONCO(165.5,D0,7),U,3)=""
SET $PIECE(^ONCO(165.5,D0,7),U,3)=DUZ
+8 SET PRM=D0
+9 IF X'=($PIECE(^ONCO(165.5,D0,7),U,2))
SET $PIECE(^ONCO(165.5,D0,7),U,22)=DUZ
SET $PIECE(^ONCO(165.5,D0,7),U,21)=DT
+10 IF (X=0)!(X=1)!(X=2)!(X="A")!(X="D")
QUIT
+11 SET PTN=$PIECE($GET(^ONCO(165.5,D0,0)),U,2)
+12 SET CMPLT=1
SET NODE0=$GET(^ONCO(165.5,D0,0))
SET ONCTYP=""
SET ONCANL=""
KILL LIST
+13 SET (COC,CC)=$EXTRACT($$GET1^DIQ(165.5,D0,.04),1,2)
+14 SET SQN=$PIECE(NODE0,U,6)
SET DTDX=$PIECE(NODE0,U,16)
+15 SET ABSTAT=$PIECE($GET(^ONCO(165.5,D0,7)),U,2)
+16 IF DTDX>3171231
DO OBS2018^ONCOEDC2
+17 IF CC=""
Begin DoDot:1
+18 WRITE !
+19 WRITE !?5,"CLASS OF CLASS is blank."
+20 WRITE !?5,"""Required"" field checking requires CLASS OF CASE."
+21 WRITE !
End DoDot:1
SET ONCTYP=""
KILL X
QUIT
+22 IF +CC<23
IF (+SQN<60)!(SQN=99)
IF DTDX>2951231
SET ONCANL=1
DO CHKFLDS
+23 ;follow-up and approach fields must be entered.
+24 NEW ONCFOLDT,ONCAUDT
+25 IF $DATA(^ONCO(160,PTN,1))
SET ONCAUDT=$PIECE(^ONCO(160,PTN,1),U,9)
+26 SET ONCFOLDT=$ORDER(^ONCO(160,PTN,"F","B",9999999),-1)
+27 IF '$GET(ONCAUDT)
Begin DoDot:1
+28 IF (ONCFOLDT="")!(ONCFOLDT<DTDX)
SET LIST("DATE OF LAST CONTACT OR DEATH")=""
SET CMPLT=0
End DoDot:1
+29 IF (DTDX>3091231)
IF ($$GET1^DIQ(165.5,PRM,234,"I")="")
SET CMPLT=0
SET LIST($PIECE($GET(^DD(165.5,234,0)),U,1))=""
+30 ;
+31 IF CMPLT=0
SET ONCTYP="A"
KILL X
QUIT
+32 IF CMPLT=1
Begin DoDot:1
+33 IF $GET(ONCANL)=1
Begin DoDot:2
+34 WRITE !!," All required data fields have been entered."
+35 WRITE !!," Beginning inter-field edit checks..."
QUIT
End DoDot:2
+36 WRITE !
DO ^ONCEDIT
End DoDot:1
+37 IF CMPLT=1
WRITE !," No inter-field edit check warnings.",!
DO EDITS
QUIT
+38 IF $GET(OVERRIDE)="NO"
GOTO QUIT
+39 KILL DIR
SET DIR(0)="YA"
+40 SET DIR("A",1)=" This abstract has inter-field WARNINGS."
+41 SET DIR("A")=" Do you wish to ignore them and proceed to the EDITS API? "
+42 SET DIR("B")="No"
DO ^DIR
KILL DIR
+43 IF Y=1
SET X=3
WRITE !
DO EDITS
QUIT
QUIT KILL OVERRIDE
+1 SET EDIT="YES"
+2 SET ONCTYP="B"
WRITE !
SET X=ABSTAT
QUIT
+3 ;
CHKFLDS ;Check ONCOLOGY PRIMARY (165.5) and ONCOLOGY PATIENT (160)
+1 SET ONCFILE=165.5
DO F1655^ONCOEDC1
+2 SET ONCFILE=160
DO F160
+3 QUIT
+4 ;
F160 ;ONCOLOGY PATIENT (160)
+1 FOR FDNUM=2,3,7,8,9,10,38,43
Begin DoDot:1
+2 if $$GET1^DIQ(160,PTN,FDNUM,"I")=""
DO CMPLT
End DoDot:1
+3 QUIT
+4 ;
CMPLT ;Set CMPLT = 0 and add field to list of fields needed to be filled in.
+1 SET FLDNAME=$PIECE($GET(^DD(ONCFILE,FDNUM,0)),U,1)
SET FDNUM=""
+2 SET CMPLT=0
SET LIST(FLDNAME)=""
+3 QUIT
+4 ;
PRINT ;Display results
+1 IF $GET(ONCTYP)=""
QUIT
+2 IF ONCTYP="A"
DO REQ
+3 IF ONCTYP="B"
DO INTER
+4 WRITE !
+5 KILL ONCTYP
+6 QUIT
+7 ;
REQ ;Missing "required" data item list
+1 WRITE !," ABSTRACT STATUS may not be set to COMPLETE unless"
+2 WRITE !," all ""required"" data items have been entered.",!
+3 WRITE !," The following ""required"" data items have not been"
+4 WRITE !," entered for this primary:",!
+5 SET EX=""
SET LINE=$SELECT($EXTRACT(IOST,1,2)="C-":IOSL-2,1:IOSL-6)
SET CNT=0
+6 SET FN=""
+7 FOR
SET FN=$ORDER(LIST(FN))
SET CNT=CNT+1
if FN=""
QUIT
WRITE !,?2,FN
IF CNT>14
DO PCHK
if EX=U
QUIT
+8 QUIT
+9 ;
INTER ;Interfield edit warnings
+1 ;W !?5,"ABSTRACT STATUS may not be set to COMPLETE until all interfield"
+2 ;W !?5,"warnings listed above have been cleared."
+3 QUIT
+4 ;
PCHK ;Enter RETURN to continue or '^' to exit:
+1 IF ($Y'<(LINE-1))
Begin DoDot:1
+2 WRITE !
KILL DIR
SET DIR(0)="E"
DO ^DIR
IF 'Y
SET EX=U
QUIT
+3 WRITE @IOF
QUIT
End DoDot:1
if EX=U
QUIT
WRITE !
+4 QUIT
+5 ;
EDITS ;Call to EDITS API
+1 ; p20 do not allow completion of 2024+ cases. These comments and
+2 ; the following line will be removed in p21. X=2 because its Input Transform
+3 IF DATEDX>3231231
WRITE !!,"THIS CASE HAS A DATE DX OF 2024 AND CANNOT BE COMPLETED YET",!
SET $PIECE(^ONCO(165.5,D0,7),U,2)=2
SET X=2
READ !?1," press RETURN to continue->",ANSWER:DTIME
QUIT
+4 SET ERRFLG=0
+5 ;Q:($G(ONCOEDIT)=1)
+6 WRITE !," Calling EDITS API..."
+7 NEW ONCDST,ONCSAPI,ONCDTTIM,ONCDTEMP
+8 DO NOW^%DTC
SET ONCDTTIM=%
+9 SET DCC=$PIECE($GET(^ONCO(165.5,D0,7)),U,1)
+10 SET DCLC=$PIECE($GET(^ONCO(165.5,D0,7)),U,21)
+11 IF DCC=""
Begin DoDot:1
+12 SET $PIECE(^ONCO(165.5,PRM,7),U,1)=ONCDTTIM
+13 SET ^ONCO(165.5,"AAD",ONCDTTIM,PRM)=""
+14 SET $PIECE(^ONCO(165.5,PRM,7),U,3)=DUZ
+15 SET $PIECE(^ONCO(165.5,PRM,"EDITS"),U,3)="N"
End DoDot:1
+16 IF ABSTAT=3
IF $PIECE($GET(^ONCO(165.5,D0,7)),U,3)=""
SET $PIECE(^ONCO(165.5,PRM,7),U,3)=DUZ
+17 IF DCC'=""
IF $PIECE($GET(^ONCO(165.5,D0,7)),U,3)=""
SET $PIECE(^ONCO(165.5,PRM,7),U,3)=DUZ
+18 DO ^ONCGENED
+19 KILL EDIT
+20 IF ERRFLG'=0
Begin DoDot:1
+21 IF ABSTAT=3
WRITE !!,"EDITS errors were encountered. ABSTRACT STATUS changed to 0 (Incomplete).",!
+22 IF ABSTAT'=3
WRITE !!,"EDITS errors were encountered. ABSTRACT STATUS is unchanged.",!
+23 IF DCC=""
Begin DoDot:2
+24 SET $PIECE(^ONCO(165.5,D0,7),U,1)=""
+25 KILL ^ONCO(165.5,"AAD",ONCDTTIM,PRM)
+26 SET $PIECE(^ONCO(165.5,D0,7),U,3)=""
+27 SET $PIECE(^ONCO(165.5,D0,"EDITS"),U,3)=""
End DoDot:2
+28 KILL DIR
SET DIR(0)="YA"
+29 SET DIR("A")=" Do you wish to return to the Primary Menu Options? "
+30 SET DIR("B")="Yes"
DO ^DIR
KILL DIR
+31 IF Y=1
SET EDIT="YES"
+32 SET X=$SELECT(ABSTAT=3:0,1:ABSTAT)
End DoDot:1
QUIT
+33 WRITE !," No EDITS errors or warnings."
+34 SET SAVEX=3
SET $PIECE(^ONCO(165.5,D0,7),U,2)=3
SET ^ONCO(165.5,"AS",3,D0)=""
+35 ;S ONCEDC3=1,DIE="^ONCO(165.5,",DA=D0,DR="91///^S X=3" D ^DIE K ONCEDC3
+36 IF DCC'=""
Begin DoDot:1
+37 IF DCLC'=""
KILL ^ONCO(165.5,"AAE",DCLC,PRM)
+38 SET $PIECE(^ONCO(165.5,PRM,7),U,21)=ONCDTTIM
+39 SET ^ONCO(165.5,"AAE",DT,PRM)=""
+40 SET $PIECE(^ONCO(165.5,PRM,7),U,22)=DUZ
+41 if $PIECE(^ONCO(165.5,PRM,7),U,3)=""
SET $PIECE(^ONCO(165.5,PRM,7),U,3)=DUZ
End DoDot:1
+42 WRITE !
+43 WRITE !," ABSTRACT STATUS.............: ",$$GET1^DIQ(165.5,D0,91,"E")
+44 WRITE !," DATE CASE INITIATED.........: ",$$GET1^DIQ(165.5,D0,236,"E")
+45 WRITE !," INITIATED BY................: ",$$GET1^DIQ(165.5,D0,244,"E")
+46 WRITE !," DATE OF FIRST CONTACT.......: ",$$GET1^DIQ(165.5,D0,155,"E")
+47 WRITE !," DATE CASE COMPLETED.........: "
SET ONCDTEMP=$PIECE($GET(^ONCO(165.5,D0,7)),U,1)
WRITE $$FMTE^XLFDT(ONCDTEMP,"5P")
+48 WRITE !," ELAPSED DAYS TO COMPLETION..: ",$$GET1^DIQ(165.5,D0,157,"E")
+49 ;W !," ELAPSED MONTHS TO COMPLETION: ",$$GET1^DIQ(165.5,D0,157.1,"E")
+50 WRITE !," ABSTRACTED BY...............: ",$$GET1^DIQ(165.5,D0,92,"E")
+51 WRITE !," DATE CASE LAST CHANGED......: "
SET ONCDTEMP=$PIECE($GET(^ONCO(165.5,D0,7)),U,21)
WRITE $$FMTE^XLFDT(ONCDTEMP,"5P")
+52 WRITE !," CASE LAST CHANGED BY........: ",$$GET1^DIQ(165.5,D0,199,"E")
+53 WRITE !
+54 SET EDITS="NO"
DO NAACCR^ONCGENED
KILL EDITS
+55 SET ONCDST=$NAME(^TMP("ONC",$JOB))
+56 DO CHKSUM^ONCGENED
+57 WRITE !
READ "Enter RETURN to continue: ",PAUSE:30
+58 IF $GET(SAVEX)=3
SET X=3
+59 QUIT
+60 ;
CLEANUP ;Cleanup
+1 KILL COC,D0,Y