PXRMTAXI ;SLC/PKR - APIs returning taxonomy information. ;08/24/2018
;;2.0;CLINICAL REMINDERS;**42**;Feb 04, 2005;Build 245
;
;===============
CODELIST(TAX,UID,CODELIST) ;Return a list of codes in a taxonomy.
;TAX is either the IEN or the .01 of the taxonomy.
;If UID is true, return the Use In Dialog Codes, otherwise return
;all Selected Codes.
N IEN,IND
S IEN=$S(+TAX=TAX:TAX,1:+$O(^PXD(811.2,"B",TAX,"")))
I IEN=0 Q
I '$D(^PXD(811.2,IEN)) Q
I UID D Q
. N TEMP
. S IND=0
. F S IND=+$O(^PXD(811.2,IEN,30,IND)) Q:IND=0 D
.. S TEMP=^PXD(811.2,IEN,30,IND,0)
.. S CODELIST($P(TEMP,U,2),$P(TEMP,U,1))=""
;
N CODE,CODESYS,JND,KND
S IND=0
F S IND=+$O(^PXD(811.2,IEN,20,IND)) Q:IND=0 D
. S JND=0
. F S JND=+$O(^PXD(811.2,IEN,20,IND,1,JND)) Q:JND=0 D
.. S CODESYS=$P(^PXD(811.2,IEN,20,IND,1,JND,0),U,1)
.. S KND=0
.. F S KND=+$O(^PXD(811.2,IEN,20,IND,1,JND,1,KND)) Q:KND=0 D
... S CODE=$P(^PXD(811.2,IEN,20,IND,1,JND,1,KND,0),U,1)
... S CODELIST(CODESYS,CODE)=""
Q
;
;===============
TAXLIST(TAXLIST) ;Return a list of all the defined taxonomies.
N IEN,NAME
S NAME=""
F S NAME=$O(^PXD(811.2,"B",NAME)) Q:NAME="" D
. S IEN=$O(^PXD(811.2,"B",NAME,""))
. S TAXLIST(NAME)=IEN
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMTAXI 1258 printed Nov 22, 2024@16:59:32 Page 2
PXRMTAXI ;SLC/PKR - APIs returning taxonomy information. ;08/24/2018
+1 ;;2.0;CLINICAL REMINDERS;**42**;Feb 04, 2005;Build 245
+2 ;
+3 ;===============
CODELIST(TAX,UID,CODELIST) ;Return a list of codes in a taxonomy.
+1 ;TAX is either the IEN or the .01 of the taxonomy.
+2 ;If UID is true, return the Use In Dialog Codes, otherwise return
+3 ;all Selected Codes.
+4 NEW IEN,IND
+5 SET IEN=$SELECT(+TAX=TAX:TAX,1:+$ORDER(^PXD(811.2,"B",TAX,"")))
+6 IF IEN=0
QUIT
+7 IF '$DATA(^PXD(811.2,IEN))
QUIT
+8 IF UID
Begin DoDot:1
+9 NEW TEMP
+10 SET IND=0
+11 FOR
SET IND=+$ORDER(^PXD(811.2,IEN,30,IND))
if IND=0
QUIT
Begin DoDot:2
+12 SET TEMP=^PXD(811.2,IEN,30,IND,0)
+13 SET CODELIST($PIECE(TEMP,U,2),$PIECE(TEMP,U,1))=""
End DoDot:2
End DoDot:1
QUIT
+14 ;
+15 NEW CODE,CODESYS,JND,KND
+16 SET IND=0
+17 FOR
SET IND=+$ORDER(^PXD(811.2,IEN,20,IND))
if IND=0
QUIT
Begin DoDot:1
+18 SET JND=0
+19 FOR
SET JND=+$ORDER(^PXD(811.2,IEN,20,IND,1,JND))
if JND=0
QUIT
Begin DoDot:2
+20 SET CODESYS=$PIECE(^PXD(811.2,IEN,20,IND,1,JND,0),U,1)
+21 SET KND=0
+22 FOR
SET KND=+$ORDER(^PXD(811.2,IEN,20,IND,1,JND,1,KND))
if KND=0
QUIT
Begin DoDot:3
+23 SET CODE=$PIECE(^PXD(811.2,IEN,20,IND,1,JND,1,KND,0),U,1)
+24 SET CODELIST(CODESYS,CODE)=""
End DoDot:3
End DoDot:2
End DoDot:1
+25 QUIT
+26 ;
+27 ;===============
TAXLIST(TAXLIST) ;Return a list of all the defined taxonomies.
+1 NEW IEN,NAME
+2 SET NAME=""
+3 FOR
SET NAME=$ORDER(^PXD(811.2,"B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+4 SET IEN=$ORDER(^PXD(811.2,"B",NAME,""))
+5 SET TAXLIST(NAME)=IEN
End DoDot:1
+6 QUIT
+7 ;