source: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGDRPC7.m@ 1093

Last change on this file since 1093 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1MAGDRPC7 ;WOIFO/EdM - RPC to fetch a Audit Info ; 05/16/2005 07:28
2 ;;3.0;IMAGING;**11,51**;26-August-2005
3 ;; +---------------------------------------------------------------+
4 ;; | Property of the US Government. |
5 ;; | No permission to copy or redistribute this software is given. |
6 ;; | Use of unreleased versions of this software requires the user |
7 ;; | to execute a written test agreement with the VistA Imaging |
8 ;; | Development Office of the Department of Veterans Affairs, |
9 ;; | telephone (301) 734-0100. |
10 ;; | |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19 ;
20GET1(OUT,LOCATION,TODAY) ; RPC = MAG DICOM TEXT AUDIT GET
21 ; Get the numbers of text-messages per day per purpose
22 N COUNT,D2,DATE,I,MSG,N,X
23 D:'$D(DT) DT^DICRW
24 K OUT S (OUT(1),N)=1,I=100
25 S TODAY=+$G(TODAY),DATE=DT
26 D:TODAY I 'TODAY S DATE=0 F S DATE=$O(^MAGDAUDT(2006.5761,DATE)) Q:'DATE D
27 . Q:'$D(^MAGDAUDT(2006.5761,DATE,1,LOCATION))
28 . ; Retrieve one day's statistics
29 . S MSG="" F S MSG=$O(^MAGDAUDT(2006.5761,DATE,1,LOCATION,1,"B",MSG)) Q:MSG="" D
30 . . S D2=$O(^MAGDAUDT(2006.5761,DATE,1,LOCATION,1,"B",MSG,"")) Q:'D2
31 . . S X=$G(^MAGDAUDT(2006.5761,DATE,1,LOCATION,1,D2,0))
32 . . S COUNT=$P(X,"^",2) Q:'COUNT
33 . . S LAST=$P(X,"^",3)
34 . . S I=I+1,N=N+1,OUT(I)=DATE_"^"_COUNT_"^"_MSG_"^"_LAST,MSG(MSG)=""
35 . . Q
36 . Q
37 S I=1,MSG="" F S MSG=$O(MSG(MSG)) Q:MSG="" D
38 . S I=I+1,N=N+1,OUT(I)="^^"_MSG
39 . Q
40 S OUT(1)=N-1
41 Q
42 ;
43GET2(OUT,LOCATION,START,STOP) ; RPC = MAG DICOM IMAGE AUDIT GET
44 ; Get the numbers of messages per day per instrument
45 N COUNT,D2,DATE,I,INSTR,N,X
46 D:'$D(DT) DT^DICRW
47 K OUT S (OUT(1),N)=1,I=100
48 S START=+$G(START)-1,STOP=+$G(STOP)
49 S:START<0 START=0
50 S:'STOP STOP=9999999
51 S DATE=START F S DATE=$O(^MAGDAUDT(2006.5762,DATE)) Q:'DATE Q:DATE>STOP D
52 . Q:'$D(^MAGDAUDT(2006.5762,DATE,1,LOCATION))
53 . ; Retrieve one day's statistics
54 . S INSTR="" F S INSTR=$O(^MAGDAUDT(2006.5762,DATE,1,LOCATION,1,"B",INSTR)) Q:INSTR="" D
55 . . S D2=$O(^MAGDAUDT(2006.5762,DATE,1,LOCATION,1,"B",INSTR,"")) Q:'D2
56 . . S X=$G(^MAGDAUDT(2006.5762,DATE,1,LOCATION,1,D2,0))
57 . . S COUNT=$P(X,"^",2) S:$P(X,"^",4)>COUNT COUNT=$P(X,"^",4)
58 . . Q:'COUNT
59 . . S INSTR(INSTR)=""
60 . . S I=I+1,N=N+1,OUT(I)=DATE_"^"_$P(X,"^",2)_"^"_INSTR_"^"_$P(X,"^",3,5)
61 . . Q
62 . Q
63 S I=1,INSTR="" F S INSTR=$O(INSTR(INSTR)) Q:INSTR="" D
64 . S I=I+1,N=N+1,OUT(I)="^^"_INSTR
65 . Q
66 S OUT(1)=N-1
67 Q
68 ;
69RANGE(OUT) ; RPC = MAG DICOM AUDIT RANGE
70 ; Get the date-ranges for the various audit files
71 N DF,DL,FM,N
72 K OUT S N=1
73 F FM=2006.5761,2006.5762 D
74 . S DF=$O(^MAGDAUDT(FM,0)) S:'DF DF=""
75 . S DL=$O(^MAGDAUDT(FM," "),-1) S:'DL DL=""
76 . S N=N+1,OUT(N)=FM_"^"_DF_"^"_DL
77 . Q
78 S N=N+1,OUT(N)="-END-"
79 Q
80 ;
81PURGE(OUT,FM,DATE) ; RPC = MAG DICOM AUDIT PURGE
82 ; Purge Audit FIle
83 N D0,DAYS,X
84 L +^MAGDAUDT(FM)
85 S DAYS=$P($G(^MAGDAUDT(FM,0)),"^",4),OUT=0
86 S X=0 F S X=$O(^MAGDAUDT(FM,X)) Q:'X Q:X'<DATE D
87 . K ^MAGDAUDT(FM,X)
88 . S DAYS=DAYS-1,OUT=OUT+1
89 . Q
90 S:DAYS<1 DAYS=0
91 S $P(^MAGDAUDT(FM,0),"^",4)=DAYS
92 L -^MAGDAUDT(FM)
93 S OUT=OUT_" day"_$S(OUT=1:"",1:"s")_" purged."
94 Q
95 ;
96COUNT(OUT,LOCATION,MESSAGE) ; RPC = MAG DICOM AUDIT COUNT
97 ; update today's count
98 N %,D2,%H,%I,TODAY,NOW,X
99 I '$G(LOCATION) S OUT="-1,No Location Specified" Q
100 I $G(MESSAGE)="" S OUT="-2,No Message Specified" Q
101 ;
102 D NOW^%DTC S TODAY=X,NOW=%
103 S D2=$O(^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,"B",MESSAGE,""))
104 D:'D2
105 . L +^MAGDAUDT(2006.5761,TODAY)
106 . S D2=$O(^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1," "),-1)+1
107 . S X=$G(^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,0))
108 . S $P(X,"^",2)="2006.576111"
109 . S $P(X,"^",3)=D2
110 . S $P(X,"^",4)=$P(X,"^",4)+1
111 . S ^MAGDAUDT(2006.5761,TODAY,1,LOCATION,0)=LOCATION
112 . S ^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,0)=X
113 . S ^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,D2,0)=MESSAGE
114 . S ^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,"B",MESSAGE,D2)=""
115 . L -^MAGDAUDT(2006.5761,TODAY)
116 . Q
117 S X=$G(^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,D2,0))
118 S X=MESSAGE_"^"_($P(X,"^",2)+1)_"^"_NOW
119 S ^MAGDAUDT(2006.5761,TODAY,1,LOCATION,1,D2,0)=X
120 S OUT=$P(X,"^",2)
121 Q
122 ;
123LOGXIMG(OUT,D0,DEST,LOCATION,STATUS,TO,XMIT,MECH) ; RPC = MAG DICOM ROUTE LOG XMIT
124 N %H,%I,X
125 ; D0 ;---- IEN of queue entry (2006.035)
126 ; DEST ;-- IEN of destination in 2005.2 or in 2006.585
127 ; TO ;---- Name of file at destination
128 ; XMIT ;-- Date and time transmission started
129 N % ;----- Current date and time
130 N D41 ;--- IEN in "routed" multiple
131 N D61 ;--- IEN in "permanent" multiple
132 N IMG ;--- IEN of Image in 2005
133 N QUEUED ; Date and time file was queued
134 N TP ;---- File TP (FULL, ABS, BIG, TXT, DICOM)
135 ;
136 D STATUS^MAGDRPC5(.X,D0,STATUS,LOCATION) I X<1 S OUT="-1,"_X Q
137 I STATUS="FAILED" S OUT=1 Q
138 S X=$G(^MAGQUEUE(2006.035,D0,0)),IMG=$P(X,"^",1),TP=$P(X,"^",3)
139 S QUEUED=$P($G(^MAGQUEUE(2006.035,D0,1)),"^",3)
140 ;
141 D NOW^%DTC
142 S $P(^MAGQUEUE(2006.035,D0,1),"^",4)=%
143 L +^MAG(2005,IMG)
144 S D41=$O(^MAG(2005,IMG,4," "),-1)+1
145 S D61=$O(^MAG(2005,IMG,6," "),-1)+1
146 D:MECH=1
147 . S ^MAG(2005,IMG,4,0)="^2005.0106^"_D41_"^"_D41
148 . S ^MAG(2005,IMG,4,D41,0)=%_"^"_DEST_"^"_TP_"^"_TO_"^"_$G(XMIT)_"^"_QUEUED_"^"_D61
149 . S ^MAG(2005,IMG,4,"LOC",DEST,D41)=""
150 . S ^MAG(2005,"ROUTE",DEST,%,IMG,D41)=""
151 . Q
152 S X=""
153 I MECH=1 S X=$P($G(^MAG(2005.2,+DEST,0)),"^",1)_"^"_(+DEST)_"^"
154 I MECH=2 S X=$P($G(^MAG(2006.587,+DEST,0)),"^",1)_"^^"_(+DEST)
155 S $P(X,"^",4)=% ; Timestamp of transmission
156 S $P(X,"^",6)=TO ; Filename at destination
157 S $P(X,"^",7)=TP ; File Type
158 S ^MAG(2005,IMG,6,0)="^2005.0106^"_D61_"^"_D61
159 S ^MAG(2005,IMG,6,D61,0)=X
160 L -^MAG(2005,IMG)
161 S OUT=1
162 Q
163 ;
Note: See TracBrowser for help on using the repository browser.