ONC2PS4A ;Hines OIFO/RTK - Post-Install Continued for Patch ONC*2.2*4 ;02/5/15
;;2.2;ONCOLOGY;**4**;Jul 31, 2013;Build 5
;
NAA15 ;Conversion for Appendix B of the NAACCR 2015 Implementation Guidelines
N CTR,DTDX,GRADE,HIST,IEN,NVAL,PRIMSITE,PRSTCD
S CTR=0
D BMES^XPDUTL("HEME Conversions for 2015. Step 1: Histology conversions...")
F DTDX=3099999:0 S DTDX=$O(^ONCO(165.5,"ADX",DTDX)) Q:DTDX'>0 D
.F IEN=0:0 S IEN=$O(^ONCO(165.5,"ADX",DTDX,IEN)) Q:IEN'>0 D
..S CTR=CTR+1 I CTR#150=0 D BMES^XPDUTL(".")
..S HIST=$P($G(^ONCO(165.5,IEN,2.2)),U,3)
..S PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
..S PRIMSITE=$P($G(^ONCO(165.5,IEN,2)),U,1)
..;Part 1
..I HIST=96543 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=96533
...S $P(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, LYMPHOCYTE DEPLETION, NOS"
..I HIST=96613!(HIST=96623) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=96503
...S $P(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, NOS"
..I HIST=96643!(HIST=96653)!(HIST=96673) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=96633
...S $P(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, NODULAR SCLEROSIS, NOS"
..I HIST=96753 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=96903
...S $P(^ONCO(165.5,IEN,8),U,2)="FOLLICULAR LYMPHOMA, NOS"
..I HIST=96843 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=96803
...S $P(^ONCO(165.5,IEN,8),U,2)="MALIGNANT LYMPHOMA, LRGE B-CELL, DIFFUSE, NOS"
..I HIST=97503!(HIST=97543) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=97513
...S $P(^ONCO(165.5,IEN,8),U,2)="LANGERHANS CELL HISTIOCYTOSIS, NOS"
..I HIST=97603!(HIST=97643) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=97623
...S $P(^ONCO(165.5,IEN,8),U,2)="HEAVY CHAIN DISEASE, NOS"
..I HIST=98053 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98093
...S $P(^ONCO(165.5,IEN,8),U,2)="MIXED PHENOTYPE ACUTE LEUKEMIA, T/MYELOID, NOS"
..I HIST=99603 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=99753
...S $P(^ONCO(165.5,IEN,8),U,2)="MYELODYSPLASTIC/MYELOPROLIFERATIVE NEOPLASM, UNCLASSIFIABLE"
..I HIST=99843 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=99833
...S $P(^ONCO(165.5,IEN,8),U,2)="REFRACTORY ANEMIA WITH EXCESS BLASTS"
..I HIST=99873 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=99203
...S $P(^ONCO(165.5,IEN,8),U,2)="THERAPY-RELATED ACUTE MYELOID LEUKEMIA, NOS"
..;Part 2
..I HIST=96703,((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98233
...S $P(^ONCO(165.5,IEN,8),U,2)="B-CELL CHRON LYMPHOCYTIC LEUK/SMALL LYMPHOMA"
..I HIST=97283,((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98113
...S $P(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
..I HIST=97293,((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98373
...S $P(^ONCO(165.5,IEN,8),U,2)="T LYMPHOBLASTIC LEUKEMIA/LYMPHOMA"
..I ((HIST=98353)!(HIST=98363)),((PRSTCD'="C42.1")&(PRSTCD'="C44.1")&(PRSTCD'="C69.0")&(PRSTCD'="C69.5")&(PRSTCD'="C69.6")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98113
...S $P(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I ((HIST=98353)!(HIST=98363)),PRSTCD="C42.1" D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98113
...S $P(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
..;Part 3
..I HIST=96703,((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98233
...S $P(^ONCO(165.5,IEN,8),U,2)="B-CELL CHRON LYMPHOCYTIC LEUK/SMALL LYMPHOMA"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=988
..I HIST=97283,((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98113
...S $P(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=988
..I HIST=97293,((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98373
...S $P(^ONCO(165.5,IEN,8),U,2)="T LYMPHOBLASTIC LEUKEMIA/LYMPHOMA"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=988
..I ((HIST=98353)!(HIST=98363)),((PRSTCD="C44.1")!(PRSTCD="C69.0")!(PRSTCD="C69.5")!(PRSTCD="C69.6")) D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=98113
...S $P(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,3)=98
...S $P(^ONCO(165.5,IEN,"CS"),U,12)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=988
..I HIST=97333 D
...S $P(^ONCO(165.5,IEN,2.2),U,3)=97323
...S $P(^ONCO(165.5,IEN,8),U,2)="MULTIPLE MYELOMA"
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=810
...I PRSTCD'="C42.1" S $P(^ONCO(165.5,IEN,"CS"),U,3)=98
...I PRSTCD="C42.1" S $P(^ONCO(165.5,IEN,"CS"),U,3)=""
...S $P(^ONCO(165.5,IEN,"CS"),U,3)=98
...S $P(^ONCO(165.5,IEN,"CS"),U,12)=987
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=999,$P(^ONCO(165.5,IEN,"CS"),U,7)=999
...S NVAL=988 I PRSTCD="C42.1" S NVAL=""
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=NVAL,$P(^ONCO(165.5,IEN,"CS"),U,9)=NVAL
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=NVAL
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=NVAL
..;Part 4
..I ((HIST=98203)!(HIST=98263)!(HIST=98313)!(HIST=98323)!(HIST=98333)!(HIST=98343)),((PRSTCD="C44.1")!(PRSTCD="C69.0")!(PRSTCD="C69.5")!(PRSTCD="C69.6")) D
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,3)=98
...S $P(^ONCO(165.5,IEN,"CS"),U,12)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,10)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,1)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,2)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,3)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,4)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,5)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,6)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS2"),U,8)=988
..I ((HIST=98113)!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98273)!(HIST=98373)),(PRSTCD="C42.3") D
...S $P(^ONCO(165.5,IEN,2),U,1)=67421
...S $P(^ONCO(165.5,IEN,"CS"),U,11)=800
...S $P(^ONCO(165.5,IEN,"CS"),U,5)=999
...S $P(^ONCO(165.5,IEN,"CS"),U,6)=988,$P(^ONCO(165.5,IEN,"CS"),U,7)=988
...S $P(^ONCO(165.5,IEN,"CS"),U,8)=988,$P(^ONCO(165.5,IEN,"CS"),U,9)=988
..Q
.Q
S CTR=0
D BMES^XPDUTL("...Step 2: Grade conversions...")
F DTDX=3099999:0 S DTDX=$O(^ONCO(165.5,"ADX",DTDX)) Q:DTDX'>0 D
.F IEN=0:0 S IEN=$O(^ONCO(165.5,"ADX",DTDX,IEN)) Q:IEN'>0 D
..S CTR=CTR+1 I CTR#150=0 D BMES^XPDUTL(".")
..S HIST=$P($G(^ONCO(165.5,IEN,2.2)),U,3)
..S PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
..S PRIMSITE=$P($G(^ONCO(165.5,IEN,2)),U,1)
..S GRADE=$P($G(^ONCO(165.5,IEN,2)),U,5)
..;
..I HIST=95903!(HIST=96503)!(HIST=96513)!(HIST=96523)!(HIST=96533)!(HIST=96553)!(HIST=96633)!(HIST=97273)!(HIST=97353)!(HIST=98003)!(HIST=98203) D
...I GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4) S $P(^ONCO(165.5,IEN,2),U,5)=9
..I HIST=98323!(HIST=98403)!(HIST=98603)!(HIST=98613)!(HIST=98633)!(HIST=98653)!(HIST=98663)!(HIST=98673)!(HIST=98693)!(HIST=98703)!(HIST=98713) D
...I GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4) S $P(^ONCO(165.5,IEN,2),U,5)=9
..I HIST=98723!(HIST=98733)!(HIST=98743)!(HIST=98913)!(HIST=98953)!(HIST=98963)!(HIST=98973)!(HIST=98983)!(HIST=99103)!(HIST=99113)!(HIST=99203) D
...I GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4) S $P(^ONCO(165.5,IEN,2),U,5)=9
..I HIST=99303!(HIST=99313)!(HIST=99653)!(HIST=99663)!(HIST=99673)!(HIST=99713) D
...I GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4) S $P(^ONCO(165.5,IEN,2),U,5)=9
..;
..I HIST=95913!(HIST=95963)!(HIST=95973)!(HIST=96593)!(HIST=96713)!(HIST=96733)!(HIST=96783)!(HIST=96793)!(HIST=96803)!(HIST=96873)!(HIST=96883)!(HIST=96893) D
...S $P(^ONCO(165.5,IEN,2),U,5)=6
..I HIST=96903!(HIST=96913)!(HIST=96953)!(HIST=96983)!(HIST=96993)!(HIST=97123)!(HIST=97313)!(HIST=97323)!(HIST=97343)!(HIST=97373)!(HIST=97383)!(HIST=97613) D
...S $P(^ONCO(165.5,IEN,2),U,5)=6
..I HIST=97623!(HIST=98113)!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98263)!(HIST=98333)!(HIST=99403) D
...S $P(^ONCO(165.5,IEN,2),U,5)=6
..;
..I HIST=97003!(HIST=97013)!(HIST=97023)!(HIST=97053)!(HIST=97083)!(HIST=97093)!(HIST=97163)!(HIST=97173)!(HIST=97183)!(HIST=97243)!(HIST=97253)!(HIST=97263)!(HIST=98273)!(HIST=98343)!(HIST=98373) D
...S $P(^ONCO(165.5,IEN,2),U,5)=5
..;
..I HIST=97143,GRADE'=6 D
...S $P(^ONCO(165.5,IEN,2),U,5)=5
..;
..I HIST=97193!(HIST=99483) D
...S $P(^ONCO(165.5,IEN,2),U,5)=8
..;
..I HIST=97403!(HIST=97413)!(HIST=97423)!(HIST=97513)!(HIST=97553)!(HIST=97563)!(HIST=97573)!(HIST=97583)!(HIST=97593)!(HIST=98013)!(HIST=98063)!(HIST=98073)!(HIST=98083)!(HIST=98093)!(HIST=98753) D
...S $P(^ONCO(165.5,IEN,2),U,5)=9
..I HIST=98763!(HIST=99453)!(HIST=99463)!(HIST=99503)!(HIST=99613)!(HIST=99623)!(HIST=99633)!(HIST=99643)!(HIST=99753)!(HIST=99803)!(HIST=99823)!(HIST=99833)!(HIST=99853)!(HIST=99863)!(HIST=99893)!(HIST=99913)!(HIST=99923) D
...S $P(^ONCO(165.5,IEN,2),U,5)=9
..;
..I HIST=98313,GRADE'=5,GRADE'=8 D
...S $P(^ONCO(165.5,IEN,2),U,5)=9
..Q
.Q
S CTR=0
D BMES^XPDUTL("...Step 3-Primary Site conversions...")
F DTDX=3099999:0 S DTDX=$O(^ONCO(165.5,"ADX",DTDX)) Q:DTDX'>0 D
.F IEN=0:0 S IEN=$O(^ONCO(165.5,"ADX",DTDX,IEN)) Q:IEN'>0 D
..S CTR=CTR+1 I CTR#150=0 D BMES^XPDUTL(".")
..S HIST=$P($G(^ONCO(165.5,IEN,2.2)),U,3)
..S PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
..S PRIMSITE=$P($G(^ONCO(165.5,IEN,2)),U,1)
..;Table 1
..I HIST=97323!(HIST=97413)!(HIST=97423) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=97613 D
...I PRIMSITE'=67420 S $P(^ONCO(165.5,IEN,2),U,1)=67420
..I HIST=98003!(HIST=98013)!(HIST=98063)!(HIST=98073)!(HIST=98083)!(HIST=98093)!(HIST=98203)!(HIST=98263)!(HIST=98313)!(HIST=98323)!(HIST=98333)!(HIST=98343) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=98403!(HIST=98603)!(HIST=98613)!(HIST=98633)!(HIST=98653)!(HIST=98663)!(HIST=98673)!(HIST=98693)!(HIST=98703)!(HIST=98713)!(HIST=98723)!(HIST=98733)!(HIST=98743) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=98753!(HIST=98763)!(HIST=98913)!(HIST=98953)!(HIST=98963)!(HIST=98973)!(HIST=98983)!(HIST=99103)!(HIST=99113)!(HIST=99203)!(HIST=99313)!(HIST=99403)!(HIST=99453) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=99463!(HIST=99483)!(HIST=99503)!(HIST=99613)!(HIST=99623)!(HIST=99633)!(HIST=99643)!(HIST=99653)!(HIST=99663)!(HIST=99673)!(HIST=99753)!(HIST=99803)!(HIST=99823) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=99833!(HIST=99853)!(HIST=99863)!(HIST=99893)!(HIST=99913)!(HIST=99923) D
...I PRIMSITE'=67421 S $P(^ONCO(165.5,IEN,2),U,1)=67421
..;Table 2
..I HIST=98113!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98273)!(HIST=98373) D
...I PRIMSITE=67420!(PRIMSITE=67424) S $P(^ONCO(165.5,IEN,2),U,1)=67421
..I HIST=97623 D
...I PRIMSITE=67420!(PRIMSITE=67423)!(PRIMSITE=67424) S $P(^ONCO(165.5,IEN,2),U,1)=67421
..;Table 3 & Table 4 (for manual review only, no code change)
..Q
.Q
D BMES^XPDUTL("...Conversions complete!")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONC2PS4A 14177 printed Dec 13, 2024@02:21:57 Page 2
ONC2PS4A ;Hines OIFO/RTK - Post-Install Continued for Patch ONC*2.2*4 ;02/5/15
+1 ;;2.2;ONCOLOGY;**4**;Jul 31, 2013;Build 5
+2 ;
NAA15 ;Conversion for Appendix B of the NAACCR 2015 Implementation Guidelines
+1 NEW CTR,DTDX,GRADE,HIST,IEN,NVAL,PRIMSITE,PRSTCD
+2 SET CTR=0
+3 DO BMES^XPDUTL("HEME Conversions for 2015. Step 1: Histology conversions...")
+4 FOR DTDX=3099999:0
SET DTDX=$ORDER(^ONCO(165.5,"ADX",DTDX))
if DTDX'>0
QUIT
Begin DoDot:1
+5 FOR IEN=0:0
SET IEN=$ORDER(^ONCO(165.5,"ADX",DTDX,IEN))
if IEN'>0
QUIT
Begin DoDot:2
+6 SET CTR=CTR+1
IF CTR#150=0
DO BMES^XPDUTL(".")
+7 SET HIST=$PIECE($GET(^ONCO(165.5,IEN,2.2)),U,3)
+8 SET PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
+9 SET PRIMSITE=$PIECE($GET(^ONCO(165.5,IEN,2)),U,1)
+10 ;Part 1
+11 IF HIST=96543
Begin DoDot:3
+12 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=96533
+13 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, LYMPHOCYTE DEPLETION, NOS"
End DoDot:3
+14 IF HIST=96613!(HIST=96623)
Begin DoDot:3
+15 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=96503
+16 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, NOS"
End DoDot:3
+17 IF HIST=96643!(HIST=96653)!(HIST=96673)
Begin DoDot:3
+18 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=96633
+19 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="HODGKIN LYMPHOMA, NODULAR SCLEROSIS, NOS"
End DoDot:3
+20 IF HIST=96753
Begin DoDot:3
+21 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=96903
+22 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="FOLLICULAR LYMPHOMA, NOS"
End DoDot:3
+23 IF HIST=96843
Begin DoDot:3
+24 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=96803
+25 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="MALIGNANT LYMPHOMA, LRGE B-CELL, DIFFUSE, NOS"
End DoDot:3
+26 IF HIST=97503!(HIST=97543)
Begin DoDot:3
+27 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=97513
+28 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="LANGERHANS CELL HISTIOCYTOSIS, NOS"
End DoDot:3
+29 IF HIST=97603!(HIST=97643)
Begin DoDot:3
+30 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=97623
+31 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="HEAVY CHAIN DISEASE, NOS"
End DoDot:3
+32 IF HIST=98053
Begin DoDot:3
+33 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98093
+34 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="MIXED PHENOTYPE ACUTE LEUKEMIA, T/MYELOID, NOS"
End DoDot:3
+35 IF HIST=99603
Begin DoDot:3
+36 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=99753
+37 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="MYELODYSPLASTIC/MYELOPROLIFERATIVE NEOPLASM, UNCLASSIFIABLE"
End DoDot:3
+38 IF HIST=99843
Begin DoDot:3
+39 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=99833
+40 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="REFRACTORY ANEMIA WITH EXCESS BLASTS"
End DoDot:3
+41 IF HIST=99873
Begin DoDot:3
+42 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=99203
+43 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="THERAPY-RELATED ACUTE MYELOID LEUKEMIA, NOS"
End DoDot:3
+44 ;Part 2
+45 IF HIST=96703
IF ((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4"))
Begin DoDot:3
+46 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98233
+47 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B-CELL CHRON LYMPHOCYTIC LEUK/SMALL LYMPHOMA"
End DoDot:3
+48 IF HIST=97283
IF ((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4"))
Begin DoDot:3
+49 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98113
+50 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
End DoDot:3
+51 IF HIST=97293
IF ((PRSTCD'="C42.0")&(PRSTCD'="C42.1")&(PRSTCD'="C42.3")&(PRSTCD'="C42.4"))
Begin DoDot:3
+52 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98373
+53 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="T LYMPHOBLASTIC LEUKEMIA/LYMPHOMA"
End DoDot:3
+54 IF ((HIST=98353)!(HIST=98363))
IF ((PRSTCD'="C42.1")&(PRSTCD'="C44.1")&(PRSTCD'="C69.0")&(PRSTCD'="C69.5")&(PRSTCD'="C69.6"))
Begin DoDot:3
+55 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98113
+56 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
+57 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+58 IF ((HIST=98353)!(HIST=98363))
IF PRSTCD="C42.1"
Begin DoDot:3
+59 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98113
+60 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
End DoDot:3
+61 ;Part 3
+62 IF HIST=96703
IF ((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4"))
Begin DoDot:3
+63 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98233
+64 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B-CELL CHRON LYMPHOCYTIC LEUK/SMALL LYMPHOMA"
+65 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+66 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+67 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+68 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+69 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
+70 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=988
+71 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=988
+72 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=988
+73 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=988
+74 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=988
+75 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=988
+76 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=988
+77 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=988
+78 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=988
End DoDot:3
+79 IF HIST=97283
IF ((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4"))
Begin DoDot:3
+80 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98113
+81 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
+82 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+83 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+84 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+85 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+86 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
+87 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=988
+88 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=988
+89 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=988
+90 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=988
+91 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=988
+92 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=988
+93 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=988
+94 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=988
+95 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=988
End DoDot:3
+96 IF HIST=97293
IF ((PRSTCD="C42.0")!(PRSTCD="C42.1")!(PRSTCD="C42.3")!(PRSTCD="C42.4"))
Begin DoDot:3
+97 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98373
+98 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="T LYMPHOBLASTIC LEUKEMIA/LYMPHOMA"
+99 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+100 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+101 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+102 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+103 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
+104 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=988
+105 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=988
+106 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=988
+107 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=988
+108 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=988
+109 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=988
+110 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=988
+111 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=988
+112 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=988
End DoDot:3
+113 IF ((HIST=98353)!(HIST=98363))
IF ((PRSTCD="C44.1")!(PRSTCD="C69.0")!(PRSTCD="C69.5")!(PRSTCD="C69.6"))
Begin DoDot:3
+114 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=98113
+115 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="B LYMPHOBLASTIC LEUKEMIA/LYMPHOMA, NOS"
+116 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+117 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+118 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,3)=98
+119 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,12)=988
+120 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+121 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+122 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
+123 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=988
+124 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=988
+125 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=988
+126 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=988
+127 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=988
+128 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=988
+129 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=988
+130 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=988
+131 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=988
End DoDot:3
+132 IF HIST=97333
Begin DoDot:3
+133 SET $PIECE(^ONCO(165.5,IEN,2.2),U,3)=97323
+134 SET $PIECE(^ONCO(165.5,IEN,8),U,2)="MULTIPLE MYELOMA"
+135 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+136 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=810
+137 IF PRSTCD'="C42.1"
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,3)=98
+138 IF PRSTCD="C42.1"
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,3)=""
+139 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,3)=98
+140 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,12)=987
+141 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=988
+142 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=999
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=999
+143 SET NVAL=988
IF PRSTCD="C42.1"
SET NVAL=""
+144 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=NVAL
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=NVAL
+145 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=NVAL
+146 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=NVAL
+147 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=NVAL
+148 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=NVAL
+149 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=NVAL
+150 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=NVAL
+151 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=NVAL
+152 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=NVAL
+153 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=NVAL
End DoDot:3
+154 ;Part 4
+155 IF ((HIST=98203)!(HIST=98263)!(HIST=98313)!(HIST=98323)!(HIST=98333)!(HIST=98343))
IF ((PRSTCD="C44.1")!(PRSTCD="C69.0")!(PRSTCD="C69.5")!(PRSTCD="C69.6"))
Begin DoDot:3
+156 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+157 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+158 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,3)=98
+159 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,12)=988
+160 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+161 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+162 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
+163 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,10)=988
+164 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,1)=988
+165 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,2)=988
+166 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,3)=988
+167 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,4)=988
+168 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,5)=988
+169 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,6)=988
+170 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,7)=988
+171 SET $PIECE(^ONCO(165.5,IEN,"CS2"),U,8)=988
End DoDot:3
+172 IF ((HIST=98113)!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98273)!(HIST=98373))
IF (PRSTCD="C42.3")
Begin DoDot:3
+173 SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
+174 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,11)=800
+175 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,5)=999
+176 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,6)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,7)=988
+177 SET $PIECE(^ONCO(165.5,IEN,"CS"),U,8)=988
SET $PIECE(^ONCO(165.5,IEN,"CS"),U,9)=988
End DoDot:3
+178 QUIT
End DoDot:2
+179 QUIT
End DoDot:1
+180 SET CTR=0
+181 DO BMES^XPDUTL("...Step 2: Grade conversions...")
+182 FOR DTDX=3099999:0
SET DTDX=$ORDER(^ONCO(165.5,"ADX",DTDX))
if DTDX'>0
QUIT
Begin DoDot:1
+183 FOR IEN=0:0
SET IEN=$ORDER(^ONCO(165.5,"ADX",DTDX,IEN))
if IEN'>0
QUIT
Begin DoDot:2
+184 SET CTR=CTR+1
IF CTR#150=0
DO BMES^XPDUTL(".")
+185 SET HIST=$PIECE($GET(^ONCO(165.5,IEN,2.2)),U,3)
+186 SET PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
+187 SET PRIMSITE=$PIECE($GET(^ONCO(165.5,IEN,2)),U,1)
+188 SET GRADE=$PIECE($GET(^ONCO(165.5,IEN,2)),U,5)
+189 ;
+190 IF HIST=95903!(HIST=96503)!(HIST=96513)!(HIST=96523)!(HIST=96533)!(HIST=96553)!(HIST=96633)!(HIST=97273)!(HIST=97353)!(HIST=98003)!(HIST=98203)
Begin DoDot:3
+191 IF GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4)
SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+192 IF HIST=98323!(HIST=98403)!(HIST=98603)!(HIST=98613)!(HIST=98633)!(HIST=98653)!(HIST=98663)!(HIST=98673)!(HIST=98693)!(HIST=98703)!(HIST=98713)
Begin DoDot:3
+193 IF GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4)
SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+194 IF HIST=98723!(HIST=98733)!(HIST=98743)!(HIST=98913)!(HIST=98953)!(HIST=98963)!(HIST=98973)!(HIST=98983)!(HIST=99103)!(HIST=99113)!(HIST=99203)
Begin DoDot:3
+195 IF GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4)
SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+196 IF HIST=99303!(HIST=99313)!(HIST=99653)!(HIST=99663)!(HIST=99673)!(HIST=99713)
Begin DoDot:3
+197 IF GRADE=1!(GRADE=2)!(GRADE=3)!(GRADE=4)
SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+198 ;
+199 IF HIST=95913!(HIST=95963)!(HIST=95973)!(HIST=96593)!(HIST=96713)!(HIST=96733)!(HIST=96783)!(HIST=96793)!(HIST=96803)!(HIST=96873)!(HIST=96883)!(HIST=96893)
Begin DoDot:3
+200 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=6
End DoDot:3
+201 IF HIST=96903!(HIST=96913)!(HIST=96953)!(HIST=96983)!(HIST=96993)!(HIST=97123)!(HIST=97313)!(HIST=97323)!(HIST=97343)!(HIST=97373)!(HIST=97383)!(HIST=97613)
Begin DoDot:3
+202 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=6
End DoDot:3
+203 IF HIST=97623!(HIST=98113)!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98263)!(HIST=98333)!(HIST=99403)
Begin DoDot:3
+204 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=6
End DoDot:3
+205 ;
+206 IF HIST=97003!(HIST=97013)!(HIST=97023)!(HIST=97053)!(HIST=97083)!(HIST=97093)!(HIST=97163)!(HIST=97173)!(HIST=97183)!(HIST=97243)!(HIST=97253)!(HIST=97263)!(HIST=98273)!(HIST=98343)!(HIST=98373)
Begin DoDot:3
+207 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=5
End DoDot:3
+208 ;
+209 IF HIST=97143
IF GRADE'=6
Begin DoDot:3
+210 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=5
End DoDot:3
+211 ;
+212 IF HIST=97193!(HIST=99483)
Begin DoDot:3
+213 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=8
End DoDot:3
+214 ;
+215 IF HIST=97403!(HIST=97413)!(HIST=97423)!(HIST=97513)!(HIST=97553)!(HIST=97563)!(HIST=97573)!(HIST=97583)!(HIST=97593)!(HIST=98013)!(HIST=98063)!(HIST=98073)!(HIST=98083)!(HIST=98093)!(HIST=98753)
Begin DoDot:3
+216 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+217 IF HIST=98763!(HIST=99453)!(HIST=99463)!(HIST=99503)!(HIST=99613)!(HIST=99623)!(HIST=99633)!(HIST=99643)!(HIST=99753)!(HIST=99803)!(HIST=99823)!(HIST=99833)!(HIST=99853)!(HIST=99863)!(HIST=99893)!(HIST=99913)!(HIST=99923)
Begin DoDot:3
+218 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+219 ;
+220 IF HIST=98313
IF GRADE'=5
IF GRADE'=8
Begin DoDot:3
+221 SET $PIECE(^ONCO(165.5,IEN,2),U,5)=9
End DoDot:3
+222 QUIT
End DoDot:2
+223 QUIT
End DoDot:1
+224 SET CTR=0
+225 DO BMES^XPDUTL("...Step 3-Primary Site conversions...")
+226 FOR DTDX=3099999:0
SET DTDX=$ORDER(^ONCO(165.5,"ADX",DTDX))
if DTDX'>0
QUIT
Begin DoDot:1
+227 FOR IEN=0:0
SET IEN=$ORDER(^ONCO(165.5,"ADX",DTDX,IEN))
if IEN'>0
QUIT
Begin DoDot:2
+228 SET CTR=CTR+1
IF CTR#150=0
DO BMES^XPDUTL(".")
+229 SET HIST=$PIECE($GET(^ONCO(165.5,IEN,2.2)),U,3)
+230 SET PRSTCD=$$GET1^DIQ(165.5,IEN,20.1)
+231 SET PRIMSITE=$PIECE($GET(^ONCO(165.5,IEN,2)),U,1)
+232 ;Table 1
+233 IF HIST=97323!(HIST=97413)!(HIST=97423)
Begin DoDot:3
+234 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+235 IF HIST=97613
Begin DoDot:3
+236 IF PRIMSITE'=67420
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67420
End DoDot:3
+237 IF HIST=98003!(HIST=98013)!(HIST=98063)!(HIST=98073)!(HIST=98083)!(HIST=98093)!(HIST=98203)!(HIST=98263)!(HIST=98313)!(HIST=98323)!(HIST=98333)!(HIST=98343)
Begin DoDot:3
+238 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+239 IF HIST=98403!(HIST=98603)!(HIST=98613)!(HIST=98633)!(HIST=98653)!(HIST=98663)!(HIST=98673)!(HIST=98693)!(HIST=98703)!(HIST=98713)!(HIST=98723)!(HIST=98733)!(HIST=98743)
Begin DoDot:3
+240 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+241 IF HIST=98753!(HIST=98763)!(HIST=98913)!(HIST=98953)!(HIST=98963)!(HIST=98973)!(HIST=98983)!(HIST=99103)!(HIST=99113)!(HIST=99203)!(HIST=99313)!(HIST=99403)!(HIST=99453)
Begin DoDot:3
+242 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+243 IF HIST=99463!(HIST=99483)!(HIST=99503)!(HIST=99613)!(HIST=99623)!(HIST=99633)!(HIST=99643)!(HIST=99653)!(HIST=99663)!(HIST=99673)!(HIST=99753)!(HIST=99803)!(HIST=99823)
Begin DoDot:3
+244 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+245 IF HIST=99833!(HIST=99853)!(HIST=99863)!(HIST=99893)!(HIST=99913)!(HIST=99923)
Begin DoDot:3
+246 IF PRIMSITE'=67421
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+247 ;Table 2
+248 IF HIST=98113!(HIST=98123)!(HIST=98133)!(HIST=98143)!(HIST=98153)!(HIST=98163)!(HIST=98173)!(HIST=98183)!(HIST=98233)!(HIST=98273)!(HIST=98373)
Begin DoDot:3
+249 IF PRIMSITE=67420!(PRIMSITE=67424)
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+250 IF HIST=97623
Begin DoDot:3
+251 IF PRIMSITE=67420!(PRIMSITE=67423)!(PRIMSITE=67424)
SET $PIECE(^ONCO(165.5,IEN,2),U,1)=67421
End DoDot:3
+252 ;Table 3 & Table 4 (for manual review only, no code change)
+253 QUIT
End DoDot:2
+254 QUIT
End DoDot:1
+255 DO BMES^XPDUTL("...Conversions complete!")
+256 QUIT