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

VBECDCR.m

Go to the documentation of this file.
  1. VBECDCR ;hoifo/gjc-data conversion & pre-implementation reporting mechanism;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 $$NEWERR^%ZTER is supported by IA: 1621
  1. ;Call to $$S^%ZTLOAD is supported by IA: 10063
  1. ;Call to FILE^DID is supported by IA: 2052
  1. ;Call to $$EXTERNAL^DILFD is supported by IA: 2055
  1. ;Call to ^DIR is supported by IA: 10026
  1. ;Call to ^DIWP is supported by IA: 10011
  1. ;Call to $$DT^XLFDT is supported by IA: 10103
  1. ;Call to $$FMTE^XLFDT is supported by IA: 10103
  1. ;Call to $$CJ^XLFSTR is supported by IA: 10104
  1. ;Call to EN^XUTMDEVQ is supported by IA: 1519
  1. ;global read on ^DPT(DFN,0) for patient name supported by IA: 10035
  1. ;Execution of ^%ZOSF("TEST") is supported by IA: 10096
  1. ;
  1. EN ; entry point for anomaly report
  1. ;
  1. 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
  1. ;
  1. ; initialize the error trap
  1. I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^VBECDCU1"
  1. E S X="D ERR^VBECDCU1",@^%ZOSF("TRAP")
  1. ;
  1. ; check to see if anomaly data exists for the most recent record in the
  1. ; VBECS DATA INTEGRITY/CONVERSION STATISTICS (#6001) file.
  1. S VBECIEN=$O(^VBEC(6001,$C(32)),-1)
  1. I '$O(^VBEC(6001,VBECIEN,"ERR",0)) D Q
  1. .K VBECIEN
  1. .W !!?3,"There are no occurrences of VistA Blood Bank data anomalies on file to be",!?3,"displayed.",$C(7)
  1. .Q
  1. ;
  1. S VBECR="START^VBECDCR",VBECS("DUZ")="",VBECS("VBECIEN")=""
  1. S VBECZ="MQ",VBECD="VBECS data anomaly reporting process"
  1. D EN^XUTMDEVQ(VBECR,VBECD,.VBECS,,1)
  1. I +$G(ZTSK)>0 W !!,"Task Number: "_ZTSK,!
  1. K VBECIEN,VBECD,VBECR,VBECS,VBECZ,ZTSK
  1. Q
  1. ;
  1. START ; display the data
  1. ;
  1. ; VBEC(1)=process start timestamp (internal)
  1. ; VBEC(2)=process (internal)
  1. ; VBEC(3)=process finish timestamp (internal)
  1. ; VBEC(4)=user responsible for process (internal)
  1. ; VBECX(1)=process start timestamp (external)
  1. ; VBECX(2)=process (external)
  1. ; VBECX(3)=process finish timestamp (external)
  1. ; VBECX(4)=user responsible for process (external)
  1. ; VBEC1A(1)=file navigated (pointer)
  1. ; VBEC1A(2)=ien of record in file navigated
  1. ; VBEC1A(3)=file navigate to (pointer)
  1. ; VBEC1A(4)=ien of record in file navigated to
  1. ; VBEC1A(5)=lrdfn1 dup blood component/blood component id (same patient)
  1. ; VBEC1A(6)=lrdfn2 dup blood component/blood component id (diff patients)
  1. ; VBEC1A(7)=blood component (pointer)
  1. ; VBEC1A(8)=blood component id
  1. ; VBEC1A(9)=user readable data integrity issue
  1. ;
  1. S:$D(ZTQUEUED) ZTREQ="@" S PAGE=1,(VBEC1,VBECXIT,VBECSTOP)=0,U="^"
  1. S $P(LINE,"*",81)="",TODAY=$$FMTE^XLFDT($$DT^XLFDT(),1)
  1. S VBEC(0)=$G(^VBEC(6001,VBECIEN,0))
  1. F I=1:1:4 S VBEC(I)=$P(VBEC(0),U,I) ;internal
  1. F I=1:1:4 S VBECX(I)=$$EXTERNAL^DILFD(6001,".0"_I,"L",VBEC(I)) ;external
  1. D HDR ; header output
  1. F S VBEC1=$O(^VBEC(6001,VBECIEN,"ERR",VBEC1)) Q:'VBEC1 D Q:VBECXIT!(VBECSTOP)
  1. .I $$S^%ZTLOAD() S (ZTSTOP,VBECSTOP)=1 Q
  1. .S VBECERR(0)=$G(^VBEC(6001,VBECIEN,"ERR",VBEC1,0))
  1. .F I=1:1:9 S VBEC1A(I)=$P(VBECERR(0),U,I)
  1. .S ERRTOT(VBEC1A(1))=+$G(ERRTOT(VBEC1A(1)))+1
  1. .D FILE^DID(VBEC1A(1),"","NAME","VBECFR")
  1. .D:VBEC1A(3) FILE^DID(VBEC1A(3),"","NAME","VBECTO")
  1. .S VBECOMP=$$EXTERNAL^DILFD(6001.01,.07,"L",VBEC1A(7)) ; value or null
  1. .S X=VBEC1A(9),DIWL=1,DIWR=55,DIWF="" D ^DIWP ; format text...
  1. .W !,"File Navigated: "_VBECFR("NAME")_"("_VBEC1A(1)_")"
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT
  1. .W:VBEC1A(2) !,$$NAME(VBEC1A(1),VBEC1A(2))
  1. .W:VBEC1A(3) !,"File Navigated To: "_VBECTO("NAME")_"("_VBEC1A(3)_")"
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT
  1. .W:VBEC1A(4) !,$$NAME(VBEC1A(3),VBEC1A(4))
  1. .W:VBEC1A(5) !,"Similar Blood Component/Blood Component ID for Lab Data patient"
  1. .W $S((VBEC1A(5)&VBEC1A(6)):"s:",(VBEC1A(5)&'VBEC1A(6)):":",1:"")
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT
  1. .W:VBEC1A(5) !?3,"LRDFN (IEN in Lab Data file): "_VBEC1A(5)
  1. .W:VBEC1A(6) !?3,"LRDFN (conflicting patient IEN): "_VBEC1A(6)
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT
  1. .W:VBEC1A(7) !,"Blood Component: "_VBECOMP
  1. .W:VBEC1A(8)'="" !,"Blood Component ID: "_VBEC1A(8)
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT
  1. .W !,"Data Integrity Issue: " S A=0
  1. .I $Y>(IOSL-4) D EOS Q:VBECXIT W !
  1. .F S A=$O(^UTILITY($J,"W",DIWL,A)) Q:'A!(VBECXIT) D
  1. ..I $Y>(IOSL-4) D EOS Q:VBECXIT W !
  1. ..W ?22,$G(^UTILITY($J,"W",DIWL,A,0)),!
  1. ..Q
  1. .K A,DIW,DIWF,DIWI,DIWL,DIWR,DIWT,DIWTC,DIWX,DN,VBEC1A,VBECFR,VBECOMP,VBECTO,X,Z,^UTILITY($J,"W")
  1. .Q
  1. ;
  1. ERRTOT ; print error total for each file
  1. I $Y>(IOSL-6) D EOS Q:VBECXIT W !
  1. S I=0 F S I=$O(ERRTOT(I)) Q:'I W !,"Total number of anomalies for file "_I_": "_$G(ERRTOT(I))
  1. ;
  1. XIT ; cleanup after yourself before you go...
  1. K A,DIRUT,DIW,DIWF,DIWI,DIWL,DIWR,DIWT,DIWTC,DIWX,DN,DTOUT,DUOUT,ERRTOT,I,LINE,PAGE,TODAY,VBEC,VBEC1,VBEC1A,VBECERR,VBECFR,VBECOMP,VBECTO,VBECX,VBECXIT,X,Z,^UTILITY($J,"W"),VBECSTOP
  1. Q
  1. ;
  1. EOS ; end of screen check & refresh screen action
  1. I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR S VBECXIT=$S(Y'>0:1,1:0) K DIR,X,Y
  1. Q:VBECXIT
  1. HDR ; draw header
  1. W:($E(IOST)="C")!(PAGE>1) @IOF
  1. W !,$$CJ^XLFSTR("VistA Blood Bank Data Anomalies Report",80)
  1. W !,"Date: ",TODAY,?69,"Page: ",PAGE S PAGE=PAGE+1
  1. W !,"Process initiated by: "_$E(VBECX(4),1,25),?49,"Process: "_VBECX(2)
  1. W !,"Start time: "_VBECX(1),?49,"Finish time: "_VBECX(3),!,LINE
  1. Q
  1. ;
  1. NAME(FILE,IEN) ; Using file number and ien, determine the value of the .01
  1. ; field and pass it back (along with the data descriptor).
  1. ; input: FILE-file number, either 2, 63, 65, or 66
  1. ; IEN-internal entry number of the record in question
  1. ; output: (examples) Patient Name: Doe,John, Lab Data ID: 12345,
  1. ; Unit ID: ABC123, Blood Component: CPDA-1 RED BLOOD CELLS
  1. ;
  1. Q:FILE=2 "Patient Name: "_$P($G(^DPT(IEN,0)),U)_$S($P($G(^DPT(IEN,0)),U)]"":" ("_$E($P($G(^DPT(IEN,0)),U,9),1,3)_"-"_$E($P($G(^DPT(IEN,0)),U,9),4,5)_"-"_$E($P($G(^DPT(IEN,0)),U,9),6,9)_")",1:"")
  1. Q:FILE=63 "Lab Data ID: "_$P($G(^LR(IEN,0)),U)
  1. Q:FILE=65 "Unit ID: "_$P($G(^LRD(65,IEN,0)),U)
  1. Q:FILE=66 "Blood Component: "_$P($G(^LAB(66,IEN,0)),U)
  1. ;