source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXA4.m@ 1211

Last change on this file since 1211 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1LEXA4 ;ISA/CJE-Look-up (Loud) Unresolved Narrative ;01-13-00
2 ;;2.0;LEXICON UTILITY;**3,6,15**;Sep 23, 1996;Build 1
3 ; JPK;Added more explanatory help text for display
4 ;
5EN ; User input was not found
6 ; PCH 6 first two lines deleted (Narrative/Exact Match)
7 S LEX("UNR")=+($G(^TMP("LEXSCH",$J,"UNR",0)))
8 ; PCH 3 - Save number of matches found
9 S LEX=+($G(^TMP("LEXSCH",$J,"NUM",0)))
10 ; PCH 3 - "not found" flag
11 N LEXNF S LEXNF=$S(LEX=0:1,1:0)
12 ; Comment out next 2 lines to allow for unresolved narratives
13 ; after the user enters an up-arrow ("^")
14 ; S LEX("RES")=$G(^TMP("LEXSCH",$J,"RES",0))
15 ; I LEX("RES")["^" K LEX("RES"),LEX("NAR"),LEX("UNR") Q
16 S LEX("RES")=$G(^TMP("LEXSCH",$J,"RES",0))
17 I LEX("RES")["^" K LEX("RES"),LEX("NAR"),LEX("UNR") Q
18 ; Quit if:
19 ; User Narrative is NULL LEX("NAR")="" or
20 ; Unresolved not allowed ^TMP("LEXSCH",$J,"UNR",0)=0
21 I $G(LEX("NAR"))=""!($G(LEX("UNR"))=0) D EN^LEXAR("QUIT") Q
22 N LEXN
23 S:'LEXNF LEXN=$$NNS(LEX("NAR")) ; PCH 3 - Prompt for user when matches were found
24 S:LEXNF LEXN=$$NNF(LEX("NAR")) ; PCH 3 - Prompt for user when no matches were found
25 I LEXN["^" D EN^LEXAR(LEXN) Q
26 I +LEXN=1,LEX("UNR")=1 D Q
27 . ; Unresolved pointer when "not found" ; PCH 3 - added
28 . I LEXNF,$L($G(LEX("NAR"))),$L($G(DIC)),$L($G(DUZ)) D Q
29 . . S:+LEXN>0&($G(DIC(0))["F") ^DISV(DUZ,DIC)=LEXN_"^"_LEX("NAR")
30 . . S:DIC(0)["Z" Y(0)=$G(^LEX(757.01,1,0)),Y(0,0)=$P($G(^LEX(757.01,1,0)),"^",1)
31 . . K:'$L($G(Y(0,0))) Y(0,0)
32 . . D SET^LEXAR4(1)
33 . ; Unresolved pointer when not an exact match
34 . I $L($G(LEX("NAR"))),'$L($G(LEX("EXM"))),$L($G(DIC)),$L($G(DUZ)) D
35 . . S:+LEXN>0&($G(DIC(0))["F") ^DISV(DUZ,DIC)=LEXN_"^"_LEX("NAR")
36 . . S:DIC(0)["Z" Y(0)=$G(^LEX(757.01,1,0)),Y(0,0)=$P($G(^LEX(757.01,1,0)),"^",1)
37 . . K:'$L($G(Y(0,0))) Y(0,0)
38 . . D EN^LEXAR(LEX("NAR")),SET^LEXAR4(1)
39 . ; Resolved the pointer if an exact match is found
40 . I $L($G(LEX("NAR"))),$L($G(LEX("EXM"))),$L($G(DIC)),$L($G(DUZ)) D
41 . . S:+($G(LEX("EXM")))>2&($G(DIC(0))["F") ^DISV(DUZ,DIC)=+($G(LEX("EXM")))
42 . . S:DIC(0)["Z" Y(0)=$G(^LEX(757.01,+(LEX("EXM")),0)),Y(0,0)=$P($G(^LEX(757.01,+(LEX("EXM")),0)),"^",1)
43 . . K:'$L($G(Y(0,0))) Y(0,0)
44 . . D EN^LEXAR(+($G(LEX("EXM")))),SET^LEXAR4(+($G(LEX("EXM"))))
45 Q
46NNS(X) ; Narrative not selected (LEX>0)
47 W ! N LEXNARR,LEXANY,LEXPMT1,LEXPMT2,%,%Y S LEXANY="",LEXNARR=X
48 D NNSA Q X
49NNSA ; Use Narrative (anyway)
50 I +($G(LEX("EXM")))=0 D
51 . S LEXPMT1=">>> You have not selected a term from the Lexicon"
52 . S LEXPMT2=$S($L(LEXANY):">>> ",1:" ")_"Use "_LEXNARR_LEXANY
53 I +($G(LEX("EXM")))>0 D
54 . S LEXPMT1=">>> Exact match found"
55 . S LEXPMT2=$S($L(LEXANY):">>> ",1:" ")_"Use "_LEXNARR
56 W:$L(LEXPMT1)&('$L(LEXANY)) !,LEXPMT1 W:$L(LEXANY) !
57 W:$L(LEXPMT2) !,LEXPMT2
58 S %=$S(+($G(LEX("EXM")))>2:1,1:2)
59 D YN^DICN S:%Y["^" X="^" S:%Y["^^" X="^^" Q:X["^" I %=-1 S X=0 Q
60 I '%,+($G(LEX("EXM")))>0 D G NNSA
61 . W !!,"An exact match was found in the Lexicon. By answering"
62 . W !,"""Yes"" you will be selecting the exact match found in"
63 . W !,"Lexicon.",!
64 I '%,+($G(LEX("EXM")))'>0 D G NNSA
65 . W !!,"A suitable term was not found in the Lexicon. By answering"
66 . W !,"""Yes"" you will be keeping your exact text as typed rather than"
67 . W !,"a term from the Lexicon"
68 . S LEXANY=" anyway"
69 I %=1 S X=% Q
70 S X=0 Q
71NNF(X) ; Narrative was not found ; PCH 3 - added
72 W ! N LEXNARR,LEXANY,LEXPMT1,LEXPMT2,LEXPMT3,LEXPMT4,LEXPMT5,%,%Y
73 S LEXANY="",LEXNARR=X
74 D NNFA Q X
75NNFA ; Use Narrative (anyway) ; PCH 3 - added
76 N LEXC,LEXF,LEXV S LEXC=1,LEXF=$G(^TMP("LEXSCH",$J,"FIL",0)),LEXV=$G(^TMP("LEXSCH",$J,"VOC",0))
77 S LEXPMT1=">>> A suitable term was not found based on user input"
78 S:LEXF="I 1" LEXF="" S:$L(LEXF)!(LEXV'="WRD") LEXPMT1=LEXPMT1_" and current defaults"
79 S LEXPMT1=LEXPMT1_"."
80 S LEXPMT2="NOTE : "_$S($L($G(LEXNARR)):"'"_LEXNARR_"' m",1:"You m")
81 S LEXPMT2=LEXPMT2_"ay have found too many matches."
82 S LEXPMT3=" You can refine your search by entering more descriptive text"
83 S LEXPMT4=" (Eg. 'DISEASE' instead of 'DIS') ..."
84 S LEXPMT5=$S($L(LEXANY):">>> ",1:" ")_"Use "_LEXNARR_LEXANY
85 W:$L(LEXPMT1)&('$L(LEXANY)) !,LEXPMT1
86 ; W:$L(LEXANY) !
87 W !!,LEXPMT2,!,LEXPMT3,!,LEXPMT4
88 W:$L(LEXPMT5) !!!,LEXPMT5
89 S %=$S(+($G(LEX("EXM")))>2:1,1:2)
90 D YN^DICN S:%Y["^" X="^" S:%Y["^^" X="^^" Q:X["^" I %=-1 S X=0 Q
91 I '% D G NNFA
92 . W !!,"A suitable term was not found in the Lexicon. By answering"
93 . W !,"""Yes"" you will be keeping the exact text as typed rather than"
94 . W !,"a term from the Lexicon.",!
95 . S LEXANY=" anyway"
96 I %=1 S X=% Q
97 S X=0 Q
Note: See TracBrowser for help on using the repository browser.