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

BLRLINKP.m

Go to the documentation of this file.
  1. BLRLINKP ; IHS/DIR/FJE - VALIDATION OF VARIOUS V FILE FIELDS ; 22-Oct-2013 09:22 ; MKK
  1. ;;5.2;IHS LABORATORY;**1001,1015,1017,1018,1019,1021,1025,1033**;NOV 01, 1997
  1. ;
  1. ; The following is post-validation logic for the fields in the various
  1. ; V files 9000010.09 (^AUPNVLAB,^AUPNVMIC,^AUPNVBB, etc.). It is
  1. ; called by the linkage process and will be executed ONLY if the PCC
  1. ; process rejects the write to the V file (PCC error 1 or 2).
  1. ; The functionality of this procedure is to interpret the reason of
  1. ; the V file edit rejection and store the error reason in field 106
  1. ; of file 9009022.
  1. ; NOTE: Field 106 = PCC ERROR FLAG;
  1. ; File 9009022 = IHS LAB TRANSACTION FILE (the ^BLRTXLOG global)
  1. ;
  1. ;
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER ^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER ^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. S ALRCHKIP="",BLRLINK=1,BLRCHQ=0
  1. F T=1:1 S BLRTXT=$T(PARSE+T) S BLRSTR=$P(BLRTXT,";",3) Q:BLRSTR=""!(BLRCHQ) D BLDFLD I $D(APCDALVR(BLRNAME)) D:BLRSS1[BLRSS!(BLRSS1="")
  1. .S X=APCDALVR(BLRNAME)
  1. .I 'BLRQUIET D FLDSCHK Q:BLRCHQ
  1. .S BLRVSUB=$S(BLRVSUB'="":BLRVSUB,1:"TRANS")
  1. .D @BLRVSUB
  1. .I '$D(X) W:'BLRQUIET !,BLRLIT_" failed edit in V file" D
  1. ..S:BLRPCC="" BLRBUL=2,BLRPCC="Field "_BLRTLOG_" of file 9009022 is invalid"
  1. ;----- BEGIN IHS MODIFICATIONS LR*5.2*1019 IHS
  1. ; Determine if update to deleted or merged visit caused Error IFF Error Message blank
  1. D:BLRPCC="" BLRPCCVE
  1. ;----- END IHS MODIFICATIONS LR*5.2*1019 IHS
  1. ; generic reject message created when specific PCC rejection not determined
  1. S:BLRPCC="" BLRBUL=2,BLRPCC="Write to "_$P($G(^DIC(BLRVFILE,0)),U)_" file rejected"
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT ^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("EXIT ^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. K BLRTXT,BLRSTR,BLRNAME,BLRVFLD,BLRLIT,BLRTLOG,BLRROOT,BLRPMSG,BLRVPRV,BLRVSUB,BLRCHQ
  1. Q
  1. ;
  1. BLDFLD ; create BLR variables from BLRSTR
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER BLDFLD^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER BLDFLD^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. S BLRNAME=$P(BLRSTR,"|"),BLRVFLD=$P(BLRSTR,"|",2),BLRLIT=$P(BLRSTR,"|",3),BLRTLOG=$P(BLRSTR,"|",4),BLRROOT=$P(BLRSTR,"|",5),BLRVSUB=$P(BLRSTR,"|",6),BLRSS1=$P(BLRSTR,"|",7) S:BLRTLOG="" BLRTLOG=BLRLIT
  1. Q
  1. ;
  1. ;
  1. TRANS ; perform input transform found in file in DD for appropriate V file
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER TRANS^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER TRANS^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. Q:APCDALVR(BLRNAME)=""
  1. S (DIE,DIC)=BLRROOT,DIC(0)=""
  1. X $P(^DD(BLRVFILE,BLRVFLD,0),U,5,99) ;INPUT TRANSFORM
  1. Q
  1. ;
  1. VTEST ; validation on required TEST field
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER VTEST^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER VTEST^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. I APCDALVR(BLRNAME)="" D REQMSG K X Q
  1. S APCDALVR(BLRNAME)=$P(APCDALVR(BLRNAME),"`",2)
  1. I '$D(^LAB(60,APCDALVR(BLRNAME))) S BLRBUL=2,BLRPCC="Field "_BLRTLOG_" of file 9009022 not a valid test in file 60" K X
  1. Q
  1. ;
  1. VVSIT ; validation on required VISIT field
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER VVSIT^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER VVSIT^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. I APCDALVR(BLRNAME)="" D REQMSG K X Q
  1. I APCDALVR(BLRNAME)'?1N.N S BLRBUL=2,BLRPCC=BLRNAME_" needs to be all numeric" K X Q
  1. ; I '$D(^AUPNVSIT(APCDALVR(BLRNAME),0)) S BLRBUL=2,BLRPCC=BLRNAME_" not a valid visit" K X
  1. ; ----- BEGIN IHS/OIT/MKK -- LR*5.2*1025 -- Need a QUIT if this error exists
  1. I '$D(^AUPNVSIT(APCDALVR(BLRNAME),0)) S BLRBUL=2,BLRPCC=BLRNAME_" not a valid visit" K X Q
  1. ; ----- END IHS/OIT/MKK -- LR*5.2*1025 -- Need a QUIT if this error exists
  1. Q:'BLRVIEN
  1. S (DIE,DIC)=BLRROOT,DIC(0)=""
  1. X $P(^DD(BLRVFILE,BLRVFLD,0),U,5,99) ;INPUT TRANSFORM
  1. Q
  1. ;
  1. VANTIB ; validation on antibiotic field for Micro or
  1. ; antibody field for blood bank
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER VANTIB^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER VANTIB^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. Q:APCDALVR(BLRNAME)=""
  1. I $E(APCDALVR(BLRNAME))="`" S APCDALVR(BLRNAME)=$P(APCDALVR(BLRNAME),"`",2)
  1. I BLRSS="MI",'$D(^LAB(62.06,APCDALVR(BLRNAME))) S BLRBUL=2,BLRPCC="Field "_BLRTLOG_" of file 9009022 not a valid antibiotic IEN" K X Q
  1. I BLRSS="BB",'$D(^LAB(61.3,APCDALVR(BLRNAME))) S BLRBUL=2,BLRPCC="Field "_BLRTLOG_" of file 9009022 not a valid antibody IEN" K X
  1. Q
  1. ;
  1. VPROV ; validation of provider field
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER VPROV^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER VPROV^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. Q:$G(APCDALVR(BLRNAME))=""
  1. ; S BLRPMSG="Field "_BLRTLOG_" of file 9009022 not in Provider file"
  1. ;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. S BLRPMSG="Field "_BLRTLOG_" of file 9009022 not in NEW PERSON file"
  1. ;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. S BLRVPRV=BLROPRV
  1. I BLRVPRV="" S BLRBUL=2,BLRPCC=BLRPMSG K X Q
  1. I $G(BLR200CV)]"",'$D(^VA(200,BLRVPRV)) D Q ;cmi/maw 1/8/2002**1015**
  1. . S BLRBUL=2,BLRPCC=BLRPMSG K X ;cmi/maw 1/8/2002 **1015**
  1. ; I '$D(^DIC(6,BLRVPRV)) S BLRBUL=2,BLRPCC=BLRPMSG K X
  1. ;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. ; If the provider is in dictionary 200, it DOES NOT matter if the
  1. ; provider is not in dictionary 6.
  1. S BLRPMSG="Field "_BLRTLOG_" of file 9009022 not in PROVIDER file"
  1. I '$D(^DIC(6,BLRVPRV))&('$D(^VA(200,BLRVPRV))) S BLRBUL=2,BLRPCC=BLRPMSG K X
  1. ;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. Q
  1. ;
  1. ;no action taken at this time
  1. VNOACT ;
  1. Q
  1. FLDSCHK ;
  1. ; D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER FLDSCHK^BLRLINKP")
  1. D ENTRYAUD^BLRUTIL("ENTER FLDSCHK^BLRLINKP") ; IHS/OIT/MKK - LR*5.2*1033
  1. D CHK^DIE(BLRVFILE,BLRVFLD,"E",APCDALVR(BLRNAME),.BLRCHK)
  1. I BLRCHK="^" W !,APCDALVR(BLRNAME)_" value is invalid for field "_BLRLIT_" "_BLRVFLD_" in file "_BLRVFILE,! S BLRCHQ=1
  1. K BLRCHK
  1. Q
  1. ;
  1. PARSE ;;subscript name|field # for appropriate V file |literal desc|field # for file #9009022|global root|validation subroutine
  1. ;;APCDTLAB|.01|lab test|.06||VTEST|
  1. ;;APCDVSIT|.03|Visit IEN||^AUPNVSIT(|VVSIT|
  1. ;;APCDTRES|.04|result text|2001|||BB,CH
  1. ;;APCDTABN|.05|Normal flag|2002|||CH
  1. ;;APCDTANT|.05|antibiotic|1303||VANTIB|MI
  1. ;;APCDTANT|.05|antibody|1403||VANTIB|BB
  1. ;;APCDTACC|.06|Acc #|1202|||
  1. ;;APCDTRES|.07|blood bank test name|1402|||BB
  1. ;;APCDTCOL|.08|collection sample|1307|||MI ;IHS/DIR TUC/AAB 04/08/98
  1. ;;APCDTCMD|.09|complete date|1309|||MI ;IHS/DIR TUC/AAB 04/08/98
  1. ;;APCDTUNI|1101|units|2003|||
  1. ;;APCDTORD|1102|order number|1103||
  1. ;;APCDTSTE|1103|site/specimen|2004|^LAB(61,|
  1. ;;APCDTRFL|1104|reference low|2008||
  1. ;;APCDTRFH|1105|reference high|2009||
  1. ;;APCDTCOS|1110|lab test cost|108||
  1. ;;APCDTLNC|1113|loinc code|1310||VNOACT|| ;IHS/ITSC/TPF 07/01/03 ADD "||" **1017**
  1. ;;APCDTCLS|1114|collection sample|1307||VNOACT|| ;IHS/ITSC/TPF 07/01/03 ADD "||" **1017**
  1. ;;APCDTCDT|1201|date/time collected|1201||
  1. ;;APCDTPRV|1202|ordering provider ien|1104||VPROV
  1. ;;APCDTEPR|1204|encounter provider ien|113||VPROV
  1. ;;APCDTOPR|1210|outside provider name|1105 or 114||
  1. ;;APCDTRDT|1212|result date and time|1309||VNOACT|| ;IHS/ITSC/TPF 07/01/03 ADD "||" **1017**
  1. ;;APCDTLC1|1301|free text comment 1|3001||
  1. ;;APCDTLC2|1302|free text comment 2|3001||
  1. ;;APCDTLC3|1303|free text comment 3|3001||
  1. ;;APCDTCPS|1402|cpt string|201||
  1. ;
  1. Q
  1. REQMSG ;creation of required field message
  1. S BLRBUL=2,BLRPCC="Field "_BLRTLOG_" is required for PCC and cannot be null"
  1. Q
  1. ;
  1. ;----- BEGIN IHS MODIFICATIONS LR*5.2*1019 IHS
  1. ; This routine tries to determine if the error message should
  1. ; reflect an unsuccessful update to either a deleted PCC visit or
  1. ; a merged PCC visit or other non-reported incidents.
  1. BLRPCCVE ;
  1. ; Variables are being NEWed so as to make sure no interference
  1. ; occurs with other LAB routines.
  1. ;
  1. NEW PTPTR,ORDERDT,COLLDT,ACC,DFN
  1. NEW BLRVDELF,BLRVMERF,COLLDTF,IHSVXF,PCCVDMF,PCCVIS
  1. NEW IHSVXF
  1. ;
  1. Q:BLRLOGDA="" ; If no transaction #, quit
  1. ;
  1. S PTPTR=$P($G(^BLRTXLOG(BLRLOGDA,0)),"^",4) ; Patient Pointer Value
  1. S ORDERDT=$P($G(^BLRTXLOG(BLRLOGDA,11)),"^",1) ; Order Date/Time
  1. S COLLDT=$P($G(^BLRTXLOG(BLRLOGDA,12)),"^",1) ; Collection Date/Time
  1. S ACC=$P($G(^BLRTXLOG(BLRLOGDA,12)),"^",2) ; Accession Number
  1. S DFN=PTPTR_$P(ORDERDT,".",1) ; Pointer to PCC Visit
  1. ;
  1. ;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1021 - Wrong. It should never be reported.
  1. ; An issue that is not reported correctly.
  1. ; I COLLDT<ORDERDT D Q
  1. ; . S BLRPCC=""
  1. ; . S BLRPCC="Collection Date is LESS THAN Ordering Date."
  1. ; S BLRBUL=2
  1. ;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. ;
  1. I $G(DFN)="" Q ; If no PCC Visit pointer, quit
  1. ;
  1. ; Initialize variables
  1. S (BLRVDELF,BLRVMERF,COLLDTF,IHSVXF,PCCVDMF,PCCVIS)=""
  1. ;
  1. S IHSVXF=$O(^LRO(68.999999901,"B",DFN,IHSVXF)) ; PCC Visit X-Ref
  1. I IHSVXF="" D ; If can't find PCC Visit
  1. . S DFN=PTPTR_$P(COLLDT,".",1) ; use Collect Date to try
  1. . S IHSVXF=$O(^LRO(68.999999901,"B",DFN,IHSVXF)) ; to get PCC Visit #
  1. . I IHSVXF'="" S COLLDTF="*" ; If Coll Date, Set Flag
  1. ;
  1. I IHSVXF="" Q ; If still null, quit
  1. ;
  1. S PCCVIS=$P($G(^LRO(68.999999901,IHSVXF,0)),"^",2) ; PCC Visit #
  1. S BLRVDELF=$P($G(^AUPNVSIT(PCCVIS,0)),"^",11) ; Visit Del Flag
  1. I BLRVDELF'="" S PCCVDMF="D" ; Deleted
  1. S BLRVMERF=$P($G(^AUPNVSIT(PCCVIS,0)),"^",37) ; Merged to Visit #
  1. I BLRVMERF'="" S PCCVDMF="M" ; Merged
  1. ;
  1. ;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. ; The BLRPCC string could be over 60 characters in length,
  1. ; which is too long for the PCC ERROR FLAG field in the
  1. ; IHS LAB TRANSACTION LOG file. It has been changed.
  1. I PCCVDMF="M" D Q
  1. . S BLRPCC="PCC Visit "_PCCVIS
  1. . S BLRPCC=BLRPCC_" has been merged to "_BLRVMERF_"."
  1. . S BLRBUL=2
  1. ;
  1. I PCCVDMF="D" D
  1. . S BLRPCC="PCC Visit "_PCCVIS_" has been deleted."
  1. . S BLRBUL=2
  1. ;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1021
  1. ;
  1. Q
  1. ;----- END IHS MODIFICATIONS LR*5.2*1019 IHS