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

PXRMDIEV.m

Go to the documentation of this file.
  1. PXRMDIEV ;SLC/PKR - Routines for disabling/enabling evaluation. ;11/16/2015
  1. ;;2.0;CLINICAL REMINDERS;**26,47**;Feb 04, 2005;Build 291
  1. ;
  1. ;=================================
  1. BUILDD(BUILD) ;Disable for a build installation.
  1. N REASON
  1. S REASON="install of "_BUILD_" build"
  1. D BMES^XPDUTL("Disabling reminder evaluation.")
  1. D SDISXTMP(REASON)
  1. Q
  1. ;
  1. ;=================================
  1. BUILDE(BUILD) ;Enable after a build installation is complete.
  1. N REASON
  1. S REASON="install of "_BUILD_" build"
  1. D BMES^XPDUTL("Enabling reminder evaluation.")
  1. D KDISXTMP(REASON)
  1. Q
  1. ;
  1. ;=================================
  1. DMSG ;Send a message that reminder evaluation has been disabled.
  1. N DTIME,NL,RDATA,REASON,TO
  1. K ^TMP("PXRMXMZ",$J)
  1. S NL=0
  1. S DTIME=$$FMTE^XLFDT($P(^XTMP("PXRM_DISEV",0),U,2))
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Reminder evaluation was disabled on "_DTIME_"."
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Because of this, the following TaskMan jobs can produce erroneous results."
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Pending jobs should not be allowed to start until evaluation is enabled."
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="The results of running jobs should be discarded and if possible, running jobs"
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="should be stopped."
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. ;
  1. S REASON=""
  1. F S REASON=$O(^XTMP("PXRM_DISEV","REASON",REASON)) Q:REASON="" D
  1. . I $D(^XTMP("PXRM_DISEV","REASON",REASON))=1 D Q
  1. .. S TEXT="Reason: "_REASON_"."
  1. .. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=TEXT
  1. . S RDATA=""
  1. . F S RDATA=$O(^XTMP("PXRM_DISEV","REASON",REASON,RDATA)) Q:RDATA="" D
  1. .. I REASON["index" S TEXT="Reason: "_REASON_" for file #"_RDATA_"."
  1. .. I REASON["manager" D
  1. ... S USER=$P(^VA(200,RDATA,0),U,1)
  1. ... S TEXT="Reason: "_REASON_" - "_USER_"."
  1. .. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=TEXT
  1. ;
  1. D TSKJOBS(.NL)
  1. D TOLIST(.TO)
  1. D SEND^PXRMMSG("PXRMXMZ","REMINDER EVALUATION DISABLED",.TO,.5)
  1. K ^TMP("PXRMXMZ",$J)
  1. Q
  1. ;
  1. ;=================================
  1. EMSG(DTIME) ;Send a message that reminder evaluation has been enabled.
  1. N ETIME,NL,TO
  1. K ^TMP("PXRMXMZ",$J)
  1. S NL=0
  1. S DTIME=$$FMTE^XLFDT(DTIME)
  1. S ETIME=$$FMTE^XLFDT($$NOW^XLFDT)
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Reminder evaluation was enabled on "_ETIME_"."
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="It was disabled on "_DTIME_"."
  1. D TOLIST(.TO)
  1. D SEND^PXRMMSG("PXRMXMZ","REMINDER EVALUATION ENABLED",.TO,.5)
  1. K ^TMP("PXRMXMZ",$J)
  1. Q
  1. ;
  1. ;=================================
  1. INDEXD(INDEX,INDEXL) ;Disable for index rebuilding.
  1. N REASON,TASKNUM
  1. S REASON="index rebuild"
  1. K ^PXRMINDX(INDEX,"DATE BUILT")
  1. D SDISXTMP(REASON,INDEX,.INDEXL)
  1. ;Start a TaskMan job to periodically check for completion of the
  1. ;rebuilding.
  1. S TASKNUM=$$TINDXCHK(REASON,INDEX)
  1. I TASKNUM'="" D
  1. . W !,"Started job ",TASKNUM," to check for completion of the rebuilding"
  1. . W !,"of the index for file # ",INDEX,"."
  1. Q
  1. ;
  1. ;=================================
  1. INDXCHK(REASON,INDEX) ;If reminder evaluation is disabled for index
  1. ;rebuilding check to see if the index has been rebuilt.
  1. I $D(^PXRMINDX(INDEX,"DATE BUILT")) D KDISXTMP(REASON,INDEX)
  1. Q
  1. ;
  1. ;=================================
  1. KDISXTMP(REASON,RDATA) ;Kill ^XTMP nodes for disabling evaluation.
  1. I $G(RDATA)'="" K ^XTMP("PXRM_DISEV","REASON",REASON,RDATA)
  1. E K ^XTMP("PXRM_DISEV","REASON",REASON)
  1. I $O(^XTMP("PXRM_DISEV","REASON",""))="" D
  1. . N DTIME
  1. . S DTIME=$P(^XTMP("PXRM_DISEV",0),U,2)
  1. . K ^XTMP("PXRM_DISEV")
  1. .;Enable PXRM options and protocols.
  1. . D OPTIONS("")
  1. . D PROTCOLS("")
  1. .;Send a message that evaluation has been enabled.
  1. . D EMSG(DTIME)
  1. Q
  1. ;
  1. ;=================================
  1. MGRD ;Code for disabling evaluation by the reminder manager.
  1. N ANS,REASON
  1. W !,"Disabling reminder evaluation will stop all evaluation, dialogs,"
  1. W !,"reminder order checks, and anything using reminder evaluation!"
  1. W !,"Are you sure you want to proceed?"
  1. S ANS=$$ASKYN^PXRMEUT("N","Disable reminder evaluation")
  1. I 'ANS Q
  1. S REASON="by reminder manager"
  1. D SDISXTMP(REASON,DUZ)
  1. Q
  1. ;
  1. ;=================================
  1. MGRE ;Code for enabling evaluation by the reminder manager.
  1. N ANS,DTIME,RDATA,REASON,TEXT
  1. W !,"Reminder evaluation is currently disabled for the following reason(s):"
  1. S REASON=""
  1. F S REASON=$O(^XTMP("PXRM_DISEV","REASON",REASON)) Q:REASON="" D
  1. . I $D(^XTMP("PXRM_DISEV","REASON",REASON))=1 D Q
  1. .. S TEXT="Reason: "_REASON_"."
  1. .. W !,TEXT
  1. . S RDATA=""
  1. . F S RDATA=$O(^XTMP("PXRM_DISEV","REASON",REASON,RDATA)) Q:RDATA="" D
  1. .. I REASON["index" S TEXT="Reason: "_REASON_" of file #"_RDATA_"."
  1. .. I REASON["manager" D
  1. ... S MNAME=$P(^VA(200,RDATA,0),U,1)
  1. ... S TEXT="Reason: "_REASON_" - "_MNAME_"."
  1. .. W !,TEXT
  1. S ANS=$$ASKYN^PXRMEUT("N","Enable reminder evaluation")
  1. I 'ANS Q
  1. S DTIME=$P(^XTMP("PXRM_DISEV",0),U,2)
  1. K ^XTMP("PXRM_DISEV")
  1. D EMSG(DTIME)
  1. D OPTIONS("")
  1. D PROTCOLS("")
  1. Q
  1. ;
  1. ;=================================
  1. MGRO ;Called by the option PXRM DISABLE/ENABLE EVALUATION.
  1. I '$D(^XUSEC("PXRM MANAGER",DUZ)) D Q
  1. . W !,"You must have the reminder managers key to use this option."
  1. I $D(^XTMP("PXRM_DISEV",0)) D MGRE Q
  1. D MGRD
  1. Q
  1. ;
  1. ;=================================
  1. OPTIONS(TEXT) ;Disable/enable critical PXRM options.
  1. ;;PXRM DEF INTEGRITY CHECK ALL
  1. ;;PXRM DEF INTEGRITY CHECK ONE
  1. ;;PXRM ORDER CHECK TESTER
  1. ;;PXRM REMINDERS DUE
  1. ;;PXRM REMINDERS DUE (USER)
  1. ;;END
  1. N IND,DONE,OPTION
  1. S DONE=0
  1. F IND=1:1 Q:DONE D
  1. . S OPTION=$P($T(OPTIONS+IND),";",3,99)
  1. . I OPTION="END" S DONE=1 Q
  1. . D OUT^XPDMENU(OPTION,TEXT)
  1. Q
  1. ;
  1. ;=================================
  1. PINDXCHK ;If reminder evaluation is disabled for index
  1. ;rebuilding periodically check to see if the index has been rebuilt.
  1. ;This is run as a TaskMan job INDEX and REASON are passed through
  1. ;ZTSAVE.
  1. N DONE
  1. S ZTREQ="@"
  1. S DONE=0
  1. F Q:DONE D
  1. . I $D(^PXRMINDX(INDEX,"DATE BUILT")) D
  1. .. S DONE=1
  1. .. I $D(^XTMP("PXRM_DISEV","REASON",REASON)) D KDISXTMP^PXRMDIEV(REASON,INDEX)
  1. . I 'DONE H 60
  1. Q
  1. ;
  1. ;=================================
  1. PROTCOLS(TEXT) ;Disable/enable critical PXRM protocols.
  1. ;;PXRM PATIENT LIST CREATE
  1. ;;PXRM EXTRACT MANUAL TRANSMISSION
  1. ;;END
  1. N IND,DONE,PROTOCOL
  1. S DONE=0
  1. F IND=1:1 Q:DONE D
  1. . S PROTOCOL=$P($T(PROTCOLS+IND),";",3,99)
  1. . I PROTOCOL="END" S DONE=1 Q
  1. . D OUT^XPDPROT(PROTOCOL,TEXT)
  1. Q
  1. ;
  1. ;=================================
  1. SDISXTMP(REASON,RDATA,INDEXL) ;Set ^XTMP nodes for disabling evaluation.
  1. N CDATE,INDEX,NINDEX,PUDATE
  1. I '$D(^XTMP("PXRM_DISEV",0)) D
  1. . S CDATE=$$NOW^XLFDT
  1. . S PUDATE=$$FMADD^XLFDT(CDATE,0,12,0,0)
  1. . S ^XTMP("PXRM_DISEV",0)=PUDATE_U_CDATE_U_"Temporarily disable reminder evaluation"
  1. I $G(RDATA)="" S ^XTMP("PXRM_DISEV","REASON",REASON)=""
  1. E S ^XTMP("PXRM_DISEV","REASON",REASON,RDATA)=""
  1. ;Disable and send the message once for the multiple index case.
  1. I $D(^XTMP("PXRM_DISEV","MULTI-INDEX","MSG SENT")) Q
  1. I $D(INDEXL) D
  1. . S INDEX="",NINDEX=0
  1. . F S INDEX=$O(INDEXL(INDEX)) Q:INDEX="" S ^XTMP("PXRM_DISEV","REASON",REASON,INDEX)="",NINDEX=NINDEX+1
  1. ;Disable some PXRM options and protocols.
  1. D OPTIONS(REASON)
  1. D PROTCOLS(REASON)
  1. ;Send a message that evaluation is disabled.
  1. D DMSG
  1. I $G(NINDEX)>1 S ^XTMP("PXRM_DISEV","MULTI-INDEX","MSG SENT")=""
  1. Q
  1. ;
  1. ;=================================
  1. TINDXCHK(REASON,INDEX) ;If reminder evaluation is disabled for index
  1. ;rebuilding start a TaskMan job to periodically check to see
  1. ;if the index has been rebuilt.
  1. N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
  1. S ZTSAVE("INDEX")=""
  1. S ZTSAVE("RDATA")=""
  1. S ZTSAVE("REASON")=""
  1. S ZTRTN="PINDXCHK^PXRMDIEV"
  1. S ZTDESC="Clinical Reminders Index building check, file #"_INDEX
  1. S ZTDTH=$$NOW^XLFDT
  1. S ZTIO=""
  1. D ^%ZTLOAD
  1. Q ZTSK
  1. ;
  1. ;=================================
  1. TOLIST(TO) ;Return the list of who to send the message to.
  1. N MGIEN,MGROUP
  1. S TO(DUZ)=""
  1. S MGIEN=$G(^PXRM(800,1,"MGFE"))
  1. I MGIEN'="" D
  1. . S MGROUP="G."_$$GET1^DIQ(3.8,MGIEN,.01)
  1. . S TO(MGROUP)=""
  1. Q
  1. ;
  1. ;=================================
  1. TSKJOBS(NL) ;Search for TaskMan jobs that may be affected by disabled reminder
  1. ;evaluation. For any that are found add information to the MailMan
  1. ;message.
  1. N TDESC
  1. S TDESC="Reminder Due Report"
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" Reminders Due Report Jobs"
  1. D TSKLIST(TDESC,.NL)
  1. ;
  1. S TDESC="Build Reminder Patient List"
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" Reminder Patient List Jobs"
  1. D TSKLIST(TDESC,.NL)
  1. ;
  1. S TDESC="Run Reminder Extract"
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" Reminder Extract Jobs"
  1. D TSKLIST(TDESC,.NL)
  1. Q
  1. ;
  1. ;=================================
  1. TSKLIST(TDESC,NL) ;Search for tasks with the description TDESC. For any
  1. ;that are found add their information to the message text.
  1. N DTIME,STATUS,TIME,TLIST,TASKNUM,USER,ZTSK
  1. D DESC^%ZTLOAD(TDESC,"TLIST")
  1. S TASKNUM=""
  1. F S TASKNUM=$O(TLIST(TASKNUM)) Q:TASKNUM="" D
  1. . K ZTSK
  1. . S ZTSK=TASKNUM
  1. . D STAT^%ZTLOAD
  1. . I ZTSK(0)=0 Q
  1. .;Only tasks that are pending or running.
  1. . I ZTSK(2)'["Active" Q
  1. . S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. . S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Task number - "_TASKNUM
  1. . S STATUS=ZTSK(2)
  1. . S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Status - "_STATUS
  1. . D ISQED^%ZTLOAD
  1. . I $D(ZTSK("D")) S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="Time - "_$$HTE^XLFDT(ZTSK("D"))
  1. . I $D(ZTSK("DUZ")) S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="User - "_$P(^VA(200,ZTSK("DUZ"),0),U,1)
  1. Q
  1. ;