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

BPXRMEXT.m

Go to the documentation of this file.
  1. BPXRMEXT ;IHS/MSC/MGH - Calls to big for other routines. ;13-Aug-2015 12:23;du
  1. ;;2.0;CLINICAL REMINDERS;**1005**;Feb 04, 2005;Build 23
  1. ;==========================================
  1. LEXCHK(CODE,CODESYS,TERM,NCODES,NL,TEXTOUT) ;Use $$TAX^LEX10CS
  1. ;to determine if code is a partial code that expands to a list of
  1. ;codes. Add valid codes to the list.
  1. N ACODE,CODEI,IND,NFOUND,RESULT,SRC,TEXT
  1. K ^TMP("LEXTAX",$J)
  1. ;DBIA #5681
  1. S RESULT=$$TAX^LEX10CS(CODE,CODESYS,DT,"LEXTAX",0)
  1. S NFOUND=+RESULT
  1. I NFOUND=-1 D Q
  1. . S TEXT(1)="Invalid coding system code pair:"
  1. . S TEXT(2)=" Coding system is "_CODESYS_", code is "_CODE
  1. . D EN^DDIOL(.TEXT)
  1. . S NL=NL+1,TEXTOUT(NL)=TEXT(1)
  1. . S NL=NL+1,TEXTOUT(NL)=TEXT(2)
  1. . K ^TMP("LEXTAX",$J)
  1. S SRC=+$O(^TMP("LEXTAX",$J,0))
  1. S CODEI=""
  1. F S CODEI=$O(^TMP("LEXTAX",$J,SRC,CODEI)) Q:CODEI="" D
  1. . S IND=0
  1. . F S IND=$O(^TMP("LEXTAX",$J,SRC,CODEI,IND)) Q:IND="" D
  1. .. S ACODE=$P(^TMP("LEXTAX",$J,SRC,CODEI,IND,0),U,1)
  1. .. S NCODES=NCODES+1
  1. .. S NL=NL+1,TEXTOUT(NL)=$J(NCODES,5)_". "_ACODE
  1. .. S ^TMP($J,"CODES",TERM,CODESYS,ACODE)=""
  1. .. I '$D(^TMP($J,"CC",ACODE,CODESYS,TERM)) D
  1. ... S ^TMP($J,"CC",ACODE,CODESYS,TERM)=""
  1. ... S ^TMP($J,"CC",ACODE)=$G(^TMP($J,"CC",ACODE))+1
  1. ... S NCODES(CODESYS)=NCODES(CODESYS)+1
  1. K ^TMP("LEXTAX",$J)
  1. Q
  1. ;
  1. ;==========================================
  1. PASTECSV(NODE) ;Paste the CSV file.
  1. N DONE,NL,TEMP
  1. K ^TMP($J,NODE)
  1. S DONE=0,NL=0
  1. D EN^DDIOL("Paste the CSV file now, press <ENTER> to finish.")
  1. D EN^DDIOL("","","!") H 1
  1. F Q:DONE D
  1. . R TEMP:10
  1. . I '$T S DONE=1 Q
  1. . I $L(TEMP)=0 S DONE=1 Q
  1. . S NL=NL+1,^TMP($J,NODE,NL,1)=TEMP
  1. Q
  1. ;=================================================
  1. HELP ;Display help for taxonomy edits
  1. N DDS,DIR0,DONE,IND,TEXT
  1. ;DBIA #5746 covers kill and set of DDS. DDS needs to be set or the
  1. ;Browser will kill some ScreenMan variables.
  1. S DDS=1,DONE=0
  1. F IND=1:1 Q:DONE D
  1. . S TEXT(IND)=$P($T(HTEXT+IND),";",3,99)
  1. . I TEXT(IND)="**End Text**" K TEXT(IND) S DONE=1 Q
  1. ;IHS/MSC/MGH Newed Variables
  1. N IOSTBM,IORI
  1. D BROWSE^DDBR("TEXT","NR","Lexicon Selection Help")
  1. S VALMBCK="R"
  1. Q
  1. ;=========================================
  1. HTEXT ;Lexicon selection help text.
  1. ;;Select one of the following actions:
  1. ;;
  1. ;; ADD - adds selected codes to the taxonomy.
  1. ;; RFT - removes selected codes from the taxonomy.
  1. ;; RFD - removes selected codes from being used in a dialog.
  1. ;; UID - adds selected codes to the taxonomy and marks them for use i
  1. ;; SAVE - saves all selected codes. Even if codes have been selected,
  1. ;; not be stored until they are saved. Finally, a save must be
  1. ;; exiting the ScreenMan form or no changes will be saved.
  1. ;; EXIT - saves then exits.
  1. ;;
  1. ;;Some coding systems cannot be used in a dialog; in those cases, the R
  1. ;;actions cannot be selected. Actions that cannot be selected have thei
  1. ;;description surrounded by parentheses. For example, when a coding sys
  1. ;;used in a dialog, the UID action will look like this:
  1. ;; UID Use in dialog
  1. ;;When the coding system cannot be used in a dialog, it will look like
  1. ;; UID (Use in dialog)
  1. ;;
  1. ;;You can select the action first and then be prompted for a list of co
  1. ;;you can input the list and then select the action. Because of the way
  1. ;;Manager works, you may be able to select a larger list by selecting t
  1. ;;first.
  1. ;;
  1. ;;**End Text**
  1. Q
  1. ;--------------------------------------------------------
  1. XSEL ;Entry action for protocol PXRM LEXICON SELECT ENTRY.
  1. N ENUM,IND,LIST,LVALID
  1. S LIST=$P(XQORNOD(0),"=",2)
  1. ;Remove trailing ,
  1. I $E(LIST,$L(LIST))="," S LIST=$E(LIST,1,$L(LIST)-1)
  1. S LVALID=1
  1. F IND=1:1:$L(LIST,",") D
  1. . S ENUM=$P(LIST,",",IND)
  1. . I (ENUM<1)!(ENUM>VALMCNT)!('$D(^TMP("PXRMLEXL",$J,"LINES",ENUM))) D
  1. .. W !,ENUM," is not a valid selection."
  1. .. W !,"The range is 1 to ",$O(^TMP("PXRMLEXL",$J,"LINES",""),-1),"."
  1. .. H 2
  1. .. S LVALID=0
  1. I 'LVALID S VALMBCK="R" Q
  1. ;
  1. ;Full screen mode
  1. D FULL^VALM1
  1. ;Possible actions.
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,OPTION,X,Y
  1. S DIR(0)="SBM"_U_"ADD:Add to taxonomy;"
  1. S DIR(0)=DIR(0)_"RFT:Remove from taxonomy;"
  1. I $$UIDOK^PXRMLEXL D
  1. . S DIR(0)=DIR(0)_"RFD:Remove from dialog;"
  1. . S DIR(0)=DIR(0)_"UID:Use in dialog;"
  1. S DIR("A")="Select Action: "
  1. S DIR("B")="ADD"
  1. S DIR("?")="Select from the actions displayed."
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT) S VALMBCK="R" Q
  1. I $D(DTOUT)!$D(DUOUT) S VALMBCK="R" Q
  1. S OPTION=Y
  1. D CLEAR^VALM1
  1. I OPTION="ADD" D INCX^PXRMLEXL(.LIST,0)
  1. I OPTION="RFD" D RFDX^PXRMLEXL(.LIST)
  1. I OPTION="RFT" D RFTX^PXRMLEXL(.LIST)
  1. I OPTION="UID" D INCX^PXRMLEXL(.LIST,1)
  1. ;
  1. S VALMBCK="R"
  1. Q
  1. SCTDESC(NODE) ;Append the SNOMED hierarchy to the description and then
  1. ;sort the list by description.
  1. N ACTDT,CODEI,CODE,DESC,FSN,HE,HIER,HS,NUM,SRC
  1. K ^TMP($J,"DESC"),^TMP($J,"SORT")
  1. S SRC=$O(^TMP(NODE,$J,0))
  1. S CODEI=""
  1. F S CODEI=$O(^TMP(NODE,$J,SRC,CODEI)) Q:CODEI="" D
  1. . S ACTDT=$P(^TMP(NODE,$J,SRC,CODEI,1),U,1)
  1. . S CODE=$P(^TMP(NODE,$J,SRC,CODEI,1,0),U,1)
  1. . S DESC=$P(^TMP(NODE,$J,SRC,CODEI,1,0),U,2)
  1. .;DBIA #5007
  1. . S FSN=$$GETFSN^LEXTRAN1(SRC,CODE,ACTDT)
  1. . S HS=$F(FSN,"(")
  1. . S HE=$F(FSN,")",HS)
  1. . S HIER=$E(FSN,HS-1,HE-1)
  1. . S DESC=DESC_" "_HIER
  1. . S ^TMP($J,"DESC",DESC,CODEI)=""
  1. S DESC="",NUM=0
  1. F S DESC=$O(^TMP($J,"DESC",DESC)) Q:DESC="" D
  1. . S CODEI=""
  1. . F S CODEI=$O(^TMP($J,"DESC",DESC,CODEI)) Q:CODEI="" D
  1. .. S NUM=NUM+1
  1. .. M ^TMP($J,"SORT",SRC,NUM)=^TMP(NODE,$J,SRC,CODEI)
  1. .. S $P(^TMP($J,"SORT",SRC,NUM,1,0),U,2)=DESC
  1. K ^TMP(NODE,$J)
  1. M ^TMP(NODE,$J)=^TMP($J,"SORT")
  1. K ^TMP($J,"DESC"),^TMP($J,"SORT")
  1. Q
  1. IMPLIST(TAXIEN,TERM,CODESYS,NCODES,NLINES,TEXT) ;Build the list for an
  1. ;imported set of codes.
  1. N ACTDT,CODE,DESC,INACTDT,NUM,PDATA,RESULT
  1. S CODE="",(NCODES,NLINES)=0
  1. F S CODE=$O(^TMP("PXRMCODES",$J,TERM,CODESYS,CODE)) Q:CODE="" D
  1. . K PDATA
  1. .;DBIA #5679
  1. . S RESULT=$$PERIOD^LEXU(CODE,CODESYS,.PDATA)
  1. . I +RESULT=-1 Q
  1. . S NCODES=NCODES+1
  1. . S (ACTDT,NUM)=0
  1. . F S ACTDT=$O(PDATA(ACTDT)) Q:ACTDT="" D
  1. .. S INACTDT=$P(PDATA(ACTDT),U,1)
  1. .. S DESC=PDATA(ACTDT,0)
  1. .. S NUM=NUM+1
  1. .. S NLINES=NLINES+1
  1. .. I NUM=1 S TEXT(NLINES)=NCODES_U_CODE_U_ACTDT_U_INACTDT_U_DESC
  1. .. E S TEXT(NLINES)=U_U_ACTDT_U_INACTDT_U_DESC
  1. Q