| 1 | LEXDFSS ; ISL Default Filter - Semantics/Sources   ; 09-23-96
 | 
|---|
| 2 |  ;;2.0;LEXICON UTILITY;;Sep 23, 1996
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; Entry:  S X=$$EN^LEXDFSS
 | 
|---|
| 5 |  ;
 | 
|---|
| 6 |  ; LEXFIL    Filter (executable)
 | 
|---|
| 7 |  ; LEXNAM    Filter Name
 | 
|---|
| 8 |  ; LEXPRO    Y/N response to proceed with building filter
 | 
|---|
| 9 |  ; LEXSTR    Filter parameters (string)
 | 
|---|
| 10 |  ; LEXSRC    Classification system (sources) portion of filter
 | 
|---|
| 11 |  ; LEXSTY    Semantic Class/Type portion of filter
 | 
|---|
| 12 |  ; LEXX      Filter returned
 | 
|---|
| 13 |  ;
 | 
|---|
| 14 | EN(LEXX) ; Entry point S X=$$EN^LEXDFSS
 | 
|---|
| 15 |  N LEXSTY,LEXSRC,LEXFIL,LEXPRO
 | 
|---|
| 16 |  S (LEXSTY,LEXSRC,LEXX)="",LEXFIL=0 D INTRO S LEXPRO=$$PRO
 | 
|---|
| 17 |  Q:LEXPRO["^" LEXPRO Q:LEXPRO'=1 "^No filter selected"
 | 
|---|
| 18 |  S LEXSTY=$$EN^LEXDFSB Q:LEXSTY["^^" "^^"
 | 
|---|
| 19 |  S LEXFIL=0 S LEXSRC=$$EN^LEXDCCC Q:LEXSRC["^^" "^^"
 | 
|---|
| 20 |  Q:$P(LEXSTY,"^",1)="" "^No filter selected"
 | 
|---|
| 21 |  S LEXSTY=$P(LEXSTY,"^",1),LEXSRC=$P(LEXSRC,"^",1)
 | 
|---|
| 22 |  Q:'$L((LEXSTY_LEXSRC)) "^No filter selected"
 | 
|---|
| 23 |  S LEXFIL=1 I $L(LEXSTY),'$L(LEXSRC) D
 | 
|---|
| 24 |  . N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT W !
 | 
|---|
| 25 |  . S DIR("A",1)="You have selected semantic classes/types to Include/Exclude in your filter"
 | 
|---|
| 26 |  . S DIR("A",2)="but have not selected any classification coding systems to include in the"
 | 
|---|
| 27 |  . S DIR("A",3)="filter.  Do you want to contine to build the filter based solely on the"
 | 
|---|
| 28 |  . S DIR("A")="semantic classes/types you selected?  "
 | 
|---|
| 29 |  . S DIR("B")="YES",DIR("?")="Answer Yes or No",DIR(0)="YAO" D ^DIR
 | 
|---|
| 30 |  . K DIR S LEXFIL=0,LEXX="^^" S:+Y>0 LEXFIL=+Y,LEXX=""
 | 
|---|
| 31 |  D:LEXFIL ASSEM Q LEXX
 | 
|---|
| 32 | INTRO ; Introduction/Proceed
 | 
|---|
| 33 |  N LEXSAB D SAB W @IOF
 | 
|---|
| 34 |  ;W !,"FILTER BY BOTH SEMANTIC CLASSES/TYPES AND CLASSIFICATION CODES"
 | 
|---|
| 35 |  W !!,"This search filter is in two segments.  The first segment limits the search"
 | 
|---|
| 36 |  W !,"based on the semantical classification of the terms.  The second segment "
 | 
|---|
| 37 |  W !,"limits the search based on classification coding systems."
 | 
|---|
| 38 |  W !!,"First, you will be provided with ",($P(^LEX(757.11,0),U,4))-1," semantic classes.  By selecting"
 | 
|---|
| 39 |  W !,"a semantic class, each term which is found during a search of the "
 | 
|---|
| 40 |  W !,"Lexicon, and belongs to that class, will be displayed for your selection."
 | 
|---|
| 41 |  W !,"Additionally, each semantic class contains semantic types (or sub-categories)"
 | 
|---|
| 42 |  W !,"which may be excluded during the search  Terms belonging to an ""included"" "
 | 
|---|
| 43 |  W !,"semantic class will be displayed unless they also belong to an ""excluded"" "
 | 
|---|
| 44 |  W !,"semantic type.  This segment is mandatory (can not be null)."
 | 
|---|
| 45 |  ;
 | 
|---|
| 46 |  W !!,"Secondly, you will be presented with ",LEXSAB," classification systems to include."
 | 
|---|
| 47 |  W !,"By selecting a classification system to include (i.e., ICD), any term which"
 | 
|---|
| 48 |  W !,"is linked to a code from that system will be displayed for selection.  "
 | 
|---|
| 49 |  W !,"Inclusion by classification code will over ride ""exclusion by sematical"
 | 
|---|
| 50 |  W !,"class or type"".  This segment is optional (may be null)."
 | 
|---|
| 51 |   K LEXSAB
 | 
|---|
| 52 |  Q
 | 
|---|
| 53 | SAB N LEXI S LEXI="",LEXSAB=0
 | 
|---|
| 54 |  F  S LEXI=$O(^LEX(757.03,"B",LEXI)) Q:LEXI=""  D
 | 
|---|
| 55 |  . Q:'$D(^LEX(757.02,"ASRC",$E(LEXI,1,3)))
 | 
|---|
| 56 |  . S:'$D(^TMP("LEXTSAB",$J,$E(LEXI,1,3))) ^TMP("LEXTSAB",$J,$E(LEXI,1,3))="",LEXSAB=LEXSAB+1
 | 
|---|
| 57 |  K ^TMP("LEXTSAB",$J)
 | 
|---|
| 58 |  Q
 | 
|---|
| 59 | PRO(LEXX) ; OK to proceed Y/N
 | 
|---|
| 60 |  N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT W !!
 | 
|---|
| 61 |  S DIR("A")="Do you wish to continue:  ",DIR("B")="YES"
 | 
|---|
| 62 |  S DIR("?")="Answer Yes or No",DIR("??")="^D PROH^LEXDFSS"
 | 
|---|
| 63 |  S DIR(0)="YAO" D ^DIR S LEXX=Y Q LEXX
 | 
|---|
| 64 | PROH ; Proceed help
 | 
|---|
| 65 |  W !!,?2,"Answer"
 | 
|---|
| 66 |  W !!,?4,"Yes     Build a filter based Semantic Types and Classification Codes"
 | 
|---|
| 67 |  W !,?4,"No      Exit without building a filter",! Q
 | 
|---|
| 68 | ASSEM ; Assemble the return value FILTER^NAME
 | 
|---|
| 69 |  N LEXSTR,LEXNAM,LEXFIL S (LEXNAM,LEXFIL)=""
 | 
|---|
| 70 |  I $L($G(LEXSTY)),$D(LEXSRC) D
 | 
|---|
| 71 |  . S LEXSTR=LEXSTY
 | 
|---|
| 72 |  . I $L($G(LEXSRC)),$G(LEXSRC)'[U S LEXSTR=LEXSTY_";"_LEXSRC
 | 
|---|
| 73 |  . S LEXFIL="I $$SC^LEXU(Y,"_""""_LEXSTR_""""_")"
 | 
|---|
| 74 |  I LEXFIL[U S LEXNAM=$$NAME^LEXDM3 I LEXNAM="^^" S LEXX="^^"
 | 
|---|
| 75 |  S:LEXX["^^" LEXFIL="",LEXNAM="^" S LEXX=LEXFIL_"^"_LEXNAM Q
 | 
|---|