source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXAR4.m@ 1674

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1LEXAR4 ; ISL/KER Look-up Response (Select Entry) ; 05/14/2003
2 ;;2.0;LEXICON UTILITY;**4,5,6,25**;Sep 23, 1996
3 ;
4 ; External References
5 ; DBIA 10086 HOME^%ZIS
6 ; DBIA 10063 ^%ZTLOAD
7 ; DBIA 10018 ^DIE
8 ;
9SEL(LEXUR,LEXVDT) ; Select # on list
10 K LEX("SEL") N LEXLVL,LEXMAX,LEXLF S LEXLF=1,LEXMAX=+($G(^TMP("LEXSCH",$J,"LST",0)))
11 S LEX=+($G(LEX)),LEXUR=+($G(LEXUR))
12 I LEXMAX=0!(LEX=0) D EDA^LEXAR G SELQ
13 K LEX("ERR"),LEX("SEL") I LEXUR'>0!(LEXUR>LEXMAX) D G SELQ
14 . S LEX("ERR",0)=+($G(LEX("ERR",0)))+1
15 . S LEX("ERR",LEX("ERR",0))="User response out of range"
16 I '$D(^TMP("LEXHIT",$J,LEXUR)) D G SELQ
17 . S LEX("ERR",0)=+($G(LEX("ERR",0)))+1
18 . S LEX("ERR",LEX("ERR",0))="Selection is either out of range or invalid"
19 N LEXEXP S LEXEXP=+($P(^TMP("LEXHIT",$J,LEXUR),"^",1))
20 I '$D(^LEX(757.01,LEXEXP,0)) D G SELQ
21 . S LEX("ERR",0)=+($G(LEX("ERR",0)))+1
22 . S LEX("ERR",LEX("ERR",0))="Selection not found in the Lexicon"
23 ; Set concept level, if modifiers are allowed build list
24 S LEXLVL=+($G(LEX("LVL"))) I LEXLVL'>1,+LEXEXP>2,$D(^LEX(757.01,+LEXEXP,0)),+($G(^TMP("LEXSCH",$J,"MOD",0)))>0 D EN^LEXAMD(LEXEXP,$G(LEXVDT))
25 ; Quit if modifiers found at next level
26 G:+($G(LEX("LVL")))>LEXLVL SELQ
27 D SET(LEXEXP,$G(LEXVDT)),EDU^LEXAR
28 G SELQ
29SET(LEXEXP,LEXVDT) ; Set LEX("SEL") Nodes
30 K LEX("SEL") D SETEXP^LEXAR5(LEXEXP)
31 N LEXMC S LEXMC=+($P(^LEX(757.01,LEXEXP,1),"^",1))
32 ; If selected from the list increment frequency
33 D:+($G(^TMP("LEXSCH",$J,"LST",0)))>0&(+($G(^TMP("LEXSCH",$J,"APP",0)))>1) INC(LEXMC)
34 N LEXMCE S LEXMCE=+(^LEX(757,LEXMC,0))
35 D SETSRC^LEXAR5(LEXMCE,$G(LEXVDT)),SETDEF^LEXAR5(LEXMCE)
36 D SETSTY^LEXAR5(LEXMC)
37 N LEXE S LEXE=0 F S LEXE=$O(^LEX(757.01,"AMC",LEXMC,LEXE)) Q:+LEXE=0 D
38 . Q:LEXE=LEXEXP D SETEXP^LEXAR5(LEXE),SETSRC^LEXAR5(LEXE,$G(LEXVDT))
39 G:+($G(LEXLF))=0 SELQ
40 Q
41INC(LEXMC) ; Increment frequency counter in ^LEX(757)
42 N LEXF,LEXFQ S LEXMC=+($G(LEXMC)) Q:LEXMC=0 Q:'$D(^LEX(757,LEXMC))
43 S ZTSAVE("LEXMC")="",ZTRTN="FQ^LEXAR4",ZTDESC="Updating Lexicon Frequencies",ZTIO="",ZTDTH=$H
44 D ^%ZTLOAD,HOME^%ZIS K Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN
45 Q
46FQ ; Edit Concept Frequency
47 N LEXA,LEXM,LEXQ,LEXS,DA,DIC,DIE S:$D(ZTQUEUED) ZTREQ="@"
48 S LEXM=+($G(LEXMC)) Q:LEXM=0 Q:'$D(^LEX(757,LEXM,0))
49 I '$D(^LEX(757.001,LEXM,0)) D AFQ G FQQ
50 S LEXQ=+($P($G(^LEX(757.001,LEXM,0)),"^",3)),LEXQ=LEXQ+1
51 S DA=+($G(LEXM)) Q:+DA=0 Q:'$D(^LEX(757.001,DA,0))
52 S LEXM=+($G(LEXMC)) Q:'$D(^LEX(757,LEXMC,0)) S LEXA=0
53 S (DIC,DIE)="^LEX(757.001,",DR="2////^S X=LEXQ"
54EFQ ; Lock record and edit frequency record
55 L +^LEX(757.001,+DA):1 I '$T S LEXA=LEXA+1 H 2 G:LEXA<4 EFQ
56 D:LEXA<4 ^DIE L -^LEX(757.001,+DA)
57 G FQQ
58 Q
59AFQ ; Add frequency record
60 N DIC,DA S ^LEX(757.001,LEXM,0)=LEXM_"^0^0" S DIC="^LEX(757.001,",DA=LEXM D SET^LEXNDX2 Q
61 Q
62FQQ ; Quit Frequency
63 Q
64SELQ ; Quit Selection
65 D:$D(LEX("SEL")) SEL^LEXAR
66 D:$D(LEX("LIST")) LST^LEXAR
67 Q
Note: See TracBrowser for help on using the repository browser.