ICDSAPI ;ISL/KER - ICD Search API ;04/21/2014
;;18.0;DRG Grouper;**57**;Oct 20, 2000;Build 7
;
; Global Variables
; None
;
; External References
; ^DIC ICR 10006
;
EN ; Main Entry Point
HELP ; Developer Help for an API
D HLP^ICDEXH("SDD") Q
;
SEARCH(FILEID,SCREEN,DISFIL,DATE) ;
;
; Input:
;
; FILEID This can be either a file number, a file root,
; a file identifier, a coding system or a source
; abbreviation that can be resolved to a file
; number. FILEID may be in the form of a file
; number, a global root, a coding system (1, 2,
; 30 OR 31), a source abbrevation (ICD, ICP,
; 10D or 10P) or a mnemonic (DIAG or PROC).
;
; SCREEN This is a string of MUMPS code that is
; executed to screen an entry from selection.
; It must contain an IF statement to set the
; value of $T. Those entries that the IF
; statement sets $T to 0 (false) will not be
; displayed or selectable.
;
; DISFIL A string of alphabetic characters which
; alter how the lookup responds. Default
; value "AEMQZ". DIC(0) will be set to the
; contents of this parameter.
;
; Parameters applicable to a versioned file
;
; A Ask the entry; if erroneous, ask again
; B Only the B index is used
; E Echo information
; F Forget the lookup value
; I Ignore the special lookup program
; M Multiple-index lookup allowed
; N Uppercase, IEN lookup allowed (not forced)
; O Only find one entry if it matches exactly
; S Suppresses display of .01
; T Search until user selects or enters ^^
; X EXact match required
; Z Zero node in Y(0), external form in Y(0,0)
;
; Parameters not Applicable to a versioned file
; and ignored by this lookup
;
; C Versioned cross-references not turned off
; K Primary Key not established
; L Learning a new entry LAYGO not allowed
; n ICD has no pure numeric entries
; Q Input is pre-processed, ?? not necessary
; U All values are external
; V Verification is not optional
;
; DATE Versioning Date (Fileman format)
;
; If supplied only active codes on that date
; will be included in the selection list.
;
; If not supplied, the date will default to
; TODAY and all codes may be selected, active
; and inactive.
;
; In both cases the display will be altered
; based on the date.
;
; ICDFMT Output Format
;
; 1 Fileman, Code and Short Text (default)
;
; 250.00 DMII WO CMP NT ST UNCNTR
;
; 2 Fileman, Code and Description
;
; 250.00 DIABETES MELLITUS WITHOUT
; MENTION OF COMPLICATION, TYPE
; II OR UNSPECIFIED TYPE, NOT
; STATED AS UNCONTROLLED
;
; 3 Lexicon, Short Text and Code
;
; DMII WO CMP NT ST UNCNTR (250.00)
;
; 4 Lexicon, Description and Code
;
; DIABETES MELLITUS WITHOUT MENTION OF
; COMPLICATION, TYPE II OR UNSPECIFIED TYPE,
; NOT STATED AS UNCONTROLLED (250.00)
;
; Output:
;
; $$SEARCH This is the value of Y (below)
;
; Y IEN ^ Code Fileman
;
; or
;
; -1 iF not found
;
; If DISFIL/DIC(0) containg the character "Z"
;
; Y(0) 0 Node Fileman
; Y(0,0) Code Fileman
; Y(0,1) $$ICDDX or $$ICDOP Non-Fileman
; Y(0,2) Long Description Non-Fileman
;
N ROOT,FILE,SYS,ICDVDT
S FILE=$$FILE^ICDEX($G(FILEID)) Q:+FILE'>0 -1
S (DIC,ROOT)=$$ROOT^ICDEX(FILE) Q:'$L(ROOT) -1
S DIC("S")=$S($L($G(SCREEN)):$G(SCREEN),1:"I 1")
S:$G(DATE)?7N ICDVDT=$G(DATE)
S SYS=$$SYS^ICDEX(FILE,$G(ICDVDT)) S:+SYS>0 ICDSYS=+SYS
S DISFIL=$G(DISFIL,"AEMQZ") S DISFIL=$TR(DISFIL,"L","") K DLAYGO
S DIC(0)=DISFIL D ^DIC S:+($G(Y))'>0 Y=-1 K DIC,ICDSYS,ICDFMT
Q Y
ICDSAPI ;ISL/KER - ICD Search API ;04/21/2014
+1 ;;18.0;DRG Grouper;**57**;Oct 20, 2000;Build 7
+2 ;
+3 ; Global Variables
+4 ; None
+5 ;
+6 ; External References
+7 ; ^DIC ICR 10006
+8 ;
EN ; Main Entry Point
HELP ; Developer Help for an API
+1 DO HLP^ICDEXH("SDD")
QUIT
+2 ;
SEARCH(FILEID,SCREEN,DISFIL,DATE) ;
+1 ;
+2 ; Input:
+3 ;
+4 ; FILEID This can be either a file number, a file root,
+5 ; a file identifier, a coding system or a source
+6 ; abbreviation that can be resolved to a file
+7 ; number. FILEID may be in the form of a file
+8 ; number, a global root, a coding system (1, 2,
+9 ; 30 OR 31), a source abbrevation (ICD, ICP,
+10 ; 10D or 10P) or a mnemonic (DIAG or PROC).
+11 ;
+12 ; SCREEN This is a string of MUMPS code that is
+13 ; executed to screen an entry from selection.
+14 ; It must contain an IF statement to set the
+15 ; value of $T. Those entries that the IF
+16 ; statement sets $T to 0 (false) will not be
+17 ; displayed or selectable.
+18 ;
+19 ; DISFIL A string of alphabetic characters which
+20 ; alter how the lookup responds. Default
+21 ; value "AEMQZ". DIC(0) will be set to the
+22 ; contents of this parameter.
+23 ;
+24 ; Parameters applicable to a versioned file
+25 ;
+26 ; A Ask the entry; if erroneous, ask again
+27 ; B Only the B index is used
+28 ; E Echo information
+29 ; F Forget the lookup value
+30 ; I Ignore the special lookup program
+31 ; M Multiple-index lookup allowed
+32 ; N Uppercase, IEN lookup allowed (not forced)
+33 ; O Only find one entry if it matches exactly
+34 ; S Suppresses display of .01
+35 ; T Search until user selects or enters ^^
+36 ; X EXact match required
+37 ; Z Zero node in Y(0), external form in Y(0,0)
+38 ;
+39 ; Parameters not Applicable to a versioned file
+40 ; and ignored by this lookup
+41 ;
+42 ; C Versioned cross-references not turned off
+43 ; K Primary Key not established
+44 ; L Learning a new entry LAYGO not allowed
+45 ; n ICD has no pure numeric entries
+46 ; Q Input is pre-processed, ?? not necessary
+47 ; U All values are external
+48 ; V Verification is not optional
+49 ;
+50 ; DATE Versioning Date (Fileman format)
+51 ;
+52 ; If supplied only active codes on that date
+53 ; will be included in the selection list.
+54 ;
+55 ; If not supplied, the date will default to
+56 ; TODAY and all codes may be selected, active
+57 ; and inactive.
+58 ;
+59 ; In both cases the display will be altered
+60 ; based on the date.
+61 ;
+62 ; ICDFMT Output Format
+63 ;
+64 ; 1 Fileman, Code and Short Text (default)
+65 ;
+66 ; 250.00 DMII WO CMP NT ST UNCNTR
+67 ;
+68 ; 2 Fileman, Code and Description
+69 ;
+70 ; 250.00 DIABETES MELLITUS WITHOUT
+71 ; MENTION OF COMPLICATION, TYPE
+72 ; II OR UNSPECIFIED TYPE, NOT
+73 ; STATED AS UNCONTROLLED
+74 ;
+75 ; 3 Lexicon, Short Text and Code
+76 ;
+77 ; DMII WO CMP NT ST UNCNTR (250.00)
+78 ;
+79 ; 4 Lexicon, Description and Code
+80 ;
+81 ; DIABETES MELLITUS WITHOUT MENTION OF
+82 ; COMPLICATION, TYPE II OR UNSPECIFIED TYPE,
+83 ; NOT STATED AS UNCONTROLLED (250.00)
+84 ;
+85 ; Output:
+86 ;
+87 ; $$SEARCH This is the value of Y (below)
+88 ;
+89 ; Y IEN ^ Code Fileman
+90 ;
+91 ; or
+92 ;
+93 ; -1 iF not found
+94 ;
+95 ; If DISFIL/DIC(0) containg the character "Z"
+96 ;
+97 ; Y(0) 0 Node Fileman
+98 ; Y(0,0) Code Fileman
+99 ; Y(0,1) $$ICDDX or $$ICDOP Non-Fileman
+100 ; Y(0,2) Long Description Non-Fileman
+101 ;
+102 NEW ROOT,FILE,SYS,ICDVDT
+103 SET FILE=$$FILE^ICDEX($GET(FILEID))
IF +FILE'>0
QUIT -1
+104 SET (DIC,ROOT)=$$ROOT^ICDEX(FILE)
IF '$LENGTH(ROOT)
QUIT -1
+105 SET DIC("S")=$SELECT($LENGTH($GET(SCREEN)):$GET(SCREEN),1:"I 1")
+106 IF $GET(DATE)?7N
SET ICDVDT=$GET(DATE)
+107 SET SYS=$$SYS^ICDEX(FILE,$GET(ICDVDT))
IF +SYS>0
SET ICDSYS=+SYS
+108 SET DISFIL=$GET(DISFIL,"AEMQZ")
SET DISFIL=$TRANSLATE(DISFIL,"L","")
KILL DLAYGO
+109 SET DIC(0)=DISFIL
DO ^DIC
IF +($GET(Y))'>0
SET Y=-1
KILL DIC,ICDSYS,ICDFMT
+110 QUIT Y