ONCOU55 ;HINES OIFO/GWB - Utility routine # 1 ;06/23/10
;;2.2;ONCOLOGY;**1,10,12,13,15,17,20**;Jul 31, 2013;Build 5
;
LTS(DA,NOTTHIS) ;Sets LAST TUMOR STATUS field (165.5,95)
;Called by AC cross-reference of CANCER STATUS (165.573,.02)
;NOTTHIS is defined by CANCER STATUS (165.573,.02) KILL logic
;If the latest CANCER STATUS is deleted, LAST TUMOR STATUS is updated
;with the next most recent CANCER STATUS.
N OX,DIE,DR,NTS,OTS
S NTS=""
S OX=$$TSLAST(DA,+$G(NOTTHIS))
S:OX NTS=$P($G(^ONCO(165.5,DA,"TS",OX,0)),U,2)
S OTS=$P($G(^ONCO(165.5,DA,7)),U,6)
S $P(^ONCO(165.5,DA,7),U,6)=NTS
K:$L(OTS) ^ONCO(165.5,"ACS",OTS,DA)
S:$L(NTS) ^ONCO(165.5,"ACS",NTS,DA)=""
Q
;
TSLAST(DA,NOTTHIS) ;Get last TUMOR STATUS DATE (165.573,.01)
N IEN
S IEN=$O(^ONCO(165.5,DA,"TS","AA",""))
I IEN,$D(NOTTHIS),$D(^ONCO(165.5,DA,"TS","AA",IEN,NOTTHIS)) S IEN=$O(^ONCO(165.5,DA,"TS","AA",IEN))
S:IEN IEN=$O(^ONCO(165.5,DA,"TS","AA",IEN,""))
Q IEN
;
SETTS(IEN,FOLDATE) ;Set TUMOR STATUS (165.5,73)
;Called by FINDSET^ONCOAIS
N DA,DO,DIC,PREVENT,PREVTS,SUBENT,TOFR,X,Y
S TOFR=$$GET1^DIQ(165.5,IEN,71)
S PREVTS=""
S PREVENT=$O(^ONCO(165.5,IEN,"TS","AA",9999999-FOLDATE))
I PREVENT D
.I TOFR'="Never disease-free" D
..S PREVENT=$O(^ONCO(165.5,IEN,"TS","AA",PREVENT,0))
..S PREVTS=$P($G(^ONCO(165.5,IEN,"TS",PREVENT,0)),U,2)
K DO,DIC
S DA(1)=IEN,DIC="^ONCO(165.5,DA(1),""TS"","
S DIC(0)="L",X=FOLDATE
S DIC("DR")=".02////^S X=PREVTS"
D FILE^DICN
S SUBENT=+Y
D LTS(IEN)
Q SUBENT
;
TNMED(IEN) ;AJCC Cancer Staging Manual Edition
N CSG,PSG,TNMED,TNMMO,TOP,YR,TNMAJCC
S YR=$E($P($G(^ONCO(165.5,IEN,0)),U,16),1,3)
S TNMED=$S(YR<283:1,YR<288:2,YR<292:3,YR<298:4,YR<303:5,YR<310:6,YR<318:7,1:8)
S TNMMO=$$HIST^ONCFUNC(IEN),TNMMO=$E(TNMMO,1,4)
S TOP=$P($G(^ONCO(165.5,IEN,2)),U,1)
S TNMAJCC=$P($G(^ONCO(165.5,IEN,"AJCC8")),"^",1)
I (YR>317)&(TOP=67421)&((TNMMO=9671)!(TNMMO=9724)!(TNMMO=9727)!(TNMMO=9801)!((TNMMO>9805)&(TNMMO<9810))!(TNMMO=9831)!(TNMMO=9833)!(TNMMO=9834)!(TNMMO=9940)!(TNMMO=9948)) D I TNMED=88 G TNMEX
.I (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($E(TNMAJCC,1,2)'="83") S TNMED=88 Q
I (YR>317)&($P($G(^ONCO(165.5,IEN,"AJCC8")),"^",1)="XX") S TNMED=88 G TNMEX
I $$LYMPHOMA^ONCFUNC(IEN) G TNMEX
I YR>295!($$LEUKEMIA^ONCOAIP2(IEN)) D
.I YR>317 Q ; because this is all new staging for 2018+ 8th edition
.S CSG=$P($G(^ONCO(165.5,IEN,2)),U,20)
.S PSG=$P($G(^ONCO(165.5,IEN,2.1)),U,4)
.I (CSG=88)&(PSG=88) S TNMED=88
I TNMED=5 D
.I (TNMMO>9730)&(TNMMO<9990) S TNMED=88 Q
.I TNMMO=9140 S TNMED=88 Q
.I (TOP=67173)!(TOP=67254)!(TOP=67260)!(TOP=67268)!(TOP=67269)!(TOP=67300)!(TOP=67301)!(TOP=67312)!(TOP=67313)!(TOP=67318)!(TOP=67319)!(TOP=67339)!(TOP=67379)!(TOP=67390)!(TOP=67398)!(TOP=67399)!(TOP=67420)!(TOP=67421) S TNMED=88 Q
.I (TOP=67422)!(TOP=67423)!(TOP=67424)!(TOP=67571)!(TOP=67572)!(TOP=67573)!(TOP=67574)!(TOP=67577)!(TOP=67578)!(TOP=67579)!(TOP=67630)!(TOP=67631)!(TOP=67637)!(TOP=67638)!(TOP=67639)!(TOP=67691)!(TOP=67699)!(TOP=67700) S TNMED=88 Q
.I (TOP=67701)!(TOP=67709)!(TOP=67710)!(TOP=67711)!(TOP=67712)!(TOP=67713)!(TOP=67714)!(TOP=67715)!(TOP=67716)!(TOP=67717)!(TOP=67718)!(TOP=67719)!(TOP=67720)!(TOP=67721)!(TOP=67722)!(TOP=67723)!(TOP=67724)!(TOP=67725) S TNMED=88 Q
.I (TOP=67728)!(TOP=67729)!(TOP=67750)!(TOP=67751)!(TOP=67752)!(TOP=67753)!(TOP=67754)!(TOP=67755)!(TOP=67758)!(TOP=67759)!(TOP=67760)!(TOP=67761)!(TOP=67762)!(TOP=67763)!(TOP=67764) S TNMED=88 Q
.I (TOP=67765)!(TOP=67767)!(TOP=67768)!(TOP=67809) S TNMED=88 Q
I TNMED>5 D
.N TOP3 S TOP3=$E(TOP,3,5)
.I TNMED<7,(TOP=67740)!(TOP=67741)!(TOP=67749) S TNMED=88 Q
.I TNMED<8,(TOP=67379)!(TOP=67750)!($E(TOP,1,4)=6776) S TNMED=88 Q
.I YR>311,$E(TOP,3,4)=77,TNMMO=9823 Q ;SEER 2012 Hematopoitic (Pg 54)
.I YR>311,TNMMO=9823,((TOP3>0)&(TOP3<425)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>469)&(TOP3<510)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>510)&(TOP3<609)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>618)&(TOP3<632)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>636)&(TOP3<690)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>690)&(TOP3<695)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>738)&(TOP3<750)) Q ;Schema 00795,Hist=98233
.I YR>311,TNMMO=9823,((TOP3>759)&(TOP3<810)) Q ;Schema 00795,Hist=98233
.;.I ((TNMMO>9730)&(TNMMO<9990))&((YR>317)&(TNMMO'=9827)) D I TNMED=88 Q
.;..I (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($E(TNMAJCC,1,2)'="83") S TNMED=88 Q
.;.I TNMMO=9140 S TNMED=88 Q ;removed these 3 lines in Patch 20
.I (TOP=67173)!(TOP=67254)!(TOP=67260)!(TOP=67268)!(TOP=67269)!(TOP=67301)!(TOP=67312)!(TOP=67313)!(TOP=67318)!(TOP=67319)!(TOP=67339)!(TOP=67390) S TNMED=88 Q
.I (TOP=67398)!(TOP=67399)!(TOP=67420)!((YR<318)&(TOP=67421))!(TOP=67422)!(TOP=67423)!(TOP=67424)!(TOP=67571)!(TOP=67572)!(TOP=67573)!(TOP=67574)!(TOP=67577)!(TOP=67578)!(TOP=67579) S TNMED=88 Q
.I (TOP=67630)!(TOP=67638)!(TOP=67639)!(TOP=67681)!(TOP=67688)!(TOP=67689)!(TOP=67691)!(TOP=67699)!(TOP=67701)!(TOP=67709) S TNMED=88 Q
.I (TOP=67754)!(TOP=67758)!(TOP=67759)!(TOP=67809) S TNMED=88 Q
.I (YR>317)&(TOP=67421)&((TNMMO=9724)!(TNMMO=9727)!(TNMMO=9801)!((TNMMO>9805)&(TNMMO<9810))!(TNMMO=9831)!(TNMMO=9833)!(TNMMO=9834)!(TNMMO=9940)!(TNMMO=9948)) D I TNMED=88 Q
..I (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($E(TNMAJCC,1,2)'="83") S TNMED=88 Q
.I YR>317,$P($G(^ONCO(165.5,IEN,"AJCC8")),"^",1)="XX" S TNMED=88 Q
.I YR>320,$P($G(^ONCO(165.5,IEN,"SSD1")),"^",1)="09520" S TNMED=9 Q
.I YR>322,$P($G(^ONCO(165.5,IEN,"SSD1")),"^",1)'="","09190^09210^09721^09722^09723^09724"[$P($G(^ONCO(165.5,IEN,"SSD1")),"^",1) S TNMED=9 Q
TNMEX ;
Q TNMED
;
MELANOMA(IEN) ;Melanoma
N XX
S XX=$$HIST^ONCFUNC(IEN)
Q (XX'<87200)&(XX<87910)
;
GTT(D0) ;Gestational Trophoblastic Tumors - 5th, 6th and 7th editions
;
N HIST,HIST14,TNMED,TOP
S TNMED=$$TNMED^ONCOU55(D0)
S TOP=$P($G(^ONCO(165.5,D0,2)),U,1)
S HIST=$$HIST^ONCFUNC(D0)
S HIST14=$E(HIST,1,4)
Q (TNMED>4)&(TOP=67589)&((HIST14>9099)&(HIST14<9106))
;
T(D0) ;Testis - 5th, 6th and 7th editions
N TNMED,TOP
S TNMED=$$TNMED^ONCOU55(D0)
S TOP=$P($G(^ONCO(165.5,D0,2)),U,1)
Q (TNMED>4)&((TOP=67620)!(TOP=67621)!(TOP=67629))
;
EDITION(IEN) ;SEER Extent of Disease Edition
Q $S($$DATEDX(IEN)>2980000:3,$$DATEDX(IEN)>2920000:2,1:1)
;
DATEDX(IEN) ;DATE DX (165.5,3)
Q $P($G(^ONCO(165.5,IEN,0)),U,16)
;
MYCOSIS(IEN) ;MYCOSIS FUNGOIDES
N XX
S XX=$$HIST^ONCFUNC(IEN)
Q ((XX=97002)!(XX=97003))
;
NOSTAGE(IEN) ;AUTOMATIC STAGING OVERRIDDEN (165.5,37.9)
Q $P($G(^ONCO(165.5,D0,24)),U)
;
TMARKER ;TUMOR MARKER 1 (165.5,25.1)
;TUMOR MARKER 2 (165.5,25.2)
;TUMOR MARKER 3 (165.5,25.3)
N TOP
S (TM1,TM2,TM3)=0
S TOP=$P($G(^ONCO(165.5,D0,2)),U,1)
I TOP'="" S TOP=$P($G(^ONCO(164,TOP,0)),U,2)
I $E(TOP,2,3)=50 S (TM1,TM2)=1 Q
I $E(TOP,2,3)=18 S TM1=1 Q
I $E(TOP,2,3)=19 S TM1=1 Q
I $E(TOP,2,3)=20 S TM1=1 Q
I $E(TOP,2,3)=22 S TM1=1 Q
I $E(TOP,2,3)=56 S TM1=1 Q
I $E(TOP,2,3)=61 S (TM1,TM2)=1 Q
I $E(TOP,2,3)=62 S (TM1,TM2,TM3)=1 Q
I $$HIST^ONCFUNC(D0)=95003 S TM1=1 Q
Q
;
CLEANUP ;Cleanup
K TM1,TM2,TM3
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCOU55 7224 printed Dec 13, 2024@02:26:06 Page 2
ONCOU55 ;HINES OIFO/GWB - Utility routine # 1 ;06/23/10
+1 ;;2.2;ONCOLOGY;**1,10,12,13,15,17,20**;Jul 31, 2013;Build 5
+2 ;
LTS(DA,NOTTHIS) ;Sets LAST TUMOR STATUS field (165.5,95)
+1 ;Called by AC cross-reference of CANCER STATUS (165.573,.02)
+2 ;NOTTHIS is defined by CANCER STATUS (165.573,.02) KILL logic
+3 ;If the latest CANCER STATUS is deleted, LAST TUMOR STATUS is updated
+4 ;with the next most recent CANCER STATUS.
+5 NEW OX,DIE,DR,NTS,OTS
+6 SET NTS=""
+7 SET OX=$$TSLAST(DA,+$GET(NOTTHIS))
+8 if OX
SET NTS=$PIECE($GET(^ONCO(165.5,DA,"TS",OX,0)),U,2)
+9 SET OTS=$PIECE($GET(^ONCO(165.5,DA,7)),U,6)
+10 SET $PIECE(^ONCO(165.5,DA,7),U,6)=NTS
+11 if $LENGTH(OTS)
KILL ^ONCO(165.5,"ACS",OTS,DA)
+12 if $LENGTH(NTS)
SET ^ONCO(165.5,"ACS",NTS,DA)=""
+13 QUIT
+14 ;
TSLAST(DA,NOTTHIS) ;Get last TUMOR STATUS DATE (165.573,.01)
+1 NEW IEN
+2 SET IEN=$ORDER(^ONCO(165.5,DA,"TS","AA",""))
+3 IF IEN
IF $DATA(NOTTHIS)
IF $DATA(^ONCO(165.5,DA,"TS","AA",IEN,NOTTHIS))
SET IEN=$ORDER(^ONCO(165.5,DA,"TS","AA",IEN))
+4 if IEN
SET IEN=$ORDER(^ONCO(165.5,DA,"TS","AA",IEN,""))
+5 QUIT IEN
+6 ;
SETTS(IEN,FOLDATE) ;Set TUMOR STATUS (165.5,73)
+1 ;Called by FINDSET^ONCOAIS
+2 NEW DA,DO,DIC,PREVENT,PREVTS,SUBENT,TOFR,X,Y
+3 SET TOFR=$$GET1^DIQ(165.5,IEN,71)
+4 SET PREVTS=""
+5 SET PREVENT=$ORDER(^ONCO(165.5,IEN,"TS","AA",9999999-FOLDATE))
+6 IF PREVENT
Begin DoDot:1
+7 IF TOFR'="Never disease-free"
Begin DoDot:2
+8 SET PREVENT=$ORDER(^ONCO(165.5,IEN,"TS","AA",PREVENT,0))
+9 SET PREVTS=$PIECE($GET(^ONCO(165.5,IEN,"TS",PREVENT,0)),U,2)
End DoDot:2
End DoDot:1
+10 KILL DO,DIC
+11 SET DA(1)=IEN
SET DIC="^ONCO(165.5,DA(1),""TS"","
+12 SET DIC(0)="L"
SET X=FOLDATE
+13 SET DIC("DR")=".02////^S X=PREVTS"
+14 DO FILE^DICN
+15 SET SUBENT=+Y
+16 DO LTS(IEN)
+17 QUIT SUBENT
+18 ;
TNMED(IEN) ;AJCC Cancer Staging Manual Edition
+1 NEW CSG,PSG,TNMED,TNMMO,TOP,YR,TNMAJCC
+2 SET YR=$EXTRACT($PIECE($GET(^ONCO(165.5,IEN,0)),U,16),1,3)
+3 SET TNMED=$SELECT(YR<283:1,YR<288:2,YR<292:3,YR<298:4,YR<303:5,YR<310:6,YR<318:7,1:8)
+4 SET TNMMO=$$HIST^ONCFUNC(IEN)
SET TNMMO=$EXTRACT(TNMMO,1,4)
+5 SET TOP=$PIECE($GET(^ONCO(165.5,IEN,2)),U,1)
+6 SET TNMAJCC=$PIECE($GET(^ONCO(165.5,IEN,"AJCC8")),"^",1)
+7 IF (YR>317)&(TOP=67421)&((TNMMO=9671)!(TNMMO=9724)!(TNMMO=9727)!(TNMMO=9801)!((TNMMO>9805)&(TNMMO<9810))!(TNMMO=9831)!(TNMMO=9833)!(TNMMO=9834)!(TNMMO=9940)!(TNMMO=9948))
Begin DoDot:1
+8 IF (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($EXTRACT(TNMAJCC,1,2)'="83")
SET TNMED=88
QUIT
End DoDot:1
IF TNMED=88
GOTO TNMEX
+9 IF (YR>317)&($PIECE($GET(^ONCO(165.5,IEN,"AJCC8")),"^",1)="XX")
SET TNMED=88
GOTO TNMEX
+10 IF $$LYMPHOMA^ONCFUNC(IEN)
GOTO TNMEX
+11 IF YR>295!($$LEUKEMIA^ONCOAIP2(IEN))
Begin DoDot:1
+12 ; because this is all new staging for 2018+ 8th edition
IF YR>317
QUIT
+13 SET CSG=$PIECE($GET(^ONCO(165.5,IEN,2)),U,20)
+14 SET PSG=$PIECE($GET(^ONCO(165.5,IEN,2.1)),U,4)
+15 IF (CSG=88)&(PSG=88)
SET TNMED=88
End DoDot:1
+16 IF TNMED=5
Begin DoDot:1
+17 IF (TNMMO>9730)&(TNMMO<9990)
SET TNMED=88
QUIT
+18 IF TNMMO=9140
SET TNMED=88
QUIT
+19 IF (TOP=67173)!(TOP=67254)!(TOP=67260)!(TOP=67268)!(TOP=67269)!(TOP=67300)!(TOP=67301)!(TOP=67312)!(TOP=67313)!(TOP=67318)!(TOP=67319)!(TOP=67339)!(TOP=67379)!(TOP=67390)!(TOP=67398)!(TOP=67399)!(TOP=67420)!(TOP=67421)
SET TNMED=88
QUIT
+20 IF (TOP=67422)!(TOP=67423)!(TOP=67424)!(TOP=67571)!(TOP=67572)!(TOP=67573)!(TOP=67574)!(TOP=67577)!(TOP=67578)!(TOP=67579)!(TOP=67630)!(TOP=67631)!(TOP=67637)!(TOP=67638)!(TOP=67639)!(TOP=67691)!(TOP=67699)!(TOP=67700)
SET TNMED=88
QUIT
+21 IF (TOP=67701)!(TOP=67709)!(TOP=67710)!(TOP=67711)!(TOP=67712)!(TOP=67713)!(TOP=67714)!(TOP=67715)!(TOP=67716)!(TOP=67717)!(TOP=67718)!(TOP=67719)!(TOP=67720)!(TOP=67721)!(TOP=67722)!(TOP=67723)!(TOP=67724)!(TOP=67725)
SET TNMED=88
QUIT
+22 IF (TOP=67728)!(TOP=67729)!(TOP=67750)!(TOP=67751)!(TOP=67752)!(TOP=67753)!(TOP=67754)!(TOP=67755)!(TOP=67758)!(TOP=67759)!(TOP=67760)!(TOP=67761)!(TOP=67762)!(TOP=67763)!(TOP=67764)
SET TNMED=88
QUIT
+23 IF (TOP=67765)!(TOP=67767)!(TOP=67768)!(TOP=67809)
SET TNMED=88
QUIT
End DoDot:1
+24 IF TNMED>5
Begin DoDot:1
+25 NEW TOP3
SET TOP3=$EXTRACT(TOP,3,5)
+26 IF TNMED<7
IF (TOP=67740)!(TOP=67741)!(TOP=67749)
SET TNMED=88
QUIT
+27 IF TNMED<8
IF (TOP=67379)!(TOP=67750)!($EXTRACT(TOP,1,4)=6776)
SET TNMED=88
QUIT
+28 ;SEER 2012 Hematopoitic (Pg 54)
IF YR>311
IF $EXTRACT(TOP,3,4)=77
IF TNMMO=9823
QUIT
+29 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>0)&(TOP3<425))
QUIT
+30 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>469)&(TOP3<510))
QUIT
+31 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>510)&(TOP3<609))
QUIT
+32 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>618)&(TOP3<632))
QUIT
+33 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>636)&(TOP3<690))
QUIT
+34 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>690)&(TOP3<695))
QUIT
+35 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>738)&(TOP3<750))
QUIT
+36 ;Schema 00795,Hist=98233
IF YR>311
IF TNMMO=9823
IF ((TOP3>759)&(TOP3<810))
QUIT
+37 ;.I ((TNMMO>9730)&(TNMMO<9990))&((YR>317)&(TNMMO'=9827)) D I TNMED=88 Q
+38 ;..I (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($E(TNMAJCC,1,2)'="83") S TNMED=88 Q
+39 ;.I TNMMO=9140 S TNMED=88 Q ;removed these 3 lines in Patch 20
+40 IF (TOP=67173)!(TOP=67254)!(TOP=67260)!(TOP=67268)!(TOP=67269)!(TOP=67301)!(TOP=67312)!(TOP=67313)!(TOP=67318)!(TOP=67319)!(TOP=67339)!(TOP=67390)
SET TNMED=88
QUIT
+41 IF (TOP=67398)!(TOP=67399)!(TOP=67420)!((YR<318)&(TOP=67421))!(TOP=67422)!(TOP=67423)!(TOP=67424)!(TOP=67571)!(TOP=67572)!(TOP=67573)!(TOP=67574)!(TOP=67577)!(TOP=67578)!(TOP=67579)
SET TNMED=88
QUIT
+42 IF (TOP=67630)!(TOP=67638)!(TOP=67639)!(TOP=67681)!(TOP=67688)!(TOP=67689)!(TOP=67691)!(TOP=67699)!(TOP=67701)!(TOP=67709)
SET TNMED=88
QUIT
+43 IF (TOP=67754)!(TOP=67758)!(TOP=67759)!(TOP=67809)
SET TNMED=88
QUIT
+44 IF (YR>317)&(TOP=67421)&((TNMMO=9724)!(TNMMO=9727)!(TNMMO=9801)!((TNMMO>9805)&(TNMMO<9810))!(TNMMO=9831)!(TNMMO=9833)!(TNMMO=9834)!(TNMMO=9940)!(TNMMO=9948))
Begin DoDot:2
+45 IF (TNMAJCC'="82.1")&(TNMAJCC'="82.2")&($EXTRACT(TNMAJCC,1,2)'="83")
SET TNMED=88
QUIT
End DoDot:2
IF TNMED=88
QUIT
+46 IF YR>317
IF $PIECE($GET(^ONCO(165.5,IEN,"AJCC8")),"^",1)="XX"
SET TNMED=88
QUIT
+47 IF YR>320
IF $PIECE($GET(^ONCO(165.5,IEN,"SSD1")),"^",1)="09520"
SET TNMED=9
QUIT
+48 IF YR>322
IF $PIECE($GET(^ONCO(165.5,IEN,"SSD1")),"^",1)'=""
IF "09190^09210^09721^09722^09723^09724"[$PIECE($GET(^ONCO(165.5,IEN,"SSD1")),"^",1)
SET TNMED=9
QUIT
End DoDot:1
TNMEX ;
+1 QUIT TNMED
+2 ;
MELANOMA(IEN) ;Melanoma
+1 NEW XX
+2 SET XX=$$HIST^ONCFUNC(IEN)
+3 QUIT (XX'<87200)&(XX<87910)
+4 ;
GTT(D0) ;Gestational Trophoblastic Tumors - 5th, 6th and 7th editions
+1 ;
+2 NEW HIST,HIST14,TNMED,TOP
+3 SET TNMED=$$TNMED^ONCOU55(D0)
+4 SET TOP=$PIECE($GET(^ONCO(165.5,D0,2)),U,1)
+5 SET HIST=$$HIST^ONCFUNC(D0)
+6 SET HIST14=$EXTRACT(HIST,1,4)
+7 QUIT (TNMED>4)&(TOP=67589)&((HIST14>9099)&(HIST14<9106))
+8 ;
T(D0) ;Testis - 5th, 6th and 7th editions
+1 NEW TNMED,TOP
+2 SET TNMED=$$TNMED^ONCOU55(D0)
+3 SET TOP=$PIECE($GET(^ONCO(165.5,D0,2)),U,1)
+4 QUIT (TNMED>4)&((TOP=67620)!(TOP=67621)!(TOP=67629))
+5 ;
EDITION(IEN) ;SEER Extent of Disease Edition
+1 QUIT $SELECT($$DATEDX(IEN)>2980000:3,$$DATEDX(IEN)>2920000:2,1:1)
+2 ;
DATEDX(IEN) ;DATE DX (165.5,3)
+1 QUIT $PIECE($GET(^ONCO(165.5,IEN,0)),U,16)
+2 ;
MYCOSIS(IEN) ;MYCOSIS FUNGOIDES
+1 NEW XX
+2 SET XX=$$HIST^ONCFUNC(IEN)
+3 QUIT ((XX=97002)!(XX=97003))
+4 ;
NOSTAGE(IEN) ;AUTOMATIC STAGING OVERRIDDEN (165.5,37.9)
+1 QUIT $PIECE($GET(^ONCO(165.5,D0,24)),U)
+2 ;
TMARKER ;TUMOR MARKER 1 (165.5,25.1)
+1 ;TUMOR MARKER 2 (165.5,25.2)
+2 ;TUMOR MARKER 3 (165.5,25.3)
+3 NEW TOP
+4 SET (TM1,TM2,TM3)=0
+5 SET TOP=$PIECE($GET(^ONCO(165.5,D0,2)),U,1)
+6 IF TOP'=""
SET TOP=$PIECE($GET(^ONCO(164,TOP,0)),U,2)
+7 IF $EXTRACT(TOP,2,3)=50
SET (TM1,TM2)=1
QUIT
+8 IF $EXTRACT(TOP,2,3)=18
SET TM1=1
QUIT
+9 IF $EXTRACT(TOP,2,3)=19
SET TM1=1
QUIT
+10 IF $EXTRACT(TOP,2,3)=20
SET TM1=1
QUIT
+11 IF $EXTRACT(TOP,2,3)=22
SET TM1=1
QUIT
+12 IF $EXTRACT(TOP,2,3)=56
SET TM1=1
QUIT
+13 IF $EXTRACT(TOP,2,3)=61
SET (TM1,TM2)=1
QUIT
+14 IF $EXTRACT(TOP,2,3)=62
SET (TM1,TM2,TM3)=1
QUIT
+15 IF $$HIST^ONCFUNC(D0)=95003
SET TM1=1
QUIT
+16 QUIT
+17 ;
CLEANUP ;Cleanup
+1 KILL TM1,TM2,TM3