source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXXFQ.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1LEXXFQ ; ISL/FJF Set Frequencies in 757.001;04/08/03
2 ;;2.0;LEXICON UTILITY;**4,25**;Sep 23, 1996
3 Q
4EN ; Update term frequencies when not found (at site)
5 S ZTRTN="UP^LEXXFQ",ZTDESC="Update Term Frequency in file 757.001"
6 S ZTIO="",ZTDTH=$H
7 D ^%ZTLOAD,HOME^%ZIS
8 K Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN
9 Q
10EN2 ; Reset term frequencies to export values (at IRMFO)
11 S ZTRTN="RE^LEXXFQ",ZTDESC="Reset Term Frequencies in file 757.001"
12 S ZTIO="",ZTDTH=$H
13 D ^%ZTLOAD,HOME^%ZIS
14 K Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN
15 Q
16CHK ; Check frequencies (at site or IRMFO)
17 N LEXI,LEXC S (LEXI,LEXC)=0
18 F S LEXI=$O(^LEX(757,LEXI)) Q:+LEXI=0 S:'$D(^LEX(757.001,LEXI)) LEXC=LEXC+1
19 I '$D(ZTQUEUED) D
20 .W:LEXC>0 !!,LEXC," Concepts do not have frequencies set",!!
21 .W:LEXC'>0 !!,"All concepts have frequencies set",!!
22 Q
23UP ; Update frequencies
24 S:$D(ZTQUEUED) ZTREQ="@"
25 N LEX1,LEX2,LEXU,LEXUC,LEXDC,LEXMA,LEXT,LEXL,LEXH
26 S (LEXDC,LEXU,LEXUC,LEXT,LEXL,LEXMA)=0,LEXH="."
27 S LEX1=$$HACK
28 I '$D(ZTQUEUED) D
29 .W !!,"Initializing Global",!," Start: ",$P(LEX1,"^",2),!," "
30 F S LEXMA=$O(^LEX(757,LEXMA)) Q:+LEXMA=0 D
31 . S:'$D(^LEX(757.001,LEXMA,0)) LEXH="+" S LEXT=LEXT+1,LEXL=LEXMA
32 . W:'$D(ZTQUEUED)&(LEXT#1000=0) LEXH S:LEXT#1000=0 LEXH=".",LEXDC=LEXDC+1
33 . W:'$D(ZTQUEUED)&(LEXDC#76=0)&(LEXDC>0)&(LEXT#1000=0) !," "
34 . I '$D(^LEX(757.001,LEXMA,0)) D SET S LEXUC=LEXUC+1
35 W:'$D(ZTQUEUED) LEXH
36 S:LEXT>0 $P(^LEX(757.001,0),"^",4)=LEXT
37 S:LEXL>0 $P(^LEX(757.001,0),"^",3)=LEXL S:$D(ZTQUEUED) ZTREQ="@"
38 S LEX2=$$HACK
39 I '$D(ZTQUEUED) D
40 .W !," Finished: ",$P(LEX2,"^",2)
41 .W !," Time: ",$$TIME($P(LEX1,"^",1),$P(LEX2,"^",1)),!
42 Q
43RE ; Reset frequencies
44 S:$D(ZTQUEUED) ZTREQ="@"
45 N LEXMA,LEXT,LEXL S (LEXT,LEXL,LEXMA)=0
46 F S LEXMA=$O(^LEX(757,LEXMA)) Q:+LEXMA=0 S LEXT=LEXT+1,LEXL=LEXMA D SET
47 S:LEXT>0 $P(^LEX(757.001,0),"^",4)=LEXT
48 S:LEXL>0 $P(^LEX(757.001,0),"^",3)=LEXL S:$D(ZTQUEUED) ZTREQ="@" Q
49SET ; Set frequency
50 N DIK,DIC,DA,LEXFQ
51 S LEXMA=+($G(LEXMA))
52 Q:'$D(^LEX(757,LEXMA,0))
53 S DIC="^LEX(757.001,",DA=LEXMA,LEXFQ=+($$FQ(LEXMA))
54 D:$D(^LEX(757.001,DA)) KILL^LEXNDX2
55 S ^LEX(757.001,LEXMA,0)=LEXMA_"^"_LEXFQ_"^"_LEXFQ
56 D SET^LEXNDX2
57 Q
58FQ(LEXX) ; Frequency
59 ;
60 ; LEXSAB Source Abbreviation
61 ; LEXSMC Semantic Class
62 ; LEXNUR Nursing Class
63 ; LEXBEH Behavior/Mental Health Class
64 ; LEXPRO Procedural Class
65 ; LEXDIA Diagnostic Class
66 ; LEXSA IEN Source Code (ICD, CPT, DSM, etc)
67 ; LEXMC IEN Major Concept
68 ; LEXSO Code
69 ;
70 N LEXMC S LEXMC=+($G(LEXX)) Q:'$D(^LEX(757,LEXMC,0)) 0 Q:LEXMC<3 0
71 N LEXSA,LEXSAB,LEXSMC,LEXNUR,LEXBEH,LEXPRO,LEXDIA,LEXSO
72 S (LEXSA,LEXNUR,LEXBEH,LEXPRO,LEXDIA)=0
73 F S LEXSA=$O(^LEX(757.02,"AMC",LEXMC,LEXSA)) Q:+LEXSA=0 D
74 . S LEXSO=$P(^LEX(757.02,LEXSA,0),"^",2)
75 . Q:+$$STATCHK^LEXSRC2(LEXSO)=0
76 . S LEXSAB=+($P($G(^LEX(757.02,LEXSA,0)),"^",3)) Q:LEXSAB=0
77 . Q:LEXSAB>15 S:LEXSAB=1 LEXDIA=1
78 . S:LEXSAB>1&(LEXSAB<5) LEXPRO=1
79 . S:LEXSAB>4&(LEXSAB<7) LEXBEH=1
80 . S:LEXSAB>10&(LEXSAB<16) LEXNUR=1
81 S LEXSMC=$$SM(LEXMC),LEXX=0 I LEXDIA=1 S LEXX=4 Q LEXX
82 I LEXBEH=1!(LEXSMC=1) S LEXX=3 Q LEXX
83 I LEXPRO=1 S LEXX=2 Q LEXX
84 I LEXNUR=1 S LEXX=1 Q LEXX
85 Q LEXX
86SM(LEXX) ; Semantic Map (757.1)
87 N LEXMC,LEXCL,LEXSA
88 S LEXSA=0,LEXMC=+($G(LEXX)),LEXX=0
89 Q:'$D(^LEX(757,LEXMC,0)) 0
90 F S LEXSA=$O(^LEX(757.1,"B",LEXMC,LEXSA)) Q:+LEXSA=0 D
91 .S LEXCL=+($P($G(^LEX(757.1,LEXSA,0)),"^",2))
92 .I LEXCL=3!(LEXCL=6) S LEXX=1
93 Q LEXX
94HACK(LEXX) ; Time Hack
95 N X,%,%H,%I
96 N HACK D NOW^%DTC S HACK=$$FMTE^XLFDT(%,1),HACK=$TR(HACK,"@"," ")
97 S LEXX=%_"^"_HACK Q LEXX
98TIME(LEXBEG,LEXEND) ; Elapsed time from begining to end
99 S LEXBEG=+($G(LEXBEG)) Q:LEXBEG=0 "" S LEXEND=+($G(LEXEND)) Q:LEXBEG=0 ""
100 S LEXBEG=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3) S:$L($P(LEXBEG,":",1))=1 $P(LEXBEG,":",1)="0"_$P(LEXBEG,":",1) S LEXBEG=$TR(LEXBEG," ","0")
101 Q LEXBEG
Note: See TracBrowser for help on using the repository browser.