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

BLRUTIL6.m

Go to the documentation of this file.
BLRUTIL6 ;IHS/MSC/MKK - MISC IHS LAB UTILITIES (Cont) ; 04-Apr-2016 14:28 ; MKK
 ;;5.2;IHS LABORATORY;**1033,1034,1035,1039**;NOV 01, 1997;Build 38
 ;
GETSTACK ; EP -- from BLRUTIL.
 NEW CONTXT,LOOP
 ;
 S CONTXT=$STACK(-1)
 F LOOP=0:1:CONTXT  D
 . S ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"$STACK",LOOP,1,"CONTEXT LEVEL")=LOOP
 . S ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"$STACK",LOOP,2,"CONTEXT TYPE")=$STACK(LOOP)
 . S ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"$STACK",LOOP,3,"CURRENT PLACE")=$STACK(LOOP,"PLACE")
 . S ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"$STACK",LOOP,4,"CURRENT SOURCE")=$STACK(LOOP,"MCODE")
 Q
 ;
DEBUGMI ; EP - from BLRUTIL.
 Q:+$G(LRAA)<1!(+$G(LRAD)<1)!(+$G(LRAN)<1)
 Q:$$GET1^DIQ(68,LRAA,"LR SUBSCRIPT")'["MICRO"
 ;
 S DMLRDFN=+$G(^LRO(68,LRAA,1,LRAD,1,LRAN,0)),DMLRIDT=$P($G(^(3)),"^",5)
 Q
 ;
MAKEITSO ; EP - Reset PROCESSING DATE variable
 NEW WOTRTN
 F  Q:$L($G(BLRQDH))=5  D
 . S BLRQDH=+$H           ; Try setting it again
 . I $L(BLRQDH)'=5 D      ; Still invalid
 .. D MAKETMPC(.WOTRTN)
 .. H 5                   ; Pause 5 seconds
 K ^TMP(WOTRTN,$J,"MAKEITSO")
 Q
 ;
MAKETMPC(WOTRTN) ; EP - Keep track of # of times tried to reset
 NEW BLRVERN,CONTEXT,FRMWHERE,MSGARRAY,STACKNUM
 ;
 D SETBLRVS("MAKETMPC")
 S FRMWHERE=BLRVERN
 ;
 ; Try to determine the calling routine's name
 S CONTEXT=$STACK(-1)
 F  Q:CONTEXT<1!(FRMWHERE'=BLRVERN)  D
 . S FRMWHERE=$STACK(CONTEXT,"PLACE")
 . S:FRMWHERE["^" FRMWHERE=$P(FRMWHERE,"^",2)
 . S FRMWHERE=$P(FRMWHERE," ")
 . S CONTEXT=CONTEXT-1
 ;
 S WOTRTN=FRMWHERE
 ;
 S ^TMP(FRMWHERE,$J,"MAKEITSO")=1+$G(^TMP(FRMWHERE,$J,"MAKEITSO"))
 S ^TMP(FRMWHERE,$J,"MAKEITSO",$H)=""
 ;
 Q:+$G(^TMP(FRMWHERE,$J,"MAKEITSO"))<5
 Q:+$O(^XTMP(FRMWHERE,"MAILSENT",+$H))   ; Skip if Mail already sent
 ;
 ; Tried to reset 5 Times, so send e-mail & Alert to LMI Mail Group
 S MSGARRAY(1)="LAB TO PCC LINKER ISSUE"
 S MSGARRAY(2)="     Cannot reset BLRQDH variable.  BLRQDH:"_BLRQDH_"."
 D MAILALMI^BLRUTIL3("LAB TO PCC LINKER ISSUE",.MSGARRAY,FRMWHERE,1)
 ;
 ; Store information about sending email
 S ^XTMP(FRMWHERE,0)=$$HTFM^XLFDT(+$H+90)_"^"_$$DT^XLFDT_"^RPMS Lab To PCC Linker Issue"
 S ^XTMP(FRMWHERE,"MAILSENT",$H)=BLRQDH
 ;
 Q
 ;
PASSMESG(WOT) ; EP -- Splash message
 NEW CRTLINE,MAXIT,AROUND
 ;
 S MAXIT="@"
 F J=1:1:$L(WOT) S MAXIT=MAXIT_$E(WOT,J,J)_"@"
 S AROUND=$TR($J("",8+$L(MAXIT))," ","@")
 S MAXIT="@@!!"_$TR(MAXIT," ","@")_"!!@@"
 ;
 D ^XBCLS
 W $TR($J("",IOM)," ","*"),!,$TR($J("",IOM)," ","*"),!
 W $TR($$CJ^XLFSTR(AROUND,IOM)," @","* "),!
 W $TR($$CJ^XLFSTR(MAXIT,IOM)," @","* "),!
 W $TR($$CJ^XLFSTR(AROUND,IOM)," @","* "),!
 W $TR($J("",IOM)," ","*"),!,$TR($J("",IOM)," ","*"),!
 Q
 ;
 ; Data in ARRAY(1)="First String"; ARRAY(2)="Second String"; etc.
UPDTCOML(LRDFN,LRSS,LRIDT,ARRAY,ERRORMSG) ; EP - Update the Comment line(s)
 NEW ANSWER,ASKORDQ,DIE,ERRCNT,ERRS,FDA,IENS,LRAS,MAILARRY,ORD,P60,P60DESC,P60BORDR,QUESCNT
 ;
 Q:$D(ARRAY)<1     ; Skip if nothing stored
 ;
 S (ERRCNT,LINE)=0
 F  S LINE=$O(ARRAY(LINE))  Q:LINE<1  D
 . Q:$L($G(ARRAY(LINE)))<1
 . D ADDCOMNT(LRDFN,LRSS,LRIDT,ARRAY(LINE),.ERRCNT)
 ;
 Q:ERRCNT<1
 ;
 ; There exist errors.  Send E-Mail via MailMan to user
 S LRAS=$P($G(^LR(LRDFN,LRSS,LRIDT,0)),"^",6)
 S MAILARRY(1)="Error Updating Accession "_LRAS,MAILARRY(2)=" "
 S MAILARRY(3)="     LRDFN:"_LRDFN
 S MAILARRY(4)="      LRSS:"_LRSS
 S MAILARRY(5)="     LRIDT:"_LRIDT
 S MAILARRY(6)="        $J:"_$J
 S MAILARRY(7)=" ",MAILARRY(8)="     SEE ^TMP(""BLRUTIL6"","_$J_",""ERRORS"")"
 ;
 D SENDMAIL^BLRUTIL3(ERRORMSG,MAILARRY,"UPDTCOML",1)
 ;
 Q
 ;
ADDCOMNT(LRDFN,LRSS,LRIDT,WOT,ERRCNT) ; EP - Add the comment
 NEW FDA,IENS,RJAMT
 ;
 S WOT=$$UP^XLFSTR($$HTE^XLFDT($H,"MPZ"))_": "_WOT
 ;
 S IENS(1)=$O(^LR(LRDFN,"CH",LRIDT,1,"B"),-1)+1  ; Get next COMMENT line
 ;
 S FDA(63.041,"+1,"_LRIDT_","_LRDFN_",",.01)=$TR(WOT,"^"," ")
 ;
 D UPDATE^DIE(,"FDA","IENS","ERRS")
 ;
 I $D(ERRS("DIERR"))>0  D
 . S ^TMP("BLRUTIL6",$J,"ERRORS",LRDFN,LRSS,LRIDT)=""
 . M ^TMP("BLRUTIL6",$J,"ERRORS",LRDFN,LRSS,LRIDT,"LINE")=WOT
 . M ^TMP("BLRUTIL6",$J,"ERRORS",LRDFN,LRSS,LRIDT,"ERRORS")=ERRS("DIERR")
 . S ERRCNT=ERRCNT+1
 Q
 ;
DUPDNAME ; EP - Find Instances of Duplicate DataNames
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 Q:$$DUPNAMEI()="Q"
 ;
 F  S DATADESC=$O(^DD(63.04,"B",DATADESC))  Q:DATADESC=""!(QFLG="Q")  D DUPNAMEL
 ;
 ; W !!,?4,"Number of Duplicate Datanames = ",CNT
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1034
 W !!,?4,DATANCNT," DataNames Analyzed."
 W !!,?9,$S(CNT:CNT,1:"No")," Duplicate DataName",$S(CNT=1:"",1:"s"),"."
 ; ----- END IHS/MSC/MKK - LR*5.2*1034
 ;
 D ^%ZISC
 ;
 D PRESSKEY^BLRGMENU(9)
 Q
 ;
DUPNAMEI() ; EP - Initialization
 D SETBLRVS("DUPDNAME")
 ;
 S HEADER(1)="Duplicate DataNames"
 S HEADER(2)="File 63.04"
 ;
 D HEADERDT^BLRGMENU
 D HEADONE^BLRGMENU(.HDRONE)
 ;
 S HEADER(3)=" "
 S $E(HEADER(4),10)="#"
 S $E(HEADER(4),20)="Description"
 S $E(HEADER(4),50)="Last Edit"
 S $E(HEADER(4),65)="F 60"
 ;
 D ^%ZIS
 I POP D  Q "Q"
 . W !,?4,"Invalid DEVICE call.  Routine Ends."
 . D PRESSKEY^BLRGMENU(9)
 ;
 U IO
 ;
 S (CNT,PG)=0
 S MAXLINES=(IOSL-4),LINES=MAXLINES+10
 S QFLG="NO"
 S DATADESC=""
 S DATANCNT=0 ; IHS/MSC/MKK - LR*5.2*1034
 Q "OK"
 ;
DUPNAMEL ; EP - Line of Data
 Q:$$DUPNAMEC(.DUPNAMEA)=0
 ;
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)  Q:QFLG="Q"
 ;
 S (CNTDN,DATANAME)=0
 F  S DATANAME=$O(DUPNAMEA(DATANAME))  Q:DATANAME<1!(QFLG="Q")  D
 . I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)  Q:QFLG="Q"
 . ;
 . S CNTDN=CNTDN+1
 . W $J(CNTDN,3)
 . W ?9,DATANAME
 . W ?19,$E(DATADESC,1,28)
 . S CREATEDT=$G(DUPNAMEA(DATANAME,"DT"))
 . W:$L(CREATEDT) ?49,$$FMTE^XLFDT(CREATEDT,"5DZ")
 . W ?65,$O(^LAB(60,"C","CH;"_DATANAME_";1",0))
 . W !
 . S LINES=LINES+1
 ;
 W !
 S LINES=LINES+1
 S CNT=CNT+1
 Q
 ;
DUPNAMEC(ARRAY) ; EP - Check on the DataName
 S DATANCNT=DATANCNT+1  ; IHS/MSC/MKK - LR*5.2*1034
 ;
 NEW DN,NUMDUPS
 ;
 K ARRAY
 ;
 S (DN,NUMDUPS)=0
 F  S DN=$O(^DD(63.04,"B",DATADESC,DN))  Q:DN<1  D
 . S NUMDUPS=NUMDUPS+1
 . S ARRAY(DN)=""
 . S ARRAY(DN,"DT")=$G(^DD(63.04,DN,"DT"))
 ;
 Q $S(NUMDUPS<2:1,1:0)
 ;
FINDSEXR ; EP - Find usage of SEX in Reference Ranges in File 60
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 Q:$$FINDSEXI()="Q"
 ;
 F  S F60IEN=$O(^LAB(60,F60IEN))  Q:F60IEN<1!(QFLG="Q")  D
 . S F60DESC=$$GET1^DIQ(60,F60IEN,"NAME")
 . S SITESPEC=0
 . F  S SITESPEC=$O(^LAB(60,F60IEN,1,SITESPEC))  Q:SITESPEC<1!(QFLG="Q")  D FINDSEXL
 ;
 W:CNT !!,?4,"Number of Tests with SEX in Reference Range = ",CNT,!
 ;
 D ^%ZISC
 ;
 D PRESSKEY^BLRGMENU(9)
 Q
 ;
FINDSEXI() ; EP - Initialization
 D SETBLRVS("FINDSEXR")
 ;
 S HEADER(1)="LABORATORY TEST (#60) FILE"
 S HEADER(2)="RANGES WITH 'SEX' USED IN MUMPS CODE"
 ;
 D HEADERDT^BLRGMENU
 D HEADONE^BLRGMENU(.HDRONE)
 ;
 S HEADER(3)=" "
 S HEADER(4)=$TR($$CJ^XLFSTR("@File@60@",26)," @","= ")
 S $E(HEADER(4),29)=$TR($$CJ^XLFSTR("@File@62@",26)," @","= ")
 S $E(HEADER(4),58)="Ref",$E(HEADER(4),62)="Ref"
 S $E(HEADER(4),66)="Cri",$E(HEADER(4),70)="Cri"
 S $E(HEADER(4),74)="Thr",$E(HEADER(4),78)="Thr"
 S HEADER(5)="IEN",$E(HEADER(5),10)="Description"
 S $E(HEADER(5),29)="IEN",$E(HEADER(5),39)="Description"
 S $E(HEADER(5),58)="Low",$E(HEADER(5),62)="Hi"
 S $E(HEADER(5),66)="Low",$E(HEADER(5),70)="Hi"
 S $E(HEADER(5),74)="Low",$E(HEADER(5),78)="Hi"
 ;
 D ^%ZIS
 I POP D  Q "Q"
 . W !,?4,"Device Issue.  Routine Ends."
 . D PRESSKEY^BLRGMENU(9)
 ;
 U IO
 ;
 S MAXLINES=(IOSL-4),LINES=MAXLINES+10
 S (CNT,F60IEN,PG)=0
 S QFLG="NO"
 Q "OK"
 ;
FINDSEXL ; EP - Line of Data
 S STR=$$UP^XLFSTR($G(^LAB(60,F60IEN,1,SITESPEC,0)))
 Q:STR'["SEX"
 ;
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)  Q:QFLG="Q"
 D FINDSEXB
 ;
 W F60IEN
 W ?9,$E(F60DESC,1,17)
 W ?28,SITESPTR
 W ?38,$E(SITESPN,1,17)
 W:REFLOW["SEX" ?58,"X"
 W:REFHIGH["SEX" ?62,"X"
 W:CRITLOW["SEX" ?66,"X"
 W:CRITHIGH["SEX" ?70,"X"
 W:THERLOW["SEX" ?74,"X"
 W:THERHIGH["SEX" ?78,"X"
 W !
 S CNT=CNT+1
 S LINES=LINES+1
 Q
 ;
FINDSEXB ; EP - Breakout Data
 S SITESPTR=+STR
 S SITESPN=$$GET1^DIQ(61,SITESPTR,"NAME")
 ;
 S REFLOW=$P(STR,"^",2)
 S REFHIGH=$P(STR,"^",3)
 S CRITLOW=$P(STR,"^",4)
 S CRITHIGH=$P(STR,"^",5)
 S THERLOW=$P(STR,"^",11)
 S THERHIGH=$P(STR,"^",12)
 Q
 ;
 ; See LRORDST routine regarding ^TMP("LRORDST") setup.
IHSCOLS ; EP - From LRWLST1.
 NEW DN,F60IEN,COLLSAMP,COLLSIEN,CSAMP1,CSAMP2,CSAMP3,STR,TMPCNT,TMPSPEC,TMPSAMP,TMPTEST
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1034
 NEW F69CSAMP
 ;
 S F69CSAMP=$$GET1^DIQ(69.01,LRSN_","_LRODT,"COLLECTION SAMPLE","I")
 I F69CSAMP D  Q
 . S FDA(LRI,68.05,"+1,"_LR6802,1)=F69CSAMP
 ; ----- END IHS/MSC/MKK - LR*5.2*1034
 ;
 S TMPSAMP=0  F  S TMPSAMP=$O(^TMP("LRORDST",$J,"LROT",TMPSAMP))  Q:TMPSAMP<1  D
 . S TMPSPEC=0  F  S TMPSPEC=$O(^TMP("LRORDST",$J,"LROT",TMPSAMP,TMPSPEC))  Q:TMPSPEC<1  D
 .. S TMPCNT=0  F  S TMPCNT=$O(^TMP("LRORDST",$J,"LROT",TMPSAMP,TMPSPEC,TMPCNT))  Q:TMPCNT<1  D
 ... S TMPTEST(+$G(^TMP("LRORDST",$J,"LROT",TMPSAMP,TMPSPEC,TMPCNT)))=TMPSAMP_"^"_TMPSPEC
 ;
 S F60IEN=+LRTSTS
 Q:F60IEN<1
 ;
 I $D(TMPTEST) D  Q:$L(LRSAMP)
 . S STR=$G(TMPTEST(F60IEN))
 . S LRSAMP=$P(STR,"^"),LRSPEC=$P(STR,"^",2)
 . S FDA(LRI,68.05,"+1,"_LR6802,1)=LRSAMP
 ;
 ; Reset LRSPEC variable
 S LRSPEC=+LRX
 S:LRSPEC<1 LRSPEC=-1
 ;
 S COLLSIEN=+$O(^LAB(60,F60IEN,3,0))
 S CSAMP1=+$$GET1^DIQ(60.03,COLLSIEN_","_F60IEN,.01,"I")   ; Collection Sample from File 60
 S CSAMP2=+$$GET1^DIQ(61,LRSPEC,4.1,"I")                   ; Collection Sample from File 61
 ;
 ; ---- BEGIN IHS/MSC/MKK - LR*5.2*1034
 I $L($P($G(LRZX),"^",3)),CSAMP2<1 S CSAMP2=$P(LRZX,"^",3)
 ;
 S COLLSAMP=$S(CSAMP2:CSAMP2,1:CSAMP1)
 ; ---- END IHS/MSC/MKK - LR*5.2*1034
 ;
 ; If null, set COLLSAMP variable from Collection Sample from File 60
 I $L($G(COLLSAMP))<1,CSAMP1 S COLLSAMP=CSAMP1
 ;
 Q:+$G(COLLSAMP)<1
 ;
 S FDA(LRI,68.05,"+1,"_LR6802,1)=COLLSAMP
 ;
 ; Force the Order file to have the value, if null
 S:$P(^LRO(69,LRODT,1,LRSN,0),"^",3)="" $P(^LRO(69,LRODT,1,LRSN,0),"^",3)=COLLSAMP
 ;
 ; Reset LRSAMP variable
 S LRSAMP=COLLSAMP
 Q
 ;
 ;
BADSTUFF(MSG) ; EP - 'Routine Ends' prompt
 W !!,?4,MSG," Routine Ends."
 D PRESSKEY^BLRGMENU(9)
 Q
 ;
BADSTUFQ(MSG) ; EP - Quits with "Q"
 D BADSTUFF(MSG)
 Q "Q"
 ;
BADSTUFN(MSG) ; EP - Quits with ""
 D BADSTUFF(MSG)
 Q ""
 ;
SETBLRVS(TWO) ; EP - Use the STACK to find the Routine and set the BLRVRN variable(S)
 K BLRVERN,BLRVERN2
 ;
 S BLRVERN=$P($P($T(+1),";")," ")
 S:$L($G(TWO)) BLRVERN2=$G(TWO)
 Q
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1034
STORDIAG(LRODT,LRSP,LROT,ICDSTR) ; EP - Store the Diagnosis code(s)
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,ICDSTR,LRODT,LRSP,LROT,XPARSYS,XQXFLG)
 ;
 Q:ICDSTR<1     ; Quit if no ICD code
 ;
 S F60PTR=+$$GET1^DIQ(69.03,LROT_","_LRSP_","_LRODT,.01,"I")
 Q:$$REFLABCK(F60PTR,LRODT,LRSP)<1      ; Do nothing if not a Ref Lab test
 ;
 S ORDERN=$$GET1^DIQ(69.01,LRSP_","_LRODT,9.5,"I")
 Q:ORDERN<1      ; Quit if no Order #
 ;
 S LRDFN=$$GET1^DIQ(69.01,LRSP_","_LRODT,.01,"I")
 S DFN=$$GET1^DIQ(63,LRDFN,.03,"I")
 ;
 S TORDIEN=LROT_","_LRSP_","_LRODT
 ;
 S X=$$ORD^BLRRLEDI(ORDERN,DFN)   ; Create entry in 9009026.3, if necessary
 ;
 S ORDIEN=$$FIND1^DIC(9009026.3,,,ORDERN)
 Q:ORDIEN<1   ; Quit if Order # NOT in 9009026.3
 ;
 ; Store ICD code(s) into DIAGNOSIS field
 D ADBLRRLO(LRODT,LRSP,LROT)
 Q
 ;
ADBLRRLO(LRODT,LRSP,LROT) ; EP - Add ICD(s) to 9009026.3
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LRSP,LROT,U,XPARSYS,XQXFLG)
 ;
 S IEN=LRSP_","_LRODT
 ;
 S F60PTR=+$$GET1^DIQ(69.03,LROT_","_IEN,.01,"I")
 Q:$$REFLABCK(F60PTR,LRODT,LRSP)<1      ; Do nothing if not a Ref Lab test
 ;
 S LRDFN=$$GET1^DIQ(69.01,IEN,.01,"I")
 S ORDERN=$$GET1^DIQ(69.01,IEN,9.5,"I")
 S DFN=$$GET1^DIQ(63,LRDFN,.03,"I")
 S X=$$ORD^BLRRLEDI(ORDERN,DFN)    ; Create entry in 9009026.3, if necessary
 ;
 S ORDIEN=$$FIND1^DIC(9009026.3,,,ORDERN)
 Q:ORDIEN<1      ; Quit if Order # NOT in 9009026.3
 ;
 S F60PTR=$$GET1^DIQ(69.03,LROT_","_IEN,.01,"I")
 S IEN=LROT_","_LRSP_","_LRODT
 ;
 S ICD=0
 F  S ICD=$O(^LRO(69,LRODT,1,LRSP,2,LROT,2,ICD))  Q:ICD<1  D
 . S ICDIEN=$$GET1^DIQ(69.05,ICD_","_IEN,.01,"I")
 . ; Skip if UNCODED DIAGNOSIS
 . Q:$$GET1^DIQ(80,ICDIEN,.01)=".9999"!($$GET1^DIQ(80,ICDIEN,.01)="ZZZ.999")
 . ;
 . K FDA,ERRS
 . S FDA(9009026.31,"?+1,"_ORDIEN_",",.01)=ICDIEN
 . S:$L(F60PTR) FDA(9009026.31,"?+1,"_ORDIEN_",",1)=F60PTR      ; IHS/MSC/MKK - LR*5.2*1034
 . D UPDATE^DIE(,"FDA",,"ERRS")
 Q
 ;
REFLABCK(F60PTR,LRODT,LRSP) ; EP - Return 1 if Test is a Reference Lab test, otherwise return 0 (zero)
 NEW ORDLINST,ORDLOC
 ;
 S ORDLOC=+$$GET1^DIQ(69.01,LRSP_","_LRODT,23,"I")    ; Ordering Location
 S ORDLINST=+$$GET1^DIQ(44,ORDLOC,3,"I")              ; Ord Loc's Institution
 ;
 Q $$REFLAB(ORDLINST,F60PTR)      ; IHS/MSC/MKK - LR*5.2*1035
 ;
REFLAB(INSTIEN,F60IEN) ; EP - If Test has been MAPPED, return 1 else return 0
 NEW REFLLABS
 ;
 S REFLLABS=+$$GET1^DIQ(9009029,INSTIEN,3001,"I")    ; Reference Lab
 Q:REFLLABS<1 0
 ;
 ; I +$$GET1^DIQ(9009029,INSTIEN,3022) Q $$F629MAP(F60IEN)   ; IHS/MSC/MKK - LR*5.2*1035 - If a LEDI setup, check its Mapped Tests in File 62.9
 I +$$GET1^DIQ(9009029,INSTIEN,3022,"I") Q $$F629MAP(F60IEN)   ; IHS/MSC/MKK - LR*5.2*1039 - If a LEDI setup, check its Mapped Tests in File 62.9 - Need Internal value of field 3022.
 ;
 Q $S(+$O(^BLRRL("ALP",F60IEN,REFLLABS,0)):1,1:0)     ; The "ALP" index must be valid for this to work.
 ; ----- END IHS/MSC/MKK - LR*5.2*1034
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1035
F629MAP(F60IEN) ; EP - Is test mapped in the LAB CONFIGURATION (#62.9) File? (1=YES,0=No)
 NEW IEN,MAPPED
 ;
 S (IEN,MAPPED)=0
 F  S IEN=$O(^LAHM(62.9,IEN))  Q:IEN<1!(MAPPED)  D
 . Q:$$GET1^DIQ(62.9,IEN,.04,"I")<1   ; Don't check if INACTIVE
 . S:+$O(^LAHM(62.9,IEN,60,"B",F60IEN,0)) MAPPED=IEN
 ;
 Q $S(MAPPED:1,1:0)
 ; ----- END IHS/MSC/MKK - LR*5.2*1035