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

BLREXECU.m

Go to the documentation of this file.
BLREXECU ;IHS/ITSC/TPF - IHS EXECUTE CODES ; 22-Oct-2013 09:22 ; MKK
 ;;5.2;LR;**1016,1017,1018,1022,1033**;NOV 01, 1997
 ;;
GETDNAM(NAME) ;
 S DNAME=$O(^DD(63.04,"B",NAME,0))
 Q:DNAME="" "NULL"
 Q DNAME
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1033
GETDNAMT(NAME) ; EP - Get DataName from File 60 Test
 NEW F60IEN
 S F60IEN=+$$FIND1^DIC(60,,,NAME)
 Q:F60IEN<1 "NULL"
 ;
 S DNAME=+$$GET1^DIQ(60,F60IEN_",",400,"I")
 ;
 Q $S(DNAME:DNAME,1:"NULL")
 ; ----- END IHS/MSC/MKK - LR*5.2*1033
 ;
 ;GET RACE OF PATIENT; DEFINED AS BLACK OR NON-BLACK PER DR. NARVA'S
 ;APPLICATION OF THE GFR CALCULATION
RACE(DFN) ;
 S RACEPTR=$P($G(^DPT(DFN,0)),U,6)
 Q:RACEPTR="" "N"  ;IF NO ENTRY CONSIDER NON-BLACK PER DR. NARVA
 S RACEENT=$P($G(^DIC(10,RACEPTR,0)),U)
 Q:RACEENT[("BLACK") "B"  ;IF NAME FIELD  CONTAINS BLACK RACE= BLACK
 Q "N"  ;OTHERWISE NON-BLACK
GFRDEL(CRET) ;
 ;NOW THAT WE HAVE A CREATININE RESULT CHECK VARIABLES NEEDED FOR GFR
 ;CALCULATION
 Q:$G(CRET)="" ""
 N BLRERR
 S BLRERR="N/A"
 ;FOLLOWING LINE ADDED TO HANDLE CANCELS ETC IHS/ITSC/TPF 7/1/03 **1017*
 I $G(CRET)?1A.A S %X=BLRERR Q %X
 ;FOLLOWING LINE ADDED TO HANDLE ERRORS SENT BY SOME INSTRUMENTS
 ;FOR INSTANCE "#########" AS OUT OF RANGE
 I $E($G(CRET))="#" S %X=BLRERR Q %X
 I $E($G(CRET))="<" S %X=BLRERR Q %X  ;IHS/ITSC/TPF 02/23/2004 ADDED FOR VTROS RESULTS WITH "<" AND "<" INCLUDED
 I $E($G(CRET))="-" S %X=BLRERR Q %X  ;IHS/ITSC/MKK 11/18/2004 ADDED FOR NEGATIVE RESULTS
 I +$G(CRET)=0 S %X=BLRERR Q %X  ;IHS/ITSC/MKK 11/18/2004 ADDED FOR ZERO RESULTS
 I AGE["DYS"!(AGE["MOS") S %X=BLRERR Q %X
 I AGE<17 S %X=BLRERR Q %X  ;16 AND YOUNGER NOT DONE
 I SEX="" S %X=BLRERR Q %X  ;CANNOT CALCULATE WITHOUT SEX
 ;
 ;CONSTANTS, EXPONENTS
 S SEXFACTR=$S(SEX="M":1,1:.742)             ;SEX FACTOR
 ;
 ; S RACEFACT=$S($$RACE(DFN)="B":1.21,1:1)     ;RACE FACTOR
 ; ----- BEGIN IHS/OIT/MKK - Modifications -- 1022
 ; NOTE: the DFN is the Patient Pointer from the ^LR global
 ;
 ; If DFN is NOT null, then calculate Race Factor
 I $G(DFN)'="" S RACEFACT=$S($$RACE(DFN)="B":1.21,1:1)     ;RACE FACTOR
 ;
 ; If DFN IS null, try to set temporary variable to Patient Pointer
 ; using LRDFN.  If it can be set, then use that to caculate the
 ; Race Factor.
 NEW TMPVAR
 I $G(DFN)="" D
 . I $G(LRDFN)'="" S TMPVAR=$P($G(^LR(LRDFN,0)),"^",3)
 . I $G(TMPVAR)'="" S RACEFACT=$S($$RACE(TMPVAR)="B":1.21,1:1)     ;RACE FACTOR
 ;
 ; If RACEFACT still not set, default is Non-Black, per Dr. Narva
 I $G(RACEFACT)="" S RACEFACT=1
 ; ----- END IHS/OIT/MKK - Modifications -- 1022
 ; 
 S CONSTA=186       ;CONSTANT A
 S CRETEXP=-1.154   ;CREATININE EXPONENT
 S AGEEXP=-.203     ;AGE EXPONENT
 ;
 ;
 ;FORMULA BELOW IS ON PAGE 10 OF WEB PAGE
 ;HTTP://WWW.KIDNEY.ORG/PROFESSIONALS/DOQI/KDOQI/P5_LAB_G4.HTM
 ;AND IS REFERENCED BY DR. NARVA IN HIS CORRSPONDENCE
 S %X=CONSTA*(CRET**CRETEXP)*(AGE**AGEEXP)*$G(SEXFACTR)*$G(RACEFACT)
 ;
 S %X=$TR($FN(%X,"",0)," ")          ;ROUND RESULT
 ;
 ; ----- BEGIN IHS/OIT/MKK - Modifications -- 1022
 ; Change requested by Lab PSG
 ; See www.nkdep.nih.gov/resources/laboratory_reporting.htm
 I %X>60 S %X=">60"
 ; ----- END IHS/OIT/MKK - Modifications -- 1022
 ;
 Q %X