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

PSULR2.m

Go to the documentation of this file.
  1. PSULR2 ;BIR/PDW - PBM LAB EXTRACT PROCESS PATIENTS ;25 AUG 1998
  1. ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
  1. ;
  1. ;DBIA'S
  1. ; Reference to file #2 supported by DBIA 10035
  1. ; Reference to file #63 supported by DBIA 2524
  1. ;
  1. EN ;EP SCAN AND SPLIT INTO DIVISION,RECORDS
  1. ; Build ^XTMP(,,"RECORDS",PSUDIV,L)
  1. ; Build ^XTMP(,,"PATIENT",DFN,TEST)="" AND THEN
  1. ; ,DATE)=RESULT^FLAG
  1. K ^XTMP(PSULRSUB,"RECORDS"),^("PATIENTS")
  1. ; Gather the tests necessary for each patient
  1. S PSUDA="" F S PSUDA=$O(^XTMP(PSULRSUB,"EVENT",PSUDA)) Q:PSUDA'>0 S X=^(PSUDA) D TESTS
  1. ;
  1. ; with the tests gathered for each patient
  1. ; now scan each patients daily lab results looking for the tests
  1. D PATIENT
  1. Q
  1. TESTS ;EP Gather tests for a patient for the drug class
  1. ; nodes used in ^XTMP sampler
  1. ;^XTMP("PSULR_541074170","CODES","CV800",6) = POTASSIUM
  1. ;^XTMP("PSULR_541074170","EVENT",1) = IV^599^13^12345^ASPRIN^CV800
  1. ;^XTMP("PSULR_541074170","PATIENT",13,4) = CREATININE
  1. ;^XTMP("PSULR_541074170","PATIENT",13,4,7029388.859632) = 1.0^^^50
  1. ;^XTMP("PSULR_541074170","PATIENT",13,6) = POTASSIUM
  1. ;^XTMP("PSULR_541074170","PATIENT",13,6,7029388.859632) = 5.0^^^50
  1. ;
  1. ; lab test "ch" node locations for each drug class were built in PSULR1
  1. ; Setup "Patient",ch node)="" by codes and tests built in XTMP(,,"CODES",TEST node)=test name
  1. ;
  1. S PSUDRCD=$P(X,U,6),PSUDFN=$P(X,U,3)
  1. S PSULRND=0 F S PSULRND=$O(^XTMP(PSULRSUB,"CODES",PSUDRCD,PSULRND)) Q:PSULRND'>0 S X=^(PSULRND) D
  1. . S ^XTMP(PSULRSUB,"PATIENT",PSUDFN,PSULRND)=X
  1. Q
  1. ;
  1. PATIENT ;EP SCAN for each patient their tests needed
  1. ;Take ^XTMP(,"PATIENT","CH TEST NODE")=TESTNAME
  1. ;scan the lab file
  1. ;and build
  1. ; ^XTMP(,"PATIENT","CH TEST NODE",DATE)=RESULT^TESTFLAG
  1. ;
  1. S X1=PSUEDT,X2=-365 D C^%DTC
  1. ;S X1=PSUSDT,X2=-365 D C^%DTC
  1. S PSULREDT=9999999-X ; only go back one year
  1. S PSULRSDT=9999999-PSUSDT
  1. ;
  1. ; gather needed test (nodes) from ^XTMP and put into the X to PSUNODE array
  1. ;
  1. S DFN=0 F K X S DFN=$O(^XTMP(PSULRSUB,"PATIENT",DFN)) Q:DFN'>0 M X=^(DFN) D
  1. . N PSUNODE
  1. . ; psunode("CH" NODE)=test name
  1. . M PSUNODE=X
  1. . I '$D(^DPT(DFN,"LR")) Q
  1. . S PSULRDFN=^DPT(DFN,"LR")
  1. . S DA=PSULRSDT F S DA=$O(^LR(PSULRDFN,"CH",DA)) Q:DA'>0 Q:'$D(PSUNODE) Q:DA>PSULREDT D
  1. .. ; check each date for each ch node in PSUNODE
  1. .. S Y=0 F S Y=$O(PSUNODE(Y)) Q:Y'>0 I $D(^LR(PSULRDFN,"CH",DA,Y)) D
  1. ... ;found a test, save result & quit testing for the node
  1. ... I '$P(^LR(PSULRDFN,"CH",DA,0),U,3) Q ; results not verified
  1. ... S ^XTMP(PSULRSUB,"PATIENT",DFN,Y,DA)=^LR(PSULRDFN,"CH",DA,Y)
  1. ... K PSUNODE(Y)
  1. ;
  1. Q
  1. ;