Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ONCSCHMS

ONCSCHMS.m

Go to the documentation of this file.
  1. ONCSCHMS ;HINES OIFO/RTK - Derive schema discriminator ;08/27/18
  1. ;;2.2;ONCOLOGY;**10,13**;Jul 31, 2013;Build 7
  1. ;
  1. ;
  1. DER ;Derive the correct schema discriminator codes for the abstract based
  1. ; on Primary Site and Histology
  1. ; NOTE: need the schema discriminators (if any) before call to ONCSCHMA
  1. ; to calculate the schema ID (field 3800)
  1. ; TOPCOD should be set in Abstract
  1. N ONCHIST,ONCTPCD,ONCSDIS1,ONCSDIS2,ONCT3,HST14
  1. N ONCPTPR S ONCPTPR=$P($G(^ONCO(165.5,D0,0)),U,2),ONCSSEX=$P($G(^ONCO(160,ONCPTPR,0)),U,8) I $G(ONCSSEX)="" W "CHECK PATIENT FILE" H 2
  1. K ONC3927,ONCONLY2 ;used to prompt for or skip field #3926,3927
  1. S ONCSCMDS=0 ;initialize the schema first
  1. ;
  1. S ONCHIST=$$HIST^ONCFUNC(D0)
  1. I '$D(TOPCOD)!('$D(ONCHIST)) W !!," ** MISSING PRIMARY SITE AND/OR HISTOLOGY -- CANNOT DERIVE DISCRIMINATORS **",! Q
  1. S ONCTPCD=$P(TOPCOD,".",1)_$P(TOPCOD,".",2) ;remove the "."
  1. S HST14=$E(ONCHIST,1,4),ONCT3=$E(ONCTPCD,2,5)
  1. ;
  1. ;Nasopharynx/Oropharynx
  1. I "C019^C024^C051^C052^C090^C091^C098^C099^C100^C102^C103^C104^C108^C109"[ONCTPCD D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00100",ONC3927=1
  1. I ONCTPCD="C111" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00100",ONC3927=1
  1. ;
  1. ;Esophagus
  1. I ONCTPCD="C160" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8016))!((HST14>8020)&(HST14<8047))!(HST14=8060)!((HST14>8070)&(HST14<8074))!((HST14>8074)&(HST14<8077)) S ONCSCMDS="00161" ;,ONC3927=1
  1. .I ((HST14>8077)&(HST14<8083))!((HST14>8083)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249)) S ONCSCMDS="00161" ;,ONC3927=1
  1. .I ((HST14>8249)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00161" ;,ONC3927=1
  1. I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMDS'=0 Q
  1. .I (HST14=8020) S ONCSCMDS="00161",ONC3927=1
  1. I ONCTPCD="C160" D I ONCSCMDS'=0 Q
  1. .I (HST14=8020) S ONCSCMDS="00161",ONC3927=1
  1. I ONCTPCD="C160" D I ONCSCMDS'=0 Q
  1. .I ((HST14>8049)&(HST14<8055))!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560) S ONCSCMDS="00161" ;,ONC3927=1
  1. I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMDS'=0 Q
  1. .I (HST14=8020) S ONCSCMDS="00161",ONC3927=1
  1. I ONCTPCD="C160" D I ONCSCMDS'=0 Q
  1. .I (HST14=8020) S ONCSCMDS="00161",ONC3927=1
  1. ;
  1. I ONCTPCD="C160" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00170"
  1. ;
  1. ;Bile Ducts Distal/Bile Ducts Perihilar/Cystic Duct
  1. I ONCTPCD="C240" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00250"
  1. ;
  1. ;GIST (Primary Peritoneum)
  1. I (ONCT3="000")!((ONCT3>0)&(ONCT3<540))!((ONCT3>570)&(ONCT3<810)) D I ONCSCMDS'=0 Q
  1. .I (HST14=8935)!(HST14=8936) S ONCSCMDS="00430"
  1. ;
  1. ;Cervical LN and Unknown Primary (Occult Head & Neck)
  1. I ONCTPCD="C760" D I ONCSCMDS'=0 Q
  1. .I (HST14=8941) S ONCSCMDS="00450"
  1. I "C473^C475^C493^C494^C495"[ONCTPCD D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8804))!((HST14>8809)&(HST14<8922))!((HST14>8931)&(HST14<8935))!((HST14>8939)&(HST14<8991))!((HST14>8999)&(HST14<9017)) S ONCSCMDS="00450",ONCONLY2=1,ONC3927=1 Q
  1. .I ((HST14>9029)&(HST14<9044))!((HST14>9044)&(HST14<9139))!((HST14>9140)&(HST14<9231))!((HST14>9239)&(HST14<9581))!(HST14=9582)!(HST14=9700)!(HST14=9701) S ONCSCMDS="00450",ONCONLY2=1,ONC3927=1 Q
  1. ;
  1. ;Urethra
  1. I ONCTPCD="C680" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00631"
  1. ;
  1. ;Melanoma Ciliary Body/Iris
  1. I ONCTPCD="C694" D I ONCSCMDS'=0 Q
  1. .I ((HST14>8719)&(HST14<8791)) S ONCSCMDS="00672"
  1. ;
  1. ;Lacrimal Gland/Sac
  1. I ONCTPCD="C695" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!(HST14=8941)!(HST14=8980)!(HST14=8982)!(HST14=9700)!(HST14=9701) S ONCSCMDS="00690"
  1. ;
  1. ;Thyroid (including Medullary)
  1. I ONCTPCD="C739" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8345))!((HST14>8349)&(HST14<8421))!((HST14>8439)&(HST14<8510))!((HST14>8513)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="00730"
  1. ;
  1. I ONCTPCD="C739" D I ONCSCMDS'=0 Q
  1. .I ((HST14>8344)&(HST14<8348))!(HST14=8430)!(HST14=8510)!(HST14=8512)!(HST14=8513) S ONCSCMDS="00730"
  1. ;
  1. ;Lymphoma
  1. I (ONCTPCD="C000")!((ONCT3>0)&(ONCT3<441))!((ONCT3>441)&(ONCT3<690))!((ONCT3>690)&(ONCT3<695))!(ONCT3=689)!(ONCT3=699)!((ONCT3>738)&(ONCT3<751))!((ONCT3>753)&(ONCT3<810)) D I ONCSCMDS'=0
  1. .I (HST14=9591) S ONCSCMDS="00790"
  1. I ((ONCT3>699)&(ONCT3<730))!((ONCT3>750)&(ONCT3<754)) D I ONCSCMDS'=0
  1. .I (ONCHIST=95913) S ONCSCMDS="00790"
  1. ;
  1. ;Plasma Cell Myeloma
  1. I (ONCT3="000")!((ONCT3>0)&(ONCT3<810)) D I ONCSCMDS'=0 Q
  1. .I HST14=9732 S ONCSCMDS="00821"
  1. ;
  1. ;Ill-Defined/Other (Occult)
  1. I ONCTPCD="C760" D I ONCSCMDS'=0 Q
  1. .I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMDS="99999"
  1. ;
  1. I ONCSCMDS=0 S Y="@006"
  1. ;
  1. I ONCSCMDS'=0 Q ;S $P(^ONCO(165.5,D0,"SSD1"),U,1)=ONCSCMDS
  1. ;
  1. Q