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

LEXAR.m

Go to the documentation of this file.
  1. LEXAR ;ISL/KER - Look-up (Interpret User Response) ;04/21/2014
  1. ;;2.0;LEXICON UTILITY;**3,19,25,55,80**;Sep 23, 1996;Build 1
  1. ;
  1. ; Global Variables
  1. ; ^TMP("LEXFND" SACC 2.3.2.5.1
  1. ; ^TMP("LEXHIT" SACC 2.3.2.5.1
  1. ; ^TMP("LEXSCH" SACC 2.3.2.5.1
  1. ;
  1. ; External References
  1. ; None
  1. ;
  1. ; User Responses
  1. ;
  1. ; Numeric -----------------------------------------------
  1. ;
  1. ; # Select Entry
  1. ;
  1. ; Numeric^Comment ----------------------------------------
  1. ;
  1. ; IEN^COMMENT Application comment about term
  1. ;
  1. ; Up-Arrow -----------------------------------------------
  1. ;
  1. ; ^# Jump to # on list
  1. ; ^ End dialog with the user
  1. ; ^^ End dialog with the application
  1. ;
  1. ; Question -----------------------------------------------
  1. ;
  1. ; ? Standard help in LEX("HLP")
  1. ; ?? Extended help in LEX("HLP")
  1. ; ?# Definition for # in LEX("HLP")
  1. ;
  1. ; Null ---------------------------------------------------
  1. ;
  1. ; Advance the selection list
  1. ;
  1. ; String -------------------------------------------------
  1. ;
  1. ; Narrative Return and store Unresolved Narrative
  1. ;
  1. ; --------------------------------------------------------
  1. EN(LEXUR,LEXVDT) ; Interpret user response
  1. D VDT^LEXU I '$D(LEX) D APN Q
  1. K LEX("HLP")
  1. N LEXLL,LEXMAX
  1. I $D(LEX("LIST",0)),+$G(^TMP("LEXSCH",$J,"NUM",0))>0 D
  1. .S LEX=+$G(^TMP("LEXSCH",$J,"NUM",0))
  1. I LEXUR="END",+LEX>0 S LEXUR="^"_LEX
  1. S LEXLL=+$G(^TMP("LEXSCH",$J,"LEN",0))
  1. S:LEXLL=0 LEXLL=5
  1. S LEXMAX=+$G(^TMP("LEXSCH",$J,"LST",0))
  1. S LEXUR=$G(LEXUR)
  1. S (LEX("RES"),^TMP("LEXSCH",$J,"RES",0))=LEXUR
  1. S ^TMP("LEXSCH",$J,"RES",1)="User Response"
  1. ; Timed out/Quit
  1. I LEXUR="DTOUT"!(LEXUR="QUIT") D EDA Q
  1. ; Yes/No response list has one entry
  1. I $G(LEX)=1,+LEXUR=0,LEXUR'["^" D
  1. .I $E(LEXUR,1)="Y"!($E(LEXUR,1)="y") S LEXUR=1 Q
  1. .I LEXUR["?" D HLP^LEXAR3 Q
  1. .S LEXUR=""
  1. ; Null (Page Down)
  1. I LEXUR="" D NULL^LEXAR2 D END Q
  1. ; Minus (Page Up)
  1. I $E(LEXUR,1)="-" D LIST^LEXAL2("PGUP") D END Q
  1. ; Help
  1. I LEXUR["?" D HLP^LEXAR3 D END Q
  1. ; Up Arrow
  1. I LEXUR["^",$D(^TMP("LEXSCH",$J)) D UPA^LEXAR2(LEXUR) D END Q
  1. ; Select
  1. I +LEXUR>0,+LEXUR'>LEXMAX D SEL^LEXAR4(+LEXUR,$G(LEXVDT)) D END Q
  1. ; User Unresolved Narrative
  1. I LEXUR=$G(^TMP("LEXSCH",$J,"NAR",0)),+$G(^TMP("LEXSCH",$J,"UNR",0))=1 D D END Q
  1. .D SAVE^LEXAR6
  1. APN ; Application Unresolved Narrative
  1. I LEXUR["^",'$D(^TMP("LEXSCH",$J)),+LEXUR>0,$D(^LEX(757.01,+LEXUR,0)),$L($P(LEXUR,"^",2)) D Q
  1. .K LEX
  1. .D COM^LEXAR6(LEXUR)
  1. D END
  1. Q
  1. END ; End of Interpretation of the Users Response
  1. I $D(^TMP("LEXSCH",$J)) D
  1. .S (LEX("RES"),^TMP("LEXSCH",$J,"RES",0))=LEXUR
  1. .S ^TMP("LEXSCH",$J,"RES",1)="User Response"
  1. I $D(LEX("LIST",0)),+$G(^TMP("LEXSCH",$J,"NUM",0))>0 D
  1. .S LEX=+$G(^TMP("LEXSCH",$J,"NUM",0))
  1. Q
  1. SEL ; Selection made
  1. K LEX("RES"),LEX("ERR"),LEX("LIST"),LEX("MIN"),LEX("MAX"),LEX("MAT"),LEX("HLP")
  1. D NAR,EMF,KLST,KSCH
  1. S:$D(LEX("SEL")) LEX=0
  1. Q
  1. EDU ; End Dialog with the User
  1. D NAR,EMF,KLST,KARL,KSCH
  1. S LEX=0
  1. Q
  1. EDA ; End Dialog with the Application
  1. K LEX
  1. D KLST,KSCH
  1. Q
  1. LST ; List exist
  1. D NAR,MAX,MIN,MAT,EML
  1. Q
  1. ;
  1. KLST ; Kill Global List
  1. ; ^TMP("LEXFND",$J)
  1. ; ^TMP("LEXHIT",$J)
  1. K ^TMP("LEXFND",$J),^TMP("LEXHIT",$J)
  1. Q
  1. KSCH ; Kill Search Variables
  1. ; ^TMP("LEXSCH",$J)
  1. ; PCH 55 - The only way to kill ^TMP("LEXSCH",$J) is exiting LEXA1
  1. Q
  1. KARL ; Kill Array List and supporting variables
  1. ; LEX("LIST"),LEX("MAT"),LEX("MIN"),LEX("MAX")
  1. K LEX("LIST"),LEX("MAT"),LEX("MIN"),LEX("MAX")
  1. K LEX("EXC"),LEX("EXM")
  1. Q
  1. LEX ; Set LEX to the number of entries on the list
  1. S:+$G(^TMP("LEXSCH",$J,"NUM",0))>0 LEX=+$G(^TMP("LEXSCH",$J,"NUM",0))
  1. Q
  1. NAR ; Set LEX("NAR") to the user narrative
  1. K LEX("NAR")
  1. S:$L($G(^TMP("LEXSCH",$J,"NAR",0))) LEX("NAR")=$G(^TMP("LEXSCH",$J,"NAR",0))
  1. Q
  1. MAX ; Set LEX("MAX") to the last entry reviewed by the user
  1. K LEX("MAX")
  1. S:+$G(^TMP("LEXSCH",$J,"LST",0))>0 LEX("MAX")=+$G(^TMP("LEXSCH",$J,"LST",0))
  1. Q
  1. MIN ; Set LEX("MIN") to the first entry reviewed by the user
  1. K LEX("MIN")
  1. S:+$G(LEX("MAX"))>0 LEX("MIN")=1
  1. Q
  1. EML ; Set LEX("EXM") post-selection IEN^Expression text
  1. K LEX("EXM")
  1. S:$L($G(^TMP("LEXSCH",$J,"EXM",2))) LEX("EXM")=$G(^TMP("LEXSCH",$J,"EXM",2))
  1. Q
  1. EMF ; Set LEX("EXM") pre-selection LIST#^Expression text
  1. K LEX("EXM")
  1. I $L($G(^TMP("LEXSCH",$J,"EXM",0))),$L($G(^TMP("LEXSCH",$J,"EXM",1))) D
  1. .S LEX("EXM")=$G(^TMP("LEXSCH",$J,"EXM",0))_"^"_$G(^TMP("LEXSCH",$J,"EXM",1))
  1. Q
  1. MAT ; Set "matches found" string and top of list flag
  1. ; LEX("MAT") # Matches found
  1. ; ^TMP("LEXSCH",$J,"TOL",0) 1 - Top of list
  1. ; 0 - Not top of list
  1. K LEX("MAT")
  1. I $D(LEX("SEL"))!('$D(^TMP("LEXSCH",$J)))!('$D(LEX("LIST"))) Q
  1. N LEXOL,LEXL
  1. S LEXOL=$G(^TMP("LEXSCH",$J,"TOL",0))
  1. S LEXL=$O(LEX("LIST",0))
  1. I LEXOL'=0,LEXL=1 S ^TMP("LEXSCH",$J,"TOL",0)=1
  1. I LEXOL'=0,LEXL'=1 S ^TMP("LEXSCH",$J,"TOL",0)=0
  1. I LEXOL=1,$L($G(^TMP("LEXSCH",$J,"MAT",0))) D
  1. .S LEX("MAT")=$G(^TMP("LEXSCH",$J,"MAT",0))
  1. Q