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

ONC2PS10.m

Go to the documentation of this file.
ONC2PS10 ;Hines OIFO/RTK - Post-Install Routine for Patch ONC*2.2*10 ;11/27/18
 ;;2.2;ONCOLOGY;**10**;Jul 31, 2013;Build 20
 ;
 ;N RC
 ;DC production server Patch 10
 S RC=$$UPDCSURL^ONCSAPIU("http://127.0.0.1:86/cgi_bin/oncsrv.exe")
 ;DC test server, comment out for final release.
 ;S RC=$$UPDCSURL^ONCSAPIU("http://127.0.0.1:81/cgi_bin/oncsrv.exe")
 ;
 K ^DD(164.81,.001)
 K ^DD(164.82,.001)
 K ^DD(164.83,.001)
 K ^DD(164.84,.001)
 K ^DD(167.1,.001)
 K ^DD(167.5,.001)
 D LVI,COC,RAD18
 Q
PRE ;Pre-init logic
 ;delete the old version of Extract file
 K ^ONCO(160.16)
 D BMES^XPDUTL("Done removing old entries in file #160.16")
 K ^ONCO(164.44)
 K ^ONCO(165.9)
 Q
 ;
LVI ;need to reset any Lymph-Vascular Invasion with value of '1' for
 ; 2018+ cases, because new 2018 LVI has new values and '1' values
 ; could be 1 or new 2,3 or 4 values so must be reset
 S ONCDXLVI=3171231 F  S ONCDXLVI=$O(^ONCO(165.5,"ADX",ONCDXLVI)) Q:ONCDXLVI'>0  D
 .S IEN=0 F  S IEN=$O(^ONCO(165.5,"ADX",ONCDXLVI,IEN)) Q:IEN'>0  D
 ..I $P($G(^ONCO(165.5,IEN,2)),"^",19)=1 S $P(^ONCO(165.5,IEN,2),"^",19)=""
 K ONCDXLVI Q
COC ;Set the COC Accredited Flag field for 2018+ cases
 ; code to calculate/automatically set COC ACCREDITED FLAG (#7033) field 
 ; this code will also automatically set the DERIVED SS2018 (#7012) fld
 S ONCDXCOC=3171231 F  S ONCDXCOC=$O(^ONCO(165.5,"ADX",ONCDXCOC)) Q:ONCDXCOC'>0  D
 .S IEN=0 F  S IEN=$O(^ONCO(165.5,"ADX",ONCDXCOC,IEN)) Q:IEN'>0  D
 ..S $P(^ONCO(165.5,IEN,"NCR18"),"^",13)=9  ;set=9 until were able to calc
 ..I $P($G(^ONCO(165.5,IEN,0)),U,16)<3180000 Q
 ..I $$COCACC^ONCACDU2'="01" S $P(^ONCO(165.5,IEN,"NCR18B"),"^",10)=0
 ..I $$COCACC^ONCACDU2="01" D
 ...N ONCCOC S ONCCOC=$P($G(^ONCO(165.5,IEN,0)),U,4)
 ...I ((ONCCOC>1)&(ONCCOC<10)) S $P(^ONCO(165.5,IEN,"NCR18B"),"^",10)=1 ;ANALYTIC, class of case 10-22 (iens in 165.3 of 2-9)
 ...I (ONCCOC=1)!(ONCCOC=24)!((ONCCOC>9)&(ONCCOC<23)) S $P(^ONCO(165.5,IEN,"NCR18B"),"^",10)=2 ;NON-ANALYTIC, class of case 30-43,99,00 (iens 10-22,1,24)
 ; not set for CoC ien 23
 K ONCDXCOC Q
 Q
RAD18 ;populate the new 2018 Radiation fields according to the NAACCR
 ; crosswalk using the existing data in old Radiation fields
 ;
PASS1 ;
 D BMES^XPDUTL("Populate 2018 Radation fields according to NAACCR crosswalk...")
 D MES^XPDUTL("...pass 1 (of 5)...")
 S ONCDONE=0
 S IEN=0 F  S IEN=$O(^ONCO(165.5,IEN)) Q:IEN'>0  D 
 .S DATEDX=$P($G(^ONCO(165.5,IEN,0)),U,16)
 .S TOPIEN=$P($G(^ONCO(165.5,IEN,2)),U,1) Q:TOPIEN=""
 .S TOPCOD=$P($G(^ONCO(164,TOPIEN,0)),U,2)
 .S ONCTPCD=$P(TOPCOD,".",1)_$P(TOPCOD,".",2) ;remove the "."
 .S ONCHIST=$$HIST^ONCFUNC(IEN)
 .S HST14=$E(ONCHIST,1,4),ONCT3=$E(ONCTPCD,2,5)
 .S RAD1540=$P($G(^ONCO(165.5,IEN,3)),U,21)
 .S RAD1570=$P($G(^ONCO(165.5,IEN,"BLA2")),U,18)
 .S RAD3200=$P($G(^ONCO(165.5,IEN,24)),U,9)
 .I RAD1540=1 S RAD1504=1,RAD1505=1,RAD1501="00000" D SETPIECE Q
 .I RAD1540=2 S RAD1504=10,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=3 S RAD1504=11,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=4 S RAD1504=12,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=5 S RAD1504=13,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I (RAD1540=6)!(RAD1540=7) D  I ONCDONE=1 Q
 ..I ((HST14>9589)&(HST14<9730)) S RAD1504=2,RAD1505=10,RAD1501="99999" D SETPIECE Q
 ..I (ONCT3="000")!((ONCT3>0)&(ONCT3<10))!((ONCT3>19)&(ONCT3<51))!((ONCT3>59)&(ONCT3<70)) S RAD1504=16,RAD1505=2,RAD1501="99999" D SETPIECE Q
 ..I (ONCTPCD="C019")!((ONCT3>50)&(ONCT3<60))!((ONCT3>89)&(ONCT3<110))!(ONCTPCD="C140") S RAD1504=17,RAD1505=2,RAD1501="99999" D SETPIECE Q
 ..I ((ONCT3>109)&(ONCT3<120)) S RAD1504=15,RAD1505=2,RAD1501="99999" D SETPIECE Q
 ..I (ONCTPCD="C129")!((ONCT3>129)&(ONCT3<140))!((ONCT3>319)&(ONCT3<330)) S RAD1504=18,RAD1505=2,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=22,RAD1505=2,RAD1501="99999" D SETPIECE Q
 .I RAD1540=8 S RAD1504=18,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=9 S RAD1504=19,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=10 S RAD1504=20,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=11 D  I ONCDONE=1 Q
 ..I ((HST14>9049)&(HST14<9056)) S RAD1504=24,RAD1505=3,RAD1501="99999" D SETPIECE Q
 ..I ((HST14>8579)&(HST14<8589)) S RAD1504=25,RAD1505=3,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=26,RAD1505=3,RAD1501="99999" D SETPIECE Q
 .I RAD1540=12 D  I ONCDONE=1 Q
 ..I ((HST14>9049)&(HST14<9056)) S RAD1504=24,RAD1505=1,RAD1501="99999" D SETPIECE Q
 ..I ((HST14>8579)&(HST14<8589)) S RAD1504=25,RAD1505=1,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=23,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=13 S RAD1504=30,RAD1505=3,RAD1501="99999" D SETPIECE Q
 .I RAD1540=14 S RAD1504=31,RAD1505=6,RAD1501="99999" D SETPIECE Q
 .I RAD1540=15 S RAD1504=36,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=16 S RAD1504=38,RAD1505=6,RAD1501="99999" D SETPIECE Q
 .I RAD1540=17 S RAD1504=42,RAD1505=6,RAD1501="99999" D SETPIECE Q
 .I RAD1540=18 D  I ONCDONE=1 Q
 ..I ((ONCT3>169)&(ONCT3<180)) S RAD1504=32,RAD1505=6,RAD1501="99999" D SETPIECE Q
 ..I ((ONCT3>179)&(ONCT3<190)) S RAD1504=33,RAD1505=11,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=39,RAD1505=6,RAD1501="99999" D SETPIECE Q
 .I RAD1540=19 D  I ONCDONE=1 Q
 ..I ((RAD1570>35)&(RAD1570<42))&(RAD3200=1) S RAD1504=28,RAD1505=1,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=27,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=20 S RAD1504=27,RAD1505=5,RAD1501="99999" D SETPIECE Q
 .I RAD1540=21 S RAD1504=29,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=22 S RAD1504=29,RAD1505=5,RAD1501="99999" D SETPIECE Q
 .I RAD1540=23 S RAD1504=65,RAD1505=10,RAD1501="99999" D SETPIECE Q
 .I RAD1540=24 S RAD1504=66,RAD1505=10,RAD1501="99999" D SETPIECE Q
 .I RAD1540=25 S RAD1504=54,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=26 S RAD1504=53,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=27 S RAD1504=56,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=28 S RAD1504=57,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=29 S RAD1504=58,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=30 D  I ONCDONE=1 Q
 ..I ((HST14>9589)&(HST14<9730)) S RAD1504=7,RAD1505=10,RAD1501="99999" D SETPIECE Q
 ..I "C180^C181^C182^C183^C184^C185^C186^C187^C188^C189"[ONCTPCD S RAD1504=33,RAD1505=11,RAD1501="99999" D SETPIECE Q
 ..I ONCTPCD="C209" S RAD1504=34,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I "C210^C211^C212^C213^C214^C215^C216^C217^C218"[ONCTPCD S RAD1504=35,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I "C510^C511^C512^C518"[ONCTPCD S RAD1504=51,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I ONCTPCD="C529" S RAD1504=52,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I ((ONCT3>529)&(ONCT3<560)) S RAD1504=50,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I ONCTPCD="C619" S RAD1504=44,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I ONCTPCD="C669" S RAD1504=43,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I "C670^C671^C672^C673^C674^C675^C676^C677^C678^C679"[ONCTPCD S RAD1504=40,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=59,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=31 S RAD1504=61,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=32 S RAD1504=62,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=33 S RAD1504=63,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=34 S RAD1504=64,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=35 S RAD1504=40,RAD1505=7,RAD1501="99999" D SETPIECE Q
 .I RAD1540=36 S RAD1504=44,RAD1505=7,RAD1501="99999" D SETPIECE Q
 .I RAD1540=37 S RAD1504=50,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=38 S RAD1504=55,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=39 S RAD1504=60,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=40 S RAD1504=67,RAD1505=10,RAD1501="99999" D SETPIECE Q
 .I RAD1540=43 S RAD1504=14,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=44 S RAD1504=44,RAD1505=1,RAD1501="99999" D SETPIECE Q
 .I RAD1540=45 S RAD1504=21,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=46 S RAD1504=9,RAD1505=10,RAD1501="99999" D SETPIECE Q
 .I RAD1540=41 D  I ONCDONE=1 Q
 ..I ONCTPCD="C669" S RAD1504=43,RAD1505=7,RAD1501="99999" D SETPIECE Q
 ..I ONCTPCD="C680" S RAD1504=46,RAD1505=11,RAD1501="99999" D SETPIECE Q
 ..I "C600^C601^C602^C603^C604^C605^C606^C607^C608^C609"[ONCTPCD S RAD1504=47,RAD1505=11,RAD1501="99999" D SETPIECE Q
 ..I ((ONCT3>619)&(ONCT3<640)) S RAD1504=48,RAD1505=11,RAD1501="99999" D SETPIECE Q
 ..S RAD1504=69,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540=42 S RAD1504=70,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .I RAD1540'="" S RAD1504=68,RAD1505=11,RAD1501="99999" D SETPIECE Q
 .Q
 ;
PASS2 ;
 D MES^XPDUTL("...pass 2 (of 5)...")
 S IEN=0 F  S IEN=$O(^ONCO(165.5,IEN)) Q:IEN'>0  D 
 .S DATEDX=$P($G(^ONCO(165.5,IEN,0)),U,16)
 .S TOPIEN=$P($G(^ONCO(165.5,IEN,2)),U,1) Q:TOPIEN=""
 .S TOPCOD=$P($G(^ONCO(164,TOPIEN,0)),U,2)
 .S ONCTPCD=$P(TOPCOD,".",1)_$P(TOPCOD,".",2) ;remove the "."
 .S ONCHIST=$$HIST^ONCFUNC(IEN)
 .S HST14=$E(ONCHIST,1,4),ONCT3=$E(ONCTPCD,2,5)
 .S RAD1570=$P($G(^ONCO(165.5,IEN,"BLA2")),U,18)
 .I RAD1570="" Q
 .I RAD1570=1 S RAD1506=1,RAD1502=1 D SETPASS2 Q
 .I (RAD1570=20)!(RAD1570=29) S RAD1506=2,RAD1502=2 D SETPASS2 Q
 .I RAD1570=21 S RAD1506=3,RAD1502=3 D SETPASS2 Q
 .I (RAD1570=22)!(RAD1570=23)!(RAD1570=24)!(RAD1570=25)!(RAD1570=26)!(RAD1570=27) S RAD1506=3,RAD1502=2 D SETPASS2 Q
 .I RAD1570=28 S RAD1506=5,RAD1502=4 D SETPASS2 Q
 .I RAD1570=30 S RAD1506=6,RAD1502=2 D SETPASS2 Q
 .I RAD1570=31 S RAD1506=3,RAD1502=6 D SETPASS2 Q
 .I RAD1570=32 S RAD1506=2,RAD1502=5 D SETPASS2 Q
 .I RAD1570=33 S RAD1506=4,RAD1502=2 D SETPASS2 Q
 .I RAD1570=34 S RAD1506=3,RAD1502=7 D SETPASS2 Q
 .I RAD1570=35 S RAD1506=3,RAD1502=8 D SETPASS2 Q
 .I RAD1570=36 S RAD1506=3,RAD1502=9 D SETPASS2 Q
 .I RAD1570=37 S RAD1506=8,RAD1502=12 D SETPASS2 Q
 .I RAD1570=38 S RAD1506=9,RAD1502=12 D SETPASS2 Q
 .I RAD1570=39 S RAD1506=10,RAD1502=12 D SETPASS2 Q
 .I RAD1570=40 S RAD1506=11,RAD1502=12 D SETPASS2 Q
 .I RAD1570=41 S RAD1506=12,RAD1502=12 D SETPASS2 Q
 .I (RAD1570=42)!(RAD1570=43) S RAD1506=14,RAD1502=12 D SETPASS2 Q
 .I RAD1570=44 S RAD1506=16,RAD1502=12 D SETPASS2 Q
 .I RAD1570=45 S RAD1506=17,RAD1502=12 D SETPASS2 Q
 .I (RAD1570=46)!(RAD1570=47)!(RAD1570=18) S RAD1506=18,RAD1502=13 D SETPASS2 Q
 .I RAD1570=19 S RAD1506=18,RAD1502=14 D SETPASS2 Q
 .I ((RAD1570>1)&(RAD1570<18)) S RAD1506=18,RAD1502=13 D SETPASS2 Q
 .Q
 ;
PASS3 ;
 D MES^XPDUTL("...pass 3 (of 5)...")
 S IEN=0 F  S IEN=$O(^ONCO(165.5,IEN)) Q:IEN'>0  D 
 .S RAD1520=$P($G(^ONCO(165.5,IEN,3)),U,20)
 .S RAD1510=$P($G(^ONCO(165.5,IEN,"THY1")),U,43)
 .S RAD3210=$P($G(^ONCO(165.5,IEN,"THY1")),U,44)
 .S RAD1503=RAD1520
 .D
 ..I RAD1510="" S RAD1507="" Q
 ..I RAD1510=0 S RAD1507=0 Q
 ..I RAD1510="88888" S RAD1507="888888" Q
 ..I RAD1510="99999" S RAD1507="999999" Q
 ..S RAD1507="0"_RAD1510 Q
 .D
 ..I RAD3210="" S RAD1517="" Q
 ..I RAD3210=0 S RAD1517=0 Q
 ..I RAD3210="88888" S RAD1517="888888" Q
 ..I RAD3210="99999" S RAD1517="999999" Q
 ..S RAD1517="0"_RAD3210 Q
 .S $P(^ONCO(165.5,IEN,"RAD18"),U,3)=RAD1503  ;PHASE 1 NUM OF FRACTIONS
 .S $P(^ONCO(165.5,IEN,"RAD18"),U,7)=RAD1507  ;PHASE 1 TOTAL DOSE
 .S $P(^ONCO(165.5,IEN,"RAD18"),U,14)=RAD1517  ;PHASE 2 TOTAL DOSE
 .Q
 ;
 D ^ONC2PSTN
 ;
 Q
 ;
SETPIECE ;set the values for the new RAD fields - Pass 1
 S $P(^ONCO(165.5,IEN,"RAD18"),U,4)=RAD1504  ;PHASE 1 RAD TX VOL
 S $P(^ONCO(165.5,IEN,"RAD18"),U,5)=RAD1505  ;PHASE 1 RAD DRAINING LN
 S $P(^ONCO(165.5,IEN,"RAD18"),U,1)=RAD1501  ;PHASE 1 RAD DOSE PER FRAC
 S ONCDONE=1
 Q
 ;
SETPASS2 ;set the values for the new RAD fields - Pass 2
 S $P(^ONCO(165.5,IEN,"RAD18"),U,6)=RAD1506  ;PHASE 1 RAD TX MODALITY
 S $P(^ONCO(165.5,IEN,"RAD18"),U,2)=RAD1502  ;PHASE 1 RAD EXT BEAM PLAN
 Q