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

ONCOU.m

Go to the documentation of this file.
  1. ONCOU ;Hines OIFO/GWB ONCOTRAX utilities ;06/06/00
  1. ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
  1. ;
  1. ASKNUM(TXT,RNG,DFLT) ;ask for a number - expects RNG as NNN:NNN
  1. N DIR,Y S DIR(0)="N^"_RNG,DIR("A")=TXT S:$D(DFLT) DIR("B")=DFLT D ^DIR Q Y
  1. ASKY(TXT) ;ask a Y/N question, default YES, returns 1 for Y, 0 for N
  1. N DIR,Y S DIR("A")=TXT,DIR(0)="Y",DIR("B")="Yes" D ^DIR S:Y=U Y=-1 Q Y
  1. LOOKUP(FL,NTR,UIO,Y) ;look up entry NTR in File FL with user options UIO, return Y array if parameter passed
  1. N DIC,Y S DIC=FL,DIC(0)=$G(UIO),X=NTR D ^DIC Q +Y
  1. GETVAL(FN,DA,DR,SE,SF) ;get value of field DR in entry DA in file FN - if DR is a multiple then get subfield SF in subentry SE
  1. N DI,DIC,DIQ,OQ,OX,D0 S DIC=FN,DIQ="OQ",OX=+$P(^DD(FN,DR,0),U,2) S:OX DA(OX)=SE,DR(OX)=SF D EN^DIQ1 Q $S(OX:OQ(OX,SE,SF),1:OQ(FN,DA,DR))
  1. VERSION(PKG) ;get version # for pkg
  1. N PNU,Y S PNU=+$O(^DIC(9.4,"B",PKG,"")),Y=$G(^DIC(9.4,PNU,"VERSION")) Q Y
  1. VERCHK(PKG,VER,PATNO) ;verify version for a patch
  1. N INST,OK S OK=0 ; assume the worst
  1. W !!,"This routine will install ",PKG," Version ",VER," Patch ",PATNO,".",!!
  1. S INST=$$VERSION(PKG)
  1. I INST="" W *7,"But the ",PKG," package doesn't seem to be installed on this system!"
  1. E I INST'=VER W *7,"But Version ",VER," of the ",PKG," package doesn't seem to be installed!" W:INST !,"(Current installed version: ",INST,")"
  1. E S OK=1
  1. Q OK
  1. SITEPAR(MSG) ;Are ONCOCOLOGY SITE PARAMETERS defined?
  1. N OK
  1. S OK=$O(^ONCO(160.1,"C",DUZ(2),0))
  1. I OK="" S OK=$O(^ONCO(160.1,0))
  1. I 'OK,$G(MSG)="ERRMSG" W !!,"The ONCOLOGY SITE PARAMETERS have not been set up.",!,"Use the ""Define Tumor Registry Parameters"" Option.",!!
  1. Q OK
  1. LTS(DA,NOTTHIS) ;Invoked by AC cross-reference of TUMOR STATUS CODE sub-field (#.02) of TUMOR STATUS field (#73) of ONCOLOGY PRIMARY file (#165.5), sets value into LAST TUMOR STATUS field (#95)
  1. ;NOTTHIS is defined in the KILL logic - we want to skip the current TUMOR STATUS
  1. N OX,DIE,DR,NTS,OTS
  1. S NTS="" ; new tumor status defaults to null
  1. S OX=$O(^ONCO(165.5,DA,"TS","AA","")) I OX,$D(NOTTHIS),$D(^ONCO(165.5,DA,"TS","AA",OX,NOTTHIS)) S OX=$O(^ONCO(165.5,DA,"TS","AA","")) ; get IEN of last status - skip the current node on the kill
  1. S:OX OX=$O(^(OX,"")) S:OX NTS=$P($G(^ONCO(165.5,DA,"TS",OX,0)),U,2) S OTS=$P($G(^ONCO(165.5,DA,7)),U,6),$P(^(7),U,6)=NTS ;get old data, set new data
  1. K:$L(OTS) ^ONCO(165.5,"ACS",OTS,DA) S:$L(NTS) ^ONCO(165.5,"ACS",NTS,DA)="" ;kill old xref, set new xref
  1. Q
  1. ;
  1. KILLNAT(FILE,SWS) ;Kill national fields only for a file
  1. ;Valid switches in SWS:/DOTS prints a dot every 10
  1. N DOTS,DA,DIK,KT
  1. S DOTS=(SWS["/DOTS") ;print dots?
  1. S DA(1)=FILE
  1. I $D(^DD(FILE)) S DIK="^DD("_FILE_",",DA=0 F KT=1:1 S DA=$O(^DD(FILE,DA)) Q:'DA!(DA'<10000) D ^DIK I DOTS W:KT#10=0 "." ;if file exists, kill national fields only
  1. Q +$G(KT)
  1. ;
  1. CLNNOSUS ;Delete ONCOLOGY PATIENT (160) entries with no primaries/no suspense
  1. N TOTKT,CLNKT
  1. W @IOF
  1. W !
  1. W !," This option will delete ONCOTRAX PATIENT records"
  1. W !," with no suspense records and no primaries."
  1. W !
  1. L +^ONCO(160):5
  1. I D
  1. .K ^TMP($J,"NOSUS")
  1. .D COUNT
  1. .I CLNKT=0 W " No records to delete" W ! K DIR S DIR(0)="E" D ^DIR
  1. .I CLNKT>0,$$CLNOK D PURGE
  1. .L -^ONCO(160)
  1. E W !!,"The ONCOTRAX PATIENT file is in use... try again later!",*7,!!
  1. Q
  1. ;
  1. COUNT ;Count the number of entries to delete
  1. N OI S OI=0
  1. S (TOTKT,CLNKT)=0
  1. F S OI=$O(^ONCO(160,OI)) Q:OI'=+OI D CHK
  1. W !," Total ONCOTRAX PATIENT records: ",TOTKT
  1. W !," Total records marked for deletion: ",CLNKT,!
  1. I CLNKT>0 W !," Patients to be deleted:" S IEN=0 F S IEN=$O(^TMP($J,"NOSUS",IEN)) Q:IEN'>0 D
  1. .W !,?3,$$GET1^DIQ(160,IEN,60,"E")," ",$$GET1^DIQ(160,IEN,.01,"E")
  1. W !
  1. Q
  1. ;
  1. CHK S TOTKT=TOTKT+1
  1. S SUSDT=$O(^ONCO(160,OI,"SUS","B","")) I SUSDT'="" Q
  1. Q:$D(^ONCO(165.5,"C",OI))
  1. Q:$O(^ONCO(160,OI,"SUSNR",0))
  1. I '$D(^ONCO(160,OI,0)) K ^ONCO(160,OI) Q
  1. S CLNKT=CLNKT+1
  1. S ^TMP($J,"NOSUS",OI)=""
  1. Q
  1. ;
  1. CLNOK() ;Confirm deletion
  1. N DIR
  1. S DIR("A")=" Proceed with deletion",DIR("B")="No",DIR(0)="Y"
  1. D ^DIR
  1. Q Y
  1. ;
  1. PURGE ;Delete entries
  1. N DIK S DIK="^ONCO(160,"
  1. N DA S DA=0
  1. F S DA=$O(^TMP($J,"NOSUS",DA)) Q:DA'=+DA D ^DIK W "."
  1. W " DONE"
  1. W ! K DIR S DIR(0)="E" D ^DIR
  1. Q
  1. ;
  1. LCASE(ONCOSTR) ;Convert string to upper/lowercase
  1. N ONCO F ONCO=2:1:$L(ONCOSTR) I $E(ONCOSTR,ONCO)?1U,$E(ONCOSTR,ONCO-1)?1A S ONCOSTR=$E(ONCOSTR,0,ONCO-1)_$C($A(ONCOSTR,ONCO)+32)_$E(ONCOSTR,ONCO+1,999)
  1. Q ONCOSTR
  1. UCASE ;Convert string to uppercase
  1. S X=$TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. Q