Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VBECDCU1

VBECDCU1.m

Go to the documentation of this file.
  1. VBECDCU1 ;hoifo/gjc-data conversion & pre-implementation utilities;Nov 21, 2002
  1. ;;2.0;VBEC;;Jun 05, 2015;Build 4
  1. ;
  1. ;Medical Device #:
  1. ;Note: The food and Drug Administration classifies this software as a
  1. ;medical device. As such, it may not be changed in any way.
  1. ;Modifications to this software may result in an adulterated medical
  1. ;device under 21CFR820, the use of which is considered to be a
  1. ;violation of US Federal Statutes. Acquiring and implementing this
  1. ;software through the Freedom of Information Act requires the
  1. ;implementer to assume total responsibility for the software, and
  1. ;become a registered manufacturer of a medical device, subject to FDA
  1. ;regulations.
  1. ;
  1. ;Call to ^%ZTER is supported by IA: 1621
  1. ;Call to $$GET1^DIQ is supported by IA: 2056
  1. ;Call to SETUP^XQALERT is supported by IA: 10081
  1. ;
  1. ATTR() ; select the data family to display
  1. ; Output: the file that the VistA data resides in as well as the full
  1. ; name of the data family - EX: 61.3^Antigen/Antibody
  1. ;
  1. K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y N VBECFILE,VBECATT
  1. ;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"
  1. S DIR(0)="S^AA:Antigen/Antibody;TR:Transfusion Reaction",DIR("A")="Select the unmapped data attribute to display"
  1. S DIR("?",1)="Enter 'AA' for Antibodies and Antigens (Vista File: Function Field #61.3)"
  1. ;S DIR("?",2)="Enter 'BP' for Blood Product (Vista File: Blood Product #66)"
  1. ;S DIR("?",3)="Enter 'BS' for Blood Supplier"
  1. S DIR("?",2)="Enter 'TR' for Transfusion Reaction (VistA File: Blood Bank Utility"
  1. S DIR("?")="#65.4)" D ^DIR
  1. I $D(DIRUT) K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y S (VBECFILE,VBECATT)=""
  1. E S VBECFILE=$S(Y="AA":61.3,1:65.4),VBECATT=Y(0)
  1. ;E S VBECFILE=$S(Y="AA":61.3,Y="TR":65.4,Y="BP":66,1:66.01),VBECATT=Y(0)
  1. Q VBECFILE_"^"_VBECATT
  1. ;
  1. BRKPNT(LRDFN,DFN) ; check for broken pointers between files 2 & 63.
  1. ; Check the pointer from the Patient (#2) to the Lab Data (#63)
  1. ; file against the Parent File (#.02), piece two of LRDATA, and
  1. ; Name (#.03), piece three of LRDATA, fields on the Lab Data file.
  1. ; Parent File field value must equal 2 (Pat. file) & Name field
  1. ; value must equal the DFN of the patient for the pointer to be
  1. ; correct.
  1. ;
  1. ; Input LRDFN: pointer, ien of the Lab Data record in the Patient file
  1. ; DFN: DFN of the patient in the Patient file
  1. ; Returns: 1 if the link between the files is broken, else 0
  1. ;
  1. N LRDATA S LRDATA=$G(^LR(LRDFN,0))
  1. Q $S($P(LRDATA,U,2)'=2:1,$P(LRDATA,U,3)'=DFN:1,1:0)
  1. ;
  1. 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
  1. ; a Microsoft machine.
  1. ;
  1. ; global subscript to file name conversion
  1. ; ----------------------------------------
  1. ;"VBEC63 PAT" -> "VBEC63_PAT"
  1. ;"VBEC63 ANTIP" -> "VBEC63_ANTIP"
  1. ;"VBEC63 ANTIA" -> "VBEC63_ANTIA"
  1. ;"VBEC63 AI" -> "VBEC63_AI"
  1. ;"VBEC63 BBC" -> "VBEC63_BBC"
  1. ;"VBEC63 TD" -> "VBEC63_TD"
  1. ;"VBEC63 TRD" -> "VBEC63_TRD"
  1. ;"VBEC63 TC" -> "VBEC63_TC"
  1. ;"VBEC63 TRC" -> "VBEC63_TRC"
  1. ;"VBEC FINIS" -> "VBEC_FINIS"
  1. ;
  1. N LRDATA,LRNAME,LRNODE,LRC,LRX
  1. S LRDATA=0 ; if data, flip LRDATA to 1
  1. S LRDATA=$$DATA($J)
  1. I 'LRDATA DO ALERT^VBECDCU(DUZ,VBECCNV,0,-1) QUIT
  1. 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
  1. ;
  1. ; Set DBCONV.INI file. This will tell the system where to find the
  1. ; database on the VBECS system
  1. S ^TMP("DBCONV.INI",$J,1,0)="[database]"
  1. S ^TMP("DBCONV.INI",$J,2,0)="database name="_VBECDBN
  1. S ^TMP("DBCONV.INI",$J,3,0)="[server]"
  1. S ^TMP("DBCONV.INI",$J,4,0)="server name="_VBECDBN1
  1. S LRNODE="^TMP(""DBCONV.INI"","_$J_",1,0)"
  1. S LRFLG=$$GTF^VBECDCU($NA(@LRNODE),3,"DBCONV.INI")
  1. ;
  1. ; Set finish global. This global is used to flag the SQL Server box
  1. ; that data exists, and that the data can be set into SQL tables.
  1. ;
  1. S LRX="VBEC FINI"
  1. F S LRX=$O(^TMP(LRX)) Q:LRX=""!(LRX]"VBEC63 zzz") D
  1. .S LRNODE="^TMP("""_LRX_""","_$J_",1,0)"
  1. .S LRNAME=$TR(LRX," ","_")_".TXT"
  1. .S LRFLG=$$GTF^VBECDCU($NA(@LRNODE),3,LRNAME)
  1. .Q
  1. Q
  1. ;
  1. DATA(Y) ; determine if we've captured data and create empty files if no data found
  1. ; Input: Y=$J or process id
  1. K LRXX N LRZ S LRXX="VBEC FINI",LRZ=0
  1. F S LRXX=$O(^TMP(LRXX)) Q:LRXX=""!(LRXX]"VBEC63 zzz") D
  1. . I $E(LRXX,1,4)="VBEC",('$D(^TMP(LRXX,Y))\10) S ^TMP(LRXX,Y,1,0)=""
  1. . Q
  1. K LRXX Q 1
  1. ;
  1. ERR ;come here on error, record error in error trap and alert all VBEC mail
  1. ;group members
  1. N XQA,XQAMSG
  1. ;record error & write message
  1. S XQA(DUZ)="",XQAMSG="Option "_$TR($E($G(XQY0),1,30),"^","")_" has encountered an Error."
  1. ; IA: 10111 read ^XMB(3.8,DO,0) with FileMan (supported)
  1. S VBECMG=$$GET1^DIQ(3.8,+$P($G(^VBEC(6000,1,0)),U,7)_",",.01)
  1. S:VBECMG'="" XQA("G."_VBECMG)=""
  1. D ^%ZTER,SETUP^XQALERT K VBECMG
  1. S LRSTOP=-1 ;data conversion/integrity checker must stop processing
  1. Q
  1. ;
  1. SUBS ;
  1. ;;VBEC63 PAT
  1. ;;VBEC63 ANTIP
  1. ;;VBEC63 ANTIA
  1. ;;VBEC63 AI
  1. ;;VBEC63 BBC
  1. ;;VBEC63 TRD
  1. ;;VBEC63 TRC
  1. ;;VBEC FINIS
  1. FILES ; here are the file names for used for the legacy Blood Bank data
  1. ;;VBEC63_PAT
  1. ;;VBEC63_ANTIP
  1. ;;VBEC63_ANTIA
  1. ;;VBEC63_AI
  1. ;;VBEC63_BBC
  1. ;;VBEC63_TRD
  1. ;;VBEC63_TRC
  1. ;;VBEC_FINIS
  1. ;;