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

ONCOU55A.m

Go to the documentation of this file.
  1. ONCOU55A ;Hines OIFO/GWB,RTK-UTILITY ROUTINE 2 ;12/15/99
  1. ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
  1. Q ;no direct invocations
  1. ;
  1. RSTG(ONCDDX) ;restage all primaries diagnosed from year YEAR1 forward - called by STAGEM
  1. ;ONCDDX:optional parameter - date from which to begin
  1. ;default = beginning of time
  1. W !!,"This option is no longer available." Q
  1. N DXDATE,WRTFLG,SYBIX,SYBIX1,COUNT,COUNTCHG
  1. D INIT ;initialize our variables
  1. D PROCESS ;process the primaries
  1. Q
  1. ;
  1. INIT ;initialize our variables - called by RSTG
  1. S (COUNT,COUNTCHG)=0
  1. S WRTFLG=0 ; suppress interaction with the stager
  1. S SYBIX=$G(^ONCO("RESTAGE",0))+1,^(0)=SYBIX,^(SYBIX,0)=$H,SYBIX1=0 ; indices for use in saving old stage
  1. I '$D(ONCDDX) S ONCDDX=0 ; date dx index - will be used in PROC
  1. I ONCDDX S ONCDDX=ONCDDX-1E10 ; to catch the first one if we're not starting at the top
  1. Q
  1. ;
  1. PROCESS ;Process the primaries - called by RSTG
  1. F S ONCDDX=$O(^ONCO(165.5,"ADX",ONCDDX)) Q:ONCDDX="" D
  1. .N PRIMIX S PRIMIX=0
  1. .F S PRIMIX=$O(^ONCO(165.5,"ADX",ONCDDX,PRIMIX)) Q:PRIMIX="" I $$DIV^ONCFUNC(PRIMIX)=DUZ(2) D PROC1(PRIMIX)
  1. ;
  1. W !,"Number of primaries processed : ",$J(COUNT,6)
  1. W !,"Number of primaries restaged : ",$J(COUNTCHG,6),!!
  1. S $P(^ONCO("RESTAGE",SYBIX,0),U,2)=COUNT
  1. Q
  1. ;
  1. PROC1(D0) ;process a single primary D0 - called by PROCESS
  1. ;save off the old value, calculate and store the new value
  1. ;(not user override of stage) AND (tumor not a Lymphoma)
  1. I '$$NOSTAGE^ONCOU55(D0),'$$LYMPHOMA^ONCFUNC(D0),'$$MYCOSIS^ONCOU55(D0) D
  1. .N OLDSTAGE S OLDSTAGE=$P($G(^ONCO(165.5,D0,2)),U,20) ; get old stage
  1. .S SYBIX1=$G(SYBIX1)+1,^ONCO("RESTAGE",SYBIX,SYBIX1,0)=D0_U_OLDSTAGE ; save old stage
  1. .S DA=D0 D ES^ONCOTN ; do the staging - returns variable SG
  1. .S COUNT=$G(COUNT)+1 ; number processed
  1. .I $P($G(^ONCO(165.5,+D0,2)),U,20)'=OLDSTAGE S COUNTCHG=$G(COUNTCHG)+1 ; number changed
  1. .W:$R(50)=0 "."
  1. Q
  1. ;
  1. STAGEM ;Interact with user to restage primaries
  1. ;Called by routine ONCOPOS
  1. ;Called by option ONCO #SITE-RESTAGE PRIMARY
  1. N FIRST S FIRST=$$RSTGASK()
  1. I FIRST<0 W !!,*7,"Restaging aborted - no data changed - continuing...",!!
  1. E D RSTG(FIRST) ; start with date returned in Y
  1. Q
  1. ;
  1. RSTGASK() ;Function to determine initial restaging date/time
  1. N DIR,DTOUT,DUOUT,Y
  1. S DIR(0)="DO^2880101:"_DT_":EP",DIR("A")="Beginning date for restaging",DIR("B")="1/1/88",DIR("?")="Enter the date from which to restage all primaries (just the year is fine)"
  1. D ^DIR ; returns result in Y
  1. I $D(DTOUT)!$D(DUOUT) S Y=-1 ; they bailed out or fell asleep
  1. QUIT +Y