BDMD819 ; IHS/CMI/LAB - 2008 DIABETES AUDIT ; 21 Jan 2014 10:55 AM
;;2.0;DIABETES MANAGEMENT SYSTEM;**2,4,5,6,7,8,9,10**;JUN 14, 2007;Build 12
;
;
W:$D(IOF) @IOF
W !!,"Checking for Taxonomies to support the 2008 Audit. ",!,"Please enter the device for printing.",!
ZIS ;
S XBRC="",XBRP="TAXCHK^BDMD819",XBNS="",XBRX="XIT^BDMD819"
D ^XBDBQUE
D XIT
Q
TAXCHK ;EP
W:$D(IOF) @IOF
K BDMQUIT
W !,"Checking for Taxonomies to support the 2008 Audit...",!
NEW A,BDMX,I,Y,Z,J,BDMY,B,C
K A,B
S C=0
S T="TAXS" F J=1:1 S Z=$T(@T+J),BDMX=$P(Z,";;",2),Y=$P(Z,";;",3) Q:BDMX="" D
.I '$D(^ATXAX("B",BDMX)) S A(BDMX)=Y_"^is Missing" Q
.S I=$O(^ATXAX("B",BDMX,0))
.I '$D(^ATXAX(I,21,"B")) S A(BDMX)=Y_"^has no entries "
S T="LAB" F J=1:1 S Z=$T(@T+J),BDMX=$P(Z,";;",2),Y=$P(Z,";;",3) Q:BDMX="" D
.I '$D(^ATXLAB("B",BDMX)) S A(BDMX)=Y_"^is Missing " Q
.S I=$O(^ATXLAB("B",BDMX,0))
.I '$D(^ATXLAB(I,21,"B")) S A(BDMX)=Y_"^has no entries " Q
.I '$P(^ATXLAB(I,0),U,11) D
..;check for panels and warn
..S BDMY=0 F S BDMY=$O(^ATXLAB(I,21,"B",BDMY)) Q:BDMY'=+BDMY D
...I $O(^LAB(60,BDMY,2,0)) S C=C+1,B(BDMX,C)=Y_"^contains a panel test: "_$P(^LAB(60,BDMY,0),U)_" and should not."
I $Y>(IOSL-2) D PAGE
I '$D(A),'$D(B) W !,"All taxonomies are present.",! K A,BDMX,Y,I,Z Q
W !!,"In order for the 2008 Diabetes Audit to find all necessary data, several",!,"taxonomies must be established. The following taxonomies are missing, have",!,"no entries or contain a panel test and should not:",!
S BDMX="" F S BDMX=$O(A(BDMX)) Q:BDMX=""!($D(BDMQUIT)) D
.I $Y>(IOSL-2) D PAGE Q:$D(BDMQUIT)
.W !,$P(A(BDMX),U)," [",BDMX,"] ",$P(A(BDMX),U,2)
.Q
G:$D(BDMQUIT) DONE
S BDMX="" F S BDMX=$O(B(BDMX)) Q:BDMX=""!($D(BDMQUIT)) D
.S BDMY=0 F S BDMY=$O(B(BDMX,BDMY)) Q:BDMY'=+BDMY!($D(BDMQUIT)) D
..W !,$P(B(BDMX,BDMY),U)," [",BDMX,"] ",$P(B(BDMX,BDMY),U,2)
DONE ;
I $E(IOST)="C",IO=IO(0) S DIR(0)="EO",DIR("A")="End of taxonomy check. HIT RETURN" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q
XIT ;EP
K BDM,BDMX,BDMQUIT,BDMLINE,BDMJ,BDMX,BDMTEXT,BDM
K X,Y,J
Q
LASTHF(P,C,BDATE,EDATE,F) ;EP - get last factor in category C for patient P
I '$G(P) Q ""
I $G(C)="" Q ""
I $G(F)="" S F=""
S C=$O(^AUTTHF("B",C,0)) ;ien of category passed
I '$G(C) Q ""
NEW H,D,O S H=0 K O
F S H=$O(^AUTTHF("AC",C,H)) Q:'+H D
. Q:'$D(^AUPNVHF("AA",P,H))
. S D="" F S D=$O(^AUPNVHF("AA",P,H,D)) Q:D'=+D D
.. Q:(9999999-D)>EDATE ;after time frame
.. Q:(9999999-D)<BDATE ;before time frame
.. S O(D)=$O(^AUPNVHF("AA",P,H,D,""))
. Q
S D=$O(O(0))
I D="" Q D
I F="F" Q $P(^AUTTHF($P(^AUPNVHF(O(D),0),U),0),U)
;
Q 1
;;
BANNER ;EP - banner for 2008 audit menu
S BDMTEXT="TEXTD",BDM("VERSION")="2.0 (Patch 10)"
F BDMJ=1:1 S BDMX=$T(@BDMTEXT+BDMJ),BDMX=$P(BDMX,";;",2) Q:BDMX="QUIT"!(BDMX="") S BDMLINE=BDMJ
PRINT D ^XBCLS W:$D(IOF) @IOF
F BDMJ=1:1:BDMLINE S BDMX=$T(@BDMTEXT+BDMJ),BDMX=$P(BDMX,";;",2) W !?80-$L(BDMX)\2,BDMX K BDMX
W !?80-(8+$L(BDM("VERSION")))/2,"Version ",BDM("VERSION")
G XIT:'$D(DUZ(2)) G:'DUZ(2) XIT S BDM("SITE")=$P(^DIC(4,DUZ(2),0),"^") W !!?80-$L(BDM("SITE"))\2,BDM("SITE")
D XIT
Q
TEXTD ;EP
;;****************************************
;;** DIABETES MANAGEMENT SYSTEM **
;;** 2008 Diabetes Audit Report Menu **
;;****************************************
;;QUIT
PAGE ;
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BDMQUIT="" Q
Q
BMIEPI(H,W) ;EP ;
NEW %
I H="" Q ""
I W="" Q ""
I 'H Q ""
S W=W*.45359,H=(H*.0254),H=(H*H),%=(W/H),%=$J(%,4,1)
Q %
TAXS ;
;;SURVEILLANCE DIABETES;;Diabetes Diagnoses Codes
;;SURVEILLANCE HYPERTENSION;;Hypertension Diagnoses Codes
;;SURVEILLANCE TUBERCULOSIS;;Tuberculosis Diagnoses Codes
;;DM AUDIT DEPRESSIVE DISORDERS;;Depressive Disorders Diagnoses Codes
;;DM AUDIT DIET EDUC TOPICS;;Diabetes Diet Education Topics
;;DM AUDIT EXERCISE EDUC TOPICS;;Diabetes Excercise Education Topics
;;DM AUDIT OTHER EDUC TOPICS;;Other Diabetes Education Topics
;;DM AUDIT SMOKING CESS EDUC;;Smoking Cess Education Topics
;;DM AUDIT TOBACCO HLTH FACTORS;;Tobacco Health Factors
;;DM AUDIT PROBLEM SMOKING DXS;;Smoking related diagnoses for Problem List
;;DM AUDIT PROBLEM HTN DIAGNOSES;;Hypertension Diagnoses
;;DM AUDIT PROBLEM DIABETES DX;;Diabetes Diagnoses
;;DM AUDIT SMOKING RELATED DXS;;Smoking related diagnoses for POVs
;;DM AUDIT CESSATION HLTH FACTOR;;Smoking Cessation Health Factors
;;DM AUDIT TB HEALTH FACTORS;;TB Status Health Factors
;;DM AUDIT INSULIN DRUGS;;Insulin Drug Taxonomy
;;DM AUDIT SULFONYLUREA DRUGS;;Sulfonylurea Drug Taxonomy
;;DM AUDIT METFORMIN DRUGS;;Metformin Drug Taxonomy
;;DM AUDIT ACARBOSE DRUGS;;Acarbose Drug Taxonomy
;;DM AUDIT LIPID LOWERING DRUGS;;Lipid Lowering Drug Taxonomy
;;DM AUDIT STATIN DRUGS;;Statin Drug Taxonomy
;;DM AUDIT GLITAZONE DRUGS;;Glitzaone Drug Taxonomy
;;DM AUDIT INCRETIN MIMETIC;;Incretin Drug Taxonomy
;;DM AUDIT DPP4 INHIBITOR DRUGS;;DPP4 Drug Taxonomy
;;DM AUDIT ACE INHIBITORS;;ACE Inhibitor Drug Taxonomy
;;DM AUDIT ASPIRIN DRUGS;;Aspirin Drug Taxonomy
;;DM AUDIT ANTI-PLATELET DRUGS;;Anti-Platelet Drug Taxonomy
;;DM AUDIT SDM PROVIDERS;;SDM providers Taxonomy
;;DM AUDIT TYPE II DXS;;Type II Diagnoses
;;DM AUDIT TYPE I DXS;;Type I Diagnoses
;;DM AUDIT P/C RATIO LOINC;;Protein/Creatinine Ratio Taxnonomy
;;BGP QUANT URINE PROT LOINC;;Quantitative Urine Protein Taxonomy
;;
LAB ;
;;DM AUDIT URINE PROTEIN TAX;;Urine Protein Lab Taxonomy
;;DM AUDIT MICROALBUMINURIA TAX;;Microalbuminuia Lab Taxonomy
;;DM AUDIT HGB A1C TAX;;HGB A1C Lab Taxonomy
;;DM AUDIT CREATININE TAX;;Creatinine Lab Taxonomy
;;DM AUDIT CHOLESTEROL TAX;;Cholesterol Lab Taxonomy
;;DM AUDIT LDL CHOLESTEROL TAX;;LDL Cholesterol Lab Taxonomy
;;DM AUDIT HDL TAX;;HDL Lab Taxonomy
;;DM AUDIT TRIGLYCERIDE TAX;;Triglyceride Lab Taxonomy
;;DM AUDIT URINALYSIS TAX;;Urinalysis Lab Taxonomy
;;DM AUDIT A/C RATIO TAX;;A/C RATIO Lab Taxonomy
;;DM AUDIT P/C RATIO TAX;;P/C RATIO Lab Taxonomy
;;BGP GPRA ESTIMATED GFR TAX;;Estmated GFR Taxonomy
;;BGP QUANT URINE PROTEIN;;Quantitative Urine Protein Taxonomy
;;
BDMD819 ; IHS/CMI/LAB - 2008 DIABETES AUDIT ; 21 Jan 2014 10:55 AM
+1 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2,4,5,6,7,8,9,10**;JUN 14, 2007;Build 12
+2 ;
+3 ;
+4 IF $DATA(IOF)
WRITE @IOF
+5 WRITE !!,"Checking for Taxonomies to support the 2008 Audit. ",!,"Please enter the device for printing.",!
ZIS ;
+1 SET XBRC=""
SET XBRP="TAXCHK^BDMD819"
SET XBNS=""
SET XBRX="XIT^BDMD819"
+2 DO ^XBDBQUE
+3 DO XIT
+4 QUIT
TAXCHK ;EP
+1 IF $DATA(IOF)
WRITE @IOF
+2 KILL BDMQUIT
+3 WRITE !,"Checking for Taxonomies to support the 2008 Audit...",!
+4 NEW A,BDMX,I,Y,Z,J,BDMY,B,C
+5 KILL A,B
+6 SET C=0
+7 SET T="TAXS"
FOR J=1:1
SET Z=$TEXT(@T+J)
SET BDMX=$PIECE(Z,";;",2)
SET Y=$PIECE(Z,";;",3)
IF BDMX=""
QUIT
Begin DoDot:1
+8 IF '$DATA(^ATXAX("B",BDMX))
SET A(BDMX)=Y_"^is Missing"
QUIT
+9 SET I=$ORDER(^ATXAX("B",BDMX,0))
+10 IF '$DATA(^ATXAX(I,21,"B"))
SET A(BDMX)=Y_"^has no entries "
End DoDot:1
+11 SET T="LAB"
FOR J=1:1
SET Z=$TEXT(@T+J)
SET BDMX=$PIECE(Z,";;",2)
SET Y=$PIECE(Z,";;",3)
IF BDMX=""
QUIT
Begin DoDot:1
+12 IF '$DATA(^ATXLAB("B",BDMX))
SET A(BDMX)=Y_"^is Missing "
QUIT
+13 SET I=$ORDER(^ATXLAB("B",BDMX,0))
+14 IF '$DATA(^ATXLAB(I,21,"B"))
SET A(BDMX)=Y_"^has no entries "
QUIT
+15 IF '$PIECE(^ATXLAB(I,0),U,11)
Begin DoDot:2
+16 ;check for panels and warn
+17 SET BDMY=0
FOR
SET BDMY=$ORDER(^ATXLAB(I,21,"B",BDMY))
IF BDMY'=+BDMY
QUIT
Begin DoDot:3
+18 IF $ORDER(^LAB(60,BDMY,2,0))
SET C=C+1
SET B(BDMX,C)=Y_"^contains a panel test: "_$PIECE(^LAB(60,BDMY,0),U)_" and should not."
End DoDot:3
End DoDot:2
End DoDot:1
+19 IF $Y>(IOSL-2)
DO PAGE
+20 IF '$DATA(A)
IF '$DATA(B)
WRITE !,"All taxonomies are present.",!
KILL A,BDMX,Y,I,Z
QUIT
+21 WRITE !!,"In order for the 2008 Diabetes Audit to find all necessary data, several",!,"taxonomies must be established. The following taxonomies are missing, have",!,"no entries or contain a panel test and should not:",!
+22 SET BDMX=""
FOR
SET BDMX=$ORDER(A(BDMX))
IF BDMX=""!($DATA(BDMQUIT))
QUIT
Begin DoDot:1
+23 IF $Y>(IOSL-2)
DO PAGE
IF $DATA(BDMQUIT)
QUIT
+24 WRITE !,$PIECE(A(BDMX),U)," [",BDMX,"] ",$PIECE(A(BDMX),U,2)
+25 QUIT
End DoDot:1
+26 IF $DATA(BDMQUIT)
GOTO DONE
+27 SET BDMX=""
FOR
SET BDMX=$ORDER(B(BDMX))
IF BDMX=""!($DATA(BDMQUIT))
QUIT
Begin DoDot:1
+28 SET BDMY=0
FOR
SET BDMY=$ORDER(B(BDMX,BDMY))
IF BDMY'=+BDMY!($DATA(BDMQUIT))
QUIT
Begin DoDot:2
+29 WRITE !,$PIECE(B(BDMX,BDMY),U)," [",BDMX,"] ",$PIECE(B(BDMX,BDMY),U,2)
End DoDot:2
End DoDot:1
DONE ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
SET DIR(0)="EO"
SET DIR("A")="End of taxonomy check. HIT RETURN"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 QUIT
XIT ;EP
+1 KILL BDM,BDMX,BDMQUIT,BDMLINE,BDMJ,BDMX,BDMTEXT,BDM
+2 KILL X,Y,J
+3 QUIT
LASTHF(P,C,BDATE,EDATE,F) ;EP - get last factor in category C for patient P
+1 IF '$GET(P)
QUIT ""
+2 IF $GET(C)=""
QUIT ""
+3 IF $GET(F)=""
SET F=""
+4 ;ien of category passed
SET C=$ORDER(^AUTTHF("B",C,0))
+5 IF '$GET(C)
QUIT ""
+6 NEW H,D,O
SET H=0
KILL O
+7 FOR
SET H=$ORDER(^AUTTHF("AC",C,H))
IF '+H
QUIT
Begin DoDot:1
+8 IF '$DATA(^AUPNVHF("AA",P,H))
QUIT
+9 SET D=""
FOR
SET D=$ORDER(^AUPNVHF("AA",P,H,D))
IF D'=+D
QUIT
Begin DoDot:2
+10 ;after time frame
IF (9999999-D)>EDATE
QUIT
+11 ;before time frame
IF (9999999-D)<BDATE
QUIT
+12 SET O(D)=$ORDER(^AUPNVHF("AA",P,H,D,""))
End DoDot:2
+13 QUIT
End DoDot:1
+14 SET D=$ORDER(O(0))
+15 IF D=""
QUIT D
+16 IF F="F"
QUIT $PIECE(^AUTTHF($PIECE(^AUPNVHF(O(D),0),U),0),U)
+17 ;
+18 QUIT 1
+19 ;;
BANNER ;EP - banner for 2008 audit menu
+1 SET BDMTEXT="TEXTD"
SET BDM("VERSION")="2.0 (Patch 10)"
+2 FOR BDMJ=1:1
SET BDMX=$TEXT(@BDMTEXT+BDMJ)
SET BDMX=$PIECE(BDMX,";;",2)
IF BDMX="QUIT"!(BDMX="")
QUIT
SET BDMLINE=BDMJ
PRINT DO ^XBCLS
IF $DATA(IOF)
WRITE @IOF
+1 FOR BDMJ=1:1:BDMLINE
SET BDMX=$TEXT(@BDMTEXT+BDMJ)
SET BDMX=$PIECE(BDMX,";;",2)
WRITE !?80-$LENGTH(BDMX)\2,BDMX
KILL BDMX
+2 WRITE !?80-(8+$LENGTH(BDM("VERSION")))/2,"Version ",BDM("VERSION")
+3 IF '$DATA(DUZ(2))
GOTO XIT
IF 'DUZ(2)
GOTO XIT
SET BDM("SITE")=$PIECE(^DIC(4,DUZ(2),0),"^")
WRITE !!?80-$LENGTH(BDM("SITE"))\2,BDM("SITE")
+4 DO XIT
+5 QUIT
TEXTD ;EP
+1 ;;****************************************
+2 ;;** DIABETES MANAGEMENT SYSTEM **
+3 ;;** 2008 Diabetes Audit Report Menu **
+4 ;;****************************************
+5 ;;QUIT
PAGE ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BDMQUIT=""
QUIT
+2 QUIT
BMIEPI(H,W) ;EP ;
+1 NEW %
+2 IF H=""
QUIT ""
+3 IF W=""
QUIT ""
+4 IF 'H
QUIT ""
+5 SET W=W*.45359
SET H=(H*.0254)
SET H=(H*H)
SET %=(W/H)
SET %=$JUSTIFY(%,4,1)
+6 QUIT %
TAXS ;
+1 ;;SURVEILLANCE DIABETES;;Diabetes Diagnoses Codes
+2 ;;SURVEILLANCE HYPERTENSION;;Hypertension Diagnoses Codes
+3 ;;SURVEILLANCE TUBERCULOSIS;;Tuberculosis Diagnoses Codes
+4 ;;DM AUDIT DEPRESSIVE DISORDERS;;Depressive Disorders Diagnoses Codes
+5 ;;DM AUDIT DIET EDUC TOPICS;;Diabetes Diet Education Topics
+6 ;;DM AUDIT EXERCISE EDUC TOPICS;;Diabetes Excercise Education Topics
+7 ;;DM AUDIT OTHER EDUC TOPICS;;Other Diabetes Education Topics
+8 ;;DM AUDIT SMOKING CESS EDUC;;Smoking Cess Education Topics
+9 ;;DM AUDIT TOBACCO HLTH FACTORS;;Tobacco Health Factors
+10 ;;DM AUDIT PROBLEM SMOKING DXS;;Smoking related diagnoses for Problem List
+11 ;;DM AUDIT PROBLEM HTN DIAGNOSES;;Hypertension Diagnoses
+12 ;;DM AUDIT PROBLEM DIABETES DX;;Diabetes Diagnoses
+13 ;;DM AUDIT SMOKING RELATED DXS;;Smoking related diagnoses for POVs
+14 ;;DM AUDIT CESSATION HLTH FACTOR;;Smoking Cessation Health Factors
+15 ;;DM AUDIT TB HEALTH FACTORS;;TB Status Health Factors
+16 ;;DM AUDIT INSULIN DRUGS;;Insulin Drug Taxonomy
+17 ;;DM AUDIT SULFONYLUREA DRUGS;;Sulfonylurea Drug Taxonomy
+18 ;;DM AUDIT METFORMIN DRUGS;;Metformin Drug Taxonomy
+19 ;;DM AUDIT ACARBOSE DRUGS;;Acarbose Drug Taxonomy
+20 ;;DM AUDIT LIPID LOWERING DRUGS;;Lipid Lowering Drug Taxonomy
+21 ;;DM AUDIT STATIN DRUGS;;Statin Drug Taxonomy
+22 ;;DM AUDIT GLITAZONE DRUGS;;Glitzaone Drug Taxonomy
+23 ;;DM AUDIT INCRETIN MIMETIC;;Incretin Drug Taxonomy
+24 ;;DM AUDIT DPP4 INHIBITOR DRUGS;;DPP4 Drug Taxonomy
+25 ;;DM AUDIT ACE INHIBITORS;;ACE Inhibitor Drug Taxonomy
+26 ;;DM AUDIT ASPIRIN DRUGS;;Aspirin Drug Taxonomy
+27 ;;DM AUDIT ANTI-PLATELET DRUGS;;Anti-Platelet Drug Taxonomy
+28 ;;DM AUDIT SDM PROVIDERS;;SDM providers Taxonomy
+29 ;;DM AUDIT TYPE II DXS;;Type II Diagnoses
+30 ;;DM AUDIT TYPE I DXS;;Type I Diagnoses
+31 ;;DM AUDIT P/C RATIO LOINC;;Protein/Creatinine Ratio Taxnonomy
+32 ;;BGP QUANT URINE PROT LOINC;;Quantitative Urine Protein Taxonomy
+33 ;;
LAB ;
+1 ;;DM AUDIT URINE PROTEIN TAX;;Urine Protein Lab Taxonomy
+2 ;;DM AUDIT MICROALBUMINURIA TAX;;Microalbuminuia Lab Taxonomy
+3 ;;DM AUDIT HGB A1C TAX;;HGB A1C Lab Taxonomy
+4 ;;DM AUDIT CREATININE TAX;;Creatinine Lab Taxonomy
+5 ;;DM AUDIT CHOLESTEROL TAX;;Cholesterol Lab Taxonomy
+6 ;;DM AUDIT LDL CHOLESTEROL TAX;;LDL Cholesterol Lab Taxonomy
+7 ;;DM AUDIT HDL TAX;;HDL Lab Taxonomy
+8 ;;DM AUDIT TRIGLYCERIDE TAX;;Triglyceride Lab Taxonomy
+9 ;;DM AUDIT URINALYSIS TAX;;Urinalysis Lab Taxonomy
+10 ;;DM AUDIT A/C RATIO TAX;;A/C RATIO Lab Taxonomy
+11 ;;DM AUDIT P/C RATIO TAX;;P/C RATIO Lab Taxonomy
+12 ;;BGP GPRA ESTIMATED GFR TAX;;Estmated GFR Taxonomy
+13 ;;BGP QUANT URINE PROTEIN;;Quantitative Urine Protein Taxonomy
+14 ;;