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

VBECDCHX.m

Go to the documentation of this file.
  1. VBECDCHX ;hoifo/gjc-data conversion & pre-implementation;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 $$ROOT^DILFD is supported by IA: 2055
  1. ;
  1. ; This routine is called from the main data conversion software
  1. ; (VBECDC01). This routine checks if antigen/antibody, transfusion
  1. ; reaction, blood product, or blood supplier data has been edited
  1. ; or deleted from the legacy VistA Blood Bank files. I do not check
  1. ; for added data to the legacy VistA Blood Bank files; other options
  1. ; within the software exist for this purpose.
  1. ;
  1. ; input: no data input into this module
  1. ; return: VBECFLG - 1 if a discrepancy exists, else 0
  1. ; check the data, all of this is run real-time (no queuing)
  1. ;
  1. ; variable definitions:
  1. ; CNT-counter, used to print '.' every 100 records
  1. ; VBEC01-'file-ien' or 'file' data (.01 field on file 6005)
  1. ; VBECDA-record ien file 6005
  1. ; VBECDATA-antigen/antibody, trans. react., blood prod., blood supplier
  1. ; VBECFILE-file number of legacy data
  1. ; VBECFLG-indicates if data is valid across files/sub-file:
  1. ; 61.3, 65.4, & 6005 (1 for no, 0 for yes)
  1. ; VBECGUID-only checking data that has been mapped
  1. ; VBECIEN-record ien (.01 field, file 6005 2nd piece delimited by '-')
  1. ; (not applicable on blood supplier data)
  1. ; VBECL0-legacy file (#s 61.3, or 65.4) zero node
  1. ; VBECLCX-checksum for a data record, legacy file (#s 61.3 & 65.4)
  1. ; VBECLID-identifier on legacy file
  1. ; VBECLNM-name of record in legacy file
  1. ; VBECLTOT-checksum value for legacy data (name and identifier)
  1. ; VBECRT-legacy file data global. in all cases: ^LAB(File#
  1. ; VBECSTR-temporary string data, holding variable
  1. ; VBECT0-transitory file (# 6005) zero node
  1. ; VBECTCX-checksum for a data record, transitory file (# 6005)
  1. ; VBECTID-identifier on transitory file
  1. ; VBECTNM-name of record in transitory file
  1. ; VBECTTOT-checksum value for transitory data (name and identifier)
  1. ;
  1. 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
  1. ; proceed with the data conversion (VBECDC01).
  1. ;
  1. W @IOF N CNT,VBECFLG S (CNT,VBECFLG)=0 ;assume successful test
  1. ;check the antigen/antibody data first
  1. F VBECFILE=61.3,65.4 D Q:VBECFLG
  1. .S VBEC01=VBECFILE,VBECRT=$$ROOT^DILFD(VBEC01,"",1)
  1. .S VBECDATA=$S(VBECFILE="61.3":"Antibody/Antigen",VBECFILE="65.4":"Transfusion Reaction",VBECFILE="66":"Blood Product",1:"Blood Supplier")
  1. .W !,"Checking the integrity of "_VBECDATA_" data.",!,"'*' indicates truncated data (65 chars max)."
  1. .;obtain the GUID. Only checking mapped data
  1. .S VBECGUID=""
  1. .F S VBECGUID=$O(^VBEC(6005,"AB",VBEC01,VBECGUID)) Q:VBECGUID="" D Q:VBECFLG=1
  1. ..S VBECDA=+$O(^VBEC(6005,"AB",VBEC01,VBECGUID,0)) Q:'VBECDA ;ien
  1. ..;
  1. ..;must have data on the node
  1. ..S VBECT0=$G(^VBEC(6005,VBECDA,0)) Q:VBECT0=""
  1. ..;
  1. ..S VBECIEN=+$P($P(VBECT0,U),"-",2) Q:'VBECIEN
  1. ..;
  1. ..;obtain .01 field value and identifier
  1. ..S VBECSTR=$$FILEIEN(VBECRT,VBECIEN)
  1. ..S VBECLNM=$P(VBECSTR,U),VBECLID=$P(VBECSTR,U,2)
  1. ..;
  1. ..;compare the checksums of the data between the parent files (61.3
  1. ..;& 65.4) against the mapped data in file 6005
  1. ..S VBECTNM=$P(VBECT0,U,2),VBECTID=$P(VBECT0,U,3)
  1. ..S VBECLTOT=$$CHECKSUM^VBECDCU2(VBECLNM)+$$CHECKSUM^VBECDCU2(VBECLID)
  1. ..S VBECTTOT=$$CHECKSUM^VBECDCU2(VBECTNM)+$$CHECKSUM^VBECDCU2(VBECTID)
  1. ..I VBECLTOT'=VBECTTOT S VBECFLG=1 D
  1. ...;
  1. ...;display the discrepancies to the user
  1. ...W !,"Legacy NAME: "_VBECLNM
  1. ...W !,"Mapped NAME: "_VBECTNM
  1. ...W !,"Legacy ID: "_$E(VBECLID,1,65)_$S($L(VBECLID)>65:"*",1:"")
  1. ...W !,"Mapped ID: "_$E(VBECTID,1,65)_$S($L(VBECTID)>65:"*",1:"")
  1. ...Q
  1. ..S CNT=CNT+1 W:'(CNT#100) "."
  1. ..Q
  1. .Q
  1. ;
  1. KILL ; kill and quit
  1. K VBEC01,VBECDA,VBECDATA,VBECFILE,VBECGUID,VBECL0,VBECLCX,VBECLID
  1. K VBECLNM,VBECLTOT,VBECRT,VBECT0,VBECTCX,VBECTTOT
  1. Q VBECFLG
  1. ;
  1. 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
  1. ; different pieces for different files.
  1. ; Antibody/Antigen data resides in: ^LAB(61.3,
  1. ; Transfusion Reaction data resides in: ^LAB(65.4,
  1. ; input: VBECIEN-ien of the record in question
  1. ; VBECRT-file root of the data global
  1. ; Note: VBECFILE is of a global scope
  1. ; return: VBECSTR-delimited string: NAME^ID (optional)
  1. N VBECL0,VBECPCE S VBECL0=$G(@VBECRT@(VBECIEN,0)) Q:VBECL0="" ""
  1. ;
  1. ; VBECPCE is the SNOMED code for antibody/antigen data or the full name
  1. ; of our transfusion reaction.
  1. ; If data changes on the VistA side (name or required identifier value)
  1. ; the data conversion will not proceed.
  1. ;
  1. S VBECPCE=$S(VBECFILE=61.3:2,1:3) ;note origin of data
  1. Q $P(VBECL0,U)_"^"_$P(VBECL0,U,VBECPCE)
  1. ;