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

APCLTAX0.m

Go to the documentation of this file.
APCLTAX0 ; IHS/CMI/LAB - DMS TAXONOMY MANAGEMENT UTILITY ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;UTILITY PROGRAM TO MANAGE TAXONOMY CREATION AND EDITING
TAX ;EP;TAXONOMY MANAGEMENT
 W !!,"This taxonomy setup option has been disabled.  Each individual package"
 W !,"that requires taxonomy setup will have it's own menu option for setting"
 W !,"up the taxonomies required by the package.  For example, to update the"
 W !,"taxonomies for the CRS report follow the menu path CI05-SET-TAX."
 W !,"To update the taxonomies required by the 2005 Diabetes Audit use"
 W !,"the taxonomy setup option provided in the 2005 Diabetes Audit menu.",!!
 K DIR S DIR(0)="E",DIR("A")="Press enter: " D ^DIR K DIR
 Q
 F  D TAX1 Q:$D(APCLQUIT)!$D(APCLOUT)
TAXEXIT K APCLQUIT,APCLOUT,APCLJ,APCLX,APCLY,APCLTDA,APCLTNAM,APCLINK,APCLINK0,APCLLDA,APCLWHCH,APCLADA,APCLANAM,APCLTF,APCLTFF,APCLCANN,APCLGO,APCLTFDA,APCLTFNA
 K APCLHIGH,APCLLOW,APCLTYPE,APCLANAM,APCLCANN,APCLFILE,APCLILE,APLCGO,APLCJ,APCLRXDA,APCLRXVC,APCLTDA,APCLTNAM,APCLADA,APCLANAM
 K ^TMP("APCLVR",$J)
 Q
TAX1 D TAXEXIT
 D TAXHEAD^APCLTAX1
 S VALMCNT=1
 S DIR(0)="SO^1:Diabetes Mgt System Taxonomies;2:Other Taxonomies"
 S DIR("A")="Which one"
 D DIR^APCLDIC
 I Y<1 S APCLQUIT="" Q
 S APCLTYPE=$S(Y=1:"DMS",1:"OTHER")
 I APCLTYPE="OTHER" D OTHER^APCLTAX2 Q
 D TAXRX
 Q
TAXRX ;PROCESS TAXONOMIES
 F  D TAXRX1 Q:$D(APCLQUIT)!$D(APCLOUT)
 K APCLQUIT
 Q
TAXRX1 ;
 W @IOF
 W !?10,"Select one of the following ",!?10
 W "Diabetes Mgt System Taxonomy"
 W "Categories to review."
 S DIR(0)="SO^1:Diagnosis;2:Medication;3:Patient Education Topic;4:Health Factors;5:Problem List Diagnosis;6:Provider;7:Lab;8:ADA Code"
 S DIR("A")="Which one"
 D DIR^APCLDIC
 I Y<1 S APCLQUIT="" Q
 S APCLWHCH=$S(Y=7:"LAB",1:"RX")
 I Y=1 S APCLANAM="DIAGNOSIS"
 I Y=2 S APCLANAM="RX"
 I Y=3 S APCLANAM="PATIENT ED TOPIC"
 I Y=4 S APCLANAM="HEALTH FACTORS"
 I Y=5 S APCLANAM="PROBLEM LIST DIAGNOSIS"
 I Y=6 S APCLANAM="PROVIDER"
 I Y=7 S APCLANAM="LAB" D LAB^APCLTAX1 Q
 I Y=8 S APCLANAM="ADA CODE"
 S APCLADA=$O(^AMQQ(5,"B",APCLANAM,""))
 I 'APCLADA D  Q
 .W !!,"A taxonomy can not be created for this attribute.  Ask your"
 .W !,"system manager to add ",APCLX," as an attribute then try again."
 D TERM
 Q:APCLINK0=""
 D TAXDISP:APCLINK
 Q
TERM ;EP;SET QMAN DICTIONARY OF TERMS VALUES
 S APCLINK=$P(^AMQQ(5,APCLADA,0),U,5)
 S APCLINK0=$G(^AMQQ(1,APCLINK,0))
APCLTF ;EP;
 S APCLTF=U_$P(^AMQQ(5,APCLADA,0),U,18)
APCLTF1 ;EP;
 S:$E(APCLTF,$L(APCLTF))="(" APCLTFF=$E(APCLTF,1,$L(APCLTF)-1)
 S:$E(APCLTF,$L(APCLTF))="," APCLTFF=$E(APCLTF,1,$L(APCLTF)-1)_")"
 S (APCLFILE,APCLTFDA)=+$P($G(@APCLTFF@(0)),U,2)
 S APCLTFNA=$P($G(@APCLTFF@(0)),U)
 Q
TAXDISP ;DISPLAY TAXONOMIES
 D VALM("APCL TAXONOMY DISPLAY")
 Q
 S VALMSG="'-' Previous Page  'QU' Quit  ?? for More Actions"
 Q
TAXADD ;EP;ENTER A NEW TAXONOMY
 D:'$G(APCLADA) ATTRIB^APCLTAX2
 Q:'$G(APCLADA)
 D APCLTF
 I APCLANAM="DIAGNOSIS" S APCLCANN=1 ;CANONIC/NON-CANONIC
 I APCLANAM="ADA CODE" S APCLCANN=0
 I APCLANAM="RX" S APCLCANN=0
 I APCLANAM="PROCEDURE (MEDICAL)" S APCLCANN=1
 I APCLANAM="PATIENT ED TOPIC" S APCLCANN=0
 I APCLANAM="HEALTH FACTORS" S APCLCANN=0
 I APCLANAM="PROBLEM LIST DIAGNOSIS" S APCLCANN=1
 I APCLANAM="PROVIDER" S APCLCANN=0
 S DIR(0)="FO^3:30"
 S DIR("A")="Taxonomy Name"
 W !
 D DIR^APCLDIC
 I Y="" S APCLQUIT="" D TABACK Q
 I $D(^ATXAX("B",Y)) W !!,"The ",Y," taxonomy already exists." G TAXADD
 S (X,APCLTNAM)=Y
 S DIC="^ATXAX("
 S DIC(0)="L"
 S DIC("DR")=".02////"_Y_";.05////"_DUZ_";.08////0;.09////"_DT_";.12////"_APCLINK_";.13////"_APCLCANN_";.15////"_+APCLTFDA
 D FILE^APCLDIC
 S APCLTDA=+Y
 I 'APCLTDA D TABACK Q
 D TILIST
TABACK S APCLGO="TAX"
 D BACK
 Q
TAXEDIT ;EP;EDIT AN EXISTING TAXONOMY
 D SELECT
 I $D(APCLQUIT) K APCLQUIT D TEBACK Q
TE1 ;EP
 D TILIST
TEBACK S APCLGO="TAX"
 D BACK
 Q
SELECT ;SELECT AN EXISTING TAXONOMY
 S DIR(0)="NO^1:"_APCLJ
 S DIR("A")="Which Taxonomy"
 W !
 D DIR^APCLDIC
 I Y<1 S APCLQUIT="" Q
 Q:'$D(APCLJ(Y))
 S APCLTDA=+APCLJ(Y)
 S APCLTNAM=$P($G(^ATXAX(+APCLTDA,0)),U)
 Q
EDIT ;EP;EDIT A TAXONOMY
 S DA=APCLTDA
 S DIE=$S(APCLWHCH="RX":"^ATXAX(",1:"^ATXLAB(")
 S DR=$S(APCLWHCH="RX":"[APCL EDIT TAXONOMY]",1:"[APCL EDIT LAB TAXONOMY]")
 D DDS^APCLDIC
 S APCLGO="TAX"
 D BACK
 Q
TAXINIT ;EP;INITIALIZE ARRAY FOR TAXONOMY DISPLAY
 K ^TMP("APCLVR",$J),^TMP("APCLTMP",$J)
 K APCLJ,VALMCNT S VALMCNT=0
 D PROCESS^APCLTAX4
 Q:'$D(APCLTAX)
 N A,X,Y,Z
 S X="     "_$S(APCLANAM'="RX":APCLANAM,1:"MEDICATION")_" Taxonomies"
 D Z(X)
 S X="  "
 D Z(X)
 S X="     No.  Taxonomy"
 D Z(X)
 S X="     ---  ------------------------------"
 D Z(X)
 S Z=0
 S X=""
 F  S X=$O(APCLTAX(X)) Q:X=""  D
 .S Z=Z+1
 .S A="    "_Z
 .S:$L(A)=5 A=" "_A
 .S A=A_"    "
 .S A=A_X
 .D Z(A)
 .S APCLJ(Z)=+APCLTAX(X)_U_X
 I '$D(^TMP("APCLVR",$J)) D
 .S X="NO TAXONOMIES ON FILE FOR "_APCLX
 .D Z(X)
 S APCLJ=Z
 Q
VALM(APCLX) ;EP;VALM INTERFACE
 S VALMCC=1 ;1=screen mode, 0=scrolling mode
 D TERM^VALM0
 D EN^VALM(APCLX)
 D CLEAR^VALM1
 Q
LABADD ;EP;ADD LAB TO LAB TAXONOMY
 F  D L1 Q:$D(APCLQUIT)
 D BACK
 Q
L1 ;
 D CLEAR^VALM1
 W !,"Lab tests currently in this taxonomy:"
 NEW X S X=0 F  S X=$O(^ATXLAB(APCLTDA,21,X)) Q:X'=+X  W !,$P(^LAB(60,$P(^ATXLAB(APCLTDA,21,X,0),U),0),U)
 W !!,"Select lab tests to add."
 S DIC="^LAB(60,"
 S DIC(0)="AEMQZ"
 S DIC("A")="Which LAB TEST: "
 W !
 D DIC^APCLDIC
 I +Y<1 S APCLQUIT="" Q
 I $D(^ATXLAB(APCLTDA,21,"B",+Y)) D  Q
 .S APCLLDA=$O(^ATXLAB(APCLTDA,21,"B",+Y,0))
 .W !!,Y(0,0)," already selected for this taxonomy." H 2
 I '$D(^ATXLAB(APCLTDA,21,"B",Y(0,0)))&'$D(^ATXLAB(APCLTDA,21,"B",+Y)) D  I 1
 .S DA(1)=APCLTDA
 .S X=+Y
 .S $P(^ATXLAB(DA(1),21,0),U,2)="9002228.02101PA"
 .S DIC="^ATXLAB("_DA(1)_",21,"
 .S DIC(0)="L"
 .D FILE^APCLDIC
 .S APCLLDA=+Y
LE S DA=APCLLDA
 S DA(1)=APCLTDA
 S DIE="^ATXLAB("_DA(1)_",21,"
 S DR="1101;"
 D DIE^APCLDIC
 Q
LABEDIT ;EP;EDIT LAB IN LAB TAXONOMY
 S DIR("A")="EDIT "
 D SLAB
 I $D(APCLQUIT) K APCLQUIT D BACK Q
 D LE
 D BACK
 Q
SLAB ;SELECT EXISTING LAB FROM LAB TAXONOMY
 S DIR(0)="NO^1:"_APCLJ
 S DIR("A")=$G(DIR("A"))_"Which Lab Test"
 W !
 D DIR^APCLDIC
 I Y<1 S APCLQUIT="" Q
 I '$D(APCLJ(APCLTDA,Y)) S APCLQUIT="" Q
 S APCLLDA=+APCLJ(APCLTDA,Y)
 Q
DLAB ;EP;DELETE LAB FROM LAB TAXONOMY
 S DIR("A")="DELETE "
 D SLAB
 I $D(APCLQUIT) K APCLQUIT D BACK Q
 S DA(1)=APCLTDA
 S DA=APCLLDA
 S DIK="^ATXLAB("_DA(1)_",21,"
 D DIK^APCLDIC
 D BACK
 Q
TILIST ;EP;TO DISPLAY ITEMS ON TAXONOMY LIST
 D VALM("APCL TAXONOMY ITEMS DISPLAY")
 Q
TIINIT ;EP;TO LIST ITEMS ON TAXONOMY
 K APCLY
 K ^TMP("APCLVR",$J),APCLJ
 S VALMCNT=0
 S X="     "_$P(^ATXAX(APCLTDA,0),U)
 D Z(X)
 S X="--------------------------------------"
 D Z(X)
 N A,B,X,Y,Z
 S APCLX=""
 F  S APCLX=$O(^ATXAX(APCLTDA,21,"B",APCLX)) Q:APCLX=""  D
 .S APCLLDA=0
 .F  S APCLLDA=$O(^ATXAX(APCLTDA,21,"B",APCLX,APCLLDA)) Q:'APCLLDA  D
 ..S X=$G(^ATXAX(APCLTDA,21,APCLLDA,0))
 ..Q:X=""
 ..D Y^APCLTAX1
 ..S APCLY(APCLLOW_" ")=APCLHIGH_U_APCLLDA
 S APCLJ=0
 S APCLLOW=""
 F  S APCLLOW=$O(APCLY(APCLLOW)) Q:APCLLOW=""  D
 .S APCLHIGH=$P(APCLY(APCLLOW),U)
 .S APCLJ=APCLJ+1
 .S A=""
 .S $E(A,5)=APCLJ
 .S:$L(A)=5 A=" "_A
 .S A=A_"   "
 .S A=A_APCLLOW_$E("                              ",1,30-$L(APCLLOW))
 .S A=A_APCLHIGH_$E("                              ",1,30-$L(APCLHIGH))
 .D Z(A)
 .S APCLLDA=$P(APCLY(APCLLOW),U,2)
 .S APCLJ(APCLTDA,APCLJ)=APCLLDA_U_A
 Q
TIADD ;EP;TO ADD ITEM TO TAXONOMY
 I $P(^ATXAX(APCLTDA,0),U,22) W !!,"The ",$P(^ATXAX(APCLTDA,0),U)," taxonomy is READ ONLY.",!,"You cannot add items to it." D PAUSE Q
 F  D TI1 Q:$D(APCLQUIT)
 K APCLQUIT
 Q
TI1 K APCL
 N X,Y,Z
 I APCLANAM="DIAGNOSIS"!(APCLANAM="PROBLEM LIST DIAGNOSIS")!(APCLTFDA=80) D  I 1
 .S X=0
 .F  S X=$O(^ATXAX(APCLTDA,21,X)) Q:'X  D
 ..S Y=$G(^ATXAX(APCLTDA,21,X,0))
 ..S:$P(Y,U)]"" APCL(X)=$P(Y,U)_U_$S($P(Y,U,2)]"":$P(Y,U,2),1:$P(Y,U))
 .D ^APCLTAX1
 .Q:$D(APCLQUIT)
 .S X=$P(APCL("LOW"),U)
 E  D
 .D CLEAR^VALM1
 .W !?5,"Select an item to ADD to the"
 .W !!?5,APCLTNAM," Taxonomy"
 .S DIC=APCLTF
 .S DIC(0)="AEMQZ"
 .S DIC("A")="Which "_APCLANAM_": "
 .S:APCLANAM="OTHER" DIC("A")="Which "_APCLTFNA_": "
 .W !
 .D DIC^APCLDIC
 .I +Y<1 S APCLQUIT="" Q
 .D X^APCLTAX1
 .S APCL("LOW")=X
 .S APCL("HIGH")=""
 I $D(APCLQUIT) D TIBACK Q
 S X=$P(APCL("LOW"),U)
 S DA(1)=APCLTDA
 S DIC="^ATXAX("_APCLTDA_",21,"
 S DIC(0)="L"
 S DIC("DR")=".02////"_$S($P(APCL("HIGH"),U)]"":$P(APCL("HIGH"),U),1:X)
 S:'$D(^ATXAX(APCLTDA,21,0)) ^ATXAX(APCLTDA,21,0)="^9002226.02101A"
 D FILE^APCLDIC:'$D(^ATXAX(APCLTDA,21,"B",X))
TIBACK S APCLGO="TI"
 D BACK
 Q
TIREMOVE ;EP;TO REMOVE ITEM FROM TAXONOMY
 I $P(^ATXAX(APCLTDA,0),U,22) W !!,"The ",$P(^ATXAX(APCLTDA,0),U)," taxonomy is READ ONLY.",!,"You cannot remove items from it." D PAUSE Q
 D TISEL
 I $D(APCLQUIT) K APCLQUIT D TIBACK Q
 N APCLI,APCLX
 F APCLI=1:1 S APCLX=$P(APCLY,",",APCLI) Q:APCLX=""  D
 .Q:'$D(APCLJ(APCLTDA,APCLX))
 .S APCLLDA=+APCLJ(APCLTDA,APCLX)
 .S DA(1)=APCLTDA
 .S DA=APCLLDA
 .S DIK="^ATXAX("_DA(1)_",21,"
 .D DIK^APCLDIC
 S APCLGO="TI"
 D BACK
 Q
TISEL ;EP;SELECT EXISTING ITEM FROM A TAXONOMY
 S DIR(0)="LO^1:"_APCLJ
 S DIR("A")="Delete which Taxonomy Item(s)"
 W !
 D DIR^APCLDIC
 I Y<1 S APCLQUIT="" Q
 S APCLY=Y
 Q
BACK ;EP;SETUP FOR RETURN TO LISTMAN
 S VALMBCK="R"
 I APCLWHCH="LAB" D LABINIT^APCLTAX4 Q
 D TAXINIT:APCLGO="TAX"
 D TIINIT:APCLGO="TI"
 D TERM^VALM0
 Q
Z(X) ;SET TMP NODE
 S VALMCNT=$G(VALMCNT)+1
 S ^TMP("APCLVR",$J,VALMCNT,0)=X
 Q
LADD ;EP
 S DIR(0)="FO^3:30"
 S DIR("A")="Taxonomy Name"
 W !
 D DIR^APCLDIC
 I Y="" S APCLQUIT="" D TABACK Q
 I $D(^ATXLAB("B",Y)) W !!,"The ",Y," taxonomy already exists." G LADD
 S (X,APCLTNAM)=Y
 S DIC="^ATXLAB("
 S DIC(0)="L"
 S DIC("DR")=".02////"_($P(APCLTNAM," TAX")_" TEST TAX")_";.05////"_DUZ_";.06////"_DT_";.08////B;.09////60"
 D FILE^APCLDIC
 S APCLTDA=+Y
 Q:'APCLTDA
 D LABTEST^APCLTAX1
 Q
PAUSE ;EP
 Q:'(IO=IO(0))
 Q:'($E(IOST,1,2)="C-")
 S Y=$$DIR^XBDIR("EO")
 S:$D(DUOUT) XBQ=1
 Q
 ;