LARAPMT ; IHS/DIR/FJE - RAPIMAT URINE PAD ROUTINE 7/20/90 10:04 ;
;;5.2;LA;;NOV 01, 1997
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
LA1 S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1
Q:'$D(^LA(TSK,"I",0))
S MISCREEN="MICROSCOPIC EXAMINATION NOT INDICATED"
K LATOP D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP") S:'$D(LALCT) LALCT="" Q:LALCT="N"
LA2 K TV,TY,Y,MICFLAG S TOUT=0,A=1,RMK="" D IN G QUIT:TOUT D QC
S (TOUT,BAD)=0
S V=+$E(IN,2,11) D NUM S (ID,IDE,CUP)=V,TRAY=1
F A=2:1 D IN Q:+$E(IN,2,11)'=CUP D QC
X S ^LA(TSK,"I",0)=CNT-1 F A=0:0 S A=$O(Y(A)) Q:A<1!(A>80) S X=Y(A) X TC(A,2) S:$D(V) @TC(A,1)=V
LA3 X LAGEN G LA2:'ISQN
F I=0:0 S I=$O(TV(I)) Q:I<1 S:TV(I,1)]"" ^LAH(LWL,1,ISQN,I)=TV(I,1)
I $D(MICFLAG)=0 S RMK=MISCREEN
I $D(RMK),$L(RMK) D RMK^LASET
G LA2
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
S V=$E(IN,33,34) D NUM S TN=V,V=$E(IN,41,55) D NUM,RNUM S Y(TN)=V Q
;S Y(A)=IN Q
NUM S X="" F JJ=1:1:$L(V) S:$A(V,JJ)>32 X=X_$E(V,JJ)
S V=X Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1,IN="" Q:TOUT>9 H 5 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0 G IN:$E(IN,1)'="D" G IN:+$E(IN,2,11)<1
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP("LA",$J)
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
RNUM ;PUT TOGETHER EXPONENT AND VALUE OF TEST DCN/BUF 31 AUG 87
I $P(V,"E",2)=0 Q
S EXP=$P(V,"E",2),FACTOR=$S(EXP="01":10,EXP="02":100,EXP="03":1000,EXP="-01":.1,EXP="-02":.01,1:1)
S V=V*FACTOR Q
COLOR ;THIS AREA SETS THE VALUES FOR URINE COLOR
S V=$S(X=1:"COLORLESS",X=2:"STRAW",X=3:"YELLOW",X=4:"AMBER",X=5:"BROWN",X=6:"ORANGE",X=7:"RED",X=8:"BLUE",X=9:"BLACK",X=10:"OTHER",1:"") Q
APPEAR ;THIS AREA SETS THE VALUE FOR URINE APPEARANCE
S V=$S(X=1:"CLEAR",X=2:"HAZY",X=3:"SL. CLOUDY",X=4:"CLOUDY",X=5:"TURBID",X=6:"FLOCCULATED",X=7:"MILKY",X=8:"MUCOID",X=9:"OTHER",1:"") S:V'="CLEAR" MICFLAG=1 Q
MICRO ;THIS SECTION IS USED TO DETERMINE MICROSCOPIC VALUES
S V=$S(X=0:"",X=9:"NONE",X=10:"1+",X=11:"2+",X=12:"3+",X=13:"4+",X<9:"RANGE",1:"")
I A=17 S V=$S(X=1:"0-2",X=2:"3-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
I A=18 S V=$S(X=1:"0-5",X=2:"6-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
I A=19 S V=$S(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")
I (A>30)&(A<55) S V=$S(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")
LARAPMT ; IHS/DIR/FJE - RAPIMAT URINE PAD ROUTINE 7/20/90 10:04 ;
+1 ;;5.2;LA;;NOV 01, 1997
+2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
LA1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
IF TSK<1
QUIT
+1 IF '$DATA(^LA(TSK,"I",0))
QUIT
+2 SET MISCREEN="MICROSCOPIC EXAMINATION NOT INDICATED"
+3 KILL LATOP
DO ^LASET
IF 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
IF '$DATA(LALCT)
SET LALCT=""
IF LALCT="N"
QUIT
LA2 KILL TV,TY,Y,MICFLAG
SET TOUT=0
SET A=1
SET RMK=""
DO IN
IF TOUT
GOTO QUIT
DO QC
+1 SET (TOUT,BAD)=0
+2 SET V=+$EXTRACT(IN,2,11)
DO NUM
SET (ID,IDE,CUP)=V
SET TRAY=1
+3 FOR A=2:1
DO IN
IF +$EXTRACT(IN,2,11)'=CUP
QUIT
DO QC
X SET ^LA(TSK,"I",0)=CNT-1
FOR A=0:0
SET A=$ORDER(Y(A))
IF A<1!(A>80)
QUIT
SET X=Y(A)
XECUTE TC(A,2)
IF $DATA(V)
SET @TC(A,1)=V
LA3 XECUTE LAGEN
IF 'ISQN
GOTO LA2
+1 FOR I=0:0
SET I=$ORDER(TV(I))
IF I<1
QUIT
IF TV(I,1)]""
SET ^LAH(LWL,1,ISQN,I)=TV(I,1)
+2 IF $DATA(MICFLAG)=0
SET RMK=MISCREEN
+3 IF $DATA(RMK)
IF $LENGTH(RMK)
DO RMK^LASET
+4 GOTO LA2
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
+1 SET V=$EXTRACT(IN,33,34)
DO NUM
SET TN=V
SET V=$EXTRACT(IN,41,55)
DO NUM
DO RNUM
SET Y(TN)=V
QUIT
+2 ;S Y(A)=IN Q
NUM SET X=""
FOR JJ=1:1:$LENGTH(V)
IF $ASCII(V,JJ)>32
SET X=X_$EXTRACT(V,JJ)
+1 SET V=X
QUIT
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
SET TOUT=TOUT+1
SET IN=""
IF TOUT>9
QUIT
HANG 5
GOTO IN
+1 SET ^LA(TSK,"I",0)=CNT
SET IN=^(CNT)
SET TOUT=0
IF $EXTRACT(IN,1)'="D"
GOTO IN
IF +$EXTRACT(IN,2,11)<1
GOTO IN
+2 QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK),^TMP("LA",$JOB)
+1 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)
RNUM ;PUT TOGETHER EXPONENT AND VALUE OF TEST DCN/BUF 31 AUG 87
+1 IF $PIECE(V,"E",2)=0
QUIT
+2 SET EXP=$PIECE(V,"E",2)
SET FACTOR=$SELECT(EXP="01":10,EXP="02":100,EXP="03":1000,EXP="-01":.1,EXP="-02":.01,1:1)
+3 SET V=V*FACTOR
QUIT
COLOR ;THIS AREA SETS THE VALUES FOR URINE COLOR
+1 SET V=$SELECT(X=1:"COLORLESS",X=2:"STRAW",X=3:"YELLOW",X=4:"AMBER",X=5:"BROWN",X=6:"ORANGE",X=7:"RED",X=8:"BLUE",X=9:"BLACK",X=10:"OTHER",1:"")
QUIT
APPEAR ;THIS AREA SETS THE VALUE FOR URINE APPEARANCE
+1 SET V=$SELECT(X=1:"CLEAR",X=2:"HAZY",X=3:"SL. CLOUDY",X=4:"CLOUDY",X=5:"TURBID",X=6:"FLOCCULATED",X=7:"MILKY",X=8:"MUCOID",X=9:"OTHER",1:"")
IF V'="CLEAR"
SET MICFLAG=1
QUIT
MICRO ;THIS SECTION IS USED TO DETERMINE MICROSCOPIC VALUES
+1 SET V=$SELECT(X=0:"",X=9:"NONE",X=10:"1+",X=11:"2+",X=12:"3+",X=13:"4+",X<9:"RANGE",1:"")
+2 IF A=17
SET V=$SELECT(X=1:"0-2",X=2:"3-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
+3 IF A=18
SET V=$SELECT(X=1:"0-5",X=2:"6-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
+4 IF A=19
SET V=$SELECT(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")
+5 IF (A>30)&(A<55)
SET V=$SELECT(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")