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

BQITAXX.m

Go to the documentation of this file.
BQITAXX ;PRXM/HC/ALA-Enter New Taxonomies ; 16 May 2006  10:27 AM
 ;;2.4;ICARE MANAGEMENT SYSTEM;;Apr 01, 2015;Build 41
 ;
 Q
 ;
LST(DATA,REG) ; EP -- BQI GET TAXONOMY LIST
 ; Input
 ;  REG - Retrieves taxonomies for a particular registry.  
 ;        If left blank, it retrieves taxonomies for iCare.
 ;
 ;  Gets the list of taxonomies defined for iCare
 ;
 NEW UID,II,TIEN,TTXT,BQIH,TAXV,X,ID,USER,TXIEN,CAT,CN,PROC,TAXNM,SORT,TAX
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQITXLST",UID)),SORT=$NA(^TMP("BQITXSRT",UID))
 K @DATA,@SORT
 ;
 S REG=$G(REG,"")
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQITAXX D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00030TAXONOMY_NAME^T00015TAXONOMY_IEN^T00020TAX_CATEGORY^T00003TAX_SITE_DEFINED^T00030TAX_ID^T00003TAX_ITEMS^T00030REGISTER^T00003USER_EDITABLE"_$C(30)
 ;
 I REG'="" D
 . I REG'?.N S REG=$$FIND1^DIC(90507,"","",REG,"B","","")
 . D RGS
 ;
 I REG="" D
 . D ALL^BQITAXX4
 . D ICARE
 . D CMET^BTPWTAX
 . S REG=0
 . F  S REG=$O(^BQI(90507,REG)) Q:'REG  D
 .. I $P(^BQI(90507,REG,0),U,8)=1 Q
 .. D RGS
 ;
 S II=0,TAX=""
 F  S TAX=$O(@SORT@(TAX)) Q:TAX=""  D
 . S CAT="" F  S CAT=$O(@SORT@(TAX,CAT)) Q:CAT=""  D
 .. S ID="" F  S ID=$O(@SORT@(TAX,CAT,ID)) Q:ID=""  S II=II+1,@DATA@(II)=@SORT@(TAX,CAT,ID)_$C(30)
 ;
 D SNOM
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ICARE ; Get taxonomies for iCare
 Q  S TTXT="",BQIH=$$SPM^BQIGPUTL()
 F  S TTXT=$O(^BQI(90508,BQIH,10,"B",TTXT)) Q:TTXT=""  D
 . S TIEN=""
 . F  S TIEN=$O(^BQI(90508,BQIH,10,"B",TTXT,TIEN)) Q:TIEN=""  D
 .. NEW DA,IENS
 .. S DA(1)=BQIH,DA=TIEN,IENS=$$IENS^DILF(.DA)
 .. S II=II+1
 .. S ID=$$GET1^DIQ(90508.03,IENS,.05,"I")
 .. S USER=$S(ID="CM":"YES",1:"NO")
 .. I ID="CM" S TXIEN=$O(^ATXAX("B",TTXT,"")),USER="NO" I TXIEN'="" S USER=$S(DUZ=$P(^ATXAX(TXIEN,0),U,5):"YES",1:"NO")
 .. S TAXN=$$GET1^DIQ(90508.03,IENS,.02,"I"),CAT=$$GET1^DIQ(90508.03,IENS,.03,"E")
 .. S SITE=$S($$GET1^DIQ(90508.03,IENS,.04,"I")=1:"YES",1:"NO"),ID=$$GET1^DIQ(90508.03,IENS,.05,"E")
 .. S ITEM=$S($$GET1^DIQ(90508.03,IENS,.02,"I")="":"MIS",$$GET1^DIQ(90508.03,IENS,.07,"I")=1:"YES",'$$ENTRS($$GET1^DIQ(90508.03,IENS,.02,"I")):"NO",1:"YES")
 .. S REGS=""
 .. S @SORT@(TTXT,CAT,ID)=TTXT_U_TAXN_U_CAT_U_SITE_U_ID_U_ITEM_U_REGS_U_USER
 .. ;S @DATA@(II)=TTXT_"^"_$$GET1^DIQ(90508.03,IENS,.02,"I")_"^"_$$GET1^DIQ(90508.03,IENS,.03,"E")
 .. ;S @DATA@(II)=@DATA@(II)_"^"_$S($$GET1^DIQ(90508.03,IENS,.04,"I")=1:"YES",1:"NO")_"^"_$$GET1^DIQ(90508.03,IENS,.05,"E")
 .. ;S @DATA@(II)=@DATA@(II)_"^"_$S($$GET1^DIQ(90508.03,IENS,.02,"I")="":"MIS",$$GET1^DIQ(90508.03,IENS,.07,"I")=1:"YES",'$$ENTRS($$GET1^DIQ(90508.03,IENS,.02,"I")):"NO",1:"YES")_"^^"_USER_$C(30)
 Q
 ;
RGS ; Get taxonomies for registers
 S TIEN=0
 F  S TIEN=$O(^BQI(90507,REG,10,TIEN)) Q:'TIEN  D
 . NEW DA,IENS
 . S DA(1)=REG,DA=TIEN,IENS=$$IENS^DILF(.DA)
 . S ID=$$GET1^DIQ(90507.01,IENS,.05,"I"),TTXT=$$GET1^DIQ(90507.01,IENS,.01,"E")
 . S USER=$S(ID="CM":"YES",1:"NO")
 . I ID="CM" S TXIEN=$O(^ATXAX("B",TTXT,"")) I TTXT'="" S USER=$S(DUZ=$P(^ATXAX(TXIEN,0),U,5):"YES",1:"NO")
 . ;S BQITAX(TAXNM,CAT,ID)=TAXNM_U_TAXN_U_CAT_U_SITE_U_ID_U_ITEM_U_U_USER
 . S TAXN=$$GET1^DIQ(90507.01,IENS,.02,"I"),CAT=$$GET1^DIQ(90507.01,IENS,.03,"E")
 . S SITE=$S($$GET1^DIQ(90507.01,IENS,.04,"I")=1:"YES",1:"NO"),ID=$$GET1^DIQ(90507.01,IENS,.05,"E")
 . S ITEM=$S($$GET1^DIQ(90507.01,IENS,.02,"I")="":"MIS",$$GET1^DIQ(90507.01,IENS,.06,"I")=1:"YES",'$$ENTRS($$GET1^DIQ(90507.01,IENS,.02,"I")):"NO",1:"YES")
 . S REGS=$$GET1^DIQ(90507,REG_",",.01,"E")
 . S @SORT@(TTXT,CAT,ID)=TTXT_U_TAXN_U_CAT_U_SITE_U_ID_U_ITEM_U_REGS_U_USER
 . ;S @DATA@(II)=TTXT_"^"_$$GET1^DIQ(90507.01,IENS,.02,"I")_"^"_$$GET1^DIQ(90507.01,IENS,.03,"E")
 . ;S @DATA@(II)=@DATA@(II)_"^"_$S($$GET1^DIQ(90507.01,IENS,.04,"I")=1:"YES",1:"NO")_"^"_$$GET1^DIQ(90507.01,IENS,.05,"E")
 . ;S @DATA@(II)=@DATA@(II)_"^"_$S($$GET1^DIQ(90507.01,IENS,.02,"I")="":"MIS",$$GET1^DIQ(90507.01,IENS,.06,"I")=1:"YES",'$$ENTRS($$GET1^DIQ(90507.01,IENS,.02,"I")):"NO",1:"YES")_"^"_$$GET1^DIQ(90507,REG_",",.01,"E")_U_USER_$C(30)
 Q
 ;
SNOM ;EP - Get SNOMED subsets
 ;NEW BQILIST,BSN
 S BQILIST=$NA(^TMP("BQISNLST",$J)) K @BQILIST
 D SUBSET^BSTSAPIA(BQILIST,"36^1")
 S BSN=0
 F  S BSN=$O(@BQILIST@(BSN)) Q:BSN=""  D
 . S II=II+1
 . S @DATA@(II)=@BQILIST@(BSN)_"^"_@BQILIST@(BSN)_";BSTS^SNOMED Subset^NO^SNOMED Subset^YES^^NO"_$C(30)
 K @BQILIST
 Q
 ;
ENTRS(TAXV) ;EP - Find if any entries in a taxonomy
 ;
 ;Input
 ;  TAXV - Taxonomy internal entry number
 ;
 NEW IEN,GLOBAL
 I TAXV="" Q 0
 S IEN=$P(TAXV,";",1),GLOBAL="^"_$P(TAXV,";",2)_IEN_")"
 I $O(@GLOBAL@(21,0))'="" Q 1
 Q 0
 ;
GREF(VAL) ; EP - Returns the file number
 NEW GL,FILN
 S GL="^"_$P(VAL,";",2)_"0)"
 S FILN=$P($G(@GL),U,2)
 S FILN=$$STRIP^XLFSTR(FILN,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
 Q FILN