VBECDCU1 ;hoifo/gjc-data conversion & pre-implementation utilities;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 ^%ZTER is supported by IA: 1621
;Call to $$GET1^DIQ is supported by IA: 2056
;Call to SETUP^XQALERT is supported by IA: 10081
;
ATTR() ; select the data family to display
; Output: the file that the VistA data resides in as well as the full
; name of the data family - EX: 61.3^Antigen/Antibody
;
K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y N VBECFILE,VBECATT
;S DIR(0)="S^AA:Antigen/Antibody;BP:Blood Product;BS:Blood Supplier;TR:Transfusion Reaction",DIR("A")="Select the unmapped data attribute to display"
S DIR(0)="S^AA:Antigen/Antibody;TR:Transfusion Reaction",DIR("A")="Select the unmapped data attribute to display"
S DIR("?",1)="Enter 'AA' for Antibodies and Antigens (Vista File: Function Field #61.3)"
;S DIR("?",2)="Enter 'BP' for Blood Product (Vista File: Blood Product #66)"
;S DIR("?",3)="Enter 'BS' for Blood Supplier"
S DIR("?",2)="Enter 'TR' for Transfusion Reaction (VistA File: Blood Bank Utility"
S DIR("?")="#65.4)" D ^DIR
I $D(DIRUT) K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y S (VBECFILE,VBECATT)=""
E S VBECFILE=$S(Y="AA":61.3,1:65.4),VBECATT=Y(0)
;E S VBECFILE=$S(Y="AA":61.3,Y="TR":65.4,Y="BP":66,1:66.01),VBECATT=Y(0)
Q VBECFILE_"^"_VBECATT
;
BRKPNT(LRDFN,DFN) ; check for broken pointers between files 2 & 63.
; Check the pointer from the Patient (#2) to the Lab Data (#63)
; file against the Parent File (#.02), piece two of LRDATA, and
; Name (#.03), piece three of LRDATA, fields on the Lab Data file.
; Parent File field value must equal 2 (Pat. file) & Name field
; value must equal the DFN of the patient for the pointer to be
; correct.
;
; Input LRDFN: pointer, ien of the Lab Data record in the Patient file
; DFN: DFN of the patient in the Patient file
; Returns: 1 if the link between the files is broken, else 0
;
N LRDATA S LRDATA=$G(^LR(LRDFN,0))
Q $S($P(LRDATA,U,2)'=2:1,$P(LRDATA,U,3)'=DFN:1,1:0)
;
SAVE ; Save off the legacy Blood Bank data into globals, ^TMP(name_space,$J)
; and then move data from globals to either VMS files or text files on
; a Microsoft machine.
;
; global subscript to file name conversion
; ----------------------------------------
;"VBEC63 PAT" -> "VBEC63_PAT"
;"VBEC63 ANTIP" -> "VBEC63_ANTIP"
;"VBEC63 ANTIA" -> "VBEC63_ANTIA"
;"VBEC63 AI" -> "VBEC63_AI"
;"VBEC63 BBC" -> "VBEC63_BBC"
;"VBEC63 TD" -> "VBEC63_TD"
;"VBEC63 TRD" -> "VBEC63_TRD"
;"VBEC63 TC" -> "VBEC63_TC"
;"VBEC63 TRC" -> "VBEC63_TRC"
;"VBEC FINIS" -> "VBEC_FINIS"
;
N LRDATA,LRNAME,LRNODE,LRC,LRX
S LRDATA=0 ; if data, flip LRDATA to 1
S LRDATA=$$DATA($J)
I 'LRDATA DO ALERT^VBECDCU(DUZ,VBECCNV,0,-1) QUIT
F VBECI=1:1:7 S VBECI1=$P($T(SUBS+VBECI),";;",2) I '$D(^TMP(VBECI1,$J)) S ^TMP(VBECI1,$J)="" ;RLM 10/28/05
;
; Set DBCONV.INI file. This will tell the system where to find the
; database on the VBECS system
S ^TMP("DBCONV.INI",$J,1,0)="[database]"
S ^TMP("DBCONV.INI",$J,2,0)="database name="_VBECDBN
S ^TMP("DBCONV.INI",$J,3,0)="[server]"
S ^TMP("DBCONV.INI",$J,4,0)="server name="_VBECDBN1
S LRNODE="^TMP(""DBCONV.INI"","_$J_",1,0)"
S LRFLG=$$GTF^VBECDCU($NA(@LRNODE),3,"DBCONV.INI")
;
; Set finish global. This global is used to flag the SQL Server box
; that data exists, and that the data can be set into SQL tables.
;
S LRX="VBEC FINI"
F S LRX=$O(^TMP(LRX)) Q:LRX=""!(LRX]"VBEC63 zzz") D
.S LRNODE="^TMP("""_LRX_""","_$J_",1,0)"
.S LRNAME=$TR(LRX," ","_")_".TXT"
.S LRFLG=$$GTF^VBECDCU($NA(@LRNODE),3,LRNAME)
.Q
Q
;
DATA(Y) ; determine if we've captured data and create empty files if no data found
; Input: Y=$J or process id
K LRXX N LRZ S LRXX="VBEC FINI",LRZ=0
F S LRXX=$O(^TMP(LRXX)) Q:LRXX=""!(LRXX]"VBEC63 zzz") D
. I $E(LRXX,1,4)="VBEC",('$D(^TMP(LRXX,Y))\10) S ^TMP(LRXX,Y,1,0)=""
. Q
K LRXX Q 1
;
ERR ;come here on error, record error in error trap and alert all VBEC mail
;group members
N XQA,XQAMSG
;record error & write message
S XQA(DUZ)="",XQAMSG="Option "_$TR($E($G(XQY0),1,30),"^","")_" has encountered an Error."
; IA: 10111 read ^XMB(3.8,DO,0) with FileMan (supported)
S VBECMG=$$GET1^DIQ(3.8,+$P($G(^VBEC(6000,1,0)),U,7)_",",.01)
S:VBECMG'="" XQA("G."_VBECMG)=""
D ^%ZTER,SETUP^XQALERT K VBECMG
S LRSTOP=-1 ;data conversion/integrity checker must stop processing
Q
;
SUBS ;
;;VBEC63 PAT
;;VBEC63 ANTIP
;;VBEC63 ANTIA
;;VBEC63 AI
;;VBEC63 BBC
;;VBEC63 TRD
;;VBEC63 TRC
;;VBEC FINIS
FILES ; here are the file names for used for the legacy Blood Bank data
;;VBEC63_PAT
;;VBEC63_ANTIP
;;VBEC63_ANTIA
;;VBEC63_AI
;;VBEC63_BBC
;;VBEC63_TRD
;;VBEC63_TRC
;;VBEC_FINIS
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVBECDCU1 5446 printed Oct 16, 2024@18:44:28 Page 2
VBECDCU1 ;hoifo/gjc-data conversion & pre-implementation utilities;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 ^%ZTER is supported by IA: 1621
+15 ;Call to $$GET1^DIQ is supported by IA: 2056
+16 ;Call to SETUP^XQALERT is supported by IA: 10081
+17 ;
ATTR() ; select the data family to display
+1 ; Output: the file that the VistA data resides in as well as the full
+2 ; name of the data family - EX: 61.3^Antigen/Antibody
+3 ;
+4 KILL DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y
NEW VBECFILE,VBECATT
+5 ;S DIR(0)="S^AA:Antigen/Antibody;BP:Blood Product;BS:Blood Supplier;TR:Transfusion Reaction",DIR("A")="Select the unmapped data attribute to display"
+6 SET DIR(0)="S^AA:Antigen/Antibody;TR:Transfusion Reaction"
SET DIR("A")="Select the unmapped data attribute to display"
+7 SET DIR("?",1)="Enter 'AA' for Antibodies and Antigens (Vista File: Function Field #61.3)"
+8 ;S DIR("?",2)="Enter 'BP' for Blood Product (Vista File: Blood Product #66)"
+9 ;S DIR("?",3)="Enter 'BS' for Blood Supplier"
+10 SET DIR("?",2)="Enter 'TR' for Transfusion Reaction (VistA File: Blood Bank Utility"
+11 SET DIR("?")="#65.4)"
DO ^DIR
+12 IF $DATA(DIRUT)
KILL DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y
SET (VBECFILE,VBECATT)=""
+13 IF '$TEST
SET VBECFILE=$SELECT(Y="AA":61.3,1:65.4)
SET VBECATT=Y(0)
+14 ;E S VBECFILE=$S(Y="AA":61.3,Y="TR":65.4,Y="BP":66,1:66.01),VBECATT=Y(0)
+15 QUIT VBECFILE_"^"_VBECATT
+16 ;
BRKPNT(LRDFN,DFN) ; check for broken pointers between files 2 & 63.
+1 ; Check the pointer from the Patient (#2) to the Lab Data (#63)
+2 ; file against the Parent File (#.02), piece two of LRDATA, and
+3 ; Name (#.03), piece three of LRDATA, fields on the Lab Data file.
+4 ; Parent File field value must equal 2 (Pat. file) & Name field
+5 ; value must equal the DFN of the patient for the pointer to be
+6 ; correct.
+7 ;
+8 ; Input LRDFN: pointer, ien of the Lab Data record in the Patient file
+9 ; DFN: DFN of the patient in the Patient file
+10 ; Returns: 1 if the link between the files is broken, else 0
+11 ;
+12 NEW LRDATA
SET LRDATA=$GET(^LR(LRDFN,0))
+13 QUIT $SELECT($PIECE(LRDATA,U,2)'=2:1,$PIECE(LRDATA,U,3)'=DFN:1,1:0)
+14 ;
SAVE ; Save off the legacy Blood Bank data into globals, ^TMP(name_space,$J)
+1 ; and then move data from globals to either VMS files or text files on
+2 ; a Microsoft machine.
+3 ;
+4 ; global subscript to file name conversion
+5 ; ----------------------------------------
+6 ;"VBEC63 PAT" -> "VBEC63_PAT"
+7 ;"VBEC63 ANTIP" -> "VBEC63_ANTIP"
+8 ;"VBEC63 ANTIA" -> "VBEC63_ANTIA"
+9 ;"VBEC63 AI" -> "VBEC63_AI"
+10 ;"VBEC63 BBC" -> "VBEC63_BBC"
+11 ;"VBEC63 TD" -> "VBEC63_TD"
+12 ;"VBEC63 TRD" -> "VBEC63_TRD"
+13 ;"VBEC63 TC" -> "VBEC63_TC"
+14 ;"VBEC63 TRC" -> "VBEC63_TRC"
+15 ;"VBEC FINIS" -> "VBEC_FINIS"
+16 ;
+17 NEW LRDATA,LRNAME,LRNODE,LRC,LRX
+18 ; if data, flip LRDATA to 1
SET LRDATA=0
+19 SET LRDATA=$$DATA($JOB)
+20 IF 'LRDATA
DO ALERT^VBECDCU(DUZ,VBECCNV,0,-1)
QUIT
+21 ;RLM 10/28/05
FOR VBECI=1:1:7
SET VBECI1=$PIECE($TEXT(SUBS+VBECI),";;",2)
IF '$DATA(^TMP(VBECI1,$JOB))
SET ^TMP(VBECI1,$JOB)=""
+22 ;
+23 ; Set DBCONV.INI file. This will tell the system where to find the
+24 ; database on the VBECS system
+25 SET ^TMP("DBCONV.INI",$JOB,1,0)="[database]"
+26 SET ^TMP("DBCONV.INI",$JOB,2,0)="database name="_VBECDBN
+27 SET ^TMP("DBCONV.INI",$JOB,3,0)="[server]"
+28 SET ^TMP("DBCONV.INI",$JOB,4,0)="server name="_VBECDBN1
+29 SET LRNODE="^TMP(""DBCONV.INI"","_$JOB_",1,0)"
+30 SET LRFLG=$$GTF^VBECDCU($NAME(@LRNODE),3,"DBCONV.INI")
+31 ;
+32 ; Set finish global. This global is used to flag the SQL Server box
+33 ; that data exists, and that the data can be set into SQL tables.
+34 ;
+35 SET LRX="VBEC FINI"
+36 FOR
SET LRX=$ORDER(^TMP(LRX))
if LRX=""!(LRX]"VBEC63 zzz")
QUIT
Begin DoDot:1
+37 SET LRNODE="^TMP("""_LRX_""","_$JOB_",1,0)"
+38 SET LRNAME=$TRANSLATE(LRX," ","_")_".TXT"
+39 SET LRFLG=$$GTF^VBECDCU($NAME(@LRNODE),3,LRNAME)
+40 QUIT
End DoDot:1
+41 QUIT
+42 ;
DATA(Y) ; determine if we've captured data and create empty files if no data found
+1 ; Input: Y=$J or process id
+2 KILL LRXX
NEW LRZ
SET LRXX="VBEC FINI"
SET LRZ=0
+3 FOR
SET LRXX=$ORDER(^TMP(LRXX))
if LRXX=""!(LRXX]"VBEC63 zzz")
QUIT
Begin DoDot:1
+4 IF $EXTRACT(LRXX,1,4)="VBEC"
IF ('$DATA(^TMP(LRXX,Y))\10)
SET ^TMP(LRXX,Y,1,0)=""
+5 QUIT
End DoDot:1
+6 KILL LRXX
QUIT 1
+7 ;
ERR ;come here on error, record error in error trap and alert all VBEC mail
+1 ;group members
+2 NEW XQA,XQAMSG
+3 ;record error & write message
+4 SET XQA(DUZ)=""
SET XQAMSG="Option "_$TRANSLATE($EXTRACT($GET(XQY0),1,30),"^","")_" has encountered an Error."
+5 ; IA: 10111 read ^XMB(3.8,DO,0) with FileMan (supported)
+6 SET VBECMG=$$GET1^DIQ(3.8,+$PIECE($GET(^VBEC(6000,1,0)),U,7)_",",.01)
+7 if VBECMG'=""
SET XQA("G."_VBECMG)=""
+8 DO ^%ZTER
DO SETUP^XQALERT
KILL VBECMG
+9 ;data conversion/integrity checker must stop processing
SET LRSTOP=-1
+10 QUIT
+11 ;
SUBS ;
+1 ;;VBEC63 PAT
+2 ;;VBEC63 ANTIP
+3 ;;VBEC63 ANTIA
+4 ;;VBEC63 AI
+5 ;;VBEC63 BBC
+6 ;;VBEC63 TRD
+7 ;;VBEC63 TRC
+8 ;;VBEC FINIS
FILES ; here are the file names for used for the legacy Blood Bank data
+1 ;;VBEC63_PAT
+2 ;;VBEC63_ANTIP
+3 ;;VBEC63_ANTIA
+4 ;;VBEC63_AI
+5 ;;VBEC63_BBC
+6 ;;VBEC63_TRD
+7 ;;VBEC63_TRC
+8 ;;VBEC_FINIS
+9 ;;