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

AICDADK1.m

Go to the documentation of this file.
AICDADK1 ; IHS/OHPRD/ACC - PART 2 OF ADD KEYWORDS TO "OTHER KEYWORDS" FIELD IN ^ICD0/9 ; 
 ;;3.51;IHS ICD/CPT lookup & grouper;;MAY 30, 1991
 ; NOTE: ALL KILLS DONE IN MAIN ROUTINE (AICDADK)
 ;
NONCON D SETLOOP I (+$P(AICDCODE,".",1))=($P(AICDCODE,".",1)) S AICDNUMB=AICDCODE_"001" D SETLOOP
 Q
 ;
CANONIC D SETLOOP S AICDNUMB=AICDCODE_" " D SETLOOP
 Q
 ;
SETLOOP F AICDQ=0:0 S AICDNUMB=$O(@AICDGBL@("AB",AICDNUMB)) Q:AICDNUMB=""  Q:$E(AICDNUMB,1,$L(AICDCODE))'=AICDCODE  D SET
 Q
 ;
GETKWD ; GET WORD STRING AND BUILD WORD TABLE
 K AICDWT S AICDWT=0
 R "Keywords: ",AICDL:DTIME,! S:'$T AICDL=U Q:U[AICDL
 I AICDL="?" D LIST G GETKWD
 I AICDL?.E1C.E W *7,"-- control characters not allowed in input!",! G GETKWD
 F AICDQ=0:0 S AICDNW=$F(AICDL,"~") Q:'AICDNW  S AICDL=$E(AICDL,1,AICDNW-2)_$C(8)_$E(AICDL,AICDNW,255)
 S AICDWT=0 F AICDNW=1:1 S AICDWD=$P(AICDL," ",AICDNW) Q:AICDWD=""  I AICDWD]"",AICDWD'="@",AICDNWS'[("^"_AICDWD_"^") S AICDWT=AICDWT+1,AICDWT(AICDWD)=""
 Q
 ;
LIST ; LIST KEYWORDS FOR CODE
 Q:'AICDCDFN  Q:'$D(@AICDGBL@(AICDCDFN,AICDFLD,"B"))
 S AICDWD=0 F AICDL=0:0 S AICDWD=$O(@AICDGBL@(AICDCDFN,AICDFLD,"B",AICDWD)) Q:AICDWD=""  W AICDWD,!
 Q
 ;
SET ; SET WORDS IN WORD TABLE INTO ^ICD0/9 UNDER 'NCODE'
 S AICDDFN=$O(@AICDGBL@("AB",AICDNUMB,""))
 L @AICDGBL@(AICDDFN,AICDFLD)
 S:'$D(@AICDGBL@(AICDDFN,AICDFLD,0)) ^(0)="^80.999999921A^0^0"
 S AICDCNT=$P(@AICDGBL@(AICDDFN,AICDFLD,0),U,4)
 S AICDWD="" F AICDW=1:1 S AICDWD=$O(AICDWT(AICDWD)) Q:AICDWD=""  D DECIDE
 S $P(@AICDGBL@(AICDDFN,AICDFLD,0),U,4)=AICDCNT
 L
 W:$X'=0 !
 Q
 ;
DECIDE ; DECIDE WHETHER TO SET OR KILL
 S AICDWSV=AICDWD
 I $E(AICDWD)="@" S AICDWD=$E(AICDWD,2,255) D KILLWD S AICDWD=AICDWSV Q
 D SETWD S AICDWD=AICDWSV Q
 ;
KILLWD ; KILL WORD IN ^ICD0/9
 I '$D(@AICDGBL@(AICDDFN,AICDFLD,"B",AICDWD)) W AICDBB," -- '",AICDWD,"' not in ",AICDNUMB,! Q
 S AICDSQN="" F AICDQ=0:0 S AICDSQN=$O(@AICDGBL@(AICDDFN,AICDFLD,"B",AICDWD,AICDSQN)) Q:AICDSQN=""  S AICDCNT=AICDCNT-1 W "." K ^(AICDSQN),@AICDGBL@(AICDDFN,AICDFLD,AICDSQN,0) S AICDEXEC="K @AICDGBL@(""AIHS"",AICDWD,AICDDFN,AICDSQN)" D TOKNDX
 Q
 ;
SETWD ; SET WORD INTO ^ICD0/9
 Q:$D(@AICDGBL@(AICDDFN,AICDFLD,"B",AICDWD))
 D GETSEQ
 S AICDCNT=AICDCNT+1
 S @AICDGBL@(AICDDFN,AICDFLD,AICDSQN,0)=AICDWD
 S @AICDGBL@(AICDDFN,AICDFLD,"B",AICDWD,AICDSQN)=""
 S AICDEXEC="S @AICDGBL@(""AIHS"",AICDWD,AICDDFN,AICDSQN)="""""
 D TOKNDX
 Q
 ;
TOKNDX ; BREAK WORD INTO TOKENS AND INDEX
REMQT S AICDI=$F(AICDWD,"'") I AICDI>0 S AICDWD=$E(AICDWD,1,AICDI-2)_$E(AICDWD,AICDI,255) G REMQT
 I '$F(AICDWD,"-") X AICDEXEC Q
 S AICDWS=AICDWD,AICDWC=""
 F AICDI=1:1 S AICDWF=$P(AICDWD,"-",AICDI) Q:AICDWF=""  Q:$L(AICDWF)>2  S AICDWC=AICDWC_AICDWF
 S:AICDWF'="" AICDWC=AICDWD
 F AICDI=1:1 S AICDWD=$P(AICDWC,"-",AICDI) Q:AICDWD=""  X AICDEXEC
 S AICDWD=AICDWS
 Q
 ;
GETSEQ ; GET NEXT AVAIILABLE SUB-DFN
 F AICDSQN=1:1 Q:'$D(@AICDGBL@(AICDDFN,AICDFLD,AICDSQN))
 Q
 ;
CHKCODE ; CHECK FORMAT OF CODE
 G:AICDGBL="^ICD0" OPCODE
DXCODE S:AICDCODE?3N!(AICDCODE?1U1N.N) AICDCODE=AICDCODE_"."
 Q:(AICDCODE?1"V"2N1".")!(AICDCODE?1"V"2N1"."1N)!(AICDCODE?1"V"2N1"."2N)
 Q:(AICDCODE?1"E"3N1".")!(AICDCODE?1"E"3N1"."1N)!(AICDCODE?1"E"3N1"."2N)
 Q:(AICDCODE?3N1".")!(AICDCODE?3N1"."1N)!(AICDCODE?3N1"."2N)!(AICDCODE?1"."4N)
 S AICDCODE=""
 Q
OPCODE S:AICDCODE?2N AICDCODE=AICDCODE_"."
 Q:(AICDCODE?2N1".")!(AICDCODE?2N1"."1N)!(AICDCODE?2N1"."2N)
 S AICDCODE=""
 Q