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

BKMVQCR9.m

Go to the documentation of this file.
BKMVQCR9 ;PRXM/HC/BWF - BKMV Quality of Care Report; [ 1/19/2005  7:16 PM ]
 ;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
 ; Quality of Care Audit Report
 Q
ARVCALC ; EP - ARV Calculation
 N ARVTOT,DFN,PTOTAL,CNT1,CNT2,CNT3,VSTDT,TEST,CNTM02,CNTM03,CNTM05
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 S ARVTOT=0,DFN=0,(CNT1,CNT2,CNT3)=0
 F  S DFN=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN)) Q:'DFN  D
 .S VSTDT="",CNTM02=0,CNTM03=0,CNTM05=0
 .F  S VSTDT=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM02",VSTDT)) Q:VSTDT=""  D
 ..S TEST=""
 ..F  S TEST=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM02",VSTDT,TEST)) Q:TEST=""  S CNTM02=CNTM02+1
 .F  S VSTDT=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM03",VSTDT)) Q:VSTDT=""  D
 ..S TEST=""
 ..F  S TEST=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM03",VSTDT,TEST)) Q:TEST=""  S CNTM03=CNTM03+1
 .F  S VSTDT=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM05",VSTDT)) Q:VSTDT=""  D
 ..S TEST=""
 ..F  S TEST=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"ARVM05",VSTDT,TEST)) Q:TEST=""  S CNTM05=CNTM05+1
 .I CNTM02+CNTM03+CNTM05=0 Q
 .S ARVTOT=ARVTOT+1
 .I CNTM02+CNTM03+CNTM05=1 S CNT2=CNT2+1 Q
 .; 3 different criteria will classify medications as HAART
 .I CNTM03>2 S CNT1=CNT1+1 Q
 .I CNTM05>1,CNTM03>0 S CNT1=CNT1+1 Q
 .I CNTM03>1,CNTM02+CNTM05>0 S CNT1=CNT1+1 Q
 .S CNT3=CNT3+1
 I ARVTOT=0 Q
 S ^TMP("BKMVQCR",$J,"ARVT","TOTAL","CNT")=ARVTOT
 S ^TMP("BKMVQCR",$J,"ARVT","TOTAL","PERC")=ARVTOT/PTOTAL*100
 S ^TMP("BKMVQCR",$J,"ARVT","HAART","CNT")=CNT1
 S ^TMP("BKMVQCR",$J,"ARVT","HAART","PERC")=CNT1/ARVTOT*100
 S ^TMP("BKMVQCR",$J,"ARVT","MONO","CNT")=CNT2
 S ^TMP("BKMVQCR",$J,"ARVT","MONO","PERC")=CNT2/ARVTOT*100
 S ^TMP("BKMVQCR",$J,"ARVT","OTHER","CNT")=CNT3
 S ^TMP("BKMVQCR",$J,"ARVT","OTHER","PERC")=CNT3/ARVTOT*100
 Q
PCP ; EP - PCP Calculation
 N PCPTOT,CD4TOT
 S CD4TOT=$G(^TMP("BKMVQCR",$J,"CD4T","BET50/200 ANY","CNT"))
 I CD4TOT<1 Q
 S PCPTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","PCPPTCNT"))
 S ^TMP("BKMVQCR",$J,"PCPT","TOTAL","CNT")=PCPTOT
 S ^TMP("BKMVQCR",$J,"PCPT","TOTAL","PERC")=PCPTOT/CD4TOT*100
 Q
MAC ; EP - MAC Calculation
 N MACTOT,CD4TOT
 S CD4TOT=$G(^TMP("BKMVQCR",$J,"CD4T","LT50 ANY","CNT"))
 I CD4TOT<1 Q
 S MACTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","MACPTCNT"))
 S ^TMP("BKMVQCR",$J,"MACT","TOTAL","CNT")=MACTOT
 S ^TMP("BKMVQCR",$J,"MACT","TOTAL","PERC")=MACTOT/CD4TOT*100
 Q
TOBCALC ; EP - Tobacco use Calculation
 N DFN,CNT1,CNT2,CNT3,CNT4,PTOTAL,TOBTOT
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 I PTOTAL=0 Q
 S TOBTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","TOBTOT"))
 I TOBTOT<1 Q
 S DFN=0,(CNT1,CNT2,CNT3,CNT4)=0
 F  S DFN=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN)) Q:'DFN  D
 .I '$D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"TOB")) Q  ; Only sub-total those who have been screened
 .I $D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"TOBUSER")) S CNT1=CNT1+1 D  Q  ; Current Tobacco User
 ..;Only count tobacco counseling on current tobacco users
 ..I $D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"TOBED")) S CNT2=CNT2+1
 ..Q
 .I $D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"TOBNONUSER")) S CNT3=CNT3+1 Q  ; Non-Current Tobacco User
 .S CNT4=CNT4+1 ; Screened, but not documented as to Current or Non-Current Tobacco User
 S ^TMP("BKMVQCR",$J,"TOBT","SCREEN","CNT")=TOBTOT
 S ^TMP("BKMVQCR",$J,"TOBT","SCREEN","PERC")=TOBTOT/PTOTAL*100
 S ^TMP("BKMVQCR",$J,"TOBT","USER","CNT")=CNT1
 S ^TMP("BKMVQCR",$J,"TOBT","USER","PERC")=CNT1/TOBTOT*100
 S ^TMP("BKMVQCR",$J,"TOBT","ED","CNT")=CNT2
 S ^TMP("BKMVQCR",$J,"TOBT","ED","PERC")=CNT2/TOBTOT*100
 S ^TMP("BKMVQCR",$J,"TOBT","NON","CNT")=CNT3
 S ^TMP("BKMVQCR",$J,"TOBT","NON","PERC")=CNT3/TOBTOT*100
 S ^TMP("BKMVQCR",$J,"TOBT","UNK","CNT")=CNT4
 S ^TMP("BKMVQCR",$J,"TOBT","UNK","PERC")=CNT4/TOBTOT*100
 Q
SUBCALC ; EP - Substance abuse Calculation
 N DFN,PTOTAL,CNT1,CNT2,CNT3,CNT4
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 I PTOTAL=0 Q
 S DFN=0,CNT1=0,CNT2=0
 F  S DFN=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN)) Q:'DFN  D
 . I $D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"SUBS01")) S CNT1=CNT1+1
 I CNT1<1 Q
 S DFN=0
 F  S DFN=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN)) Q:'DFN  D
 . I $D(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"SUBS01CURR")) S CNT2=CNT2+1
 ; No info on how to calculate 'Not Current', or 'IV'. Assume 0 for now.
 S CNT3=0,CNT4=0
 S ^TMP("BKMVQCR",$J,"SUBST","TOTAL","CNT")=CNT1
 S ^TMP("BKMVQCR",$J,"SUBST","TOTAL","PERC")=CNT1/PTOTAL*100
 S ^TMP("BKMVQCR",$J,"SUBST","CURRENT","CNT")=CNT2
 S ^TMP("BKMVQCR",$J,"SUBST","CURRENT","PERC")=CNT2/CNT1*100
 ; Can't calculate yet.
 ;S ^TMP("BKMVQCR",$J,"SUBST","IV","CNT")=CNT3
 ;S ^TMP("BKMVQCR",$J,"SUBST","IV","PERC")=CNT3/CNT2*100
 ;S ^TMP("BKMVQCR",$J,"SUBST","NOT","CNT")=CNT4
 ;S ^TMP("BKMVQCR",$J,"SUBST","NOT","PERC")=CNT4/CNT1*100
 S ^TMP("BKMVQCR",$J,"SUBST","UNK","CNT")=CNT1-(CNT2+CNT4)
 S ^TMP("BKMVQCR",$J,"SUBST","UNK","PERC")=CNT1-(CNT2+CNT4)/CNT1*100
 Q