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

LRMITSPO.m

Go to the documentation of this file.
  1. LRMITSPO ;DALOI/STAFF - MICRO TREND PROCESS ORGANISMS ;Dec 20, 2008
  1. ;;5.2;LAB SERVICE;**96,116,350**;Sep 27, 1994;Build 230
  1. ;
  1. ; from LRMITSPE
  1. ;
  1. ; bacteria
  1. I $D(LROTYPE("B")),+$G(^LR(LRDFN,"MI",LRIDT,1)),$O(^(3,0)) D
  1. . S LROTYPE="B",LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,3,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D
  1. . . ; if specific organisms required and not valid quit
  1. . . I $D(LRSORG),'$D(LRSORG(LROTYPE,LRORGN)) Q
  1. . . S LRORGNM=$E($P($G(^LAB(61.2,+LRORGN,0)),U),1,30)
  1. . . I LRORGNM="" S LRORGNM=LRUNK
  1. . . ; if antibiotic pattern required and not valid quit
  1. . . I $D(LRAP) D Q:'LROK
  1. . . . S LROK=1,LRDN=0
  1. . . . F S LRDN=$O(LRAP(LRDN)) Q:LRDN="" S LRX=$G(^LR(LRDFN,"MI",LRIDT,3,LRSUBN,LRDN)) D Q:'LROK
  1. . . . . S LRX=$$SENS(LRDN,LRX)
  1. . . . . I LRX="" S LROK=0 Q
  1. . . . . I LRX'=LRAP(LRDN) S LROK=0
  1. . . K LRANTIM
  1. . . S LRDN=2
  1. . . F S LRDN=$O(^LR(LRDFN,"MI",LRIDT,3,LRSUBN,LRDN)) Q:LRDN<2!(LRDN=3) S LRX=$G(^(LRDN)) I LRX'="" D
  1. . . . S LRINTERP=$$SENS(LRDN,LRX)
  1. . . . I LRINTERP'="" S LRANTIM(LRDN)=LRINTERP_U_LRX
  1. . . S LRORGNM="("_LROTYPE_") "_LRORGNM
  1. . . D ^LRMITSPS
  1. K LRANTIM
  1. ;
  1. ; fungus
  1. I $D(LROTYPE("F")),+$G(^LR(LRDFN,"MI",LRIDT,8)),$O(^(9,0)) D
  1. . S LROTYPE="F",LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,9,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D SETUP
  1. ;
  1. ; mycobacteria
  1. I $D(LROTYPE("M")),+$G(^LR(LRDFN,"MI",LRIDT,11)),$O(^(12,0)) D
  1. . S LROTYPE="M",LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,12,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D
  1. . . K LRTB
  1. . . S LRDN=2
  1. . . F S LRDN=$O(^LR(LRDFN,"MI",LRIDT,12,LRSUBN,LRDN)) Q:LRDN="" S LRTB(LRDN)=$P(^(LRDN),U)
  1. . . D SETUP
  1. K LRTB
  1. ;
  1. ; parasite
  1. I $D(LROTYPE("P")),+$G(^LR(LRDFN,"MI",LRIDT,5)),$O(^(6,0)) D
  1. . S LROTYPE="P",LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,6,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D SETUP
  1. ;
  1. ; virus
  1. I $D(LROTYPE("V")),+$G(^LR(LRDFN,"MI",LRIDT,16)),$O(^(17,0)) D
  1. . S LROTYPE="V",LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,17,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D SETUP
  1. ;
  1. ; Expanded Search
  1. I '$D(LROTYPE("B")),+$G(^LR(LRDFN,"MI",LRIDT,0)),$O(^(3,0)) D
  1. . S LROTYPE=$S($D(LROTYPE("V")):"V",$D(LROTYPE("P")):"P",$D(LROTYPE("F")):"F",$D(LROTYPE("M")):"M",1:"")
  1. . Q:LROTYPE=""
  1. . S LRSUBN=0
  1. . F S LRSUBN=$O(^LR(LRDFN,"MI",LRIDT,3,LRSUBN)) Q:LRSUBN<1 S LRORGN=+^(LRSUBN,0) D:LROTYPE=$P(^LAB(61.2,+LRORGN,0),U,5) SETUP
  1. Q
  1. ;
  1. ;
  1. SETUP ; if specific organisms are required, do not setup unless valid organism
  1. I $D(LRSORG),'$D(LRSORG(LROTYPE,LRORGN)) Q
  1. S LRORGNM=$E($P($G(^LAB(61.2,+LRORGN,0)),U),1,30) I LRORGNM="" S LRORGNM=LRUNK
  1. S LRORGNM="("_LROTYPE_") "_LRORGNM
  1. ; setup data on isolate
  1. D ^LRMITSPS
  1. Q
  1. ;
  1. ;
  1. SENS(DRUGNODE,VALUES) ; $$(antibiotic,susceptibility) -> "S","R" or ""
  1. N INTERP,RESULT
  1. S INTERP=$P(VALUES,U,2),RESULT=$P(VALUES,U)
  1. I INTERP="",RESULT'="" S INTERP=$G(^LAB(62.06,"AI",DRUGNODE,RESULT))
  1. I INTERP="" S INTERP=RESULT
  1. I INTERP="" Q ""
  1. I $D(LRSUSS(INTERP)) Q "S"
  1. I $D(LRSUSR(INTERP)) Q "R"
  1. I INTERP["S" Q "S"
  1. Q ""