SYSTEM AND METHOD FOR MEDICAL LANGUAGE EXTRACTION AND ENCODING

Abstract: In computerized processing of natural-language medical/clinical data including phrase parsing and regularizing, parameters are referred to whose values can be specified by the user. Thus, a computerized system can be provided with versatility, for the processing of the data originating in diverse domains, for example. Further to a parser (12) and a regularizer (13), the system includes a preprocessor (11), output filters (14) and an encoding mechanism (15).

Description: Description System and Method for Medical Language Extraction and Encoding Background of the Invention This invention relates to natural language processing and, more specifically, to computerized processing of natural-language phrases found in medical/clinical data. Clinical information as expressed by health care personnel is typically provided in natural language, e.g., in English. But, while phrases in natural language are convenient in interpersonal communication, the same typically does not apply to computerized applications such as automated quality assurance, clinical decision support, patient management, outcome studies, administration, research and literature searching. Even where clinical data is available in electronic or computer-readable form, the data may remain inaccessible to computerized systems because of its form as narrative text. For computerized applications, methods and systems have been developed for producing standardized, encoded representations of clinical information from natural-language sources such as findings from examinations, medical history, progress notes, and discharge summaries. Special-purpose techniques have been used in different domains, e.g., general and specialized pathology, radiology, and surgery discharge reports. Of particular further interest is a general approach which is based on concepts and techniques described in the following papers: C. Friedman et al., "A Conceptual Model for Clinical Radiology Reports". In: C. Safran, ed., Seventeenth Symposium for Computer Applications in Medical Care. New York, McGraw-Hill, March 1994, pp. 829-833; C. Friedman et al., "A General Natural-Language Text Processor for Clinical Radiology", Journal of the American Medical Informatics Association. Vol. 1 (April 1994), pp. 161-174; C. Friedman et al., "A Schema for Representing Medical Language Applied to Clinical Radiology", Journal of the American Medical Informatics Association. Vol. 1 (June 1994), pp. 233-248; C. Friedman et al., "Natural Language Processing in an Operational Clinical Information System", Natural Language Engineering. Vol. 1 (March 1995), pp. 83-106. Summary of the Invention A preferred method for computerized processing of natural-language medical/clinical data includes basic steps here designated as phrase parsing and regularizing and, optionally, code selection. Further included, preferably, is a step of pre-processing prior to phrase parsing, and a step of output filtering. Output can be generated in the form of a printout, as a monitor display, as a database entry, or via the "information highway", for example. In processing, one or several parameters are referred to. The parameters are associated with options. To choose an option, the appropriate value is assigned to the parameter. A parameter can have a value by default. Of particular importance is the inclusion of a parameter which is associated with the medical/clinical domain or sub field of the input data. Other parameters may be associated with the level of parsing accuracy desired, whether code selection is desired, the type of filtering, or the format of the output. The method can be expressed in a high-level computer language such as Prolog, for example, for execution as a system on a suitable general-purpose computer. In the following, the method and the system will be referred to by the acronym MedLEE, short for Medical Language Extraction and Encoding. Brief Description of the Drawing Fig. 1 is a diagram of the MedLEE system or "server". Fig. 2 is a diagram of a system or application which has an interface for MedLee. An Appendix hereto includes a printout of computer source code for a portion of MedLEE. Detailed Description of Preferred Embodiments A natural-language phrase included in medical/clinical data is understood as a delimited string comprising natural-language terms or words. The string is computer-readable as obtained, e.g., from a pre-existing database, or from keyboard input, optical scanning of typed or handwritten text, or processed voice input. The delimiter may be a period, a semicolon, an end-of-message signal, a new- paragraph signal, or any other suitable symbol recognizable for this purpose. Within the phrase, the terms are separated by another delimiter, e.g., a blank or another suitable symbol. As a result of phrase parsing, terms in a natural-language phrase are classified, e.g., as referring to a body part, a body location, a clinical condition or a degree of certainty of a clinical condition, and the relationships between the terms are established and represented in a standard form. For example, in the phrase "moderate cardiac enlargement", "moderate" is related to "enlargement" and cardiac is also related to "enlargement". In the interest of versatility and applicability of the system to different domains, parsing is domain specific as a function of the value assigned to a parameter which the system refers to in parsing. Depending on the value of the domain parameter, the appropriate rules can be referred to in parsing by the system. While parsing may be based primarily on semantics or meaning, use of syntactic or grammatical information is not precluded. Regularizing involves bringing together terms which may be discontiguous in a natural-language phrase but which belong together conceptually. Regular forms or composites are obtained. Regularizing may involve reference to a separate knowledge base. For example, from each of the phrases "heart is enlarged", "enlarged heart", "heart shows enlargement" and "cardiac enlargement", a regularizer can generate "enlarged heart". In code selection, which is optional, a common, unique vocabulary term or code is assigned to each regular term by reference to yet another knowledge base which may also be chosen domain specific. For example, in the domain of X-ray diagnostics, the term "cystic disease" has a different meaning as compared with the domain of mammography. Fig. 1 shows a preprocessor module 11 by which natural-language input text is received. The preprocessor uses the lexicon knowledge base 101 and handles abbreviations, which may be domain dependent. With the domain parameter properly set, the preprocessor refers to the proper knowledge base. For example, depending on the domain, the abbreviation "P.E." can be understood as physical examination or as pleural effusion. Also, the preprocessor determines phrase or sentence boundaries, and generates a list form for each phrase for further processing by the parser module 12. The parser module 12 also uses the lexicon 101, and a grammar module 102 to generate intermediate target forms. Thus, in addition to parsing of complete phrases, subphrase parsing can be used to advantage where highest accuracy is not required. In case a phrase cannot be parsed in its entirety, one or several attempts can be made to parse a portion of the phrase for obtaining useful information in spite of some uncertainty. For example, subphrase parsing can be used in surveying discharge summaries. With the parsed forms as input, and using mapping information 103, the phrase regularizer 13 composes regular terms as described above. From the regularized phrases, the filter module 14 deletes information on the basis of parameter settings. For example, a parameter can be set to call for removal of negative findings. The encoder module 15 uses a table of codes 104 to translate the regularized forms into unique concepts which are compatible with a clinical controlled vocabulary. Fig. 2 shows an interface module 21, and the MedLee system 22 of Fig. 1. The interface module 21 may be domain-specific, and it may serve, e.g., to separate formatted sections from non- formatted sections in a report. Also, the interface 22 may serve to pass chosen parameter values to the MedLEE system 22 and to pass output from the MedLEE system. For example, such an interface can be designed for communication over the World-Wide Web or a local network, for input to or output from MedLEE. Conveniently, each module is software-implemented and stored in random-access memory of a suitable computer, e.g., a work-station computer. The software can be in the form of executable object code, obtained, e.g., by compiling from source code. Source code interpretation is not precluded. Source code can be in the form of sequence-controlled instructions as in Fortran, Pascal or "C", for example. Alternatively, a rule-based system can be used such a Prolog, where suitable sequencing is chosen by the system at run-time. An illustrative portion of the MedLEE system is shown in the Appendix in the form of a Prolog source listing with comments. The following is further to the comments. Process_sents with get_inputsents, process_sects and outputresults reads in an input stream, processes sections of the input stream according to parameter settings, and produces output according to the settings. Among parameters supplied to Process_sents are the following: Exam (specifying the domain), Mode (specifying the parsing mode), Amount (specifying the type of filtering), Type (specifying the output format) and Protocol (html or plain). Process_sents is called by another predicate, after user-specified parameters have been processed. Process_sects with get_section and parse_sentences gets each section and generates intermediate output for the sentences in each section. Outputresults with removefromtarg, write, writelines, markupsents and outputhl7 filters output if appropriate, produces output in the appropriate format and optionally including formats tags for selected words of the original sentence, and produces error messages and an end-of-output message. Setargs sets arguments or parameter values based on user input or by default. Removefromtarg filters formatted output by leaving only positive clinical information and by removing negative findings from the formatted output. Another parameter, pare, removes findings associated with past information from the formatted output. Any number of different filters can be included as suitable. Writelines produces one line per finding, in list format. Writeindentform and writeindentform2 produce output in indented form. Markupsents envelopes the original sentence with tags so that the clinical information is highlighted. Different types of information can be highlighted in different colors by use of an appropriate browser program such as Netscape, for example. Outputhl7 converts output to appropriate form for database (xformtodb) and writes out the form in hl7 in coded format. This process uses synonym knowledge and an encoding knowledge base. APPENDIX fail an unknown predicate ■ unknown (_, fail) . op(900, fy, [\+, not, once] ) % same priority and type as \+ op(700, xfx, [\-.~-]) . % same priority and type as ■ or «« dynamic (domain/1) . % domain being processed dynamic(outputform/1) . % form of output (needed to distinguish % markup of text from formatting forms Λ dynamic (currentsect/1) % section for outputting results C CO % Use when testing grammar - use default parameters for section, type, mode 0) testing (Exam, Form,Amount, Infile,θutfile) « - see (In ile) , seen, see(Infile), get_inputsents ( [] ,Toklist) m retractall (domai (_) ) , y j assert (domain(Exam) ) , . -E retractall (paragno (_) ) , c m assert (paragno (1) ) , * H retractall (sentno(_) ) , 30 assert (sentno ( O ) ) , C retractall (output form (_ ) , hi asse rt (outputform ( Form) ) , N> retractall (currentsect (_) ) procesβ_testing(Toklist, Exam,Amount, Outf ile) . proceβs_testing ([],_,_) i - I. process_testing(Tokllst, Exam,Amount, Outfile) i - get_βentence(Toklist, Sent, Rest) , parse_sentences (Sent, Fmtlist,θutfail, Outundefs, OutunSents, tes ting , bp, Kxam,_, _, 0 ) , tel l (Ou tf i le) , wri te_βentences (Sent) , outputform (Type) , outputresu jllttss((FFmmtt:list,θutfail,Outfile,Outundefs,Outfile,OutunSents, Outfile,Amount.Type. Exam, 1, 0,_, exe, plain) , process_testing (Rest, Exam,Amount, Outfile) . process_sents(Exam, Sect, Mode,_, Outfile, Amount, Type,Compno, DocComp, Errf ile, Unfile, Caller, Protocol) :- get_inputsents ( [] ,Toklist) , !, % read in and tokenize input tell (Outf ile) , ( % write out output label If writing using client/βerver model % or if protocol is html (Caller ■ server, I; Protocol - html, I), % beginning of output C write('<html> <head> <title>' ) , 03 writeCOutput Generated by MedLEE'), HJ write('</title> </hβad>' ) , new_line (html) , H write('<body> <H1> Output Generated by MedLEE </Hl> <HR> '), nl, 5j new_line(html) , nl m ; true « >. m (Tokiiβt - 11. t, πj write_message (Errf ile, ' Input Error: No input entered' .Caller, .-» '<HR><H3> Application Message: No Input entered </H3><HR>') £ ; % check for legitimate section header if Sect - 'mixed' r~ Sect ■ mixed, get_section(Toklist,_,_, S,_) , S ■ [], %no header found write_mβssage (Errfile, ' Input Error: No legitimate section header', σ> Caller, '<HR><H3> Application Message: Legitimate section header is missing </H 3><HR>') ; retractall (domai (_) ) , assert (domai (Exam) ) , % used in grammar to permit certain rules retractall (outputform (_)) , assert (outputfor (Type) ) , % used in parser and formatter retractall (currentsect (_)) , % used in formatting output assert (currentsect (Sect) ) , markup (Tokliβt,Toklist2, Sect) , % markup up in certain conditions procβ8s_sects (Toklist2, Sect. Mode, Bxam, Fmtlist, Failed, Undef , UnSent.l), outputresults(Fmtlist, Failed, Errfile, Undef , Unfile, UnSent, Outfile. Amount, Type, Exam, Compno, DocComp,_, Caller, Protocol) ) . % case where there is no more input. proces»_βects ([]._,_,_,[],[],[],[] ,_) :- I. % sections are specified in input - there are several sections in input process_sects (Tokl1s , mixed, Mode, Bxam, Fmtlists, FaiIs, Undefs, UnSents,_) :- S2 get_section (Toklist, Sents.Rest, Sect, Printname) , I , %get section of report {j parse_jeentences (Sents. Fmtlist, Failed, Undef, UnSent, W Sect, Mode, Bxam,_,_, 1) . 1, 3 process_sects (Rest, mixed, Mode, Bxam, Fmtlist2, Fai12, Undef2, C UnSent2,_), nl (outputform (htext) , I, FmtO - [ [section, [Printname] ]] ; % name of section 0) FmtO - [] m >' m append( [FmtO, Fmtlist, Fmtlist2] , Fmtlists) , % list of formatted output ~* append (F i led, Fail2, Fails) , % list of sentences having parsing errors 3J appen (Undef, Unde 2 , Undefs) , % list of words not in lexicon ^ apρend(UnSent,UnSent2,UnSents) . % list of sentences with undefined words. m M % input is a single section process_sects (Toklist, Sect, Mode, Bxam, Fmtlist, Failed, Undef, UnSent,_) : - Sect \» mixed, retractall (paragno(_) ) , assert (paragno(l) ) , retractall (sentno ( )), assert (sentno (0) ) , parse_sentences (Toklist, Fmtlistl, Failed, Undef .UnSent, Sect,Mode,Exam,_,_, 1) . I, (outputform (htext) , Fmtlistl \- [] . 1 , • append( [ [ [section, [Sect] ] ] ] , Fmtlistl, Fmtlist) j outputform (htext) , Fmtlist - [] , I, Fmtlist - [[ [section, [Sect] ]]] ; Fmtlist - Fmtlistl ) . outputresults(FmtliβtO,Failed. Brrflie, Undef, Unflie, UnSent, Outf ile, Amount,Type, Exam,Compno, DocComp, NewCompno, Caller. Protocol) : - (Amount « full, Fmtlist ■ FmtllstO, Ij % do nothing to formatted output %Amount » short, removemodlf ler (F tl iβtO , Fmtlistl) , 1 ι % remove neg and/or old flndngs membe (Amount, [pac, poβ] ) , removefro ta (Amount, Fmtl istO. mtlis l) , I , fixupllβtβ(Fmtllstl, Fmtlist, ype) %produces extra brackets <2 ). 03 (Protocol ■ html, I , Op » htmlj W Caller ■ server, I , Op » html; J - Op - plain) , C (Type - nested, t, write (Fmtlist) , new_llne (Op) j fj| Type » line, I, writelines (Fmtlist,Op) , new_line(θp) , I? O) Type - htext, I, markupsents (Fmtlist) . new_line (Op) , I; ^ Type - indented, I, nl, writeindentform (Fmtlist,Type, Op) , Ij m Type - hl71, 1. write (' <hl7>' ) . ^ outputhl (Fmtlist, Bxam, Outfile, Compno, DocComp, NewCompno,Op) , j5 write(*</hl7>' ) , % end of hl7 part of output r- write (' <line>' ) , m (Fmtlist \- []. writelines (Fmtlist.Op) , 1 σj j true ) , % write non-empty wrlte('</llne>' ) , nl. I; %nested part outputhl7 (Fmtlist, Bxam.Outflie,Compno, DocComp, ewCompno,Op) %default -9,- (Op - html, I, write ('</bodyx/htπιl>' ) ; % end document true) . % (Failed - [] , !; no parsing failures % Errfile • [], !; % don't write problem messages % tell (Errflie), % % write('*** w Grammar Failures in domain '), % % write(Exam) , writeC ****'), nl, % wrlte_sentences (Failed) , nl % ) • % set_argβ: Process options % Argument options % -a Amount of output desired. The choice* are: (A % full (no filtering of output is done) % pos (only positive findings are shown) J? % pac (only current and positive findings are shown) . H % short (certain modifiers are not shown) H * -c Component Number (starting component number for HL7 output H % default is 1) m % -d Component where document number iβ stored (default is 0) ω X % -e Examtype (otherwise default is chestxray) m % -p ProbFile (otherwise default is problem messages are not written to file) ϋ} % -i Infile (If input is supplied by file and not standard input •Sj % -s Section (default is impression) C % - Mode (default is bp; the 6 choices are bp, model • modeS) [^ % -o Outfile (if output should be file and not standard output) f % -? Provide list of default arguments ϋδ % -f or -t Type of output (default is hl7; the choices are: % hl7, nested, line, hl71, htext % The line version has nesting but consists of single % unconnected findings; % The hl71 version has both hl7 ♦ line; each is tagged % -pr Protocol - html or plain % -u Undefs (otherwise default is - undefined messages are not written % to a file) set_args (Args, Bxamtype, Section, Mode, Infile,Outfile. Amount, Type, Component, Startdoc, Prbf lie, Undef, Protocol) : - ι % MEDCODES for descendants of chestxrays member (E, ['10220' , '10221', '27489' , '27618', • 27619', '27620' 10220, 10221, 27489, 27618, 27619, 27620. '27621' , '27622', '27624', '27625', '27626', '27627' 27621, 27622, 27624, 27625, 27626, 27627, '27628', '27629', 2762Θ, 27629, '27630', '27631', '27632' , 27630, 27631, 27632, '40607' , '40676' '40680' , '40682' , '40684' , '40689' 40607, 40676, 40680. 40682, 40684, 40689, '40692', '40744' '40759' , '40762' , '40764', '40829' 40692, 40744, 40759, 40762, 40764, 40829, 9/3 § 0 S -. I set_βtartcom (Args, Startdoc) :• (nexttoC -d' , D, Args) j nextto(d, D, Args) ) , name (0, Dchars) , number_charβ (Startdoc, Dchars) set_startcomp(_, 0) . % default parent finding set_section (Args, Section, Exam ype) - (nextto C - s' , S , Args) ; next to (s , S , Args) ) , ! , % - s or s option sectionis (S, Section, Bxamtype) . set_section (_, ' report impresβion item' , chestxray) . % default section se t_sect ion (_, ' report impresβion item' , roararoography) % default section set_section(_, ' report clinical information ite '.dsum) % default section sectionis ' 34900' ,' report description item' ,_) :- !. co sectionis 34900, 'report description item' ,_) :- I. CD sectionis description, ' report description item',_) :- I. co sectionis ' 34901' ,' report impresβion item' ,_) :• I. H sectionis 34901, ' report impression ltem',_) :- I. H C sectionis Impresβion, ' report impression item' ,_) ι - I . H m sectionis '34902' ,' report clinical information item' ,_) ι- !. n sectionis 34902, ' report clinical information item' ,_) »- I. σ z sectionis 'clinical information' ,' report clinical information item',_) ι- I. ( m rπ sectionis clininfo, ' report clinical information item' ,_) :- !. H sectionis clinical ,' report clinical Information item',_) :- I. sectionis mixed, mixed,_) i- I. % section headers are included In text cr sectionis testing, testing, _) i • ! . m sectionis _,' report impression item' , mammo raphy) :- !. % default section t σ> sectionis _,' report impression item' .chestxray) J- I. sectionis 'discharge diagnoses' ,' report discharge diagnosis item' ,_) i-l. sect ioπiβ 'history of present 11 lness' ,' report history of present illness item' - I . sectionis 'chief complaint' ,' report chief complaint item',_) : - l. sectionis 'past medical history' ,' report past medical history item' ,_) : - I. sectionis 'review of systems' ,' report review of systems item',_) :- I. sect ionl s 'hospital course' ,' report hospital course item',_) ι- I. sectioni s 'physical examination' ,' report physical examination item',_) :- I. sectionis 'social history' ,' report social history item' ,_) :- !. sectionis X,X,dsura) : - ! . set_roode (Args, Mode) :- (nexttoC -m' .M.Args) ; nextto(m,M, Args) ) , models (M, Mode) , 1. aet_jnode (_, bp) . % default output type models (relax, ode2) : • I models (strict, model) t- models (skip, mode4) : - I. models (longest, mode3) :- CO models (best. bp) ι- 1. C models (model .model) : - 1. 00 CO models (mode2,mode2) : - ! . H models (mode3,mode3) : • 1. mode 1 s (mo e , mode ) « - 1. mode i s (mode5 , mo e 5 ) : - 1. co x set_type (Args, Type) :- m m (nexttoC -t' .Type, Args) nexttoC t' .Type, Args) ; H nexttoC -f ' .Type, Args) j nexttoC ' .Type, Args) 3 ), I, % -f ,f, -t, or t option c r- member (Type, [nested, line, lnden ed , hl7,hl71,drg,dsumroary, htext] ) , I . m βet_type (_,hl7) . % default form N> CD set_amount (Args, Amount) :- (nexttoC -a' .Amount, Args) j nexttoC a' .Amount, Args) ) , I. % -a or a option memb r (Amount, [full , short, pacpos) ) , I . set_amoun (_, full) . % default type βet_protocol (Args, Protocol) :- (nexttoC -pr' , Protocol, Args) j nextto Cpr' , Protocol, Args) ) , member (Protocol, [html, plain] ) , I. βet_protocol (_, plain) . βet_undefs (Args, Undef β) i- nexttoC -u' , Undef β, Args) ; nextto (u, Undef s. Args) . I. % undef file option set_undefs (_, []) . % default is no file of undef ineds created set_inf ile (Args, Inf ile) «- nonvar (Inf lie) . I; % Inf ile is set already nexttoC -i' , Infile, Args) . I; nextto (1, Inf ile, Args) , I. co Cc set_inf ile (_, user_input) . % default is standard input CO set_prbf ile (Args, Prbf ile) « H nexttoC -p' , Prbf ile, Args) , 1; nextto (p. Prbf ile, Args) . 1. % prob file option ^ _l set_prbf lie (_, [] ) . % default Is no file of problems is created O m l\J co set_outf ile (Args, Outf ile) m nonvar (Outfile) , I; % Outfile is already set Jϊj nexttoC -o' , Outfile, Args) , I; nextto (o,Outflie, Args) , I. % outflie option .—» set_outfile(_, user_output) . % default Is standard output 3J C r new_line (html) :- write ( '<br>' ) , I. m to new_line (server) «- write ( '<br>' ) , I cι> new_line (exe) :• nl new_line (plain) :- nl. write_message (_,(], exe,_) ι- I. write_message ([],_, exe,_) :- I. write_message(_, {], plain,_) i- I. write_message ( [] ,_, plain,_) :- !. write_message(File, Contents, Caller, Message) :- ( member (Caller, [exe, plain] ) , tell(File), I true), • write (Message) , new_line (Caller) , (Contents » []; write (Contents) , new_line (Caller) ) . write_hlghlight(_, I] ._) :- I. write_highlight (Undef . [Word| UnSent] .Caller) J - member (Caller, [html, serverl ) . I, (member (Word, Unde ) , write C <strong>' ) , wrlte(Word), write (' </strong>' ) ; write (Word) ) , ( sentend( [Word] .Caller) . writβ_highlight (Undef .UnSent, Caller) , I f write (' '), write_hlghlight (Undef. UnSent, Caller) ) . O C wrlte_highllght (Unde , [Word| UnSent] .Caller) t - DO member (Caller, [exe, plain] ) , ϊ?l ls_llst(Word) , I, % bracketed phrase write_highlight (Undef .Word, Caller) , % write out words in phrase C ri te C ' ) , wr 1 te_highl lght (Undef , UnSent, Caller) . m wrlte_highllght (Undef, [Word| UnSent] .Caller) t- C0 member (Caller, [exe, plain] ) , !, m write(Word), % write individual word m ( sentend( [Word] .Caller) . wrlte_highllght (Undef . UnSent,Caller) . Ij writeC '), write_highlight (Undef, UnSent, Caller) ) . write__highllght (_,_, plain) J- write_hlghlight(_,_.exe) t- 1, sentend( [X|_] .Caller) t - meraber(X. ['.'.' j' .'?']) . new_llne (Caller) , I. removemodif iers ([], [] ) ι- I. removemodif iers ([ [sentence. ['']]], [] ) »- I . % at end of file marker removemodif iers ( [ [section, S] |Fmts] . [ [βec ion.S] |NewFmts] ) « - removemodif iers (Fmts.NewFmts) . 1. removemodif iers ( [SI I Rest] , [NewSl |NewRest] ) :- removemodβ (Sl.NewSl) , removemodifiers (Res , NewRest) , !. % removeaods(+Fmts, -NewFmts) » removemods removes certain modifiers from % Fmts when mode is "short" form, resulting in NewFmts removemodβ ([],[]) x - I . removemods ( [ [sentence, S] | Fmts] , [ [sentence, S] | ewFmts] ) t - removemods(Fmtβ, NewFmts) , 1. removemods ( [Fmtl I Rest] , [NewFmtl | NewRest] ) :- chkan remove (Fmtl, ewFmtl) , removemods (Rest, NewRest) , I. %removemodβ ( [ [f inding,demo| L] |Reβt) , [ [f indln ,demo| L] | NewRest] ) t - <Λ % rumovemods (Rent, NewRest) , I. 03 %removemods ( [Fmtl I Rest] , [NewFmtl I NewRest] ) :- O chkandremove( [Fmtl | Rest] . 3 %removef romlist (Fmtl, NewFmtl) , C % removemods (Rest, NewRest) , I. % remaining ones fπ removefromlist ([], [] ) !- I. CO removefromlist ( [Fmtl |Rest] , [NewFmtl I NewRest] ) i- jE chkandremove (Fmtl, NewFmtl) , % formats (- rn removef romlist (Rest, ewRest) , I. _^J chkandremove ( [Type I Rest] , [Type I Rest] ) :- % leave alone l 3 member(Type, [sentence, section] ) , I. r- %chkandremove( [finding,demo|Rest] , [finding, demo| est] ) :- I. % leave alone m chkandremove ( [Type |_] , [] ) : - % remove certain type of formats first o> skiptypes(Type) , 1. chkandremove( [Type, Value] , [Type, Value] ) i- !. % no mods to remove chkandremove (Fmt.NewFmt) :- removemod (Frat.NewFmt) . % removemod (+OneFmt, -NewFmt) : removerood( [Type, Value I Mods] , [Type, Value | NewMods] ) i- process ods (Type, Mods, ewMods) , !. removemod ([],[]) . % check each modifier - leave more modifiers for finding processmods (_, [], []). processmods (Type, [Modi I Rest] .NewMods) :- Type \- finding. chkmodl (Modi , NewMod) , proceβsmodβ (Type, est, NewModβl) , ( NewMod \- [j, append ( [NewMod] .NewModsl, NewMods) ; NewMod - [J , NewMods - NewModβl), I. processmods(f indlng, [Modl|Rest] , NewMods) ι- chkmod2 (Modi, NewMod) . proceββmods (Type, Rest, NewModsl) , ( NewMod \- [], appen ( [NewMod] .NewModsl, NewMods) t NewMod - [] , NewModa - NewModsl), I. chk odK [Typel Rest] .NewMod) t- okmodsl (Type) . NewMod ■ [Type|Rest], I w NewMod - [] . I . C chkmodl ([]. []) . ς j chkmod2 ( [Type | Rest] .NewMod) «- % leave more mods for findings H okmods2 (Type) . NewMod - [Type] es ], I; ! NewMod - [] , I . chkmod2([] . []) . m skiptypes(Type) » - I member (Type. [βtatuβ,prev_lnfo, rel time, normal finding, demo] ) . "J ok odβl (Type) t- —1 member(Type, [status. certainty, odyloc, escriptor, region, sentld, "5J 'section of examination']). C okmods2 (Type) >- rη tneinber (Type, [status , certainty, bodyloc, descriptor, region, sentld, r degree, change, 'βectlon of examination' .age. ethnic. sex, race] ) . removef romtarg (_,[],[] ) i-l. remove romtar (_.[ [sentence. ['']]],[] ) «- I. removef romtar (Amount. (SI | Rest] , em) t- removef ro sent (Amount, SI, ewSl) , removef romtarg (Amount, Rest, NewRest) , (NewSl \- (]. Rem - iNewSl | NewRest] . !j Rem - NewRest, I) . remove romsent (_, [section, S] . [section, S] ) : - retractall (currentsect (_) ) , assert (currentsect (S) ) . removef romsent (_, [ [section. S] ] , [ [section, S] ] ) t - retractall (currentsect (_) ) , αvawr (currentsec (S) ) . removef romsent (Amount, [ [sentence, S) | mts] . [ [sentence.9] | NewKmtβ] ) ι - CO c removef lndngs (Amount, F tβ.NewFrotβ) , I . 03 removef romsent (_,[], [] ) ι- I. _l removefromsent (Amount, Fmts. ewFmts) s- %add extra bracket when there is H removeflndngs (Amount, [Fmts] , NewFmts) . I. % no sentence prefix ^ removeflndngs (_.[],[] ) :• I. m removeflndngs (Amount, [FI |Rest] , Rem) :- O removef indng (Amount, FI, NewFl) , m removef lndngs (Amount, est, NewRest) , J3 (NewFl \» [], Rem - [NewFl | ewRest] , I; r- Rem » NewRest) , 1. c ^ removef indng (Amount, [FI |Rest] , [FI I Rest] ) s- r- m chktypeandpacβ (Amount, [FI I eβt] ) , I. % these formats are positive, curr, not M % normal σ> removefindng (_, F, []) . % this format Is normal, negative, or old %ch ypeandpacβ ( (Type|_J ) :- % member (Type, [sentence, section] ) , !. % leave these alone chktypeandpacu (Amount, [Type, _|Mods] ) :- chktargtype(Type,Mods) , chkpacs (Amount, Mods) . chktargtype (finding, Mods) :- \+ chkfornormal (Mods) , !. % change mod - better, descr mod ■ normal chktargtype (Type._) :- \+ member (Type, [normal f lndlng, status,date. tlmeper, prev_lnfol ) . chkpacs (_, [] ) : - I . chkpacs (Amount, Mods) chkf orpos (Mods) , % remove neg. only; don't filter time ( Amount * pos, ! ; chkf orsect (Mods) , chkforcurdate (Mods) ) . chkfornormal (Mods) : - (setof (X, ember ( [change, X] .Mods) .Changes) , (outputform(htext) , gettargets (Changes, ewchanges) , % target form Newchanges ■ Changes) , member ( [better] , [Newchanges] ) , t ; O c setof (X, ember ( [descriptor, X] .Mods) .Descrs) , 03 (outputform(htext) , gettargets (Descrs, Newdescrs) , I CO H Newdescrs = Descrs) , H member (normal, Newdescrs) , I) . C - chkf orpos (Fmt) t- m ( setof (X, member ( [certainty. X] ,Fmt) .Certs) , I , % certainty modifiers co (outputform (htext) , gettargets (Certs. Newcerts) , x m Newcerts - Certs) , m \+ iβneg (Newcerts) , I; H true) . c chkf orcurβ tat (Mods) :- r (setof (X, member ( [status, X] .Mode) , State) , 1. % status modifiers m (outputfor (htext) . gettargets (Stats, ewβtatβ) , l ; I en Newstats - Stats) , \+ isold(Newβtats) , I ; true) . chkf orsect (Mods) ι - \+ ou tput for (htext) , !, % leave out if past history section \+ ispasthistory (Mods) , I, chkforcurstat (Mods) . % not past history - check status for current chkforsect (Mods) :- % htext mode, check status for current outputform(htext) , ( ispasthistory (Mods) , I; % leave alone if in past history section chkforcurstat (Mods) ) . ispasthistory (Mods) i- member( ['section of examination' ,X] .Mods) , X ■ 'past history report item', !. ispasthistory (Mods) :- currentsect (S) , <2 member(S, ['past history report item', ['PAST MEDICAL HISTORY:.']]) . DO _} chkforcurdate (Mods) :- H \+ chkfordate(Mods) , 3 + chkfor astadm Mods . m ch O member ( [date I _] .Mods) . % dates are generally in the past X m chkforpastadm (_) :- fail. m gettargets ([]. [] ) :- ! gettargets ( [Wl |Rest] . [Tl |Trest] ) : ■ D foundword(Wl._, Tl) , % target for Wl m gettargets (Rest, Trest) , I to σ> isneg(X) : - intersect (X, [no, negative, deny, ' rule out']). lsold(X) i- lntersect (X, [' risk factor' , resolved, nd, previous, ' exposed to', 'positive family history' , future, removed, need, prepare, post, 'negative family history' .hold, ' past history' .postoperative, prepare, 'ran out' ,' treatment option' , 'strong family history', tendency,weaned, withdrawal, avoid, inactive, need, offer, plan, soon] ) . % convert output to database form and write out hl7 with codes outputhl7 (Fmtlist, Exam, Outfile, Compno, DocComp, NewCompno, Caller) : - xformtodb (Fmtlist, Newfmtlist, Exam) , I, % database form writehl7 (Newfmtlist,Outfile, Compno, DocComp, NewCompno, Caller) . % hl7 fixuplists ([], []._) :- !. fixuplists (F, F, htext) :- I. % output is correct for markup fixuplists ( [FI |Rest] .Fixed, Type) :- % remove extra bracket around sentences fixuplists(Rest, NewRest,Type) , append (FI, NewRest. Fixed) , !. % write out one finding in nested form per line writelines ([] ,_) :- I. % no more findings writelines ( [Onefindlng |Moref indingβ] .Caller) : - write (Onefinding) , new_line (Caller) , writelines (More indings, Caller) , 1. writeindentform2 ( [] ,_,_) i- I. W writeindentform2 (Findings, Type. html) :- 00 write (' <pre>' ) , nl, J writeinden fndgs (Findings, Type, plain) , Zj write (' </pre>' ) , nl . C writeindentform2 (Findings, Type, plain) t- m writeindentfndgs(Findingβ, Type, plain) . I. CO writeindβntfndgs ( [] ,_,_) *- I. jjj writeindentfndgs ( [Fl|Reβt] .Type, Op) :- m writeindented(Fl.Typβ.Op) . ^ writeindentfndgβ(Rest,Type,θp) , I. 33 wrlteindentform(Pinding, Type, html) «- I- write('<pre>' ) , nl, m writeindented (Finding, Type, plain) , % in pre mode - new line is recognized gj write C</pre>') , nl. % in html """ writeindentform (Finding, ype, plain) i- writeindented (Finding, ype, plain) . writeindented( [] »_,_) »- I. % no more findings writeindented( [OnefindinglMorefindings] , Type, Caller) »- writeind(θnefindlng, Type, Caller) , writeindented(MorefIndings, Type, Caller) , 1. writeind( [] ,_,_) :-l. writeind( [failure] ,_, Caller) :- wrlteC - -parsing failure--'), %nl, I . new_line (Caller) , I. writeindt [Type. Finding |Modβ] , Output, Caller) J - (Output * indented; Output » dsummary) , I, write (Type), write(':'), write (Finding) , nl. co c %new_line (Caller) , 00 writemods (Mods, 11.Caller) , —I %new_line (Caller) . 2 * while testing DRGs write out findings relevant to DRGs only m writeind([finding,Finding|Mods] ,drg. Caller) :- CO drgch (Finding) , % is Finding relevant for DRG m check ods (Mods) , I, % check that Mod is not certainty » 'no' πi wrlteind( [finding, Finding | Mods] , indented,Caller) . writeind(_,drg,_) :- I. % no output for this finding 33 C writemods ([] ,_,_) :- 1. % no more mods m writemods ( [Onerood|Moremods] . Tabno, Caller) : - writβonemod (Onemod, Tabno, Caller) , writemods (Moremods, Tabno, Caller) IM σ> wri teonemod ( [ ] ,_._) wri teonemod ( [Mod, Value | Rest] . Tabno, Cal ler) : - wri teblanks (Tabno) , wri te (Mod) , wri te ( ' » ' ) , wri te (Value ) , n l . I , new_l ine (Ca l ler) , t . (Rest - [] ; Newtab is Tabno + θ, writemods (Rest, Newtab.Cal ler) ). writeonemod(L, Tabno. Caller) s- strip (L, Newl) . I, writeonemod (Newl, abno, Caller) . writeonemod (_,_,_) . writeblanks (0) i-l. writeblanks (Tabno) ι - ' write (' '), T iβ Tabno - 1, writeblanks (T) , !. drgchk (Finding) :- drgs(L), %list of findings for drg member (Finding, L) . checkmods (M) j - \+ member ( [certainty, no] , M) . writeoutβent ( [] ) t- I. writeoutβent ( [Word I Rest] ) i- nuraber (Word) , write(Word), I, (Reβt \- [] , writeC , ' ) . writeoutβen (Reβt) ; CO c true) , I . 03 markupsβnts ( (] ) ι-l. CO ma rkupsents { ( [ sentence , ['']]]) : - % at end of file marker H markupsents ( [ [βection, S] |Fmts] ) t C write C<p>' ) , H m write_βentenceβ (S) , I, o retractall (currentβect (_) ) , x assert (currentsect (S) ) , m m markupsents (Fmts) . H markupsents ( [ [ [section. S] ] |Fmtβ) ) write_sentences (S) , I, markupsents (Fmts) . m markupsents ( [811 Reβt] ) ■• en markupβentllβt (Si) markupsents (Rest) , I. markupsentlist ( [ [sentence, S] | Fmts] ) i - arkupformatβ (S, Ftntβ.MarkedSent) , I , write_markedβent (MarkedSent) , !. %wrlte out marked up sentence write_markedsent( [W1,W2,W3 |S] ) :- Wl - '<b><font color - ', write(Wl), write(W2), wrlteC '), write(W3), writβC ') write_βentences(S) . write_markedsent (S) :- write_sentences (S) . markupformats (S, [] , S) :- i. % no markup is needed markupformats (S, [Fmtl |Rest] ,MSent) :- color_markup(S, Fmtl, MSI) , % markup 1st part markupformats (MSI, Reβt, MSent) , I. % markup reβt CO %color_markup(+L, +Fmt, -MFmt) : c 00 color_markup(L. [] ,L) . CO color_markup (L, [finding, Value|Modβ] , ewL) i- H ype » finding. Value \- demo. H C Color « '"brown"', H (setof (X, member ( [change, X] , Mods) .Changes) , %change or degree mod m markup_list (L, Changes, Color. NewLl) , I; % for findings co x seto (X, member ( [degree, X] .Mods) . Degrees) , m m markup_list (L, Degrees, Color, NewLl) , ! ; I H L « NewLl) , 3 (setof (X. member ( [descriptor, X] .Mods) .Descrs) % descriptor c r markup_list (NewLl, Descrs, Color, NewL2) ; m New 2 - NewLl) , ι write_color (NewL2, Value, Color, NewL) . % finding σ> color_markup(L, [Type, Value | Mods] ,NewL) : - (Type * problem. Color « '"brown"', NL » L; Type » med, medcolor(L, Mods, L, Color) , I; % differentiate meds from % reaction to meds Type - procedure. Color - '"blue"', NL - L; Type - device. Color - '"blue"'. NL - L) , I, (Type ■ procedure, gettargets ( [Value] , Proc) , member (Proc, [view, examination] ) , I; % dont markup generic procedure write_color (NL, Value, Color, NewL) ) . %color_markup(L, [finding, demo|Mods] , NewL) :- %get age, sex, race, ethnic color_markup(L,_. L) . medcolor (L, Mode, NL. ' "brown" * ) «- currentsect (S) . member (S, [' report allergy I tern' , [ 'ALLERGIES i .']]) , I, (Mods - []. L - NL, I; chkforreact(L,Modβ,NL) ) . medcolor (L, [] ,L, ' "green"' ) t- I. %not allergy βectlon - medication medcolor (L, Mods, NL, ' "brown"' ) «- chkforreact (L.Mods.NL) . chkforreact(L.Modβ.NL) :• % markup up reaction to med also setof (X. member ( [ reaction, X] .Mods) , React) , C gettargets (React, arreact) , [J ) (listhaβreact (Tarreact) , markreact (React, Tarreact, L, NL) ; d L - NL) . ^ medcolor (L,_,L, ' "green"' ) . % default H markreact ([], [], L, L) :- !. J" markreact ([R|Reβt] , [Tar|TarReβt] ,L,NL) »- (iβreact (Tar) , wrlte_color (L.R, ' "brown"' .NewL) , JJj markreact (Rest, TarReβt, NewL, NL) , I; H markreact (Rest, TarRest, L, NL) , I). "3 markreact (_,_, L.L) . C isreact(Tar) :- % adverse reaction m member (Tar, [allergy, intolerant, 'not e fective' ,' oxic' ,' side effect', lo 'not better' , reaction] ) . *— listhaβreact (Tarreact) ι- lntersect (Tarreact, [allergy, Intolerant, 'not effective' , toxic, 'side effect' , 'not better' , reaction] ) . % markup_liβt(+Sentlist.+Wordlist,+Color, -NewL) m«rkup_l let (L, []._,L) i- I . % no more elements to markup markuρ_liβt(L, [Value |Reβt] .Color, NewL) ι- write_color(L. Value, Color. ew) , tnarkup_llst (New, Reβt, Color, NewL) . write_color(L, Value, Color. NewL) t- atomic (Value) , I. βuf fix (L, [Value | Rest] ) , % word in sentence list append (Prefix, [Value |Rest] ,L) . % part of sentence before word (notmarke (Prefix) , I. % check word Is not marked already βurround(Valuβ. Color, MVal) , append ( [Pref lx.MVal.Reβt] .NewL) j write_color(Rest, Value, Color, NewR) , I , % mark up latter part of sentence append(Prefix, [Value I NewR] , ewL) ; % add to first part L ■ NewL % don't do anything O ). Q J write_color (L, alue, olor. NewL) »- H Value • [Wl|_], βuf f lx (L, [Wl |Reβt] ) , % wordl of phrase in sentence H append(Pref lx, [Wl |Rest] ,L) , % prefix is part of L before phraβe ^ (notmarked (Pref lx) , % phrase lβ not marked already m last(Wn, Value) , βuf f lx(Rest, [WnlRestn] ) , % laβt word in phrase JΛ add_colorprefx(Wl .Color, MW1) , % markup before Wl of phrase m append (Phrase, [Wn|Restn] , Rest) , % get rest of phrase in sentence [JJ add_colorsufx( [Wn] ,MWn) , % markup up end of phrase ^ append( [Pref ix.MWl, hrase, MWn.Restn] , NewL) , 1; % put all pieces together ^ write_color (Rest, Value, Color, ewR) , % write up latter part of sentence m append(Pre ix, IW1 |NewR] , NewL) , I) . % leave sentence unmarked t wrlte_color (L,_,_, L) . 3 surround (W, Color, CList) :• add_colorpref x(W, Color, PreL) , add__colorsufx (PreL, CList) . % add_colorprefx(+W, +Color, -CW) j W is word, CW lβ a list containing % starting markup for color (I.e. markup preceeds W) add_colorprefx(W, Color, ('<b><font color » *|CLlst]) i- appenddtColor] , [' size-+l>'] , (WJJ.CLiβt) . % add_colorprefx(+L. -W) J L iβ a llβt, W lβ a llβt containing ending % markup for a color which is In a llβt preceded L In sentence add_colorsuf (L, SL) t- append(L, [' </font></b>' ] , SL) . notmarked ( [] ) : - l . notmarked (Preflx) :- laβt(X, refix) , X \« ' size»+l>' . writeoutsent( [Word|Rest] ) : writeC"). write (Word), writeC"), I, (Word - ' ' " , write (' ' " ) l ; true) , (Rest \- [] , write (* , ' ) , , writeoutβen (Reβt) , Ij true) , I . ['\«']) . orm, Bxamtype) : ■ seen, see(Infile), st) , f_f lie, I ; st, Dbform, Examtype) ) . t- c xformtodb( [], [],_) t • 1. xformtodb ( [X I Rest] .Dbform, Examtype) :- t % one finding or recommendation ( lβonef indlng (X) , I, (todbform(X, Nβwx, Bxamtype) . Newform ■ [Newx] ; Newform [] ) % multiple findings or recommendations lsmultiflnding(X) , I, (tdbformulti (X, Newform, Bxamtype) Newform - [] ) ; % is not a finding - don' t produce output Newform » [] ), xformtodb (Rest, Newrest, Examtype) , append (Newform, Newrest, Dbform) . isonef indln (X) CO c X X -- [[YY||_. l. 03 atom(Y) CO H Ismultifindlng (X) C [Y| H m list(Y) . co I X tdbformulti ([], [] ) :- I. m tdbformultK [X|Rest] .Xdblist, Examtype) i- H todbform(X,Xdb, Examtype) , % βingle finding or recommend tdbformulti (Rest, Xdbreβt, Examtype) , C= ( Xdb »= [] , Xdblist - Xdbrest; m append( [Xdb] , Xdbrest, Xdblist) σ> todbform( [Type, Finding |Mods] .Xdb, Examtype) t - okframetype (Type) , Type \- recommend, 1, ( computecode (Finding, finding,Medterm, Examtype) , %find medcode certaintychk(Modβ,Cval) , statuschk (Mods. Sval) , %removenu11 (Mods, Mode1) , fixmodβ (Mods, Model, Examtype) , computeval (Cval, Sval, Value) , Xdb - [Medterm, Value I Model] ; todbform( [recommend, FuExam |Mods] , Xdb, Examtype) ι- ( computerecval (FuExam, Mods,Val, Bxamtype, Model) , % compute value for recommend f ixmods (Model, Mods2, Examtype) , %removenull (Model, Mods2) , Xdb - ['report recommendation item' , Val |Modβ2] ; Xdb - [] %f indlng cannot go in database - no medcode (_, [] ,_) :-!. e value of finding for database al (Medterm,Cval, Sval, Newmods, db) ι- pu eval (Cval, Sval. Value) . CO Xdb - [Medterm, Value I ewmods] . X m m % Value of recommendation is computed aa follow*. % 1. If there Is an exam or procedure mentioned, that value 33 C % 2. Otherwise, if 'follow up' lβ value and/or no exam is r- m % is mentioned, the value will be the current exam. % 3. Otherwise, if there is a follow up time period mentioned to σ> % the value will be the current exam, and it will have a % modifier which is follow-up times, with a value which % is the follow up time. computerecval (FuExam,Mods, Val, Examtype, NewMods) : - % certaintych (Mods. Cval) , % degreechk (Mods. Dval ) , getβpeci ic(FuBxam.SpBxAm) . % get most βpecific exam % only followup is mentioned; recommend denoteβ followup (SpBxam - 'followup', computecode (Bxamtype,_, Val, Bxamtype) j %code for exam \+ SpBxam ■ 'followup', %followup procedure is stated % value Is a more specific procedure (computecode (SpBxam, Type, Val, Bxamtype) ; Val « Examtype) ) , % If there are modifiers - check time period and add approp. modifier addtimemod(Mods, Ne Mods ) , I. % Get specific examination - not word followup getspeclf ic (FuBxam. FuExam) z- atom (FuBxam) , 1. C % recommend a list of exams - get most specific Q j getspeci fie (FuBxam, SpBxam) t- H lβ_liβt (FuExam) . H FuExam - [Head|Tail], Ej ( Head - followup, I, getspeclfic (Tall, SpBxam) , I; m SpBxam « Head sm JJJ addtimemod (Mods, NewMods) :- ^- futexamchk (Mods.Futval) , % get value for future exam if it exists ^2 Futval » [unitval.X.Ti eunit] , %calculate standard time r~ % This will be replace when number+unlt can be stored in db JJJ (X - 6. Timeunit - month. FuModVal - 'follow-up in 6 months'; %6 month foil O) owup 6, Tlmeunlt - week, FuModVal - 'follow-up In 6 weeks'; %6 week folio wup X - 1, Timeunit - year. FuModVal - 'follow-up In 1 year*), append (Mods, ([' ollow-up times' , FuModVal] ], NewMods) , I. addtimemod (Mode, Mods) . computecode (Regterm, Type, Medterm, Bxamtype) i- ( synonyms (Regterm, T, Medterm, Domain) , % There Is a Medterm for this term % general domain matches any exam; otherwise Bxamtype must match ( Domain ■ general; Domain ■ Bxamtype; member (Examtype, Domain) ), . ( T - Type, I; % same type of information subtype (Type, T) , !; % Type is a subtype of T member (Type, [proced re, problem, device, normal finding, postprocedure, allergy]), T - finding %equivalent ) Medterm - Regterm % if there is no synonym, use original ) . medcode (Medterm, _) . % can go into db form only if there is a medcode certaintychk ([], [] ) :-!. gj certaintychk dX|Reβt] , Val) 03 X - [certainty, Val|_J ; W certaintychk(Reβt,Val) . C statuβchM [].[]) ι - I . m βtatuβchkt [X|Reβt] .Val) i- CO X - [•tatuβ,Val|_]; jj βtatuβchk (Reβt, Val) . m ^ degreechk( [] , []) .- 1. 3j degreechk([X|Rest] .Val) t- r= X - [degree, Val |_] ; m degreechk (Rest, Val) . 3 % check if modifier contains a recommended time for future exam futexamchk ([], [] ) >- I. futexamchk( [X|Reβt] ,Val) i- X - [futurβ_exam, Val |_J ; futexamchk (Rest, Val) . % remove empty list from present list fixmodβd], [],_) :- !. f ixmods ( [ [] IReβt] .Newrest, Bxamtype) : - fixmods (Rest, Newrest, Examtype) , I. f ixmods ( [X| Rest] , Newmods, Examtype) :- X " [Type,Regterm|Moremods] , % type of slot, regularized value, nested mods (computecode (Type, βlot, Mβdtype, general) , % compute slot term computecode (Regterm, Type, Medterm, Examtype) , % compute med term fixmods (Morβmodβ.NewMore, Examtype) , % fix nested mods if any CO NewX » [Medtype, Medterm I NewMore] ; % new controlled vocab term NewX « [] % no controlled term 0 CO 3 I \ • H f ixroodβ (Re» , Newrest, Examtype) , I , ji (NewX » [] , 1 , Newmods ■ Newrest; — I Newmods » [NewX | Newrest] I m ) . CO X m ) _l computeval ([],[], 'moderate certainty'). •c: computeval (Cval, Sval, Vcode) :- C (\+ Cval = [] . Vcode - Cval, I; ff Cval - [], \+ Sval » [], Vcode « Sval, I; no Vcode ■ 'high certainty'). σ> writehl7 (Findings,_,Compstart,Docstart,Compend,Caller) : - findlngtoθbx(Fin ings,Compβtart,Compend,Docstart, Caller) findingtoθbx( [] ,Compstart,Compstart,_,_) :- I. findingtoObx ( [Finding | Rest] , Coropβtart,Compend, Docstart,Caller) : - writeObx (Finding,Compstart.Docstart.Compnext,Caller) , fIndingtoObx (Rest, Compnext,Compend, Docstart, Caller) . wrlteθbx( [] .Component,_, Component,_) :- I. writeθbx( [Finding, Value |Mods] .Component, Parent, extcomp, Caller) : - medcode (Finding,Code) , medcode (Value, Vcode) , %Medcodes wri teObxPart (Component) , %OBX |Component |CE| writecoded(Code, Finding) , write (Parent) , write('j'), wri tecode (Vcode, Value) , wri teendObx (Caller) , Newcomponent is Component + 1, % write modifier components wrlteroodObx (Mods, Newcomponent,Component, Nextcomp, Caller) . O CD % handle unit hl7 —I % writeObx ( [Finding, Value I Mods] .Component, Parent, Nextcomp) :- H % handle date hl7 5 % writeObx ( [Finding, Valuβ|Modβ] .Component, Parent, Nextcomp) :- m O % no new component written because Medcode missing m writeObx ([_I_] .Component,_, Component,_) i- I. m r-» writemodθbx( [] .Component,_,Component,_) t- 1. ^ writemodObx( [Mod IRest] .Component, Parent, Finalcomp, Caller) :- fZ writeObx (Mod, Component, Parent, Nextcomp, Caller) , 1 ^ wrlteroodObx (Rest, extcomp, Parent, Finalcomp, Caller) . σ> writeObxPart (Component) : - write('OBXl') . write (Component) , writeC |CE| ') . wrl ecode (Code, Finding) i- write(Code). write ('*'), write (Finding) , writeC I')- 15/2 Φ <0 υ Φ c Φ c e — — « M — s

Claims: - 16 Claims 1. A computer method for processing medical/clinical data comprising a natural-language phrase, the method comprising parsing the natural-language phrase and regularizing the parsed phrase, wherein parsing comprises referring to a domain parameter whose value is indicative of a medical/clinical domain from which the data originated. 2. The method according to claim 1, further comprising preprocessing the data prior to parsing, with preprocessing comprising referring to the domain parameter. 3. The method according to claim 1, further comprising encoding at least one term of the regularized phrase, with encoding comprising referring to the domain parameter. 4. The method according to claim 1, further comprising filtering the regularized phrase. 5. The method according to claim 1, further comprising referring to an additional parameter which is indicative of the degree to which subphrase parsing is to be carried out. 6. The method according to claim 1 , further comprising referring to an additional parameter which is indicative of desired filtering. 7. The method according to claim 1, further comprising referring to an additional parameter which is indicative of a desired type of output. - 17 - 8. The method according to claim 1, further comprising referring to an additional parameter which is indicative of a desired output format. 9. A computer system for processing medical/clinical data comprising a natural-language phrase, the system comprising means for parsing the natural-language phrase and means for regularizing the parsed phrase, wherein the parsing means comprises means for referring to a domain parameter whose value is indicative of a medical/clinical domain from which the data originated. 10. The system according to claim 9, further comprising means for preprocessing the data prior to parsing, with the preprocessing means comprising means for referring to the domain parameter. 11. The system according to claim 9, further comprising means for encoding at least one term of the regularized phrase, with the encoding means comprising means for referring to the domain parameter. 12. The system according to claim 9, further comprising means for filtering the regularized phrase. 13. The system according to claim 9, further comprising means for referring to an additional parameter which is indicative of the degree to which subphrase parsing is to be carried out. 14. The system according to claim 9, further comprising means for referring to an additional parameter which is indicative of desired filtering. 15. The system according to claim 9, further comprising means for referring to an additional parameter which is indicative of a desired type of output. - 18 - 16. The system according to claim 9, further comprising means for referring to an additional parameter which is indicative of a desired output format. 17. A combination of the system according to claim 9 with an interface module for enabling the system to receive input from and/or to produce standardized output for the World-Wide Web and/or a local network. 18. The combination according to claim 17, further comprising means for viewing the output using a standardized browser. 19. The combination according to claim 18, wherein the browser is a Web- browser.

Inventors: FRIEDMAN CAROL, FRIEDMAN, CAROL
Applicants: UNIV COLUMBIA, TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW
Application year: 1997
Main classification: G06F17
IPC codes: G06F17, G06Q50