[613] | 1 | MAGXCVC ;WOIFO/SEB,MLH - Image Index Conversion Commit ; 24 Mar 2005 9:56 AM
|
---|
| 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 | ; Entry point for the commit image indices option (MAG IMAGE INDEX COMMIT indices)
|
---|
| 21 | COMMIT N START,END,FLAG,TMF,STATUS
|
---|
| 22 | N ZTDTH,ZTIO,ZTRTN,ZTDESC,ZTSAVE,ZTSK ; -- TaskMan variables
|
---|
| 23 | N INPUT ; -------------------------------- user input holder
|
---|
| 24 | ;
|
---|
| 25 | S STATUS=$G(^XTMP("MAG30P25","STATUS"))
|
---|
| 26 | L +MAGTMP("IMAGE INDEX GENERATE"):0 E D G COMMITX
|
---|
| 27 | . W !,"Image index generation still in progress. Please try again later."
|
---|
| 28 | . Q
|
---|
| 29 | L +MAGTMP("IMAGE INDEX COMMIT"):0 E D G COMMITX
|
---|
| 30 | . W !,"Image index commit still in progress. Please try again later."
|
---|
| 31 | . Q
|
---|
| 32 | I '$D(^XTMP("MAGIXCVGEN")) D G COMMITX
|
---|
| 33 | . W !,"You must generate the image indices before running this option."
|
---|
| 34 | . Q
|
---|
| 35 | S (START,END)=0,FLAG=""
|
---|
| 36 | D BOUNDS^MAGXCVP(.START,.END) I START="^" G COMMITX
|
---|
| 37 | D RECREATE^MAGXCVP(.FLAG) I FLAG="^" G COMMITX
|
---|
| 38 | R !!,"Commit new index entries? N // ",INPUT:DTIME
|
---|
| 39 | I INPUT="" S INPUT="N"
|
---|
| 40 | S INPUT=$$UCASE^MAGXCVP($E(INPUT))
|
---|
| 41 | I INPUT'="Y" W !,"OK, entries not committed." G COMMITX
|
---|
| 42 | D TASKMAN^MAGXCVP(.TMF) I TMF="^" G COMMITX
|
---|
| 43 | S ZTSK=0 I TMF="" D COM1(START,END,FLAG,0) G COMMITX
|
---|
| 44 | S ZTRTN="COMTM^MAGXCVC",ZTDESC="COMMIT IMAGE INDEX VALUES",ZTDTH=TMF,ZTIO=""
|
---|
| 45 | S ZTSAVE("START")=START,ZTSAVE("END")=END,ZTSAVE("FLAG")=FLAG
|
---|
| 46 | D ^%ZTLOAD
|
---|
| 47 | W !!,"Image index commitment has been queued as task #"_ZTSK_"."
|
---|
| 48 | ;
|
---|
| 49 | COMMITX ; Clean up locks from COMMIT initial processing.
|
---|
| 50 | L -MAGTMP("IMAGE INDEX GENERATE")
|
---|
| 51 | L -MAGTMP("IMAGE INDEX COMMIT")
|
---|
| 52 | Q
|
---|
| 53 | ;
|
---|
| 54 | ; TaskMan entry point for committing image indices
|
---|
| 55 | COMTM D COM1(START,END,FLAG,1)
|
---|
| 56 | Q
|
---|
| 57 | ;
|
---|
| 58 | COM1(START,END,FLAG,QUEUED) N MAGIEN,CT,INDXDATA,INDX,STARTDT,ENDDT,SUMMARY,STOP,HISTORY,RESULT
|
---|
| 59 | N PREVLOG ; ------ log entry of a previous committal
|
---|
| 60 | N PREV0 ; -------- beginning MAGIEN of previous range
|
---|
| 61 | N PREVF ; -------- ending MAGIEN of previous range
|
---|
| 62 | N RANGE ; -------- array containing the current range being committed
|
---|
| 63 | N T0 ; ----------- internal index of ^TMP($J,"PREVRNG") for range checks
|
---|
| 64 | ;
|
---|
| 65 | L +MAGTMP("IMAGE INDEX COMMIT"):900 E Q ; don't let more than one commit run at once!
|
---|
| 66 | K ^XTMP("MAG30P25","SUMMARY") S $P(^XTMP("MAG30P25","STATUS"),U,13,14)=4_U_ZTSK
|
---|
| 67 | D NOW^%DTC S Y=% D DD^%DT S STARTDT=Y
|
---|
| 68 | S START=+$G(START),END=+$G(END),STOP=0
|
---|
| 69 | I END=0 S END=+$P($G(^MAG(2005,0)),U,3)
|
---|
| 70 | S MAGIEN=START-1 I MAGIEN=-1 S MAGIEN=0
|
---|
| 71 | S $P(^XTMP("MAG30P25","STATUS"),U,7,11)=DUZ_U_START_U_STARTDT_U_U
|
---|
| 72 | I 'QUEUED W !!
|
---|
| 73 | ; Now run the entries that are ready to commit.
|
---|
| 74 | ;
|
---|
| 75 | K RANGE
|
---|
| 76 | F CT=0:1 S MAGIEN=$O(^XTMP("MAGIXCVGEN",MAGIEN)) Q:MAGIEN>END!(+MAGIEN'=MAGIEN) D I STOP Q
|
---|
| 77 | . D COM2(MAGIEN,CT,FLAG,QUEUED)
|
---|
| 78 | . S $P(^XTMP("MAG30P25","STATUS"),U,12)=MAGIEN
|
---|
| 79 | . I QUEUED,$$S^%ZTLOAD S STOP=1,$P(^XTMP("MAG30P25","STATUS"),U,13)=5
|
---|
| 80 | . Q
|
---|
| 81 | D NOW^%DTC S Y=% D DD^%DT S ENDDT=Y
|
---|
| 82 | S $P(^XTMP("MAG30P25","STATUS"),U,10,11)=$S(STOP:MAGIEN,1:END)_U_ENDDT
|
---|
| 83 | S ^XTMP("MAG30P25","SUMMARY")=$P(^XTMP("MAG30P25","STATUS"),U,8,11)
|
---|
| 84 | S HISTORY=$G(^XTMP("MAG30P25","HISTORY"))+1,^XTMP("MAG30P25","HISTORY")=HISTORY
|
---|
| 85 | S ^XTMP("MAG30P25","HISTORY",HISTORY)=$P(^XTMP("MAG30P25","STATUS"),U,8,11)
|
---|
| 86 | I 'STOP D ; end-of-processing cleanup
|
---|
| 87 | . S $P(^XTMP("MAG30P25","STATUS"),U,13)=6
|
---|
| 88 | . D ENTRY^MAGLOG("P17CV",$G(DUZ),START,$T(+0),"","",START_"_"_END)
|
---|
| 89 | . D NOTIFY^MAGXCVP(.RESULT,2,STARTDT,ENDDT,START,END,FLAG)
|
---|
| 90 | . Q
|
---|
| 91 | L -MAGTMP("IMAGE INDEX COMMIT")
|
---|
| 92 | Q
|
---|
| 93 | ;
|
---|
| 94 | COM2(MAGIEN,CT,FREC,QUEUED) N INDXDATA,SUMMARY
|
---|
| 95 | N FQUIT ; -------- quit flag
|
---|
| 96 | N PREV0 ; -------- beginning MAGIEN of previous range
|
---|
| 97 | ;
|
---|
| 98 | I 'QUEUED,CT#100=0 W MAGIEN
|
---|
| 99 | I 'QUEUED,CT#10=0 W "."
|
---|
| 100 | ;Patch 8 has been installed (NOOP MLH 12/6/02)
|
---|
| 101 | ;or "recreate previously calculated indices" question answered no.
|
---|
| 102 | I $TR($G(^MAG(2005,MAGIEN,40)),"^")]"" D
|
---|
| 103 | . S FQUIT=1 ; Assume they may not recreate.
|
---|
| 104 | . I $E($G(FREC))="N" Q ; "Recreate previously calculated indices" question answered no.
|
---|
| 105 | . ; Don't allow committal unless the previous calculation was done by us.
|
---|
| 106 | . I $D(^MAGIXCVT(2006.96,MAGIEN)) K FQUIT ; ok
|
---|
| 107 | . Q
|
---|
| 108 | Q:$G(FQUIT)
|
---|
| 109 | ;
|
---|
| 110 | S INDXDATA="" D COMIEN(MAGIEN,.INDXDATA)
|
---|
| 111 | K ^XTMP("MAGIXCVGEN",MAGIEN)
|
---|
| 112 | I INDXDATA="" S INDXDATA="(none)"
|
---|
| 113 | S SUMMARY=$G(^XTMP("MAG30P25","SUMMARY",INDXDATA))
|
---|
| 114 | I SUMMARY="" S ^XTMP("MAG30P25","SUMMARY",INDXDATA)=1_U_MAGIEN_U_MAGIEN
|
---|
| 115 | E S ^XTMP("MAG30P25","SUMMARY",INDXDATA)=(SUMMARY+1)_U_$P(SUMMARY,U,2)_U_MAGIEN
|
---|
| 116 | S ^XTMP("MAG30P25","SUMMARY",INDXDATA,MAGIEN)=""
|
---|
| 117 | S ^MAGIXCVT(2006.96,MAGIEN)=1 ; flag as converted by index generation
|
---|
| 118 | Q
|
---|
| 119 | ;
|
---|
| 120 | COMIEN(MAGIEN,INDXDATA) ; Commit indices for one image (IEN=MAGIEN), return indices in INDXDATA
|
---|
| 121 | N VAL40 ; --- values on the 40 node
|
---|
| 122 | N IX40 ; ---- index to pieces of the 40 node
|
---|
| 123 | ;
|
---|
| 124 | S INDXDATA=$G(INDXDATA)
|
---|
| 125 | I INDXDATA="" S INDXDATA=$P($G(^XTMP("MAGIXCVGEN",MAGIEN)),U,2,7)
|
---|
| 126 | I INDXDATA="" D GENIEN^MAGXCVI(MAGIEN,.INDXDATA)
|
---|
| 127 | F Q:$E(INDXDATA,$L(INDXDATA))'=U S INDXDATA=$E(INDXDATA,1,$L(INDXDATA)-1)
|
---|
| 128 | I INDXDATA]"" D
|
---|
| 129 | . S ^MAG(2005,MAGIEN,40)=INDXDATA
|
---|
| 130 | . Q
|
---|
| 131 | E D
|
---|
| 132 | . K ^MAG(2005,MAGIEN,40)
|
---|
| 133 | . Q
|
---|
| 134 | Q
|
---|
| 135 | ;
|
---|
| 136 | ; Direct edit of image index fields (#40-44) in the image file (#2005).
|
---|
| 137 | IMAGE N I,DIC,DIE,DA,DR,X,Y,MAGIEN,MAGDFN,MAGTMP,BEFORE,AFTER
|
---|
| 138 | W ! S DIC=2005,DIC(0)="AEQ" D ^DIC I Y=-1 Q
|
---|
| 139 | S DIE=DIC,DR="[MAG IMAGE INDEX EDIT]",(MAGIEN,DA)=$P(Y,U)
|
---|
| 140 | S MAGDFN=$P($G(^MAG(2005,MAGIEN,0)),"^",7)
|
---|
| 141 | K MAGTMP
|
---|
| 142 | D GETS^DIQ(2005,MAGIEN_",","40:45","I","MAGTMP")
|
---|
| 143 | S BEFORE="" F I=40:1:45 S:BEFORE'="" BEFORE=BEFORE_"|" S BEFORE=BEFORE_MAGTMP(2005,MAGIEN_",",I,"I")
|
---|
| 144 | D ^DIE
|
---|
| 145 | K MAGTMP
|
---|
| 146 | D GETS^DIQ(2005,MAGIEN_",","40:45","I","MAGTMP")
|
---|
| 147 | S AFTER="" F I=40:1:45 S:AFTER'="" AFTER=AFTER_"|" S AFTER=AFTER_MAGTMP(2005,MAGIEN_",",I,"I")
|
---|
| 148 | D ENTRY^MAGLOG("INDXCHG",$G(DUZ),$G(MAGIEN),"BEFORE: "_BEFORE_" "_"AFTER: "_AFTER,$G(MAGDFN),1)
|
---|
| 149 | G IMAGE
|
---|