ONCSG0A ;Hines OIFO/GWB - AUTOMATIC STAGING TABLES ;10/28/10
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;HEAD AND NECK SITES (continued)
;
PAR12 ;Paranasal Sinuses - 1st and 2nd editions
I M[1 S SG=4
E I M[0 D
.I (N[2)!(N[3) S SG=4
.E I N[1,(T[1)!(T[2)!(T[3)!(T[4) S SG=$S(T=4:4,1:3)
.E I N[0,(T[1)!(T[2)!(T[3)!(T[4) S SG=+T
Q
;
PAR34 ;Paranasal Sinuses - 3rd and 4th editions
I M[1 S SG=4
E I M[0 D
.I (N[2)!(N[3) S SG=4
.E I N[1,(T[1)!(T[2)!(T[3)!(T[4) S SG=$S(T=4:4,1:3)
.E I N[0,(T["IS")!(T[1)!(T[2)!(T[3)!(T[4) S SG=+T
Q
;
PAR5 ;Paranasal Sinuses - 5th edition
S TNM=T_$E(N,1)_M D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=300 S SG=3 Q ;III T3 N0 M0
.I TNM=110 S SG=3 Q ; T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM=400 S SG="4A" Q ;IVA T4 N0 M0
.I TNM=410 S SG="4A" Q ; T4 N1 M0
.I $E(N,1)=2,M=0 S SG="4B" Q ;IVB Any T N2 M0
.I $E(N,1)=3,M=0 S SG="4B" Q ; Any T N3 M0
.I M=1 S SG="4C" Q ;IVC Any T Any N M1
;
PAR6 ;Paranasal Sinuses - 6th edition
S TNM=T_$E(N,1)_M D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=300 S SG=3 Q ;III T3 N0 M0
.I TNM=110 S SG=3 Q ; T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM="4A00" S SG="4A" Q ;IVA T4a N0 M0
.I TNM="4A10" S SG="4A" Q ; T4a N1 M0
.I TNM=120 S SG="4A" Q ; T1 N2 M0
.I TNM=220 S SG="4A" Q ; T2 N2 M0
.I TNM=320 S SG="4A" Q ; T3 N2 M0
.I TNM="4A20" S SG="4A" Q ; T4a N2 M0
.I T="4B",M=0 S SG="4B" Q ;IVB T4b Any N M0
.I $E(N,1)=3,M=0 S SG="4B" Q ; Any T N3 M0
.I M=1 S SG="4C" Q ;IVC Any T Any N M1
;
SAL12 ;Major Salivary Glands - 1st and 2nd editions
I M[1 S SG=4
E I M[0 D
.I N[1,(T[1)!(T[2)!(T[3)!(T[4) S SG=$S(T>2:4,1:3)
.E I N[0,(T[1)!(T[2)!(T[3)!(T[4) S SG=$S(T[4:3,T[3:2,1:1)
Q
;
SAL34 ;Major Salivary Glands - 3rd and 4th editions
I M S SG=4
E I (T["4B")!(N[2)!(N[3),M[0 S SG=4
E I (T["1A")!(T["2A"),N[0,M[0 S SG=1
E I (T["1B")!(T["2B")!(T["3A"),N[0,M[0 S SG=2
E I (T["3B")!(T["4A"),N[0,M[0 S SG=3
E I N[1,M[0 S SG=3
Q
;
SAL5 ;Major Salivary Glands - 5th edition
S TNM=T_$E(N,1)_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=1 Q ; T2 N0 M0
.I TNM=300 S SG=2 Q ;II T3 N0 M0
.I TNM=110 S SG=3 Q ;III T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=400 S SG=4 Q ;IV T4 N0 M0
.I TNM=310 S SG=4 Q ; T3 N1 M0
.I TNM=410 S SG=4 Q ; T4 N1 M0
.I $E(N,1)=2,M=0 S SG=4 Q ; Any T N2 M0
.I $E(N,1)=3,M=0 S SG=4 Q ; Any T N3 M0
.I M=1 S SG=4 Q ; Any T Any N M1
;
SAL6 ;Major Salivary Glands - 6th edition
S TNM=T_$E(N,1)_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=300 S SG=3 Q ;III T3 N0 M0
.I TNM=110 S SG=3 Q ; T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM="4A00" S SG="4A" Q ;IVA T4a N0 M0
.I TNM="4A10" S SG="4A" Q ; T4a N1 M0
.I TNM=120 S SG="4A" Q ; T1 N2 M0
.I TNM=220 S SG="4A" Q ; T2 N2 M0
.I TNM=320 S SG="4A" Q ; T3 N2 M0
.I TNM="4A20" S SG="4A" Q ; T4a N2 M0
.I T="4B",M=0 S SG="4B" Q ;IVB T4b Any N M0
.I N=3,M=0 S SG="4B" Q ; Any T N3 M0
.I M=1 S SG="4C" Q ;IVC Any T Any N M1
;
THY15 K SG
I G=4 S SG=4
E D
.N MO S MO=$$HIST^ONCFUNC(D0)
.D @$S((MO=85103)!(MO=85113):"THYDM",1:"THYDPF")
I '$D(SG) S SG=99
Q
;
THYDM ;Thyroid - Medullary
I M S SG=4
E I T[1,N[0,M[0 S SG=1
E I (T[2)!(T[3)!(T[4),N[0,M[0 S SG=2
E I N[1,M[0 S SG=3
E S SG=99
Q
;
THYDPF ;Thyroid - Papillary or Follicular
N OKMO
S OKMO=("^80503^82603^82900^82903^83300^83303^83313^83323^83333^83340^83403^83503^80203^"[(U_MO_U))
I 'OKMO W:$G(RESTAGE)="" !!?12,"Histology code is incompatible." Q
E D
.D AGE^ONCOCOM
.I X<45 S SG=$S(M[1:2,M[0:1,1:"E")
.E D THYDP45
Q
;
THYDP45 ;THYROID - Papillary or Follicular - 45 years and older
I M[1 S SG=4
E I M[0 D
.I N[1 S SG=3
.E I N[0 D
..I T[1 S SG=1
..E I (T[2)!(T[3) S SG=2
..E I T[4 S SG=3
Q
;
THY6 ;Thyroid Gland - 6th and 7th editions
D AGE^ONCOCOM
S MO=$$HIST^ONCFUNC(D0)
S OKMO="80503^82603^82903^83303^83313^83323^83353^83403^83413^83423^83433^83443^83503" ;Papillary or Follicular
I X<45,OKMO[MO S SG=$S(M=0:1,M=1:2,1:99) D Q
.Q:$G(RESTAGE)="YES"
.W !!,?12,"NOTE: Papillary or Follicular"
.W !,?12," Under 45 years"
S TNM=$E(T,1)_N_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=300 S SG=3 Q ;III T3 N0 M0
.I TNM="11A0" S SG=3 Q ; T1 N1a M0
.I TNM="21A0" S SG=3 Q ; T2 N1a M0
.I TNM="31A0" S SG=3 Q ; T3 N1a M0
.I TNM="4A00" S SG="4A" Q ;IVA T4a N0 M0
.I TNM="4A1A0" S SG="4A" Q ; T4a N1a M0
.I TNM="11B0" S SG="4A" Q ; T1 N1b M0
.I TNM="21B0" S SG="4A" Q ; T2 N1b M0
.I TNM="31B0" S SG="4A" Q ; T3 N1b M0
.I TNM="4A1B0" S SG="4A" Q ; T4a N1b M0
.I T="4B",M=0 S SG="4B" Q ;IVB T4b Any N M0
.I M=1 S SG="4C" Q ;IVC Any T Any N M1
;
CLEANUP ;Cleanup
K D0,G,M,N,RESTAGE,T,X
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSG0A 6174 printed Nov 22, 2024@17:38:21 Page 2
ONCSG0A ;Hines OIFO/GWB - AUTOMATIC STAGING TABLES ;10/28/10
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;HEAD AND NECK SITES (continued)
+4 ;
PAR12 ;Paranasal Sinuses - 1st and 2nd editions
+1 IF M[1
SET SG=4
+2 IF '$TEST
IF M[0
Begin DoDot:1
+3 IF (N[2)!(N[3)
SET SG=4
+4 IF '$TEST
IF N[1
IF (T[1)!(T[2)!(T[3)!(T[4)
SET SG=$SELECT(T=4:4,1:3)
+5 IF '$TEST
IF N[0
IF (T[1)!(T[2)!(T[3)!(T[4)
SET SG=+T
End DoDot:1
+6 QUIT
+7 ;
PAR34 ;Paranasal Sinuses - 3rd and 4th editions
+1 IF M[1
SET SG=4
+2 IF '$TEST
IF M[0
Begin DoDot:1
+3 IF (N[2)!(N[3)
SET SG=4
+4 IF '$TEST
IF N[1
IF (T[1)!(T[2)!(T[3)!(T[4)
SET SG=$SELECT(T=4:4,1:3)
+5 IF '$TEST
IF N[0
IF (T["IS")!(T[1)!(T[2)!(T[3)!(T[4)
SET SG=+T
End DoDot:1
+6 QUIT
+7 ;
PAR5 ;Paranasal Sinuses - 5th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+4 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+5 ;III T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+6 ; T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+9 ;IVA T4 N0 M0
IF TNM=400
SET SG="4A"
QUIT
+10 ; T4 N1 M0
IF TNM=410
SET SG="4A"
QUIT
+11 ;IVB Any T N2 M0
IF $EXTRACT(N,1)=2
IF M=0
SET SG="4B"
QUIT
+12 ; Any T N3 M0
IF $EXTRACT(N,1)=3
IF M=0
SET SG="4B"
QUIT
+13 ;IVC Any T Any N M1
IF M=1
SET SG="4C"
QUIT
End DoDot:1
KILL TNM
QUIT
+14 ;
PAR6 ;Paranasal Sinuses - 6th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+4 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+5 ;III T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+6 ; T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+9 ;IVA T4a N0 M0
IF TNM="4A00"
SET SG="4A"
QUIT
+10 ; T4a N1 M0
IF TNM="4A10"
SET SG="4A"
QUIT
+11 ; T1 N2 M0
IF TNM=120
SET SG="4A"
QUIT
+12 ; T2 N2 M0
IF TNM=220
SET SG="4A"
QUIT
+13 ; T3 N2 M0
IF TNM=320
SET SG="4A"
QUIT
+14 ; T4a N2 M0
IF TNM="4A20"
SET SG="4A"
QUIT
+15 ;IVB T4b Any N M0
IF T="4B"
IF M=0
SET SG="4B"
QUIT
+16 ; Any T N3 M0
IF $EXTRACT(N,1)=3
IF M=0
SET SG="4B"
QUIT
+17 ;IVC Any T Any N M1
IF M=1
SET SG="4C"
QUIT
End DoDot:1
KILL TNM
QUIT
+18 ;
SAL12 ;Major Salivary Glands - 1st and 2nd editions
+1 IF M[1
SET SG=4
+2 IF '$TEST
IF M[0
Begin DoDot:1
+3 IF N[1
IF (T[1)!(T[2)!(T[3)!(T[4)
SET SG=$SELECT(T>2:4,1:3)
+4 IF '$TEST
IF N[0
IF (T[1)!(T[2)!(T[3)!(T[4)
SET SG=$SELECT(T[4:3,T[3:2,1:1)
End DoDot:1
+5 QUIT
+6 ;
SAL34 ;Major Salivary Glands - 3rd and 4th editions
+1 IF M
SET SG=4
+2 IF '$TEST
IF (T["4B")!(N[2)!(N[3)
IF M[0
SET SG=4
+3 IF '$TEST
IF (T["1A")!(T["2A")
IF N[0
IF M[0
SET SG=1
+4 IF '$TEST
IF (T["1B")!(T["2B")!(T["3A")
IF N[0
IF M[0
SET SG=2
+5 IF '$TEST
IF (T["3B")!(T["4A")
IF N[0
IF M[0
SET SG=3
+6 IF '$TEST
IF N[1
IF M[0
SET SG=3
+7 QUIT
+8 ;
SAL5 ;Major Salivary Glands - 5th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ; T2 N0 M0
IF TNM=200
SET SG=1
QUIT
+4 ;II T3 N0 M0
IF TNM=300
SET SG=2
QUIT
+5 ;III T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+6 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+7 ;IV T4 N0 M0
IF TNM=400
SET SG=4
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG=4
QUIT
+9 ; T4 N1 M0
IF TNM=410
SET SG=4
QUIT
+10 ; Any T N2 M0
IF $EXTRACT(N,1)=2
IF M=0
SET SG=4
QUIT
+11 ; Any T N3 M0
IF $EXTRACT(N,1)=3
IF M=0
SET SG=4
QUIT
+12 ; Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+13 ;
SAL6 ;Major Salivary Glands - 6th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+4 ;III T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+5 ; T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+6 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+7 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+8 ;IVA T4a N0 M0
IF TNM="4A00"
SET SG="4A"
QUIT
+9 ; T4a N1 M0
IF TNM="4A10"
SET SG="4A"
QUIT
+10 ; T1 N2 M0
IF TNM=120
SET SG="4A"
QUIT
+11 ; T2 N2 M0
IF TNM=220
SET SG="4A"
QUIT
+12 ; T3 N2 M0
IF TNM=320
SET SG="4A"
QUIT
+13 ; T4a N2 M0
IF TNM="4A20"
SET SG="4A"
QUIT
+14 ;IVB T4b Any N M0
IF T="4B"
IF M=0
SET SG="4B"
QUIT
+15 ; Any T N3 M0
IF N=3
IF M=0
SET SG="4B"
QUIT
+16 ;IVC Any T Any N M1
IF M=1
SET SG="4C"
QUIT
End DoDot:1
KILL TNM
QUIT
+17 ;
THY15 KILL SG
+1 IF G=4
SET SG=4
+2 IF '$TEST
Begin DoDot:1
+3 NEW MO
SET MO=$$HIST^ONCFUNC(D0)
+4 DO @$SELECT((MO=85103)!(MO=85113):"THYDM",1:"THYDPF")
End DoDot:1
+5 IF '$DATA(SG)
SET SG=99
+6 QUIT
+7 ;
THYDM ;Thyroid - Medullary
+1 IF M
SET SG=4
+2 IF '$TEST
IF T[1
IF N[0
IF M[0
SET SG=1
+3 IF '$TEST
IF (T[2)!(T[3)!(T[4)
IF N[0
IF M[0
SET SG=2
+4 IF '$TEST
IF N[1
IF M[0
SET SG=3
+5 IF '$TEST
SET SG=99
+6 QUIT
+7 ;
THYDPF ;Thyroid - Papillary or Follicular
+1 NEW OKMO
+2 SET OKMO=("^80503^82603^82900^82903^83300^83303^83313^83323^83333^83340^83403^83503^80203^"[(U_MO_U))
+3 IF 'OKMO
if $GET(RESTAGE)=""
WRITE !!?12,"Histology code is incompatible."
QUIT
+4 IF '$TEST
Begin DoDot:1
+5 DO AGE^ONCOCOM
+6 IF X<45
SET SG=$SELECT(M[1:2,M[0:1,1:"E")
+7 IF '$TEST
DO THYDP45
End DoDot:1
+8 QUIT
+9 ;
THYDP45 ;THYROID - Papillary or Follicular - 45 years and older
+1 IF M[1
SET SG=4
+2 IF '$TEST
IF M[0
Begin DoDot:1
+3 IF N[1
SET SG=3
+4 IF '$TEST
IF N[0
Begin DoDot:2
+5 IF T[1
SET SG=1
+6 IF '$TEST
IF (T[2)!(T[3)
SET SG=2
+7 IF '$TEST
IF T[4
SET SG=3
End DoDot:2
End DoDot:1
+8 QUIT
+9 ;
THY6 ;Thyroid Gland - 6th and 7th editions
+1 DO AGE^ONCOCOM
+2 SET MO=$$HIST^ONCFUNC(D0)
+3 ;Papillary or Follicular
SET OKMO="80503^82603^82903^83303^83313^83323^83353^83403^83413^83423^83433^83443^83503"
+4 IF X<45
IF OKMO[MO
SET SG=$SELECT(M=0:1,M=1:2,1:99)
Begin DoDot:1
+5 if $GET(RESTAGE)="YES"
QUIT
+6 WRITE !!,?12,"NOTE: Papillary or Follicular"
+7 WRITE !,?12," Under 45 years"
End DoDot:1
QUIT
+8 SET TNM=$EXTRACT(T,1)_N_M
Begin DoDot:1
+9 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+10 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+11 ;III T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+12 ; T1 N1a M0
IF TNM="11A0"
SET SG=3
QUIT
+13 ; T2 N1a M0
IF TNM="21A0"
SET SG=3
QUIT
+14 ; T3 N1a M0
IF TNM="31A0"
SET SG=3
QUIT
+15 ;IVA T4a N0 M0
IF TNM="4A00"
SET SG="4A"
QUIT
+16 ; T4a N1a M0
IF TNM="4A1A0"
SET SG="4A"
QUIT
+17 ; T1 N1b M0
IF TNM="11B0"
SET SG="4A"
QUIT
+18 ; T2 N1b M0
IF TNM="21B0"
SET SG="4A"
QUIT
+19 ; T3 N1b M0
IF TNM="31B0"
SET SG="4A"
QUIT
+20 ; T4a N1b M0
IF TNM="4A1B0"
SET SG="4A"
QUIT
+21 ;IVB T4b Any N M0
IF T="4B"
IF M=0
SET SG="4B"
QUIT
+22 ;IVC Any T Any N M1
IF M=1
SET SG="4C"
QUIT
End DoDot:1
KILL TNM
QUIT
+23 ;
CLEANUP ;Cleanup
+1 KILL D0,G,M,N,RESTAGE,T,X