TIUPNCV7 ;SLC/DJP ;PNs ==> TIU cnv rtns ;5-7-97
;;1.0;TEXT INTEGRATION UTILITIES;**3**;Jun 20, 1997
;
HELP10 ;Help text for GMRP IEN prompt
W !!?5,"Enter the Internal Entry Number (IEN)) of the last progress"
W !?5,"note you want to convert. By entering an IEN, you can run"
W !?5,"this conversion while users continue to use the Progress Note"
W !?5,"options."
W !!?5,"To complete the conversion, use the RESTART option."
Q
;
FIX ;Will back records out of ^TIU(8925
;TIU("HERE") must be set to the starting IEN
S DIK="^TIU(8925,",CTR=0
S BK=TIU("HERE") F S BK=$O(^TIU(8925,BK)) Q:'BK D
. Q:$P(^TIU(8925,BK,13),U,3)'="C"
. S DA=BK D ^DIK S CTR=CTR+1
W !!,"COMPLETED... "_CTR_" RECORDS DELETED."
Q
;
PNHALT ;Options allows site to stop conversion
W !!?12,"****** REQUEST TO HALT CONVERSION ******",!
I '$P($G(^TIU(8925.97,1,0)),U,5)
I W !!?5,"The Progress Note Conversion is not currently running.",! Q
I $P(^TIU(8925.97,1,2),U,3)>0
I W !!?5,"Progress Note Conversion has been stopped."
I W !?5,"Use the RESTART option to begin again.",! Q
W !! K DIR S DIR(0)="Y"
S DIR("A")="Do you want to HALT the Progress Note Conversion"
S DIR("B")="NO",DIR("?")="^D HALTHELP^TIUPNCV7" D ^DIR K DIR
I $D(DIRUT)!(Y=0) W !!?5,"Okay. Conversion will continue to run.",! Q
S $P(^TIU(8925.97,1,2),U,3)=1
W !!?15,"!!!!!!!! CONVERSION STOPPED !!!!!!!!",!
S TIUPNLST=$P(^TIU(8925.97,1,0),U,5)
W !?5,"Last Progress Note record processed is: ^GMR(121,"_TIUPNLST
K TIUPNLST
Q
;
HALTHELP ;Help Prompt for Halt action
W !!?5,"Answering ""YES"" to this question will stop the Progress Note"
W !?5,"Conversion before completion. ""NO"" will allow the conversion"
W !?5,"to continue.",!
Q
;
MONITOR ;Monitor progress notes conversion
;
W !!?12,"****** MONITORING PROGRESS NOTE CONVERSION ******",!
I $P($G(^TIU(8925.97,1,0)),U,3)>0 D Q
. W !?5,"This conversion has been run..."
. W !?5,"This option is only for use during the running of the Progress"
. W !?5,"Notes conversion from ^GMR(121 to ^TIU(8925."
. H 5 Q
;
AGAIN ;Redisplay monitor information
N NODE,START,CURRENT,STIME,CNTR,ERRORS,TIME,ETIME,NTIME,BYE,PERMIN
N PERHR,MIN,NUM,LEFT,ESECS
D SETVAR
D DISPLAY
D RETURN Q:$D(BYE)
W @IOF W !!?12,"**** MONITORING PROGRESS NOTE CONVERSION ****",!
G AGAIN
Q
;
SETVAR ;Using File ^TIU(8925.97, to set and compute variables
S NODE=^TIU(8925.97,1,0)
S START=$P(NODE,U,4),CURRENT=$P(NODE,U,5),STIME=$P(NODE,U,2)
S CNTR=$P(NODE,U,6),ERRORS=$P(NODE,U,7) S:ERRORS'>0 ERRORS=0
S TIME=$$FMTE^XLFDT(STIME,"1P")
S NTIME=$$NOW^XLFDT
S ETIME=$$FMDIFF^XLFDT(NTIME,STIME,3)
S ESECS=$$FMDIFF^XLFDT(NTIME,STIME,2)
S MIN=ESECS/60
S PERMIN=CNTR/+$S(MIN>0:MIN,1:1),PERHR=PERMIN*60
S NUM=$P(^GMR(121,0),U,4)-$P(^TIU(8925,0),U,4)
S LEFT=NUM/PERHR,DAYS=LEFT/24
S REMAIN1=$P(^GMR(121,0),U,4)-CURRENT ;in file
Q
;
DISPLAY ;Displays known information
W !?5," Conversion began: ",TIME
W !?5," Starting record: ",START
W !?5," Processing record: ",CURRENT
W !?5," Records processed: ",CNTR
W !?5,"Current # of error: ",ERRORS
W !?5," Elapsed time: ",ETIME
W !?5," Notes per hour: ",$P(PERHR,".")
I LEFT>24 W !?5," Days left: ",$E(DAYS,1,5)
E W !?5," Hours left: ",$E(LEFT,1,5)
W !!?2,"Notes left to convert: ",REMAIN1
W !!
Q
;
RETURN ;Issues RETURN prompt
N DIR,Y
F TIULN=1:1:(IOSL-$Y-4) W !
S DIR(0)="E" D ^DIR I $D(DIRUT) S BYE=1 Q
Q
;
TIUPNCV7 ;SLC/DJP ;PNs ==> TIU cnv rtns ;5-7-97
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**3**;Jun 20, 1997
+2 ;
HELP10 ;Help text for GMRP IEN prompt
+1 WRITE !!?5,"Enter the Internal Entry Number (IEN)) of the last progress"
+2 WRITE !?5,"note you want to convert. By entering an IEN, you can run"
+3 WRITE !?5,"this conversion while users continue to use the Progress Note"
+4 WRITE !?5,"options."
+5 WRITE !!?5,"To complete the conversion, use the RESTART option."
+6 QUIT
+7 ;
FIX ;Will back records out of ^TIU(8925
+1 ;TIU("HERE") must be set to the starting IEN
+2 SET DIK="^TIU(8925,"
SET CTR=0
+3 SET BK=TIU("HERE")
FOR
SET BK=$ORDER(^TIU(8925,BK))
IF 'BK
QUIT
Begin DoDot:1
+4 IF $PIECE(^TIU(8925,BK,13),U,3)'="C"
QUIT
+5 SET DA=BK
DO ^DIK
SET CTR=CTR+1
End DoDot:1
+6 WRITE !!,"COMPLETED... "_CTR_" RECORDS DELETED."
+7 QUIT
+8 ;
PNHALT ;Options allows site to stop conversion
+1 WRITE !!?12,"****** REQUEST TO HALT CONVERSION ******",!
+2 IF '$PIECE($GET(^TIU(8925.97,1,0)),U,5)
+3 IF $TEST
WRITE !!?5,"The Progress Note Conversion is not currently running.",!
QUIT
+4 IF $PIECE(^TIU(8925.97,1,2),U,3)>0
+5 IF $TEST
WRITE !!?5,"Progress Note Conversion has been stopped."
+6 IF $TEST
WRITE !?5,"Use the RESTART option to begin again.",!
QUIT
+7 WRITE !!
KILL DIR
SET DIR(0)="Y"
+8 SET DIR("A")="Do you want to HALT the Progress Note Conversion"
+9 SET DIR("B")="NO"
SET DIR("?")="^D HALTHELP^TIUPNCV7"
DO ^DIR
KILL DIR
+10 IF $DATA(DIRUT)!(Y=0)
WRITE !!?5,"Okay. Conversion will continue to run.",!
QUIT
+11 SET $PIECE(^TIU(8925.97,1,2),U,3)=1
+12 WRITE !!?15,"!!!!!!!! CONVERSION STOPPED !!!!!!!!",!
+13 SET TIUPNLST=$PIECE(^TIU(8925.97,1,0),U,5)
+14 WRITE !?5,"Last Progress Note record processed is: ^GMR(121,"_TIUPNLST
+15 KILL TIUPNLST
+16 QUIT
+17 ;
HALTHELP ;Help Prompt for Halt action
+1 WRITE !!?5,"Answering ""YES"" to this question will stop the Progress Note"
+2 WRITE !?5,"Conversion before completion. ""NO"" will allow the conversion"
+3 WRITE !?5,"to continue.",!
+4 QUIT
+5 ;
MONITOR ;Monitor progress notes conversion
+1 ;
+2 WRITE !!?12,"****** MONITORING PROGRESS NOTE CONVERSION ******",!
+3 IF $PIECE($GET(^TIU(8925.97,1,0)),U,3)>0
Begin DoDot:1
+4 WRITE !?5,"This conversion has been run..."
+5 WRITE !?5,"This option is only for use during the running of the Progress"
+6 WRITE !?5,"Notes conversion from ^GMR(121 to ^TIU(8925."
+7 HANG 5
QUIT
End DoDot:1
QUIT
+8 ;
AGAIN ;Redisplay monitor information
+1 NEW NODE,START,CURRENT,STIME,CNTR,ERRORS,TIME,ETIME,NTIME,BYE,PERMIN
+2 NEW PERHR,MIN,NUM,LEFT,ESECS
+3 DO SETVAR
+4 DO DISPLAY
+5 DO RETURN
IF $DATA(BYE)
QUIT
+6 WRITE @IOF
WRITE !!?12,"**** MONITORING PROGRESS NOTE CONVERSION ****",!
+7 GOTO AGAIN
+8 QUIT
+9 ;
SETVAR ;Using File ^TIU(8925.97, to set and compute variables
+1 SET NODE=^TIU(8925.97,1,0)
+2 SET START=$PIECE(NODE,U,4)
SET CURRENT=$PIECE(NODE,U,5)
SET STIME=$PIECE(NODE,U,2)
+3 SET CNTR=$PIECE(NODE,U,6)
SET ERRORS=$PIECE(NODE,U,7)
IF ERRORS'>0
SET ERRORS=0
+4 SET TIME=$$FMTE^XLFDT(STIME,"1P")
+5 SET NTIME=$$NOW^XLFDT
+6 SET ETIME=$$FMDIFF^XLFDT(NTIME,STIME,3)
+7 SET ESECS=$$FMDIFF^XLFDT(NTIME,STIME,2)
+8 SET MIN=ESECS/60
+9 SET PERMIN=CNTR/+$SELECT(MIN>0:MIN,1:1)
SET PERHR=PERMIN*60
+10 SET NUM=$PIECE(^GMR(121,0),U,4)-$PIECE(^TIU(8925,0),U,4)
+11 SET LEFT=NUM/PERHR
SET DAYS=LEFT/24
+12 ;in file
SET REMAIN1=$PIECE(^GMR(121,0),U,4)-CURRENT
+13 QUIT
+14 ;
DISPLAY ;Displays known information
+1 WRITE !?5," Conversion began: ",TIME
+2 WRITE !?5," Starting record: ",START
+3 WRITE !?5," Processing record: ",CURRENT
+4 WRITE !?5," Records processed: ",CNTR
+5 WRITE !?5,"Current # of error: ",ERRORS
+6 WRITE !?5," Elapsed time: ",ETIME
+7 WRITE !?5," Notes per hour: ",$PIECE(PERHR,".")
+8 IF LEFT>24
WRITE !?5," Days left: ",$EXTRACT(DAYS,1,5)
+9 IF '$TEST
WRITE !?5," Hours left: ",$EXTRACT(LEFT,1,5)
+10 WRITE !!?2,"Notes left to convert: ",REMAIN1
+11 WRITE !!
+12 QUIT
+13 ;
RETURN ;Issues RETURN prompt
+1 NEW DIR,Y
+2 FOR TIULN=1:1:(IOSL-$Y-4)
WRITE !
+3 SET DIR(0)="E"
DO ^DIR
IF $DATA(DIRUT)
SET BYE=1
QUIT
+4 QUIT
+5 ;