- VBECDC01 ;hoifo/gjc-data conversion & pre-implementation;Nov 21, 2002
- ;;2.0;VBEC;;Jun 05, 2015;Build 4
- ;
- ;Medical Device #:
- ;Note: The food and Drug Administration classifies this software as a
- ;medical device. As such, it may not be changed in any way.
- ;Modifications to this software may result in an adulterated medical
- ;device under 21CFR820, the use of which is considered to be a
- ;violation of US Federal Statutes. Acquiring and implementing this
- ;software through the Freedom of Information Act requires the
- ;implementer to assume total responsibility for the software, and
- ;become a registered manufacturer of a medical device, subject to FDA
- ;regulations.
- ;
- ;Call to $$NEWERR^%ZTER is supported by IA: 1621
- ;Call to $$GOTLOCAL^XMXAPIG is supported by IA: 3006
- ;Call to $$GET1^DIQ is supported by IA: 2056
- ;Call to $$FMTE^XLFDT is supported by IA: 10103
- ;Call to $$NOW^XLFDT is supported by IA: 10103
- ;
- EN(VBECCNV) ; entry point for both the pre-implementation and data
- ; conversion.
- ; Input: if VBECCNV evaluates to one, then the software
- ; executes data conversion logic. If VBECCNV evaluates
- ; to zero, then the pre-implementation logic is executed.
- ;
- I $S($D(DUZ)[0:1,$D(DUZ(0))[0:1,'DUZ:1,DUZ=.5:1,1:0) W !!?3,$C(7),"DUZ & DUZ(0) must be defined to an active user (not POSTMASTER) in order to",!?3,"proceed." Q
- ;
- ; initialize error trap
- I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^VBECDCU1"
- E S X="D ERR^VBECDCU1",@^%ZOSF("TRAP")
- ;
- ;If the data conversion process is selected to run, check the following
- ;conditions:
- ;
- ; a) If none of the VistA data been mapped prior to the data conversion
- ; convey that information to the user and exit the data conversion
- ; b) check if mapped data remains consistent with data from the parent
- ; (61.3 & 65.4) files. If not, do not proceed with the
- ; conversion
- ; c) check if the exported mail group has active local members (users
- ; checked for activity within the last seven days)
- ; d) is there a process running that has not yet finished? If so, do
- ; not allow another process to start (data conv. or anomaly check)
- ;
- I VBECCNV,$$NOMAP^VBECDCU2() Q ;condition a
- I VBECCNV,$$EN^VBECDCHX() D Q ;condition b
- .W !!?3,"Mapping errors were identified; data conversion terminated."
- .Q
- I '$$GOTLOCAL^XMXAPIG("VBECS DATA CONVERSION",7) D Q ;condition c
- .W !!?3,"There must be at least one local user assigned to the VBECS"
- .W !?3,"DATA CONVERSION Mail Group. This user must have been actively"
- .W !?3,"using VistA MailMan within the last seven (7) days.",$C(7)
- .Q
- ;
- I +$O(^VBEC(6001,0)) S VBECST=$$INPROC()
- I $L($G(VBECST)) D K VBECST Q
- .W !!,"The "_$S($P(VBECST,U,2)=1:"data conversion",1:"pre-implementation")_" has been started on: "_$$FMTE^XLFDT($P(VBECST,U,3),"1P")
- .W !,"by: "_$$GET1^DIQ(200,+$P(VBECST,U),.01)_". This process must first complete"
- .W !,"before the "_$S(VBECCNV=1:"data conversion",1:"pre-implementation")_" can be run."
- .Q
- I VBECCNV D I $D(VBECSTP) K VBECSTP Q ;Only ask for database on conversion
- . W !!?3,"You must enter the name of the database "
- . W !?3,"where the converted data will be loaded."
- . W !!?3,"An invalid database name will cause a failure"
- . W !?3,"when loading the data into VBECS."
- . F D I $D(VBECSTP)!(VBECDBN]"") Q
- . . W !!!,?3 R "VBECS Database Name: ",VBECDBN I VBECDBN=""!(VBECDBN["^") S VBECDBN="^",VBECSTP="" W !!?3,"Invalid database name. Conversion stopped." Q
- . . I VBECDBN?.E1C.E W !?4,"The database name cannot contain control characters.",!?4,"Please re-enter it." S VBECDBN=""
- . . I VBECDBN?1N.E W !?4,"The database name cannot begin with a number.",!?4,"Please re-enter it." S VBECDBN=""
- . . I $TR(VBECDBN,"_","")?.E1P.E W !?4,"The database name cannot contain punctuation except for an underscore.",!?4,"Please re-enter it." S VBECDBN=""
- ;
- I VBECCNV D I $D(VBECSTP) K VBECSTP Q ;Only ask for server on conversion
- . W !!?3,"You must enter the name of the server "
- . W !?3,"where the converted data will be loaded."
- . W !!?3,"An invalid server name will cause a failure"
- . W !?3,"when loading the data into VBECS."
- . F D I $D(VBECSTP)!(VBECDBN1]"") Q
- . . W !!!,?3 R "VBECS Server Name: ",VBECDBN1 I VBECDBN1=""!(VBECDBN1["^") S VBECDBN1="^",VBECSTP="" W !!?3,"Invalid server name. Conversion stopped." Q
- . . I VBECDBN1?.E1C.E W !?4,"The server name cannot contain control characters.",!?4,"Please re-enter it." S VBECDBN1=""
- . . I VBECDBN1?1N.E W !?4,"The server name cannot begin with a number.",!?4,"Please re-enter it." S VBECDBN1=""
- . . I $TR(VBECDBN1,"_-","")?.E1P.E W !?4,"The server name cannot contain punctuation except for an underscore (_) or dash (-).",!?4,"Please re-enter it." S VBECDBN1=""
- ;
- K VBECST W @IOF ;clear screen of past dialogue
- S (VBECDESC,ZTDESC)="VBECS "_$S(VBECCNV=1:"data conversion",1:"pre-implementation")
- W !?3,"The "_ZTDESC_" process will take some time to complete.",!?3,"It would be best if this process was run in the background.",!
- ;
- ; file the start time, process type, & user information into file 6001
- S VBECIEN=$$UP6001S^VBECDC02(+$E($$NOW^XLFDT(),1,12),VBECCNV,DUZ)
- I VBECIEN'>0 D Q
- .W !!?3,"Error filing "_ZTDESC_" statistics.",$C(7) K ZTDESC,VBECIEN
- .Q
- ; kick off the task, queued or real-time
- S ZTRTN="START^VBECDC00",ZTSAVE("DUZ")="",ZTSAVE("VBECCNV")="",ZTSAVE("VBECDBN")="",ZTSAVE("VBECDBN1")=""
- S ZTSAVE("VBECIEN")="",ZTIO="" D ^%ZTLOAD
- ; display task number for user reference
- I +$G(ZTSK) W !!,VBECDESC_" task number: "_ZTSK,!
- E D UP6001P^VBECDC02(VBECIEN) ;user exits prematurely
- K VBEC,VBECDESC,VBECIEN,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
- Q
- ;
- STOPPED ; entry point executed when the user stops a task with TaskMan
- ; if the user stopped the process:
- ; 1-DATA CONVERSION ONLY delete all data in all related ^TMP globals
- ; 2-DATA CONVERSION ONLY set options back 'in-order'
- ; 3-alert the user to the stoppage
- ; 4-delete the record from the VBECS DATA
- ; INTEGRITY/CONVERSION STATISTICS (#6001) file.
- ;
- ; Variables used within this function:
- ; VBECCNV-indicates if the data conversion (1) or data anomalies check
- ; (0) is running
- ; DUZ-the internal entry number of the person resposible for this
- ; task
- ; VBECIEN-is the IEN of the record in the VBECS DATA
- ; INTEGRITY/CONVERSION STATISTICS (#6001) file
- ; VBECANOM-flag to indicate if anomalies exist (zero if no anomalies,
- ; some number greater than zero if anomalies exist.)
- ;
- I VBECCNV D
- .D DELTMP($J) ;delete data in temporary globals ^TMP(,$J
- .D EN^VBECDC19(0) ;set options back in order, clear write nodes
- .Q
- ;next line performed for the anomaly check & data conversion
- D ALERT^VBECDCU(DUZ,VBECCNV,VBECANOM,"S"),UP6001P^VBECDC02(VBECIEN)
- Q
- ;
- INPROC() ;is there a current data conversion or anomaly process on
- ;file that has not completed? If so, prevent this current request
- ;from starting (collision errors)
- N VBECI,VBEC0,VBECSTOP,VBECX
- S VBECI=$C(32),VBECSTOP=0,VBECX=""
- F S VBECI=$O(^VBEC(6001,VBECI),-1) Q:'VBECI D Q:VBECSTOP
- .S VBEC0=$G(^VBEC(6001,VBECI,0))
- .I $P(VBEC0,U,3)="" S VBECX=$P(VBEC0,U,4)_U_$P(VBEC0,U,2)_U_$P(VBEC0,U)
- .I S VBECSTOP=1
- .Q
- Q VBECX
- ;
- DELTMP(DOLLARJ) ;Delete all Blood Bank Data in Temporary Globals
- ;
- N X S X="VBEC FINI"
- F S VBECX=$O(^TMP(VBECX)) Q:VBECX=""!(VBECX]"VBEC63 zzz") D
- .K ^TMP(VBECX,DOLLARJ)
- .Q
- Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVBECDC01 7552 printed Apr 23, 2025@18:58:30 Page 2
- VBECDC01 ;hoifo/gjc-data conversion & pre-implementation;Nov 21, 2002
- +1 ;;2.0;VBEC;;Jun 05, 2015;Build 4
- +2 ;
- +3 ;Medical Device #:
- +4 ;Note: The food and Drug Administration classifies this software as a
- +5 ;medical device. As such, it may not be changed in any way.
- +6 ;Modifications to this software may result in an adulterated medical
- +7 ;device under 21CFR820, the use of which is considered to be a
- +8 ;violation of US Federal Statutes. Acquiring and implementing this
- +9 ;software through the Freedom of Information Act requires the
- +10 ;implementer to assume total responsibility for the software, and
- +11 ;become a registered manufacturer of a medical device, subject to FDA
- +12 ;regulations.
- +13 ;
- +14 ;Call to $$NEWERR^%ZTER is supported by IA: 1621
- +15 ;Call to $$GOTLOCAL^XMXAPIG is supported by IA: 3006
- +16 ;Call to $$GET1^DIQ is supported by IA: 2056
- +17 ;Call to $$FMTE^XLFDT is supported by IA: 10103
- +18 ;Call to $$NOW^XLFDT is supported by IA: 10103
- +19 ;
- EN(VBECCNV) ; entry point for both the pre-implementation and data
- +1 ; conversion.
- +2 ; Input: if VBECCNV evaluates to one, then the software
- +3 ; executes data conversion logic. If VBECCNV evaluates
- +4 ; to zero, then the pre-implementation logic is executed.
- +5 ;
- +6 IF $SELECT($DATA(DUZ)[0:1,$DATA(DUZ(0))[0:1,'DUZ:1,DUZ=.5:1,1:0)
- WRITE !!?3,$CHAR(7),"DUZ & DUZ(0) must be defined to an active user (not POSTMASTER) in order to",!?3,"proceed."
- QUIT
- +7 ;
- +8 ; initialize error trap
- +9 IF $$NEWERR^%ZTER
- NEW $ETRAP,$ESTACK
- SET $ETRAP="D ERR^VBECDCU1"
- +10 IF '$TEST
- SET X="D ERR^VBECDCU1"
- SET @^%ZOSF("TRAP")
- +11 ;
- +12 ;If the data conversion process is selected to run, check the following
- +13 ;conditions:
- +14 ;
- +15 ; a) If none of the VistA data been mapped prior to the data conversion
- +16 ; convey that information to the user and exit the data conversion
- +17 ; b) check if mapped data remains consistent with data from the parent
- +18 ; (61.3 & 65.4) files. If not, do not proceed with the
- +19 ; conversion
- +20 ; c) check if the exported mail group has active local members (users
- +21 ; checked for activity within the last seven days)
- +22 ; d) is there a process running that has not yet finished? If so, do
- +23 ; not allow another process to start (data conv. or anomaly check)
- +24 ;
- +25 ;condition a
- IF VBECCNV
- IF $$NOMAP^VBECDCU2()
- QUIT
- +26 ;condition b
- IF VBECCNV
- IF $$EN^VBECDCHX()
- Begin DoDot:1
- +27 WRITE !!?3,"Mapping errors were identified; data conversion terminated."
- +28 QUIT
- End DoDot:1
- QUIT
- +29 ;condition c
- IF '$$GOTLOCAL^XMXAPIG("VBECS DATA CONVERSION",7)
- Begin DoDot:1
- +30 WRITE !!?3,"There must be at least one local user assigned to the VBECS"
- +31 WRITE !?3,"DATA CONVERSION Mail Group. This user must have been actively"
- +32 WRITE !?3,"using VistA MailMan within the last seven (7) days.",$CHAR(7)
- +33 QUIT
- End DoDot:1
- QUIT
- +34 ;
- +35 IF +$ORDER(^VBEC(6001,0))
- SET VBECST=$$INPROC()
- +36 IF $LENGTH($GET(VBECST))
- Begin DoDot:1
- +37 WRITE !!,"The "_$SELECT($PIECE(VBECST,U,2)=1:"data conversion",1:"pre-implementation")_" has been started on: "_$$FMTE^XLFDT($PIECE(VBECST,U,3),"1P")
- +38 WRITE !,"by: "_$$GET1^DIQ(200,+$PIECE(VBECST,U),.01)_". This process must first complete"
- +39 WRITE !,"before the "_$SELECT(VBECCNV=1:"data conversion",1:"pre-implementation")_" can be run."
- +40 QUIT
- End DoDot:1
- KILL VBECST
- QUIT
- +41 ;Only ask for database on conversion
- IF VBECCNV
- Begin DoDot:1
- +42 WRITE !!?3,"You must enter the name of the database "
- +43 WRITE !?3,"where the converted data will be loaded."
- +44 WRITE !!?3,"An invalid database name will cause a failure"
- +45 WRITE !?3,"when loading the data into VBECS."
- +46 FOR
- Begin DoDot:2
- +47 WRITE !!!,?3
- READ "VBECS Database Name: ",VBECDBN
- IF VBECDBN=""!(VBECDBN["^")
- SET VBECDBN="^"
- SET VBECSTP=""
- WRITE !!?3,"Invalid database name. Conversion stopped."
- QUIT
- +48 IF VBECDBN?.E1C.E
- WRITE !?4,"The database name cannot contain control characters.",!?4,"Please re-enter it."
- SET VBECDBN=""
- +49 IF VBECDBN?1N.E
- WRITE !?4,"The database name cannot begin with a number.",!?4,"Please re-enter it."
- SET VBECDBN=""
- +50 IF $TRANSLATE(VBECDBN,"_","")?.E1P.E
- WRITE !?4,"The database name cannot contain punctuation except for an underscore.",!?4,"Please re-enter it."
- SET VBECDBN=""
- End DoDot:2
- IF $DATA(VBECSTP)!(VBECDBN]"")
- QUIT
- End DoDot:1
- IF $DATA(VBECSTP)
- KILL VBECSTP
- QUIT
- +51 ;
- +52 ;Only ask for server on conversion
- IF VBECCNV
- Begin DoDot:1
- +53 WRITE !!?3,"You must enter the name of the server "
- +54 WRITE !?3,"where the converted data will be loaded."
- +55 WRITE !!?3,"An invalid server name will cause a failure"
- +56 WRITE !?3,"when loading the data into VBECS."
- +57 FOR
- Begin DoDot:2
- +58 WRITE !!!,?3
- READ "VBECS Server Name: ",VBECDBN1
- IF VBECDBN1=""!(VBECDBN1["^")
- SET VBECDBN1="^"
- SET VBECSTP=""
- WRITE !!?3,"Invalid server name. Conversion stopped."
- QUIT
- +59 IF VBECDBN1?.E1C.E
- WRITE !?4,"The server name cannot contain control characters.",!?4,"Please re-enter it."
- SET VBECDBN1=""
- +60 IF VBECDBN1?1N.E
- WRITE !?4,"The server name cannot begin with a number.",!?4,"Please re-enter it."
- SET VBECDBN1=""
- +61 IF $TRANSLATE(VBECDBN1,"_-","")?.E1P.E
- WRITE !?4,"The server name cannot contain punctuation except for an underscore (_) or dash (-).",!?4,"Please re-enter it."
- SET VBECDBN1=""
- End DoDot:2
- IF $DATA(VBECSTP)!(VBECDBN1]"")
- QUIT
- End DoDot:1
- IF $DATA(VBECSTP)
- KILL VBECSTP
- QUIT
- +62 ;
- +63 ;clear screen of past dialogue
- KILL VBECST
- WRITE @IOF
- +64 SET (VBECDESC,ZTDESC)="VBECS "_$SELECT(VBECCNV=1:"data conversion",1:"pre-implementation")
- +65 WRITE !?3,"The "_ZTDESC_" process will take some time to complete.",!?3,"It would be best if this process was run in the background.",!
- +66 ;
- +67 ; file the start time, process type, & user information into file 6001
- +68 SET VBECIEN=$$UP6001S^VBECDC02(+$EXTRACT($$NOW^XLFDT(),1,12),VBECCNV,DUZ)
- +69 IF VBECIEN'>0
- Begin DoDot:1
- +70 WRITE !!?3,"Error filing "_ZTDESC_" statistics.",$CHAR(7)
- KILL ZTDESC,VBECIEN
- +71 QUIT
- End DoDot:1
- QUIT
- +72 ; kick off the task, queued or real-time
- +73 SET ZTRTN="START^VBECDC00"
- SET ZTSAVE("DUZ")=""
- SET ZTSAVE("VBECCNV")=""
- SET ZTSAVE("VBECDBN")=""
- SET ZTSAVE("VBECDBN1")=""
- +74 SET ZTSAVE("VBECIEN")=""
- SET ZTIO=""
- DO ^%ZTLOAD
- +75 ; display task number for user reference
- +76 IF +$GET(ZTSK)
- WRITE !!,VBECDESC_" task number: "_ZTSK,!
- +77 ;user exits prematurely
- IF '$TEST
- DO UP6001P^VBECDC02(VBECIEN)
- +78 KILL VBEC,VBECDESC,VBECIEN,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
- +79 QUIT
- +80 ;
- STOPPED ; entry point executed when the user stops a task with TaskMan
- +1 ; if the user stopped the process:
- +2 ; 1-DATA CONVERSION ONLY delete all data in all related ^TMP globals
- +3 ; 2-DATA CONVERSION ONLY set options back 'in-order'
- +4 ; 3-alert the user to the stoppage
- +5 ; 4-delete the record from the VBECS DATA
- +6 ; INTEGRITY/CONVERSION STATISTICS (#6001) file.
- +7 ;
- +8 ; Variables used within this function:
- +9 ; VBECCNV-indicates if the data conversion (1) or data anomalies check
- +10 ; (0) is running
- +11 ; DUZ-the internal entry number of the person resposible for this
- +12 ; task
- +13 ; VBECIEN-is the IEN of the record in the VBECS DATA
- +14 ; INTEGRITY/CONVERSION STATISTICS (#6001) file
- +15 ; VBECANOM-flag to indicate if anomalies exist (zero if no anomalies,
- +16 ; some number greater than zero if anomalies exist.)
- +17 ;
- +18 IF VBECCNV
- Begin DoDot:1
- +19 ;delete data in temporary globals ^TMP(,$J
- DO DELTMP($JOB)
- +20 ;set options back in order, clear write nodes
- DO EN^VBECDC19(0)
- +21 QUIT
- End DoDot:1
- +22 ;next line performed for the anomaly check & data conversion
- +23 DO ALERT^VBECDCU(DUZ,VBECCNV,VBECANOM,"S")
- DO UP6001P^VBECDC02(VBECIEN)
- +24 QUIT
- +25 ;
- INPROC() ;is there a current data conversion or anomaly process on
- +1 ;file that has not completed? If so, prevent this current request
- +2 ;from starting (collision errors)
- +3 NEW VBECI,VBEC0,VBECSTOP,VBECX
- +4 SET VBECI=$CHAR(32)
- SET VBECSTOP=0
- SET VBECX=""
- +5 FOR
- SET VBECI=$ORDER(^VBEC(6001,VBECI),-1)
- if 'VBECI
- QUIT
- Begin DoDot:1
- +6 SET VBEC0=$GET(^VBEC(6001,VBECI,0))
- +7 IF $PIECE(VBEC0,U,3)=""
- SET VBECX=$PIECE(VBEC0,U,4)_U_$PIECE(VBEC0,U,2)_U_$PIECE(VBEC0,U)
- +8 IF $TEST
- SET VBECSTOP=1
- +9 QUIT
- End DoDot:1
- if VBECSTOP
- QUIT
- +10 QUIT VBECX
- +11 ;
- DELTMP(DOLLARJ) ;Delete all Blood Bank Data in Temporary Globals
- +1 ;
- +2 NEW X
- SET X="VBEC FINI"
- +3 FOR
- SET VBECX=$ORDER(^TMP(VBECX))
- if VBECX=""!(VBECX]"VBEC63 zzz")
- QUIT
- Begin DoDot:1
- +4 KILL ^TMP(VBECX,DOLLARJ)
- +5 QUIT
- End DoDot:1
- +6 QUIT
- +7 ;