GMRA5UTL ;HIRMFO/FT-Fix ART database due to GMRA*4*2 bug ;9/13/96 13:11
;;4.0;Adverse Reaction Tracking;**5**;Mar 29, 1996
;
; This routine is part of GMRA*4*5. GMRA*4*2 introduced a bug in
; the routine GMRAPEM0 which caused reactions that should have
; been autoverified from being marked as such.
;
EN1 ; This routine will:
; 1) Find & display reactions that have not been signed-off between
; the installation of GMRA*4*2 and GMRA*4*5, and
; 2) Prompt the user to autoverify those reactions which will change
; the ORIGINATOR SIGN OFF (#15), VERIFIED (#19) and VERIFICATION
; DATE/TIME (#20) fields in File #120.8 to mimic autoverification.
;
; get patch #2 completion date/time(s)
K ^TMP("DILIST",$J),GMRADT D CLEAN^DILF
D LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*2","","","","","")
I '$D(^TMP("DILIST",$J,"ID")) W !,"GMRA*4.0*2 has not been installed on your system. Done." D KILL Q ;quit if patch not found in Install file (#9.7)
S GMRAIDT=0
F S GMRAIDT=$O(^TMP("DILIST",$J,"ID",GMRAIDT)) Q:GMRAIDT'>0 D
.S GMRADT=+$G(^TMP("DILIST",$J,"ID",GMRAIDT,17))
.I GMRADT>0 S GMRADT(GMRADT)="" ;array for #2 completion date/times
.Q
S GMRAIDT=$O(GMRADT("")) ;get earliest #2 completion date/time
I GMRAIDT'>0 W !,"It does not appear that GMRA*4.0*2 was installed.",!,"Please contact your IRM Field Office Customer Support Representative." D KILL Q
; get GMRA*4*5 patch completion date/time(s)
K ^TMP("DILIST",$J),GMRADT D CLEAN^DILF
D LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*5","","","","","")
S GMRAENDT=0
F S GMRAENDT=$O(^TMP("DILIST",$J,"ID",GMRAENDT)) Q:GMRAENDT'>0 D
.S GMRADT=+$G(^TMP("DILIST",$J,"ID",GMRAENDT,17))
.I GMRADT>0 S GMRADT(GMRADT)="" ;array for #5 completion date/times
.Q
S GMRAENDT=$O(GMRADT("")) ;get earliest #5 completion date/time
I GMRAENDT="" S GMRAENDT=$$NOW^XLFDT() ;use current date/time if #5 has no completion date/time ("bullet-proofing").
; display #2 completion date/time
W !!,"GMRA*4.0*2 was installed on ",$$FMTE^XLFDT(GMRAIDT,1)
; get/display autoverify parameters
W !!,"Your current AUTOVERIFY site parameters are:",!!
S (GMRAUTO,GMRASITE)=0
F S GMRASITE=$O(^GMRD(120.84,GMRASITE)) Q:GMRASITE'>0 D
.S GMRASITE(0)=$G(^GMRD(120.84,GMRASITE,0)) Q:GMRASITE(0)=""
.W !," Site Parameter Name: ",$P(GMRASITE(0),U,1)
.S X=$P(GMRASITE(0),U,2),GMRAUTO=GMRAUTO+X
.W !," Autoverify Food/Drug/Other: "
.W $S(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY DRUG ONLY",X=2:"AUTOVERIFY FOOD ONLY",X=3:"AUTOVERIFY DRUG/FOOD",X=4:"AUTOVERIFY OTHER ONLY",X=5:"AUTOVERIFY DRUG/OTHER",X=6:"AUTOVERIFY FOOD/OTHER",X=7:"AUTOVERIFY ALL",1:"<none specified>")
.S X=$P(GMRASITE(0),U,6)
.W !," Autoverify Logical Operator: ",$S(X="!":"OR",X="&":"AND",1:"<none specified>")
.S X=$P(GMRASITE(0),U,3),GMRAUTO=GMRAUTO+X
.W !,"Autoverify Observed/Historical: ",$S(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY HISTORICAL ONLY",X=2:"AUTOVERIFY OBSERVED ONLY",X=3:"AUTOVERIFY BOTH",1:"<none specified>"),!!
K DIR,GMRASITE
S DIR(0)="E" D ^DIR K DIR I $D(DIRUT) D KILL Q
; if autoverified is not used at all, ask user if he/she wants to
; continue since there shouldn't be any reactions to correct.
I GMRAUTO=0 D I $D(DIRUT)!(Y=1) D KILL Q
.W !!
.K DIR S DIR(0)="Y",DIR("A")="Want to stop (Y/N)",DIR("B")="YES"
.S DIR("?")="Answer YES to continue or NO to halt."
.S DIR("A",1)="Since your site does not autoverify any reactions you can halt now."
.D ^DIR K DIR
.Q
W @IOF
S GMRANOW=$$NOW^XLFDT(),(GMRACNT,GMRAIEN)=0 K GMRAOUT
; loop through unsigned reactions
F S GMRAIEN=$O(^GMR(120.8,"ASGN",GMRAIEN)) Q:GMRAIEN'>0 D Q:$D(GMRAOUT) ;quit if user up-arrows out
.S GMRANODE=$G(^GMR(120.8,+GMRAIEN,0)) Q:GMRANODE=""
.I $P(GMRANODE,U,4)]"" D
..S GMRAODT=$P(GMRANODE,U,4) ;origination date/time
..Q:GMRAODT'>GMRAIDT ;quit if origination date/time before GMRA*4*2 installation
..Q:GMRAODT>GMRAENDT ;quit if origination date/time after GMRA*4*5 installation
..S GMRACNT=GMRACNT+1
..S DIC="^GMR(120.8,",DA=GMRAIEN K DR D EN^DIQ ;display reaction data
..;prompt user to autoverify reaction
..W !! K DIR S DIR(0)="Y",DIR("A")="Autoverify this reaction (Y/N)"
..S DIR("?")="Answer YES to mark this reaction as autoverified or NO to leave it unchanged."
..S DIR("?",1)="Answering YES will change the ORIGINATOR SIGN OFF and VERIFIED fields to YES"
..S DIR("?",2)="and enter a date/time into the VERIFICATION DATE/TIME field (i.e., this will"
..S DIR("?",3)="mark the record as autoverified)."
..S DIR("?",4)=" "
..S DIR("?",5)="Answering NO will not change the record."
..S DIR("?",6)=" "
..D ^DIR K DIR I $D(DIRUT) S GMRAOUT=1 Q ;quit if time-out/up-arrow
..;if yes change fields to mimic autoverified
..I Y=1 S DIE="^GMR(120.8,",DA=GMRAIEN,DR="15///1;19///1;20///"_GMRANOW D ^DIE
..Q
.Q
I GMRACNT=0 W !!,"No unsigned reactions were found for the time period between the",!,"installation of GMRA*4.0*2 and GMRA*4.0*5.",!!
KILL ; Kill variables
K %,DA,DIC,DIE,DIR,DIROUT,DIRUT,DTOUT,DUOUT,DR,GMRACNT,GMRADT,GMRAENDT,GMRAIDT,GMRAIEN,GMRANODE,GMRANOW,GMRAODT,GMRAOUT,GMRAUTO
K ^TMP("DILIST",$J) D CLEAN^DILF
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRA5UTL 5191 printed Dec 13, 2024@01:38:39 Page 2
GMRA5UTL ;HIRMFO/FT-Fix ART database due to GMRA*4*2 bug ;9/13/96 13:11
+1 ;;4.0;Adverse Reaction Tracking;**5**;Mar 29, 1996
+2 ;
+3 ; This routine is part of GMRA*4*5. GMRA*4*2 introduced a bug in
+4 ; the routine GMRAPEM0 which caused reactions that should have
+5 ; been autoverified from being marked as such.
+6 ;
EN1 ; This routine will:
+1 ; 1) Find & display reactions that have not been signed-off between
+2 ; the installation of GMRA*4*2 and GMRA*4*5, and
+3 ; 2) Prompt the user to autoverify those reactions which will change
+4 ; the ORIGINATOR SIGN OFF (#15), VERIFIED (#19) and VERIFICATION
+5 ; DATE/TIME (#20) fields in File #120.8 to mimic autoverification.
+6 ;
+7 ; get patch #2 completion date/time(s)
+8 KILL ^TMP("DILIST",$JOB),GMRADT
DO CLEAN^DILF
+9 DO LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*2","","","","","")
+10 ;quit if patch not found in Install file (#9.7)
IF '$DATA(^TMP("DILIST",$JOB,"ID"))
WRITE !,"GMRA*4.0*2 has not been installed on your system. Done."
DO KILL
QUIT
+11 SET GMRAIDT=0
+12 FOR
SET GMRAIDT=$ORDER(^TMP("DILIST",$JOB,"ID",GMRAIDT))
if GMRAIDT'>0
QUIT
Begin DoDot:1
+13 SET GMRADT=+$GET(^TMP("DILIST",$JOB,"ID",GMRAIDT,17))
+14 ;array for #2 completion date/times
IF GMRADT>0
SET GMRADT(GMRADT)=""
+15 QUIT
End DoDot:1
+16 ;get earliest #2 completion date/time
SET GMRAIDT=$ORDER(GMRADT(""))
+17 IF GMRAIDT'>0
WRITE !,"It does not appear that GMRA*4.0*2 was installed.",!,"Please contact your IRM Field Office Customer Support Representative."
DO KILL
QUIT
+18 ; get GMRA*4*5 patch completion date/time(s)
+19 KILL ^TMP("DILIST",$JOB),GMRADT
DO CLEAN^DILF
+20 DO LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*5","","","","","")
+21 SET GMRAENDT=0
+22 FOR
SET GMRAENDT=$ORDER(^TMP("DILIST",$JOB,"ID",GMRAENDT))
if GMRAENDT'>0
QUIT
Begin DoDot:1
+23 SET GMRADT=+$GET(^TMP("DILIST",$JOB,"ID",GMRAENDT,17))
+24 ;array for #5 completion date/times
IF GMRADT>0
SET GMRADT(GMRADT)=""
+25 QUIT
End DoDot:1
+26 ;get earliest #5 completion date/time
SET GMRAENDT=$ORDER(GMRADT(""))
+27 ;use current date/time if #5 has no completion date/time ("bullet-proofing").
IF GMRAENDT=""
SET GMRAENDT=$$NOW^XLFDT()
+28 ; display #2 completion date/time
+29 WRITE !!,"GMRA*4.0*2 was installed on ",$$FMTE^XLFDT(GMRAIDT,1)
+30 ; get/display autoverify parameters
+31 WRITE !!,"Your current AUTOVERIFY site parameters are:",!!
+32 SET (GMRAUTO,GMRASITE)=0
+33 FOR
SET GMRASITE=$ORDER(^GMRD(120.84,GMRASITE))
if GMRASITE'>0
QUIT
Begin DoDot:1
+34 SET GMRASITE(0)=$GET(^GMRD(120.84,GMRASITE,0))
if GMRASITE(0)=""
QUIT
+35 WRITE !," Site Parameter Name: ",$PIECE(GMRASITE(0),U,1)
+36 SET X=$PIECE(GMRASITE(0),U,2)
SET GMRAUTO=GMRAUTO+X
+37 WRITE !," Autoverify Food/Drug/Other: "
+38 WRITE $SELECT(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY DRUG ONLY",X=2:"AUTOVERIFY FOOD ONLY",X=3:"AUTOVERIFY DRUG/FOOD",X=4:"AUTOVERIFY OTHER ONLY",X=5:"AUTOVERIFY DRUG/OTHER",X=6:"AUTOVERIFY FOOD/OTHER",X=7:"AUTOVERIFY ALL",1:"<none specifi
ed>")
+39 SET X=$PIECE(GMRASITE(0),U,6)
+40 WRITE !," Autoverify Logical Operator: ",$SELECT(X="!":"OR",X="&":"AND",1:"<none specified>")
+41 SET X=$PIECE(GMRASITE(0),U,3)
SET GMRAUTO=GMRAUTO+X
+42 WRITE !,"Autoverify Observed/Historical: ",$SELECT(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY HISTORICAL ONLY",X=2:"AUTOVERIFY OBSERVED ONLY",X=3:"AUTOVERIFY BOTH",1:"<none specified>"),!!
End DoDot:1
+43 KILL DIR,GMRASITE
+44 SET DIR(0)="E"
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
DO KILL
QUIT
+45 ; if autoverified is not used at all, ask user if he/she wants to
+46 ; continue since there shouldn't be any reactions to correct.
+47 IF GMRAUTO=0
Begin DoDot:1
+48 WRITE !!
+49 KILL DIR
SET DIR(0)="Y"
SET DIR("A")="Want to stop (Y/N)"
SET DIR("B")="YES"
+50 SET DIR("?")="Answer YES to continue or NO to halt."
+51 SET DIR("A",1)="Since your site does not autoverify any reactions you can halt now."
+52 DO ^DIR
KILL DIR
+53 QUIT
End DoDot:1
IF $DATA(DIRUT)!(Y=1)
DO KILL
QUIT
+54 WRITE @IOF
+55 SET GMRANOW=$$NOW^XLFDT()
SET (GMRACNT,GMRAIEN)=0
KILL GMRAOUT
+56 ; loop through unsigned reactions
+57 ;quit if user up-arrows out
FOR
SET GMRAIEN=$ORDER(^GMR(120.8,"ASGN",GMRAIEN))
if GMRAIEN'>0
QUIT
Begin DoDot:1
+58 SET GMRANODE=$GET(^GMR(120.8,+GMRAIEN,0))
if GMRANODE=""
QUIT
+59 IF $PIECE(GMRANODE,U,4)]""
Begin DoDot:2
+60 ;origination date/time
SET GMRAODT=$PIECE(GMRANODE,U,4)
+61 ;quit if origination date/time before GMRA*4*2 installation
if GMRAODT'>GMRAIDT
QUIT
+62 ;quit if origination date/time after GMRA*4*5 installation
if GMRAODT>GMRAENDT
QUIT
+63 SET GMRACNT=GMRACNT+1
+64 ;display reaction data
SET DIC="^GMR(120.8,"
SET DA=GMRAIEN
KILL DR
DO EN^DIQ
+65 ;prompt user to autoverify reaction
+66 WRITE !!
KILL DIR
SET DIR(0)="Y"
SET DIR("A")="Autoverify this reaction (Y/N)"
+67 SET DIR("?")="Answer YES to mark this reaction as autoverified or NO to leave it unchanged."
+68 SET DIR("?",1)="Answering YES will change the ORIGINATOR SIGN OFF and VERIFIED fields to YES"
+69 SET DIR("?",2)="and enter a date/time into the VERIFICATION DATE/TIME field (i.e., this will"
+70 SET DIR("?",3)="mark the record as autoverified)."
+71 SET DIR("?",4)=" "
+72 SET DIR("?",5)="Answering NO will not change the record."
+73 SET DIR("?",6)=" "
+74 ;quit if time-out/up-arrow
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET GMRAOUT=1
QUIT
+75 ;if yes change fields to mimic autoverified
+76 IF Y=1
SET DIE="^GMR(120.8,"
SET DA=GMRAIEN
SET DR="15///1;19///1;20///"_GMRANOW
DO ^DIE
+77 QUIT
End DoDot:2
+78 QUIT
End DoDot:1
if $DATA(GMRAOUT)
QUIT
+79 IF GMRACNT=0
WRITE !!,"No unsigned reactions were found for the time period between the",!,"installation of GMRA*4.0*2 and GMRA*4.0*5.",!!
KILL ; Kill variables
+1 KILL %,DA,DIC,DIE,DIR,DIROUT,DIRUT,DTOUT,DUOUT,DR,GMRACNT,GMRADT,GMRAENDT,GMRAIDT,GMRAIEN,GMRANODE,GMRANOW,GMRAODT,GMRAOUT,GMRAUTO
+2 KILL ^TMP("DILIST",$JOB)
DO CLEAN^DILF
+3 QUIT