source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGXCVP.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1MAGXCVP ;WOIFO/SEB,MLH - Image Index Conversion Generate & Commit ; 29 Nov 2003 2:18 PM
2 ;;3.0;IMAGING;**17,25,31**;Mar 31, 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 ;
20 ; Input starting and ending IENs. Return in variables START and END.
21BOUNDS(START,END) N TEMP
22START R !,"From ID: 1 // ",START:DTIME
23 I $E(START)="?" D G START
24 . W !!,"Please enter the ID of an entry in the image file. This will be the first image"
25 . W !,"in the range of images processed by this menu option.",!
26 . Q
27 I START="" S START=1
28 I START="^" Q
29 I +START'=START W !!,"Please enter a starting image ID - numbers only." G START
30END R !,"To ID: LAST // ",END:DTIME
31 I $E(END)="?" D G END
32 . W !!,"Please enter the ID of an entry in the image file. This will be the last image"
33 . W !,"in the range of images processed by this menu option.",!
34 . Q
35 I "^LAST"[("^"_$$UCASE(END)) D ; includes null response default
36 . W " LAST"
37 . S END=+$P($G(^MAG(2005,0)),U,3)
38 . Q
39 I END="^" S START="^" Q
40 I +END'=END W !!,"Please enter an ending image ID - numbers only." G END
41 I START>END D G END ;S TEMP=END,END=START,START=TEMP
42 . W !!,"'To ID' value must not be less than 'From ID' value."
43 . Q
44 Q
45 ;
46 ; Prompt whether the user wishes to recreate previously-calculated indices. Return in FLAG.
47RECREATE(FLAG) S FLAG=""
48RECR R !,"Recreate previously calculated indices? Y // ",FLAG:DTIME
49 S FLAG=$$UCASE($E(FLAG)) I FLAG="" S FLAG="Y"
50 I FLAG="?" D G RECR
51 . W !!,"Entering YES will cause index fields that have been calculated by a previous"
52 . W !,"execution of this option to be recalculated. Entering NO will cause the option"
53 . W !,"to skip images that already have index fields.",!
54 . Q
55 I "YN^"'[FLAG W !!,"Please enter YES or NO." G RECR
56 Q
57 ;
58 ; Ask if user wishes to job a task into the background with TaskMan. Returns NULL if
59 ; the user wishes to run it in the foreground, and a schedule date/time if the user
60 ; wishes to use TaskMan.
61TASKMAN(RETURN) N ASK,X,%DT
62 I '$$TM^%ZTLOAD() S RETURN="" Q
63TMA R !,"Would you like to schedule this with TaskMan? Y // ",ASK:DTIME
64 S ASK=$$UCASE($E(ASK))
65 I ASK="?" D G TMA
66 . W !!,"Entering YES will run this task with TaskMan. Entering NO will cause it to"
67 . W !,"run in the foreground.",!
68 I "YN^"'[ASK W !!,"Please enter YES or NO." G TMA
69 I ASK="^" S RETURN="^" Q
70 I ASK="N" S RETURN="" Q
71SCHED R !!,"Please enter the date/time for scheduling the task: NOW // ",X:DTIME I X="" S X="NOW"
72 I X="^" S RETURN="^" Q
73 S %DT="R" D ^%DT I Y=-1 G SCHED
74 S RETURN=Y Q
75 Q
76 ;
77DONE W !!,"Done!"
78 Q
79 ;
80 ; Generate a notification message and send it to group MAG SERVER
81NOTIFY(RESULT,SUBJECT,STARTDT,ENDDT,STARTIEN,ENDIEN,RECR) N Y,LOC,XMSUB,DIS,CAP,CNT,I,VR,DM,SUMMARY
82 K ^TMP($J,"MAGQ")
83 D NOW^%DTC S Y=% D DD^%DT
84 S U="^",LOC=$$KSP^XUPARAM("WHERE")
85 S SUBJECT=$G(SUBJECT)
86 I +SUBJECT=SUBJECT S SUBJECT=$P("Generate^Commit",U,SUBJECT)
87 S XMSUB=SUBJECT_" Image Index Conversion Values: "_$G(ENDDT)
88 S ^TMP($J,"MAGQ",1)="Status: "_$$ST^MAGXCVR
89 S ^TMP($J,"MAGQ",2)="Started on: "_$G(STARTDT)
90 S ^TMP($J,"MAGQ",3)="Finished on: "_$G(ENDDT)
91 S ^TMP($J,"MAGQ",4)="Starting IEN: "_$G(STARTIEN)
92 S ^TMP($J,"MAGQ",5)="Ending IEN: "_$G(ENDIEN)
93 S ^TMP($J,"MAGQ",6)="Recreate Indices: "_$G(RECR)
94 S SUMMARY=""
95 F I=7:1 S SUMMARY=$O(^XTMP("MAG30P25","SUMMARY",SUMMARY)) Q:SUMMARY="" D
96 . S ^TMP($J,"MAGQ",I)=SUMMARY_U_^XTMP("MAG30P25","SUMMARY",SUMMARY)
97 . Q
98 N XMY,XMTEXT
99 S XMTEXT="^TMP($J,""MAGQ"","
100 S:$G(DUZ) XMY(DUZ)=""
101 S XMY("G.MAG SERVER")=""
102 S:$G(MAGDUZ) XMY(MAGDUZ)=""
103 D ^XMD
104 S RESULT="1"
105 K ^TMP($J,"MAGQ")
106 Q
107 ;
108 ; Convert a string to all uppercase.
109UCASE(STRING) N OUTPUT
110 S OUTPUT=$TR(STRING,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
111 Q OUTPUT
112 ;
113 ; Convert a string to all lowercase.
114LCASE(STRING) N OUTPUT
115 S OUTPUT=$TR(STRING,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
116 Q OUTPUT
117 ;
118 ; Strip leading and trailing spaces.
119STRIP(STRING) N START,END
120 F START=1:1:$L(STRING) I $E(STRING,START)'=" " Q
121 F END=$L(STRING):-1:1 I $E(STRING,END)'=" " Q
122 Q $E(STRING,START,END)
123 ;
124SCRUBTKN(XSTRING) ; FUNCTION - Create standard token delimiters for parsing
125 ; by changing all punctuation to spaces.
126 N STRING ; output string
127 S STRING=$TR(XSTRING,"+-/\.,~`!@#$%^&*()_-={}[]|:;""'<>?"," ")
128 ; compress multiple spaces to single space
129 F Q:STRING'[" " S STRING=$P(STRING," ",1)_" "_$P(STRING," ",2,999)
130 Q STRING
Note: See TracBrowser for help on using the repository browser.