Copyright 2006 Li Zhou Department of Biomedical Informatics Columbia University This work was funded by National Library of Medicine grants R01 LM06910 "Discovering and applying knowledge in clinical databases"; R01 LM07659 "Capturing and Linking Genomic and Clinical Information;" and R01 LM07268 "Using Narrative Data to Enrich the Online Medical Record." 03/16/2006: This program uses regular expressions to recognize the temporal information patterns in text, and then transforms them to MedLEE processable format. The formal representation of the temporal information was defined in 2005 JBI paper draft, called the Temporal Constraint Structure How to run: perl TCStagger.pl input output It first solves the "L-1" problem. It contains two libraries, Timeproc and TimeLib. Timeproc is a library containing modules for processing different types of temporal expressions. Main program, "TCStagger.pl", calls functions in the modules of this library. 1) Preproc_date.pm (Date) 2) Preproc_DuRe.pm (Duration and some Relative Date and Time) 3) Preproc_refevent.pm (Event-dependent temporal expressions) 4) Preproc_time.pm (Time) 5) Preproc_week.pm (Week) 6) Relative_time.pm (Relative Date and Time) 7) signal.pm (Signal) 8) fuzzy_time.pm (Fuzzy time) TimeLib is a library containing patterns and general functions for temporal expressions. 1) Adjctive.pm 2) Adjective_num.pm 3) Determinative.pm 4) Number.pm 5) Part.pm 6) Preposition.pm 7) Quan_modifier.pm 8) Reference_events.pm 9) Vagueness.pm Main categories and patterns were handled. In each Module, there are several blocks: 1) Schema and processed patterns 2) Matching expressions. A list of examples were presented before each matching expressions. 3) Subroutines, which transform the matched pattern to formalized output. 4) Appendix, such as comments, expression examples, testing examples. Since the programs were written as the same time as finding patterns, and the formal representation was changed several times during the whole development process, some of the part of programs were not well-origanized. However, since most of patterns were listed out and grouped, the programs should be easily improved. Annotation Schema:(Version: 5/31/2005)(From 2005 JBI paper draft) *event_point endpoint(s) (the start and/or finish) of the event constrained by the temporal expression values: start, finish, unspecified (which endpoint of the event which is constrained is not explicitly stated in the text) *anchor constraining time point can be a calendar date, a time of day, a relative date or time, an event, or a time reference (e.g. "at that time" can be encoded as "previous reference") each constraint structure can have more than one anchor (e.g. "between 1990 and 2000", has two anchors (1990 and 2000) comprising a time period) anchor_point if anchor is an event, the endpoint of the event is specified when possible. anchor_modifier indicates the stage of a period of time, or the course an event (e.g. anchor "1980s" in "early 1980s" has a modifier of "early") values: early, mid, and late *relation a temporal relation between an endpoint of an event and its anchor or interval(s) constructed by the constraint structure with respect to the anchor values: equal, before, equal or before, after and equal or after time_unit unit for measuring time periods values: of second, minute, hour, day, week, month, and year quantity specified or indefinite number or amount for measuring the length of a time period values: a number or a vague quantifier (e.g. many, a few) direction indicates the direction of an interval relative to its anchor values: minus (in the past), plus (in the future), or both (e.g. "within two days") interval_operator characterizes an endpoint of the event value: drag (continuous period of time within an interval) and jump (located at the distal end of the interval) vagueness indicates if a vagueness modifier is contained within the expression (e.g. approximately, about, roughly, and more or less) value: yes Some examples from the JBI paper draft: 4.1.1. Date and Time 4.1.1.1. He was a heavy smoker until 1984 event = "smoking"; event_point = "finish"; relation = "equal"; anchor = "1984" 4.1.1.2. the myocardial infarction occurred on January 6th, 2003 event = "myocardial infarction"; event_point = "both"; relation = "equal"; anchor = "2003-01-06" 4.1.1.3. The patient was treated from October 20th to the 31st with clindamycin. event= "treat with clindamycin"; event_point = "start"; relation= "equal"; anchor = "--10-20"; event_point2 = "finish"; relation2 = "equal"; anchor2 = "--10-31" 4.1.1.4 He had flu between Jan.5rd and Jan. 13th, 2003 event = "flu"; event_point1 = "start"; relation1 = "equal or after"; anchor = "2003-01-05"; event_point2= "finish"; reltion2= "equal or before"; anchor2 = "2003-01-13" 4.1.2. Relative date and time 4.1.2.1. Her rash started today event = "rash"; event_point = "start"; relation = "equal"; anchor = "today" 4.1.2.2. He had a laminectomy about 25 years ago. event = "laminectomy"; event_point = "unspecified"; relation = "equal"; quantity = "25"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference"; vagueness = "yes" 4.1.2.3. One month later, he was transfused three units of packed cells. event = "transfusion"; event_point = "unspecified"; relation = "equal"; quantity = "1"; time_unit = "month"; direction = "plus"; Interval_operator = "jump"; anchor = "narrative_reference" 4.1.2.4. The patient had an orthopedic clinic visit within the last three days. event = "orthopedic clinic visit"; event_point = "unspecified"; relation = "equal"; quantity = "3"; time_unit = "day"; direction = "minus"; interval_operator = "drag"; anchor = "narrative_reference" 4.1.2.5. She has had decreased appetite in the last four days. event = "decreased appetite"; event_point = "unspecified"; relation = "equal"; quantity = "4"; time_unit = "day"; direction = "minus"; interval_operator = "drag"; anchor = "narrative_reference" 4.1.3. Duration 4.1.3.1. The pain lasted for 2 days event = "pain"; event_point = "start" relation = "equal"; quantity = "2"; time_unit = "day"; direction= "minus"; interval_operator = "jump"; anchor = "event"; anchor_point = "finish" 4.1.3.2. He has a history of hypertension for the past 3 years. event = "hypertension"; event_point = "start"; relation = "equal"; quantity = "3"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference"; event_point2 = "finish"; relation2 = "equal or after"; anchor2 = "narrative_reference" 4.1.3.3. She had upper respiratory infection for the past 4 to 5 days event = "upper respiratory infection"; event_point = "start"; relation = "equal"; quantity = "4"; time_unit = "day"; quantityB = "5"; time_unitB = "day"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference"; event_point2 = "finish"; relation2= "equal or after"; anchor2 = "narrative_reference" 4.1.4. Event-dependent temporal expression 4.1.4.1. His had a fever one week prior to admission event = "fever"; event_point = "unspecified"; relation = "equal"; quantity = "1"; time_unit = "week"; direction = "minus"; interval_operator = "jump"; anchor = "admission"; anchor_point = "start" 4.1.4.2. During this hospitalization, he had a blood transfusion. event = "transfusion"; event_point = "start"; relation = "equal or after"; anchor = "start"; anchor_event = "admission"; event_point2= "finish" relation2 = "equal or before"; anchor2= "discharge"; anchor_point2 = "finish" 4.1.4.3. EMS arrived about 20 minutes after the ingestion. event = "EMS arrived"; event_point = "unspecified"; relation = "equal"; quantity = "20"; time_unit = "minute"; direction = "plus"; interval_operator = "jump"; anchor = "ingestion"; anchor_point = "finish"; vagueness = "yes" 4.1.5. Fuzzy time 4.1.5.1. She had appendectomy in the past event = "appendectomy"; event_point = "unspecified"; relation = "before"; anchor = "now" 4.1.5.2. Diagnosis of astrocytoma was made at that time event= "diagnosis of astrocytoma"; event_point = "unspecified"; relation = "equal"; anchor = "previous_reference" 4.1.5.3. He subsequently developed a rash. event= "rash"; event_point = "start"; relation= "after"; anchor= "previous_reference"; 4.1.6. Recurring times 4.1.6.1. Thiamine 100 mg p.o. q.d. for two weeks event = "Thiamine 100 mg p.o. q.d."; event_point = "start"; relation = "equal"; quantity = "2"; time_unit = "week"; direction= "minus"; interval_operator = "jump"; anchor = "event"; anchor_point = "finish." 4.2. Temporal modifiers and indefinite numbers 4.2.1. low WBC lasted for more than four weeks event = "low WBC"; event_point = "start" relation = "before"; quantity = "4"; time_unit = "week"; direction = "minus"; interval_operator = "jump"; anchor = "event"; anchor_point = "finish" 4.2.2. he had a fever more than 3 days later event = "fever"; event_point = "unspecified" relation = "after"; quantity = "3"; time_unit = "day"; direction= "plus"; interval_operator = "jump"; anchor = "narrative_reference" More examples (from evaluation's part. Li's answer): 1. He was a heavy smoker until 1984 event = "smoking"; event_point = "finish"; relation = "equal"; anchor = "1984" 2. She was found on the morning of Sep. 6th without pulses. Event= "she was found without pulse"; event_point = "unspecified"; Relation = "equal"; anchor = "2003-09-06 TMO" (GH morning as a anchormodifier) 3. Patient was admitted to the Dermatology Service from January 29, 1990 to February 26, 1990 event = "admission to the Dermatology Service"; event_point = "start"; relation= "equal"; anchor = "1990-01-29"; event_point2 = "finish"; relation2 = "equal"; anchor2 = "1990-02-26" 4. Cath urine on 9/2 showed greater than 100K Acinetobacter event = "cath urine"(and cath urine showed acinetobactor was greater than 100k); event_point = "unspecified"; relation = "equal"; anchor = "--09-02" " two events: " one is procedure cath urine " another is observation-acinetobacter so again the define of the event is an problem. The observation of acinetobacter or the existing of acinetobacer 5. the patient was admitted on 2/3/87 for vomiting of blood event = "admission"; event_point= "unspecified"; relation = "equal"; anchor = "1987-2-3" event = "vomiting of blood" event_point = "unspecified"; relation = "before"; anchor = "1987-2-3" Here needs linguistic and domain knowledge to link events and time. However, it fits the structure. 6. He underwent sclerotherapy on 2/4 and repeat sclerotherapy was performed on 2/8 and 2/12. event = "sclerotherapy" event_point = "unspecified"; relation = "equal"; anchor = "-- 02-04" event = "sclerotherapy" event_point = "unspecified"; relation = "equal"; anchor = "-- 02-08" event = "sclerotherapy" event_point = "unspecified"; relation = "equal"; anchor = "-- 02-12" 7. Repeat chest x-ray showed great reduction of cardiomegaly and vascular congestion compared with the study of 9-1. Event = "repeat chest x-ray"; event_point= "unspecified"; relation= "after"; anchor = "-- 09-01" event = "compared chest-x-ray" event_point = "unspecified"; relation = "equal"; anchor = "-- 09-01" 8. On 10/27, the patient became afebrile. event = "afebrile" event_point = "start"; relation = "equal"; anchor = "-- 10-27" 9. right cerebrovascular accident in September of l990 event = "right cerebrovascular accident" event_point = "unspecified"; relation = "equal"; anchor = "1990-09" 10. The patient was prescribed Isollyl yesterday on 7/25 event = "The patient was prescribed Isollyl" event_point = "unspecified"; relation = "equal"; anchor = "--07-25" (event = "The patient was prescribed Isollyl" event_point = "unspecified"; relation = "equal"; anchor = "yesterday") Should recognize and select one based on rules. 11. In 3-74 he underwent coronary artery bypass grafting times two. event = "underwent coronary artery bypass grafting" event_point = "unspecified"; relation = "equal"; anchor = "1974-03" 12. Lithotripsy in 1987 event = "Lithotripsy" event_point = "unspecified"; relation = "equal"; anchor = "1987" 13. It was reported that the Pap smear was normal on 3/21/91 event = "Pap smear was normal" event_point = "unspecified"; relation = "equal"; anchor = "19910321" 14. a colostomy in 1972, event = "colostomy" event_point = "unspecified"; relation = "equal"; anchor = "1972" 15. STATUS POST A BILATERAL ORCHIECTOMY IN 6/87 event = "BILATERAL ORCHIECTOMY" event_point = "unspecified"; relation = "equal"; anchor = "1987-06" 16. Her neurological disease has been characterized by chronic progressive spastic paraparesis, followed by arm involvement in the early eighties. Event= "Her neurological disease has been characterized by chronic progressive spastic paraparesis, followed by arm involvement"; event_point = "unspecified"; relation = "equal"; anchor = "198", anchor_modifier= "early" 17. Repeat salicylate level at 4 pm that day was 41. event = "repeat salicylate level was 41" event_point = "unspecified"; relation = "equal"; anchor = "16:00" 18. He had Laminectomy about 25 years ago. Event = "laminectomy"; event_point = "unspecified"; relation = "equal"; quantity = "25"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_ reference"; vagueness = "yes" 19. The patient had an orthopedic clinic visit in the last three days. event = "orthopedic clinic visit"; event_point = "unspecified"; relation = "equal"; quantity = "3"; time_unit = "day"; direction = "minus"; interval_operator = "drag"; anchor = "narrative_reference" 20. She had had decreased appetite in the last four days. event = "decreased appetite"; event_point = "unspecified"; relation = "equal"; quantity = "4"; time_unit = "day"; direction = "minus"; interval_operator = "drag"; anchor = "narrative_reference" 21. History of sinus problems with some surgery approximately 3 years ago event = "History of sinus problems with some surgery approximately"; event_point = "unspecified"; relation = "equal"; quantity = "3"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference" 22. The patient has a history of partial small bowel resection for Crohn's disease 16 years previously event = "he patient ran out of Captopril"; event_point = "unspecified"; relation = "equal"; quantity = "1"; time_unit = "month"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference" 23. history of ear surgery many years ago event = "ear surgery"; event_point = "unspecified"; relation = "equal"; quantity = "many"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference" 24. The pain lasted for 2 days event = "pain"; event_point = "start" relation = "equal"; quantity = "2"; time_unit = "day"; direction= "minus"; interval_operator = "jump"; anchor = "pain"; anchor_point = "finish" 25. She had upper respiratory infection for the past 4 to 5 days event = "upper respiratory infection"; event_point = "start"; relation = "equal"; quantity = "4"; time_unit = "day"; quantityB = "5"; time_unitB = "day"; direction = "minus"; interval_operator = "jump"; anchor = "narrative_reference"; event_point2 = "finish"; relation2= "equal or after"; anchor2 = "narrative_reference" 26. The patient's antibiotics were stopped after three days. (According to the context, the antibiotics start after a previous event - operation. Here "previous_event" servers as a pointer which can be resolved by a higher lever reasoning system) event = "treatment of antibiotics"; event_point = "finish"; relation = "equal"; quantity = "3"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor = "previous_reference"; event_point2 = "start"; relation2= "equal or after"; anchor2= "previous_reference"; 27. Married for two years event = "marriage"; event_point = "start"; relation = "equal or before"; quantity = "2"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor _point= "finish" anchor="marriage" 28. 2-3 six-packs of beer per day for 24 years. event = "2-3 six-pack beer per day"; event_point = "start"; relation = "equal or before"; quantity = "24"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor_point = "finish" anchor= "2-3 six-pack beer per day" 29. Her symptoms continued for about two days event = "symptoms"; event_point = "start"; relation = "equal or before"; quantity = "2"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor_point = "finish" anchor="symptom" 30. The patient was started on Penicillin 250 milligrams po q6 times seven days event = "started on Penicillin 250 milligrams po q6"; event_point = "start"; relation = "equal"; quantity = "7"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor_point = "finish" anchor= "started on Penicillin 250 milligrams po q6" 31. Patient had been a smoker for 22 years with a 1 pack a day habit until 1996 when she stopped event = "smoking"; event_point = "start"; relation = "equal"; quantity = "22"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor = "smoking" anchor_point = "finish"; event="smoking"; event_point = "finish"; relation= "equal"; anchor="1996" 32. the patient received 24 hours of Cefoxitin prophylaxis event = "Cefoxitin prophylaxis"; event_point = "start"; relation = "equal"; quantity = "24"; time_unit = "hour"; direction = "minus"; interval_operator = "jump"; anchor = "Cefoxitin prophylaxis"; anchor_point = "finish" 33. She had several days of Streptomycin IM. event = "Streptomycin IM"; event_point = "start"; relation = "equal"; quantity = "7"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor = "Streptomycin IM"; event_point = "finish" 34. He received a six day course of cefuroxime, later switched to p.o. ampicillin, event = "cefuroxime"; event_point = "start"; relation = "equal"; quantity = "6"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor = "cefuroxime"; event_point = "finish" (narrative time progress or use later, ampicillin is after cefuroxime) 35. Thiamine 100 mg p.o. q.d. for two weeks event = "Thiamine 100 mg p.o. q.d."; event_point = "start"; relation = "equal"; quantity = "2"; time_unit = "week"; direction= "minus"; interval_operator = "jump"; anchor = "Thiamine 100 mg p.o. q.d"; anchor_point = "finish." 36. He had a cough one week prior to admission event = "cough"; event_point = "unspecified"; relation = "equal"; quantity = "1"; time_unit = "week"; direction = "minus"; interval_operator = "jump"; anchor = "admission"; anchor_point = "start" 37. EMS arrived about 20 minutes after the ingestion. event = "EMS arrived"; event_point = "unspecified"; relation = "equal"; quantity = "20"; time_unit = "minute"; direction = "minus"; interval_operator = "jump"; anchor = "ingestion"; anchor_point = "unspecified"; vagueness = "yes" 38. On admission, hematocrit 25% with an MCV of 79 event = "hematocrit 25% with an MCV of 79" event_point = "unspecified"; relation = "equal"; anchor = "admission" anchor_point = "unspecified" 39. By the date of discharge, she had no further SVTs and her asthma appeared to be well controlled event = "SVI" event_point = "unspecified"; relation = "equal or before"; anchor = "discharge"; anchor_point = "start" event = "asthma" event_point = "unspecified"; relation = "equal or before"; anchor = "discharge"; anchor_point = "start" 40. One week prior to admission the patient saw an outside medical doctor for worsening shortness of breath but was not started on any meds. event = "for worsening shortness of breath but was not started on any meds."; event_point = "unspecified"; relation = "equal"; quantity = "1"; time_unit = "week"; direction = "minus"; interval_operator = "jump"; anchor = "admission"; anchor_point = "start" 41. His PCA was stopped on postop day #5, Event = "PCA" , event_point = "finish", relation = "equal"; quantity = "4"; time_unit = "day"; direction = "minus"; Interval_operator = "jump"; anchor= "operation"; anchor_point = "finish" 42. She had appendectomy in the past event = "appendectomy"; event_point = "unspecified"; relation = "before"; anchor = "now" 43. he subsequently developed a rash. event= "rash"; event_point = "start"; relation= "after"; anchor= "previous_reference"; 44. He was married for many years event = "marriage"; event_point = "start"; relation = "equal or before"; quantity = "many"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor _point= "finish" anchor="marriage" 45. Hypertension times many years event = "Hypertension"; event_point = "start"; relation = "equal or before"; quantity = "many"; time_unit = "year"; direction = "minus"; interval_operator = "jump"; anchor _point= "finish"; anchor = "Hypertension" 46. Asthma which she has had her entire life event = "Asthma"; event_point = "start"; relation = "equal "; anchor="birth" event = "Asthma"; event_point = "finish"; relation = "equal or after "; anchor="now" 47. hematocrit, at that time, of 32%. Event = "hematocrit"; event_point = "unspecified"; relation = "equal"; anchor = "narrative_reference" 48. He did not follow this up in clinic at that point. Event = "did not follow this up in clinic"; event_point = "unspecified"; relation = "equal"; anchor = "narrative_reference" 49. low WBC has persisted for more than four weeks event = "low WBC"; event_point = "start" relation = "before"; quantity = "2"; time_unit = "day"; direction = "minus"; interval_operator = "jump"; anchor = "low WBC"; anchor_point = "finish" 50. he had a fever less than 3 days later event = "fever"; event_point = "unspecified" relation = "before"; quantity = "3"; time_unit = "day"; direction= "plus"; interval_operator = "jump"; anchor = "narrative_reference"