ONCRESTG ;Hines OIFO/GWB - Restage 2003+ cases ;07/10/09
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;Check T version
;S VER=$T(LOGO+3^ONCODIS)
;S VER=$E(VER,29)
;I VER>1 K VER Q
;
N D0,RESTAGE,XDT
S RESTAGE="YES"
W !!," Restaging 2003+ cases"
S XDT=3030000 F CNT=1:1 S XDT=$O(^ONCO(165.5,"ADX",XDT)) Q:XDT="" S D0=0 F S D0=$O(^ONCO(165.5,"ADX",XDT,D0)) Q:D0="" D RESTAGE W:CNT#100=0 "."
Q
;
RESTAGE ;Restage 6th Edition cases
S STGIND="P"
S (ONCED,ONCOED)=6
S DA=D0
S XX=$G(^ONCO(165.5,D0,2))
Q:XX=""
S ST=$P(^ONCO(165.5,D0,0),U,1)
S G=$P(^ONCO(165.5,D0,2),U,5)
S TX=$P(^ONCO(165.5,D0,2),U,1)
S HT=$$HIST^ONCFUNC(D0)
S SP=$P($G(^ONCO(164,+TX,0)),U,11)
S XXX=$G(^ONCO(165.5,D0,2.1))
S T=$P(XXX,U,1)
S N=$P(XXX,U,2)
S M=$P(XXX,U,3)
S CM=$P($G(^ONCO(165.5,D0,2)),U,27)
Q:M=CM
I (T'="X")!(N'="X"),$E(M,1)'=1 S M=$S(CM="X":M,1:CM)
E Q
Q:(T="")!(N="")!(M="")
I T=88,N=88,M=88 Q
;
;Melanoma of the Eyelid (C44.1)
I TX=67441,ONCED<5,$$MELANOMA^ONCOU55(D0) S AG=37 G AG
;
;Melanoma of the Skin
I $$MELANOMA^ONCOU55(D0),$P($G(^ONCO(164,+TX,0)),U,15) S AG=22 G AG
;
;GTT
I TX=67589 S AG=54 G AG
;
;Urethra (C68.9)
;Urothelial (Transitional Cell) Carcinoma of the Prostate
I ONCED>4,TX=67619,(HT=81203)!(HT=81303)!(HT=81223)!(HT=81202) D G AG
.S AG=35
;
;Melanoma of the Conjunctiva
I $$MELANOMA^ONCOU55(D0),TX=67690 S AG=39 G AG
;
;Melanoma of the Uvea
I $$MELANOMA^ONCOU55(D0),((TX=67693)!(TX=67694)) S AG=40 G AG
;
;Lymphoid Neoplasms
;Mycosis fungoides (9700/3)
;Sezary Disease (9701/3)
I ONCED>5,(HT=97003)!(HT=97013) S AG=55 G AG
;
S AG=$P($G(^ONCO(164,+TX,0)),U,12)
;
AG ;DO staging subroutine
S SG=99
I T=88,N=88,M=88 S SG=88 G SG
D @(AG_"^ONCOTN0")
;
SG ;Computed stage
S $P(^ONCO(165.5,D0,2.1),U,4)=SG
I SG'="" S X=SG D KSG^ONCOCRC,PSSG^ONCOCRC
CHKSUM ;Recompute checksum
I $P($G(^ONCO(165.5,D0,7)),U,2)=3 D
.S EDITS="NO" D NAACCR^ONCGENED K EDITS
.S CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
.I CHECKSUM'=$P($G(^ONCO(165.5,D0,"EDITS")),U,1) D
..S $P(^ONCO(165.5,D0,"EDITS"),U,1)=CHECKSUM
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCRESTG 2142 printed Nov 22, 2024@17:37:41 Page 2
ONCRESTG ;Hines OIFO/GWB - Restage 2003+ cases ;07/10/09
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;Check T version
+4 ;S VER=$T(LOGO+3^ONCODIS)
+5 ;S VER=$E(VER,29)
+6 ;I VER>1 K VER Q
+7 ;
+8 NEW D0,RESTAGE,XDT
+9 SET RESTAGE="YES"
+10 WRITE !!," Restaging 2003+ cases"
+11 SET XDT=3030000
FOR CNT=1:1
SET XDT=$ORDER(^ONCO(165.5,"ADX",XDT))
if XDT=""
QUIT
SET D0=0
FOR
SET D0=$ORDER(^ONCO(165.5,"ADX",XDT,D0))
if D0=""
QUIT
DO RESTAGE
if CNT#100=0
WRITE "."
+12 QUIT
+13 ;
RESTAGE ;Restage 6th Edition cases
+1 SET STGIND="P"
+2 SET (ONCED,ONCOED)=6
+3 SET DA=D0
+4 SET XX=$GET(^ONCO(165.5,D0,2))
+5 if XX=""
QUIT
+6 SET ST=$PIECE(^ONCO(165.5,D0,0),U,1)
+7 SET G=$PIECE(^ONCO(165.5,D0,2),U,5)
+8 SET TX=$PIECE(^ONCO(165.5,D0,2),U,1)
+9 SET HT=$$HIST^ONCFUNC(D0)
+10 SET SP=$PIECE($GET(^ONCO(164,+TX,0)),U,11)
+11 SET XXX=$GET(^ONCO(165.5,D0,2.1))
+12 SET T=$PIECE(XXX,U,1)
+13 SET N=$PIECE(XXX,U,2)
+14 SET M=$PIECE(XXX,U,3)
+15 SET CM=$PIECE($GET(^ONCO(165.5,D0,2)),U,27)
+16 if M=CM
QUIT
+17 IF (T'="X")!(N'="X")
IF $EXTRACT(M,1)'=1
SET M=$SELECT(CM="X":M,1:CM)
+18 IF '$TEST
QUIT
+19 if (T="")!(N="")!(M="")
QUIT
+20 IF T=88
IF N=88
IF M=88
QUIT
+21 ;
+22 ;Melanoma of the Eyelid (C44.1)
+23 IF TX=67441
IF ONCED<5
IF $$MELANOMA^ONCOU55(D0)
SET AG=37
GOTO AG
+24 ;
+25 ;Melanoma of the Skin
+26 IF $$MELANOMA^ONCOU55(D0)
IF $PIECE($GET(^ONCO(164,+TX,0)),U,15)
SET AG=22
GOTO AG
+27 ;
+28 ;GTT
+29 IF TX=67589
SET AG=54
GOTO AG
+30 ;
+31 ;Urethra (C68.9)
+32 ;Urothelial (Transitional Cell) Carcinoma of the Prostate
+33 IF ONCED>4
IF TX=67619
IF (HT=81203)!(HT=81303)!(HT=81223)!(HT=81202)
Begin DoDot:1
+34 SET AG=35
End DoDot:1
GOTO AG
+35 ;
+36 ;Melanoma of the Conjunctiva
+37 IF $$MELANOMA^ONCOU55(D0)
IF TX=67690
SET AG=39
GOTO AG
+38 ;
+39 ;Melanoma of the Uvea
+40 IF $$MELANOMA^ONCOU55(D0)
IF ((TX=67693)!(TX=67694))
SET AG=40
GOTO AG
+41 ;
+42 ;Lymphoid Neoplasms
+43 ;Mycosis fungoides (9700/3)
+44 ;Sezary Disease (9701/3)
+45 IF ONCED>5
IF (HT=97003)!(HT=97013)
SET AG=55
GOTO AG
+46 ;
+47 SET AG=$PIECE($GET(^ONCO(164,+TX,0)),U,12)
+48 ;
AG ;DO staging subroutine
+1 SET SG=99
+2 IF T=88
IF N=88
IF M=88
SET SG=88
GOTO SG
+3 DO @(AG_"^ONCOTN0")
+4 ;
SG ;Computed stage
+1 SET $PIECE(^ONCO(165.5,D0,2.1),U,4)=SG
+2 IF SG'=""
SET X=SG
DO KSG^ONCOCRC
DO PSSG^ONCOCRC
CHKSUM ;Recompute checksum
+1 IF $PIECE($GET(^ONCO(165.5,D0,7)),U,2)=3
Begin DoDot:1
+2 SET EDITS="NO"
DO NAACCR^ONCGENED
KILL EDITS
+3 SET CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
+4 IF CHECKSUM'=$PIECE($GET(^ONCO(165.5,D0,"EDITS")),U,1)
Begin DoDot:2
+5 SET $PIECE(^ONCO(165.5,D0,"EDITS"),U,1)=CHECKSUM
End DoDot:2
End DoDot:1
+6 QUIT