| [613] | 1 | VDEFMNU ;INTEGIC/YG & BPOIFO/JG - Edit VDEF parameters & status ; 20 Dec 2005  12:57 PM
 | 
|---|
 | 2 |  ;;1.0;VDEF;**3**;Dec 28, 2004;
 | 
|---|
 | 3 |  ;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
 | 4 |  ;
 | 
|---|
 | 5 |  ; IA's: #4322 - ^HLCS(870,<link>,0)
 | 
|---|
 | 6 |  ;       #1373 - Lookup to file #101
 | 
|---|
 | 7 |  ;       #10063 - $$JOB^%ZTLOAD
 | 
|---|
 | 8 |  ;
 | 
|---|
 | 9 |  Q  ; No bozos
 | 
|---|
 | 10 |  ;
 | 
|---|
 | 11 | SITE ; Edit Site-Wide Parameters
 | 
|---|
 | 12 |  N DA,DIC,DIE,DR S DIE=579.5,DA=1,DR=".01;.02;" D ^DIE
 | 
|---|
 | 13 |  Q
 | 
|---|
 | 14 |  ;
 | 
|---|
 | 15 | REQUEST ; Edit Request Queue Parameters
 | 
|---|
 | 16 |  N DIC,DLAYGO,X,Y,DIE,DA,DR
 | 
|---|
 | 17 | REQUEST1 K DIC S DIC=579.3,DIC(0)="AQE",DIC("A")="Select Request Queue: "  W ! D ^DIC Q:Y=-1
 | 
|---|
 | 18 |  K DIC S DIE=579.3,DA=$P(Y,U),DR=".04;.05;.02" D ^DIE
 | 
|---|
 | 19 |  G REQUEST1
 | 
|---|
 | 20 |  ;
 | 
|---|
 | 21 | REQOFF ; Toggle Requestor On/Off
 | 
|---|
 | 22 |  N DIC,DLAYGO,X,Y,DIE,DA,DR
 | 
|---|
 | 23 | REQOFF1 K DIC S DIC=579.1,DIC(0)="AQE",DIC("A")="Select Requestor: " W ! D ^DIC Q:Y=-1
 | 
|---|
 | 24 |  I $$GET1^DIQ(579.1,$P(Y,U)_",",.05,"I")="A" D
 | 
|---|
 | 25 |  . W !,!,"Inactivating a requestor has a significant effect on the synchronization"
 | 
|---|
 | 26 |  . W !,"of VistA and remote system(s).  All VDEF requests made while the requestor"
 | 
|---|
 | 27 |  . W !,"is inactive will be PERMANENTLY lost.  Make sure you really want to"
 | 
|---|
 | 28 |  . W !,"turn it off.",!
 | 
|---|
 | 29 |  K DIC S DIE=579.1,DA=$P(Y,U),DR=".05" D ^DIE
 | 
|---|
 | 30 |  G REQOFF1
 | 
|---|
 | 31 |  ;
 | 
|---|
 | 32 | QUEOFF ; Toggle Request Processor Queue on/off
 | 
|---|
 | 33 |  N DIC,DLAYGO,X,Y,DIE,DA,DR,QUEUE,STAT,TMTASK
 | 
|---|
 | 34 | QUEOFF1 K DIC S DIC=579.3,DIC(0)="AQE",DIC("A")="Select Request Queue: " W ! D ^DIC Q:Y=-1
 | 
|---|
 | 35 |  K DIC S QUEUE=$P(Y,U) S DIE=579.3,DA=QUEUE,DR=".09" D ^DIE
 | 
|---|
 | 36 |  ;
 | 
|---|
 | 37 |  ; Get the new status of the Request Processor
 | 
|---|
 | 38 |  S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
 | 
|---|
 | 39 |  ;
 | 
|---|
 | 40 |  ; Start the Request Processor
 | 
|---|
 | 41 |  I STAT="R" D REQ^VDEFCONT(QUEUE)
 | 
|---|
 | 42 |  ;
 | 
|---|
 | 43 |  ; Stop the Request Processor
 | 
|---|
 | 44 |  I STAT="S" D
 | 
|---|
 | 45 |  . S TMTASK=$$GET1^DIQ(579.3,QUEUE_",",.08,"I") S:TMTASK'="" X=$$ASKSTOP^%ZTLOAD(TMTASK)
 | 
|---|
 | 46 |  . S TMTASK=$$GET1^DIQ(579.3,QUEUE_",",.11,"I") S:TMTASK'="" X=$$ASKSTOP^%ZTLOAD(TMTASK)
 | 
|---|
 | 47 |  G QUEOFF1
 | 
|---|
 | 48 |  ;
 | 
|---|
 | 49 | SCHED ; Schedule processor
 | 
|---|
 | 50 |  N DIC,DLAYGO,X,Y,SIEN,DIE,DA,DR,QUEUE,STAT,TMTASK,ENTRY
 | 
|---|
 | 51 | SCHED1 K DIC S DIC=579.3,DIC(0)="AQE",DIC("A")="Select Request Queue: " W ! D ^DIC Q:Y=-1
 | 
|---|
 | 52 |  K DIC S QUEUE=$P(Y,U) D DISP S DA(1)=QUEUE,DIC="^VDEFHL7(579.3,"_QUEUE_",2,"
 | 
|---|
 | 53 |  S DIC(0)="AQEL",DIC("A")="Select Entry: " D ^DIC G SCHED1:Y=-1
 | 
|---|
 | 54 |  S ENTRY=$P(Y,U),DIE=DIC,DA=ENTRY
 | 
|---|
 | 55 |  S DR=".01;.02;.03;D SCHFORM^VDEFMNU;.04;D SCHFORM^VDEFMNU;.05" D ^DIE
 | 
|---|
 | 56 |  W ! D DISP
 | 
|---|
 | 57 |  ;
 | 
|---|
 | 58 |  ; Now reschedule the processor task back
 | 
|---|
 | 59 |  S ZTSK=$P(^VDEFHL7(579.3,QUEUE,0),U,8) D ISQED^%ZTLOAD
 | 
|---|
 | 60 |  ;
 | 
|---|
 | 61 |  ; If old task not found or not running, start it.
 | 
|---|
 | 62 |  I $G(ZTSK("E"))'="" D REQ^VDEFCONT(QUEUE) G SCHED1
 | 
|---|
 | 63 |  I ZTSK(0)=0 D REQ^VDEFCONT(QUEUE) G SCHED1
 | 
|---|
 | 64 |  ;
 | 
|---|
 | 65 |  ; Task is scheduled, so reschedule it.
 | 
|---|
 | 66 |  K ZTDESC,ZTIO,ZTRTN,ZTSAVE S ZTDTH=$H D REQ^%ZTLOAD
 | 
|---|
 | 67 |  G SCHED1
 | 
|---|
 | 68 |  ;
 | 
|---|
 | 69 | SCHFORM W !,"Enter time in military form as HH:MM"
 | 
|---|
 | 70 |  Q
 | 
|---|
 | 71 |  ;
 | 
|---|
 | 72 | DISP ; Display scheduling rules.
 | 
|---|
 | 73 |  I '$O(^VDEFHL7(579.3,QUEUE,2,0)) W !,"No Scheduling Rules currently defined for this queue"
 | 
|---|
 | 74 |  E  S SIEN=0 D
 | 
|---|
 | 75 |  . W !,"Currently defined Scheduling Rules are :"
 | 
|---|
 | 76 |  . F  S SIEN=$O(^VDEFHL7(579.3,QUEUE,2,SIEN)) Q:'SIEN  D
 | 
|---|
 | 77 |  .. W !,$$GET1^DIQ(579.32,SIEN_","_QUEUE_",",.01,"E")
 | 
|---|
 | 78 |  .. W ") On ",$$GET1^DIQ(579.32,SIEN_","_QUEUE_",",.02,"E")
 | 
|---|
 | 79 |  .. W " the request processor is "
 | 
|---|
 | 80 |  .. S STAT=$$GET1^DIQ(579.32,SIEN_","_QUEUE_",",.03,"E")
 | 
|---|
 | 81 |  .. W STAT," from ",$$GET1^DIQ(579.32,SIEN_","_QUEUE_",",.04,"I")
 | 
|---|
 | 82 |  .. W " to ",$$GET1^DIQ(579.32,SIEN_","_QUEUE_",",.05,"I")
 | 
|---|
 | 83 |  Q
 | 
|---|
 | 84 |  ;
 | 
|---|
 | 85 | CUSTOD ; Edit Custodial Package Status
 | 
|---|
 | 86 |  N DIC,DLAYGO,X,Y,DIE,DA,DR,PACK
 | 
|---|
 | 87 | CUSTOD1 K DIC S DIC=579.6,DIC(0)="AQE",DIC("A")="Select Custodial Package: "
 | 
|---|
 | 88 |  W ! D ^DIC Q:Y=-1  S PACK=$P(Y,U)
 | 
|---|
 | 89 |  I $P(Y,U,2)="REGISTRATION" D  G CUSTOD1
 | 
|---|
 | 90 |  . W !,"Registration custodial package can't be edited"
 | 
|---|
 | 91 |  I $$GET1^DIQ(579.6,PACK_",",.02,"I")="A" D
 | 
|---|
 | 92 |  . W !!,"Inactivating a custodial package has a significant effect on the"
 | 
|---|
 | 93 |  . W !,"synchronization of VistA and remote system(s).  All VDEF requests for HL7"
 | 
|---|
 | 94 |  . W !,"messages associated with this custodial package made while the package is"
 | 
|---|
 | 95 |  . W !,"inactivated will be PERMANENTLY lost.  Make sure you really want to turn"
 | 
|---|
 | 96 |  . W !,"this custodial package off.",!
 | 
|---|
 | 97 |  K DIC S DIE=579.6,DA=PACK,DR=".02" D ^DIE
 | 
|---|
 | 98 |  G CUSTOD1
 | 
|---|
 | 99 |  ;
 | 
|---|
 | 100 | EVENT ; Edit VDEF API Event Status
 | 
|---|
 | 101 |  N DIC,DLAYGO,X,Y,DIE,DA,DR,EVENT
 | 
|---|
 | 102 | EVENT1 K DIC S DIC("W")="N Z,DESC S Z=^(0),DESC=$G(^(1)) W:$P(Z,U,9)'="""" DESC_""   ""_""Status: ""_$S($P(Z,U,11)=""A"":""ACTIVE"",1:""INACTIVE""),!,?8,""Pkg: ""_$P($G(^DIC(9.4,$P($G(^VDEFHL7(579.6,$P(Z,U,9),0),-1),U),0)),U)"
 | 
|---|
 | 103 |  S DIC=577,DIC(0)="AQES",DIC("A")="Select VDEF API Event: "
 | 
|---|
 | 104 |  W ! D ^DIC Q:Y=-1  S EVENT=$P(Y,U)
 | 
|---|
 | 105 |  I $$GET1^DIQ(577,EVENT_",",.2,"I")="A" D
 | 
|---|
 | 106 |  . W !!,"Inactivating a VDEF API event will cause all requests for that"
 | 
|---|
 | 107 |  . W !,"API to be PERMANENTLY lost.  Make sure you really want to turn"
 | 
|---|
 | 108 |  . W !,"this API event off.",!
 | 
|---|
 | 109 |  K DIC S DIE=577,DA=EVENT,DR=".2" D ^DIE
 | 
|---|
 | 110 |  G EVENT1
 | 
|---|
 | 111 |  ;
 | 
|---|
 | 112 | REPORT ; Display VDEF status/parameters
 | 
|---|
 | 113 |  N LL,LLN,SUBS,LINX,TNN,TNF,IEN,NZ,VDI,VDJ,VDK,VDA,PROT,STATS,%H,Y
 | 
|---|
 | 114 | REPORT1 W @IOF,?22,"VDEF Status - " S %H=$H D YX^%DTC W Y
 | 
|---|
 | 115 |  W !,"Logical Link Status" K LINX
 | 
|---|
 | 116 |  S VDI=0 F  S VDI=$O(^VDEFHL7(577,VDI)) Q:VDI=""  D
 | 
|---|
 | 117 |  . K RES S PROT=$P($G(^VDEFHL7(577,VDI,0)),U,7) Q:PROT=""
 | 
|---|
 | 118 |  . D GETS^DIQ(101,PROT_",","775*","I","RES")
 | 
|---|
 | 119 |  . S VDJ=0 F  S VDJ=$O(RES(101.0775,VDJ)) Q:VDJ=""  D
 | 
|---|
 | 120 |  .. S SUBS=RES(101.0775,VDJ,.01,"I")
 | 
|---|
 | 121 |  .. I SUBS S LLN=$$GET1^DIQ(101,SUBS_",",770.7,"E") I LLN'="" S LINX(LLN)=1
 | 
|---|
 | 122 |  S LLN=0 F  S LLN=$O(LINX(LLN)) Q:LLN=""  D
 | 
|---|
 | 123 |  . W !?2,LLN,": " S LL=$O(^HLCS(870,"B",LLN,"")) Q:LL=""
 | 
|---|
 | 124 |  . N ZTSK S ZTSK=$P($G(^HLCS(870,LL,0)),U,12)
 | 
|---|
 | 125 |  . I ZTSK'="" D STAT^%ZTLOAD W:$G(ZTSK(1))=2 "running task #",ZTSK K ZTSK
 | 
|---|
 | 126 |  . E  W "stopped or caught up"
 | 
|---|
 | 127 |  W !!,"Requestor Status"
 | 
|---|
 | 128 |  S IEN=0 F  S IEN=$O(^VDEFHL7(579.1,IEN)) Q:'IEN  D
 | 
|---|
 | 129 |  . S NZ=^VDEFHL7(579.1,IEN,0) W !?2,$P(NZ,U),": "
 | 
|---|
 | 130 |  . W $S($P(NZ,U,5)="A":"Activated",1:"Inactivated")
 | 
|---|
 | 131 |  . W ?32,"Dest.: ",$P(^VDEFHL7(579.2,$P(NZ,U,3),0),U)
 | 
|---|
 | 132 |  . W ?52,"Req. Queue: ",$P(^VDEFHL7(579.3,$P(NZ,U,4),0),U,1)
 | 
|---|
 | 133 |  W !!,"Request Processor Status"
 | 
|---|
 | 134 |  S IEN=0 F  S IEN=$O(^VDEFHL7(579.3,IEN)) Q:'IEN  D
 | 
|---|
 | 135 |  . S NZ=^VDEFHL7(579.3,IEN,0) W !?2,$P(NZ,U),": "
 | 
|---|
 | 136 |  . W $S($P(NZ,U,9)="R":"Running",1:"Suspended")
 | 
|---|
 | 137 |  . N ZTSK S TNN=$P(NZ,U,11),ZTSK=TNN D STAT^%ZTLOAD
 | 
|---|
 | 138 |  . W !?2,"Current Task # [Proc]: ",TNN
 | 
|---|
 | 139 |  . W " ["_$$CNV^XLFUTL($$JOB^%ZTLOAD(TNN),16)_"]"
 | 
|---|
 | 140 |  . W "  Task status: "
 | 
|---|
 | 141 |  . I 'ZTSK(0) W "Undefined"
 | 
|---|
 | 142 |  . E  W $S(ZTSK(1)=0:"Undefined",ZTSK(1)=1:"Active-Pending",ZTSK(1)=2:"Active-Running",ZTSK(1)=3:"Finished",ZTSK(1)=4:"Available",ZTSK(1)=5:"Interrupted",1:"Unknown")
 | 
|---|
 | 143 |  . S NZ=$G(^VDEFHL7(579.3,IEN,1,0))
 | 
|---|
 | 144 |  . I NZ="" W !?2,"No requests in the queue"
 | 
|---|
 | 145 |  . E  W !?2,"Requests waiting for purge: ",$P(NZ,U,4),"      Last request#: ",$P(NZ,U,3)
 | 
|---|
 | 146 |  . S STATS="" W !?2
 | 
|---|
 | 147 |  . F STAT="C","Q","E" D
 | 
|---|
 | 148 |  .. S (VDJ,VDK)=0 F VDJ=0:1:100+(STAT="Q"*900) S VDK=$O(^VDEFHL7(579.3,"C",STAT,IEN,VDK)) Q:VDK=""
 | 
|---|
 | 149 |  .. W $S(STAT="C":"Checked Out",STAT="Q":"  Queued Up",STAT="E":"  Errored Out")
 | 
|---|
 | 150 |  .. W $S(VDJ<(100+(STAT="Q"*900)):"("_VDJ_")",1:"(> "_(100+(STAT="Q"*900))_")")
 | 
|---|
 | 151 |  ;
 | 
|---|
 | 152 |  ; Loop added for dashboard monitoring
 | 
|---|
 | 153 |  R !!,"Hit <return/enter> to continue or '^' to terminate: ",VDA:5
 | 
|---|
 | 154 |  Q:VDA="^"  G REPORT1
 | 
|---|