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

PXRMTXIC.m

Go to the documentation of this file.
  1. PXRMTXIC ;SLC/PKR - Reminder Taxonomy integrity check and repair. ;04/22/2014
  1. ;;2.0;CLINICAL REMINDERS;**26**;Feb 04, 2005;Build 404
  1. ;
  1. ;===================================
  1. CHECKALL ;Check all taxonomies.
  1. N IEN,NAME,TEXT
  1. D MES^XPDUTL("Check the integrity of all reminder taxonomies.")
  1. S NAME=""
  1. F S NAME=$O(^PXD(811.2,"B",NAME)) Q:(NAME="") D
  1. . S IEN=$O(^PXD(811.2,"B",NAME,""))
  1. . S TEXT(1)=" "
  1. . S TEXT(2)="Checking "_NAME_" (IEN="_IEN_")"
  1. . D MES^XPDUTL(.TEXT)
  1. . D INTCHK(IEN)
  1. Q
  1. ;
  1. ;===================================
  1. CHECKONE ;Check selected definitions.
  1. N DIC,DTOUT,DUOUT,IEN,OK,Y
  1. S DIC="^PXD(811.2,"
  1. S DIC(0)="AEMQ"
  1. S DIC("A")="Select Reminder Taxonomy: "
  1. GETTAX ;Get the taxonomy to check.
  1. W !
  1. D ^DIC
  1. I ($D(DTOUT))!($D(DUOUT)) Q
  1. I Y=-1 Q
  1. S IEN=$P(Y,U,1)
  1. D INTCHK(IEN)
  1. G GETTAX
  1. Q
  1. ;
  1. ;===================================
  1. INTCHK(TAXIEN) ;Taxonomy integrity check.
  1. ;Check for search term inconsistencies.
  1. N CODESYS,DA1,IENS,NPROB,NTC,SAVEOK,TC,TCLIST,TEXT
  1. S TC=""
  1. F S TC=$O(^PXD(811.2,TAXIEN,20,"ATC",TC)) Q:TC="" D
  1. . S CODESYS=""
  1. . F S CODESYS=$O(^PXD(811.2,TAXIEN,20,"ATC",TC,CODESYS)) Q:CODESYS="" D
  1. .. S DA1=$P(^PXD(811.2,TAXIEN,20,"ATC",TC,CODESYS),U,1)
  1. .. S TCLIST(DA1,TC,CODESYS)=""
  1. ;Count the number of search terms that were stored and overwritten
  1. ;at DA1. There is a problem if there is more than one.
  1. S DA1=0
  1. F S DA1=$O(TCLIST(DA1)) Q:DA1="" D
  1. . S NTC=0,TC=""
  1. . F S TC=$O(TCLIST(DA1,TC)) Q:TC="" D
  1. .. S NTC=NTC+1
  1. . S TCLIST(DA1)=NTC
  1. S (DA1,NPROB)=0
  1. F S DA1=$O(TCLIST(DA1)) Q:DA1="" D
  1. . I TCLIST(DA1)<2 Q
  1. . S NPROB=NPROB+1
  1. . S NL=0,TC=""
  1. . S NL=NL+1,TEXT(NL)="WARNING: "_TCLIST(DA1)_" different search terms have been stored as the number "_DA1_" search term."
  1. . S NL=NL+1,TEXT(NL)="There can only be one number "_DA1_" search term."
  1. . S NL=NL+1,TEXT(NL)="The search terms were:"
  1. . F S TC=$O(TCLIST(DA1,TC)) Q:TC="" D
  1. .. S CODESYS=""
  1. .. F S CODESYS=$O(TCLIST(DA1,TC,CODESYS)) Q:CODESYS="" D
  1. ... S NL=NL+1,TEXT(NL)=" "_TC_"; coding system - "_CODESYS
  1. D MES^XPDUTL(.TEXT)
  1. ;If there were no problems quit.
  1. I NPROB=0 D MES^XPDUTL("No problems were found.") Q
  1. ;
  1. ;Reconstruct the 20 node using the "ATCC" index.
  1. K ^TMP("PXRMCODES",$J)
  1. M ^TMP("PXRMCODES",$J)=^PXD(811.2,TAXIEN,20,"ATCC")
  1. ;Delete the 20 node, then rebuild it.
  1. K ^PXD(811.2,TAXIEN,20)
  1. S SAVEOK=$$SAVETC^PXRMTXIM(TAXIEN)
  1. I SAVEOK D POSTSAVE^PXRMTXSM(TAXIEN)
  1. K ^TMP("PXRMCODES",$J)
  1. S TEXT="Reconstruction done."
  1. D MES^XPDUTL(.TEXT)
  1. Q
  1. ;