- VBECDCHX ;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 $$ROOT^DILFD is supported by IA: 2055
- ;
- ; This routine is called from the main data conversion software
- ; (VBECDC01). This routine checks if antigen/antibody, transfusion
- ; reaction, blood product, or blood supplier data has been edited
- ; or deleted from the legacy VistA Blood Bank files. I do not check
- ; for added data to the legacy VistA Blood Bank files; other options
- ; within the software exist for this purpose.
- ;
- ; input: no data input into this module
- ; return: VBECFLG - 1 if a discrepancy exists, else 0
- ; check the data, all of this is run real-time (no queuing)
- ;
- ; variable definitions:
- ; CNT-counter, used to print '.' every 100 records
- ; VBEC01-'file-ien' or 'file' data (.01 field on file 6005)
- ; VBECDA-record ien file 6005
- ; VBECDATA-antigen/antibody, trans. react., blood prod., blood supplier
- ; VBECFILE-file number of legacy data
- ; VBECFLG-indicates if data is valid across files/sub-file:
- ; 61.3, 65.4, & 6005 (1 for no, 0 for yes)
- ; VBECGUID-only checking data that has been mapped
- ; VBECIEN-record ien (.01 field, file 6005 2nd piece delimited by '-')
- ; (not applicable on blood supplier data)
- ; VBECL0-legacy file (#s 61.3, or 65.4) zero node
- ; VBECLCX-checksum for a data record, legacy file (#s 61.3 & 65.4)
- ; VBECLID-identifier on legacy file
- ; VBECLNM-name of record in legacy file
- ; VBECLTOT-checksum value for legacy data (name and identifier)
- ; VBECRT-legacy file data global. in all cases: ^LAB(File#
- ; VBECSTR-temporary string data, holding variable
- ; VBECT0-transitory file (# 6005) zero node
- ; VBECTCX-checksum for a data record, transitory file (# 6005)
- ; VBECTID-identifier on transitory file
- ; VBECTNM-name of record in transitory file
- ; VBECTTOT-checksum value for transitory data (name and identifier)
- ;
- EN() ; Main entry point to check if mapped data remains consistent with
- ; data from the parent (61.3 & 65.4) files. If not, do not
- ; proceed with the data conversion (VBECDC01).
- ;
- W @IOF N CNT,VBECFLG S (CNT,VBECFLG)=0 ;assume successful test
- ;check the antigen/antibody data first
- F VBECFILE=61.3,65.4 D Q:VBECFLG
- .S VBEC01=VBECFILE,VBECRT=$$ROOT^DILFD(VBEC01,"",1)
- .S VBECDATA=$S(VBECFILE="61.3":"Antibody/Antigen",VBECFILE="65.4":"Transfusion Reaction",VBECFILE="66":"Blood Product",1:"Blood Supplier")
- .W !,"Checking the integrity of "_VBECDATA_" data.",!,"'*' indicates truncated data (65 chars max)."
- .;obtain the GUID. Only checking mapped data
- .S VBECGUID=""
- .F S VBECGUID=$O(^VBEC(6005,"AB",VBEC01,VBECGUID)) Q:VBECGUID="" D Q:VBECFLG=1
- ..S VBECDA=+$O(^VBEC(6005,"AB",VBEC01,VBECGUID,0)) Q:'VBECDA ;ien
- ..;
- ..;must have data on the node
- ..S VBECT0=$G(^VBEC(6005,VBECDA,0)) Q:VBECT0=""
- ..;
- ..S VBECIEN=+$P($P(VBECT0,U),"-",2) Q:'VBECIEN
- ..;
- ..;obtain .01 field value and identifier
- ..S VBECSTR=$$FILEIEN(VBECRT,VBECIEN)
- ..S VBECLNM=$P(VBECSTR,U),VBECLID=$P(VBECSTR,U,2)
- ..;
- ..;compare the checksums of the data between the parent files (61.3
- ..;& 65.4) against the mapped data in file 6005
- ..S VBECTNM=$P(VBECT0,U,2),VBECTID=$P(VBECT0,U,3)
- ..S VBECLTOT=$$CHECKSUM^VBECDCU2(VBECLNM)+$$CHECKSUM^VBECDCU2(VBECLID)
- ..S VBECTTOT=$$CHECKSUM^VBECDCU2(VBECTNM)+$$CHECKSUM^VBECDCU2(VBECTID)
- ..I VBECLTOT'=VBECTTOT S VBECFLG=1 D
- ...;
- ...;display the discrepancies to the user
- ...W !,"Legacy NAME: "_VBECLNM
- ...W !,"Mapped NAME: "_VBECTNM
- ...W !,"Legacy ID: "_$E(VBECLID,1,65)_$S($L(VBECLID)>65:"*",1:"")
- ...W !,"Mapped ID: "_$E(VBECTID,1,65)_$S($L(VBECTID)>65:"*",1:"")
- ...Q
- ..S CNT=CNT+1 W:'(CNT#100) "."
- ..Q
- .Q
- ;
- KILL ; kill and quit
- K VBEC01,VBECDA,VBECDATA,VBECFILE,VBECGUID,VBECL0,VBECLCX,VBECLID
- K VBECLNM,VBECLTOT,VBECRT,VBECT0,VBECTCX,VBECTTOT
- Q VBECFLG
- ;
- FILEIEN(VBECRT,VBECIEN) ; For records tracking the parent file and record ien,
- ; define the NAME and ID values here. Note ID values reside on
- ; different pieces for different files.
- ; Antibody/Antigen data resides in: ^LAB(61.3,
- ; Transfusion Reaction data resides in: ^LAB(65.4,
- ; input: VBECIEN-ien of the record in question
- ; VBECRT-file root of the data global
- ; Note: VBECFILE is of a global scope
- ; return: VBECSTR-delimited string: NAME^ID (optional)
- N VBECL0,VBECPCE S VBECL0=$G(@VBECRT@(VBECIEN,0)) Q:VBECL0="" ""
- ;
- ; VBECPCE is the SNOMED code for antibody/antigen data or the full name
- ; of our transfusion reaction.
- ; If data changes on the VistA side (name or required identifier value)
- ; the data conversion will not proceed.
- ;
- S VBECPCE=$S(VBECFILE=61.3:2,1:3) ;note origin of data
- Q $P(VBECL0,U)_"^"_$P(VBECL0,U,VBECPCE)
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVBECDCHX 5397 printed Jan 18, 2025@03:45:08 Page 2
- VBECDCHX ;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 $$ROOT^DILFD is supported by IA: 2055
- +15 ;
- +16 ; This routine is called from the main data conversion software
- +17 ; (VBECDC01). This routine checks if antigen/antibody, transfusion
- +18 ; reaction, blood product, or blood supplier data has been edited
- +19 ; or deleted from the legacy VistA Blood Bank files. I do not check
- +20 ; for added data to the legacy VistA Blood Bank files; other options
- +21 ; within the software exist for this purpose.
- +22 ;
- +23 ; input: no data input into this module
- +24 ; return: VBECFLG - 1 if a discrepancy exists, else 0
- +25 ; check the data, all of this is run real-time (no queuing)
- +26 ;
- +27 ; variable definitions:
- +28 ; CNT-counter, used to print '.' every 100 records
- +29 ; VBEC01-'file-ien' or 'file' data (.01 field on file 6005)
- +30 ; VBECDA-record ien file 6005
- +31 ; VBECDATA-antigen/antibody, trans. react., blood prod., blood supplier
- +32 ; VBECFILE-file number of legacy data
- +33 ; VBECFLG-indicates if data is valid across files/sub-file:
- +34 ; 61.3, 65.4, & 6005 (1 for no, 0 for yes)
- +35 ; VBECGUID-only checking data that has been mapped
- +36 ; VBECIEN-record ien (.01 field, file 6005 2nd piece delimited by '-')
- +37 ; (not applicable on blood supplier data)
- +38 ; VBECL0-legacy file (#s 61.3, or 65.4) zero node
- +39 ; VBECLCX-checksum for a data record, legacy file (#s 61.3 & 65.4)
- +40 ; VBECLID-identifier on legacy file
- +41 ; VBECLNM-name of record in legacy file
- +42 ; VBECLTOT-checksum value for legacy data (name and identifier)
- +43 ; VBECRT-legacy file data global. in all cases: ^LAB(File#
- +44 ; VBECSTR-temporary string data, holding variable
- +45 ; VBECT0-transitory file (# 6005) zero node
- +46 ; VBECTCX-checksum for a data record, transitory file (# 6005)
- +47 ; VBECTID-identifier on transitory file
- +48 ; VBECTNM-name of record in transitory file
- +49 ; VBECTTOT-checksum value for transitory data (name and identifier)
- +50 ;
- EN() ; Main entry point to check if mapped data remains consistent with
- +1 ; data from the parent (61.3 & 65.4) files. If not, do not
- +2 ; proceed with the data conversion (VBECDC01).
- +3 ;
- +4 ;assume successful test
- WRITE @IOF
- NEW CNT,VBECFLG
- SET (CNT,VBECFLG)=0
- +5 ;check the antigen/antibody data first
- +6 FOR VBECFILE=61.3,65.4
- Begin DoDot:1
- +7 SET VBEC01=VBECFILE
- SET VBECRT=$$ROOT^DILFD(VBEC01,"",1)
- +8 SET VBECDATA=$SELECT(VBECFILE="61.3":"Antibody/Antigen",VBECFILE="65.4":"Transfusion Reaction",VBECFILE="66":"Blood Product",1:"Blood Supplier")
- +9 WRITE !,"Checking the integrity of "_VBECDATA_" data.",!,"'*' indicates truncated data (65 chars max)."
- +10 ;obtain the GUID. Only checking mapped data
- +11 SET VBECGUID=""
- +12 FOR
- SET VBECGUID=$ORDER(^VBEC(6005,"AB",VBEC01,VBECGUID))
- if VBECGUID=""
- QUIT
- Begin DoDot:2
- +13 ;ien
- SET VBECDA=+$ORDER(^VBEC(6005,"AB",VBEC01,VBECGUID,0))
- if 'VBECDA
- QUIT
- +14 ;
- +15 ;must have data on the node
- +16 SET VBECT0=$GET(^VBEC(6005,VBECDA,0))
- if VBECT0=""
- QUIT
- +17 ;
- +18 SET VBECIEN=+$PIECE($PIECE(VBECT0,U),"-",2)
- if 'VBECIEN
- QUIT
- +19 ;
- +20 ;obtain .01 field value and identifier
- +21 SET VBECSTR=$$FILEIEN(VBECRT,VBECIEN)
- +22 SET VBECLNM=$PIECE(VBECSTR,U)
- SET VBECLID=$PIECE(VBECSTR,U,2)
- +23 ;
- +24 ;compare the checksums of the data between the parent files (61.3
- +25 ;& 65.4) against the mapped data in file 6005
- +26 SET VBECTNM=$PIECE(VBECT0,U,2)
- SET VBECTID=$PIECE(VBECT0,U,3)
- +27 SET VBECLTOT=$$CHECKSUM^VBECDCU2(VBECLNM)+$$CHECKSUM^VBECDCU2(VBECLID)
- +28 SET VBECTTOT=$$CHECKSUM^VBECDCU2(VBECTNM)+$$CHECKSUM^VBECDCU2(VBECTID)
- +29 IF VBECLTOT'=VBECTTOT
- SET VBECFLG=1
- Begin DoDot:3
- +30 ;
- +31 ;display the discrepancies to the user
- +32 WRITE !,"Legacy NAME: "_VBECLNM
- +33 WRITE !,"Mapped NAME: "_VBECTNM
- +34 WRITE !,"Legacy ID: "_$EXTRACT(VBECLID,1,65)_$SELECT($LENGTH(VBECLID)>65:"*",1:"")
- +35 WRITE !,"Mapped ID: "_$EXTRACT(VBECTID,1,65)_$SELECT($LENGTH(VBECTID)>65:"*",1:"")
- +36 QUIT
- End DoDot:3
- +37 SET CNT=CNT+1
- if '(CNT#100)
- WRITE "."
- +38 QUIT
- End DoDot:2
- if VBECFLG=1
- QUIT
- +39 QUIT
- End DoDot:1
- if VBECFLG
- QUIT
- +40 ;
- KILL ; kill and quit
- +1 KILL VBEC01,VBECDA,VBECDATA,VBECFILE,VBECGUID,VBECL0,VBECLCX,VBECLID
- +2 KILL VBECLNM,VBECLTOT,VBECRT,VBECT0,VBECTCX,VBECTTOT
- +3 QUIT VBECFLG
- +4 ;
- FILEIEN(VBECRT,VBECIEN) ; For records tracking the parent file and record ien,
- +1 ; define the NAME and ID values here. Note ID values reside on
- +2 ; different pieces for different files.
- +3 ; Antibody/Antigen data resides in: ^LAB(61.3,
- +4 ; Transfusion Reaction data resides in: ^LAB(65.4,
- +5 ; input: VBECIEN-ien of the record in question
- +6 ; VBECRT-file root of the data global
- +7 ; Note: VBECFILE is of a global scope
- +8 ; return: VBECSTR-delimited string: NAME^ID (optional)
- +9 NEW VBECL0,VBECPCE
- SET VBECL0=$GET(@VBECRT@(VBECIEN,0))
- if VBECL0=""
- QUIT ""
- +10 ;
- +11 ; VBECPCE is the SNOMED code for antibody/antigen data or the full name
- +12 ; of our transfusion reaction.
- +13 ; If data changes on the VistA side (name or required identifier value)
- +14 ; the data conversion will not proceed.
- +15 ;
- +16 ;note origin of data
- SET VBECPCE=$SELECT(VBECFILE=61.3:2,1:3)
- +17 QUIT $PIECE(VBECL0,U)_"^"_$PIECE(VBECL0,U,VBECPCE)
- +18 ;