llm-ie 0.4.6__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,145 +1,162 @@
1
1
  Prompt Template Design:
2
2
 
3
3
  1. Task Description:
4
- Provide a detailed description of the task, including the background and the type of task (e.g., named entity recognition).
4
+ Provide a detailed description of the task, including the background and the type of task (e.g., named entity recognition). Explain that a sentence from the document will be send by the user at a time. The prompted agent will focus on processing them before moving to the next sentence.
5
5
 
6
6
  2. Schema Definition:
7
- List the key concepts that should be extracted, and provide clear definitions for each one.
7
+ List the key concepts that should be extracted, and provide clear definitions for each one. **Must define "entity_text"** which will be used to recognize the entity.
8
8
 
9
9
  3. Output Format Definition:
10
- The output should be a JSON list, where each element is a dictionary representing a frame (an entity along with its attributes). Each dictionary must include a key that holds the entity text. This key can be named "entity_text" or anything else depend on the context. The attributes can either be flat (e.g., {"entity_text": "<entity_text>", "attr1": "<attr1>", "attr2": "<attr2>"}) or nested (e.g., {"entity_text": "<entity_text>", "attributes": {"attr1": "<attr1>", "attr2": "<attr2>"}}).
10
+ The output should be a JSON list, where each element is a dictionary representing a frame (an entity along with its attributes). **Each dictionary must include a key "entity_text" and a key "attr"**. The attributes are placed in the "attr" (e.g., {"entity_text": "<entity_text>", "attr": {"attr1": "<attr1>", "attr2": "<attr2>"}}).
11
11
 
12
12
  4. Optional: Hints:
13
- Provide itemized hints for the information extractors to guide the extraction process.
13
+ Provide itemized hints for the information extractors to guide the extraction process. Remind the prompted agent to be truthful. Emphasize that the prompted agent is supposed to perform the task instead of writting code or instruct other agents to do it.
14
14
 
15
15
  5. Optional: Examples:
16
16
  Include examples in the format:
17
17
  Input: ...
18
18
  Output: ...
19
19
 
20
- 6. Input Placeholder:
21
- The template must include a placeholder in the format {{<placeholder_name>}} for the input text. The placeholder name can be customized as needed.
20
+ 6. Context:
21
+ The template must include a placeholder in the format {{<placeholder_name>}} for the context. The placeholder name can be customized as needed.
22
22
 
23
23
 
24
24
  Example 1 (single entity type with attributes):
25
25
 
26
- # Task description
27
- The paragraph below is from the Food and Drug Administration (FDA) Clinical Pharmacology Section of Labeling for Human Prescription Drug and Biological Products, Adverse reactions section. Please carefully review it and extract the adverse reactions and percentages. Note that each adverse reaction is nested under a clinical trial and potentially an arm. Your output should take that into consideration.
26
+ ### Task description
27
+ The paragraph below is from the Food and Drug Administration (FDA) Clinical Pharmacology Section of Labeling for Human Prescription Drug and Biological Products, Adverse reactions section. I will send you sentence by sentence. Please carefully review it and extract the adverse reactions and percentages from the given sentence. Note that each adverse reaction is nested under a clinical trial and potentially an arm. Your output should take that into consideration.
28
28
 
29
- # Schema definition
29
+ ### Schema definition
30
30
  Your output should contain:
31
- "ClinicalTrial" which is the name of the trial,
31
+ "entity_text" which is the name of the clinical trial as spelled in the sentence,
32
32
  If applicable, "Arm" which is the arm within the clinical trial,
33
33
  "AdverseReaction" which is the name of the adverse reaction,
34
34
  If applicable, "Percentage" which is the occurance of the adverse reaction within the trial and arm,
35
- "Evidence" which is the EXACT sentence in the text where you found the AdverseReaction from
36
35
 
37
- # Output format definition
36
+ ### Output format definition
38
37
  Your output should follow JSON format, for example:
39
38
  [
40
- {"ClinicalTrial": "<Clinical trial name or number>", "Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"},
41
- {"ClinicalTrial": "<Clinical trial name or number>", "Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"}
39
+ {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>"}},
40
+ {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>"}}
42
41
  ]
43
42
 
44
- # Additional hints
45
- Your output should be 100% based on the provided content. DO NOT output fake numbers.
46
- If there is no specific arm, just omit the "Arm" key. If the percentage is not reported, just omit the "Percentage" key. The "Evidence" should always be provided.
43
+ ### Additional hints
44
+ - Your output should be 100% based on the provided content. DO NOT output fake numbers.
45
+ - You are expected to generate the output instead of writting code or insturcting other agents to do so.
46
+ - If there is no specific arm, just omit the "Arm" key. If the percentage is not reported, just omit the "Percentage" key. The "Evidence" should always be provided.
47
47
 
48
- # Input placeholder
49
- Below is the Adverse reactions section:
48
+ ### Context
49
+ The text below is from the Adverse reactions section:
50
50
  "{{input}}"
51
51
 
52
52
 
53
53
  Example 2 (multiple entity types):
54
54
 
55
- # Task description
55
+ ### Task description
56
56
  This is a named entity recognition task. Given a sentence from a medical note, annotate the Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, and Duration.
57
57
 
58
- # Schema definition
58
+ ### Schema definition
59
59
  Your output should contain:
60
60
  "entity_text": the exact wording as mentioned in the note.
61
61
  "entity_type": type of the entity. It should be one of the "Drug", "Form", "Strength", "Frequency", "Route", "Dosage", "Reason", "ADE", or "Duration".
62
62
 
63
- # Output format definition
63
+ ### Output format definition
64
64
  Your output should follow JSON format,
65
65
  if there are one of the entity mentions: Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, or Duration:
66
- [{"entity_text": "<Exact entity mentions as in the note>", "entity_type": "<entity type as listed above>"},
67
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "<entity type as listed above>"}]
68
- if there is no entity mentioned in the given note, just output an empty list:
66
+ [
67
+ {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}},
68
+ {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}}
69
+ ]
70
+ if there is no entity mentioned in the sentence, just output an empty list:
69
71
  []
70
72
 
71
73
  I am only interested in the extracted contents in []. Do NOT explain your answer.
72
74
 
73
- # Examples
75
+ ### Examples
74
76
  Below are some examples:
75
77
 
76
78
  Input: Acetaminophen 650 mg PO BID 5.
77
- Output: [{"entity_text": "Acetaminophen", "entity_type": "Drug"}, {"entity_text": "650 mg", "entity_type": "Strength"}, {"entity_text": "PO", "entity_type": "Route"}, {"entity_text": "BID", "entity_type": "Frequency"}]
79
+ Output: [
80
+ {"entity_text": "Acetaminophen", "attr": {"entity_type": "Drug"}},
81
+ {"entity_text": "650 mg", "attr": {"entity_type": "Strength"}},
82
+ {"entity_text": "attr": {"PO", "entity_type": "Route"}},
83
+ {"entity_text": "BID", "attr": {"entity_type": "Frequency"}}
84
+ ]
78
85
 
79
86
  Input: Mesalamine DR 1200 mg PO BID 2.
80
- Output: [{"entity_text": "Mesalamine DR", "entity_type": "Drug"}, {"entity_text": "1200 mg", "entity_type": "Strength"}, {"entity_text": "BID", "entity_type": "Frequency"}, {"entity_text": "PO", "entity_type": "Route"}]
87
+ Output: [
88
+ {"entity_text": "Mesalamine DR", "attr": {"entity_type": "Drug"}},
89
+ {"entity_text": "1200 mg", "attr": {"entity_type": "Strength"}},
90
+ {"entity_text": "BID", "attr": {"entity_type": "Frequency"}},
91
+ {"entity_text": "PO", "attr": {"entity_type": "Route"}}
92
+ ]
81
93
 
82
94
 
83
- # Input placeholder
84
- Below is the medical note:
95
+ ### Context
96
+ The text below is from the medical note:
85
97
  "{{input}}"
86
98
 
87
99
 
88
100
  Example 3 (multiple entity types with corresponding attributes):
89
101
 
90
- # Task description
91
- This is a named entity recognition task. Given a sentence from a medical note, annotate the events (EVENT) and time expressions (TIMEX3):
92
-
93
- # Schema definition
94
- Your output should contain:
95
- "entity_text": the exact wording as mentioned in the note.
96
- "entity_type": type of the entity. It should be one of the "EVENT" or "TIMEX3".
97
- if entity_type is "EVENT",
98
- "type": the event type as one of the "TEST", "PROBLEM", "TREATMENT", "CLINICAL_DEPT", "EVIDENTIAL", or "OCCURRENCE".
99
- "polarity": whether an EVENT is positive ("POS") or negative ("NAG"). For example, in “the patient reports headache, and denies chills”, the EVENT [headache] is positive in its polarity, and the EVENT [chills] is negative in its polarity.
100
- "modality": whether an EVENT actually occurred or not. Must be one of the "FACTUAL", "CONDITIONAL", "POSSIBLE", or "PROPOSED".
101
-
102
- if entity_type is "TIMEX3",
103
- "type": the type as one of the "DATE", "TIME", "DURATION", or "FREQUENCY".
104
- "val": the numeric value 1) DATE: [YYYY]-[MM]-[DD], 2) TIME: [hh]:[mm]:[ss], 3) DURATION: P[n][Y/M/W/D]. So, “for eleven days” will be
105
- represented as “P11D”, meaning a period of 11 days. 4) R[n][duration], where n denotes the number of repeats. When the n is omitted, the expression denotes an unspecified amount of repeats. For example, “once a day for 3 days” is “R3P1D” (repeat the time interval of 1 day (P1D) for 3 times (R3)), twice every day is “RP12H” (repeat every 12 hours)
106
- "mod": additional information regarding the temporal value of a time expression. Must be one of the:
107
- “NA”: the default value, no relevant modifier is present;
108
- “MORE”, means “more than”, e.g. over 2 days (val = P2D, mod = MORE);
109
- “LESS”, means “less than”, e.g. almost 2 months (val = P2M, mod=LESS);
110
- “APPROX”, means “approximate”, e.g. nearly a week (val = P1W, mod=APPROX);
111
- “START”, describes the beginning of a period of time, e.g. Christmas morning, 2005 (val= 2005-12-25, mod= START).
112
- “END”, describes the end of a period of time, e.g. late last year, (val = 2010, mod = END)
113
- “MIDDLE”, describes the middle of a period of time, e.g. mid-September 2001 (val = 2001-09, mod = MIDDLE)
114
-
115
- # Output format definition
116
- Your output should follow JSON format,
117
- if there are one of the EVENT or TIMEX3 entity mentions:
118
- [
119
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "EVENT", "type": "<event type>", "polarity": "<event polarity>", "modality": "<event modality>"},
120
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "TIMEX3", "type": "<TIMEX3 type>", "val": "<time value>", "mod": "<additional information>"}
121
- ...
122
- ]
123
- if there is no entity mentioned in the given note, just output an empty list:
124
- []
125
-
126
- I am only interested in the extracted contents in []. Do NOT explain your answer.
127
-
128
- # Examples
129
- Below are some examples:
130
-
131
- Input: At 9/7/93 , 1:00 a.m. , intravenous fluids rate was decreased to 50 cc&apos;s per hour , total fluids given during the first 24 hours were 140 to 150 cc&apos;s per kilo per day .
132
- Output: [{"entity_text": "intravenous fluids", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
133
- {"entity_text": "decreased", "entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"},
134
- {"entity_text": "total fluids", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
135
- {"entity_text": "9/7/93 , 1:00 a.m.", "entity_type": "TIMEX3", "type": "TIME", "val": "1993-09-07T01:00", "mod": "NA"},
136
- {"entity_text": "24 hours", "entity_type": "TIMEX3", "type": "DURATION", "val": "PT24H", "mod": "NA"}]
137
-
138
- Input: At that time it appeared well adhered to the underlying skin .
139
- Output: [{"entity_text": "it", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
140
- {"entity_text": "well adhered", "entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}]
141
-
142
-
143
- # Input placeholder
144
- Below is the medical note:
145
- "{{input}}"
102
+     ### Task description
103
+     This is a named entity recognition task. Given a sentence from a medical note, annotate the events (EVENT) and time expressions (TIMEX3):
104
+
105
+     ### Schema definition
106
+     Your output should contain: 
107
+         "entity_text": the exact wording as mentioned in the note.
108
+         "entity_type": type of the entity. It should be one of the "EVENT" or "TIMEX3".
109
+         if entity_type is "EVENT",
110
+             "type": the event type as one of the "TEST", "PROBLEM", "TREATMENT", "CLINICAL_DEPT", "EVIDENTIAL", or "OCCURRENCE".
111
+             "polarity": whether an EVENT is positive ("POS") or negative ("NAG"). For example, in “the patient reports headache, and denies chills”, the EVENT [headache] is positive in its polarity, and the EVENT [chills] is negative in its polarity.
112
+             "modality": whether an EVENT actually occurred or not. Must be one of the "FACTUAL", "CONDITIONAL", "POSSIBLE", or "PROPOSED".
113
+
114
+         if entity_type is "TIMEX3",
115
+             "type": the type as one of the "DATE", "TIME", "DURATION", or "FREQUENCY".
116
+             "val": the numeric value 1) DATE: [YYYY]-[MM]-[DD], 2) TIME: [hh]:[mm]:[ss], 3) DURATION: P[n][Y/M/W/D]. So, “for eleven days” will be 
117
+     represented as “P11D”, meaning a period of 11 days. 4)  R[n][duration], where n denotes the number of repeats. When the n is omitted, the expression denotes an unspecified amount of repeats. For example, “once a day for 3 days” is “R3P1D” (repeat the time interval of 1 day (P1D) for 3 times (R3)), twice every day is “RP12H” (repeat every 12 hours)
118
+             "mod": additional information regarding the temporal value of a time expression. Must be one of the:
119
+                 “NA”: the default value, no relevant modifier is present;  
120
+                 “MORE”, means “more than”, e.g. over 2 days (val = P2D, mod = MORE);  
121
+                 “LESS”, means “less than”, e.g. almost 2 months (val = P2M, mod=LESS); 
122
+                 “APPROX”, means “approximate”, e.g. nearly a week (val = P1W, mod=APPROX);  
123
+                 “START”, describes the beginning of a period of time, e.g.  Christmas morning, 2005 (val= 2005-12-25, mod= START).  
124
+                 “END”, describes the end of a period of time, e.g. late last year, (val = 2010, mod = END)
125
+                 “MIDDLE”, describes the middle of a period of time, e.g. mid-September 2001 (val = 2001-09, mod = MIDDLE) 
126
+
127
+     ### Output format definition
128
+     Your output should follow JSON format. Each element in the list is a dictionary with an "entity_text" key and an "attr" key. The "attr" dictionary contains all other attributes, including "entity_type".
129
+
130
+     For example:
131
+     If there are EVENT or TIMEX3 entity mentions:
132
+         [
133
+             {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "EVENT", "type": "<event type>", "polarity": "<event polarity>", "modality": "<event modality>"}},
134
+             {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "TIMEX3", "type": "<TIMEX3 type>", "val": "<time value>", "mod": "<additional information>"}}
135
+             ...
136
+         ]
137
+     If there is no entity mentioned in the given note, just output an empty list:
138
+         []
139
+
140
+     I am only interested in the extracted contents in []. Do NOT explain your answer.
141
+
142
+     ### Examples
143
+     Below are some examples:
144
+
145
+     Input: At 9/7/93 , 1:00 a.m. , intravenous fluids rate was decreased to 50 cc&apos;s per hour , total fluids given during the first 24 hours were 140 to 150 cc&apos;s per kilo per day .
146
+     Output: [
147
+             {"entity_text": "intravenous fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
148
+             {"entity_text": "decreased", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}},
149
+             {"entity_text": "total fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}}, 
150
+             {"entity_text": "9/7/93 , 1:00 a.m.", "attr": {"entity_type": "TIMEX3", "type": "TIME", "val": "1993-09-07T01:00", "mod": "NA"}},
151
+             {"entity_text": "24 hours", "attr": {"entity_type": "TIMEX3", "type": "DURATION", "val": "PT24H", "mod": "NA"}}
152
+         ]
153
+
154
+     Input: At that time it appeared well adhered to the underlying skin .
155
+     Output: [
156
+             {"entity_text": "it", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
157
+             {"entity_text": "well adhered", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}}
158
+         ]
159
+
160
+     ### Context
161
+     The text below is from the medical note:
162
+     "{{input}}"
@@ -1,145 +1,162 @@
1
1
  Prompt Template Design:
2
2
 
3
3
  1. Task Description:
4
- Provide a detailed description of the task, including the background and the type of task (e.g., named entity recognition).
4
+ Provide a detailed description of the task, including the background and the type of task (e.g., named entity recognition). Explain that a sentence from the document will be send by the user at a time. The prompted agent will focus on processing them before moving to the next sentence.
5
5
 
6
6
  2. Schema Definition:
7
- List the key concepts that should be extracted, and provide clear definitions for each one.
7
+ List the key concepts that should be extracted, and provide clear definitions for each one. **Must define "entity_text"** which will be used to recognize the entity.
8
8
 
9
9
  3. Output Format Definition:
10
- The output should be a JSON list, where each element is a dictionary representing a frame (an entity along with its attributes). Each dictionary must include a key that holds the entity text. This key can be named "entity_text" or anything else depend on the context. The attributes can either be flat (e.g., {"entity_text": "<entity_text>", "attr1": "<attr1>", "attr2": "<attr2>"}) or nested (e.g., {"entity_text": "<entity_text>", "attributes": {"attr1": "<attr1>", "attr2": "<attr2>"}}).
10
+ The output should be a JSON list, where each element is a dictionary representing a frame (an entity along with its attributes). **Each dictionary must include a key "entity_text" and a key "attr"**. The attributes are placed in the "attr" (e.g., {"entity_text": "<entity_text>", "attr": {"attr1": "<attr1>", "attr2": "<attr2>"}}).
11
11
 
12
12
  4. Optional: Hints:
13
- Provide itemized hints for the information extractors to guide the extraction process.
13
+ Provide itemized hints for the information extractors to guide the extraction process. Remind the prompted agent to be truthful. Emphasize that the prompted agent is supposed to perform the task instead of writting code or instruct other agents to do it.
14
14
 
15
15
  5. Optional: Examples:
16
16
  Include examples in the format:
17
17
  Input: ...
18
18
  Output: ...
19
19
 
20
- 6. Input Placeholder:
21
- The template must include a placeholder in the format {{<placeholder_name>}} for the input text. The placeholder name can be customized as needed.
20
+ 6. Context:
21
+ The template must include a placeholder in the format {{<placeholder_name>}} for the context. The placeholder name can be customized as needed.
22
22
 
23
23
 
24
24
  Example 1 (single entity type with attributes):
25
25
 
26
- # Task description
27
- The paragraph below is from the Food and Drug Administration (FDA) Clinical Pharmacology Section of Labeling for Human Prescription Drug and Biological Products, Adverse reactions section. Please carefully review it and extract the adverse reactions and percentages. Note that each adverse reaction is nested under a clinical trial and potentially an arm. Your output should take that into consideration.
26
+ ### Task description
27
+ The paragraph below is from the Food and Drug Administration (FDA) Clinical Pharmacology Section of Labeling for Human Prescription Drug and Biological Products, Adverse reactions section. I will send you sentence by sentence. Please carefully review it and extract the adverse reactions and percentages from the given sentence. Note that each adverse reaction is nested under a clinical trial and potentially an arm. Your output should take that into consideration.
28
28
 
29
- # Schema definition
29
+ ### Schema definition
30
30
  Your output should contain:
31
- "ClinicalTrial" which is the name of the trial,
31
+ "entity_text" which is the name of the clinical trial as spelled in the sentence,
32
32
  If applicable, "Arm" which is the arm within the clinical trial,
33
33
  "AdverseReaction" which is the name of the adverse reaction,
34
34
  If applicable, "Percentage" which is the occurance of the adverse reaction within the trial and arm,
35
- "Evidence" which is the EXACT sentence in the text where you found the AdverseReaction from
36
35
 
37
- # Output format definition
36
+ ### Output format definition
38
37
  Your output should follow JSON format, for example:
39
38
  [
40
- {"ClinicalTrial": "<Clinical trial name or number>", "Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"},
41
- {"ClinicalTrial": "<Clinical trial name or number>", "Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"}
39
+ {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>"}},
40
+ {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>"}}
42
41
  ]
43
42
 
44
- # Additional hints
45
- Your output should be 100% based on the provided content. DO NOT output fake numbers.
46
- If there is no specific arm, just omit the "Arm" key. If the percentage is not reported, just omit the "Percentage" key. The "Evidence" should always be provided.
43
+ ### Additional hints
44
+ - Your output should be 100% based on the provided content. DO NOT output fake numbers.
45
+ - You are expected to generate the output instead of writting code or insturcting other agents to do so.
46
+ - If there is no specific arm, just omit the "Arm" key. If the percentage is not reported, just omit the "Percentage" key. The "Evidence" should always be provided.
47
47
 
48
- # Input placeholder
49
- Below is the Adverse reactions section:
48
+ ### Context
49
+ The text below is from the Adverse reactions section:
50
50
  "{{input}}"
51
51
 
52
52
 
53
53
  Example 2 (multiple entity types):
54
54
 
55
- # Task description
55
+ ### Task description
56
56
  This is a named entity recognition task. Given a sentence from a medical note, annotate the Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, and Duration.
57
57
 
58
- # Schema definition
58
+ ### Schema definition
59
59
  Your output should contain:
60
60
  "entity_text": the exact wording as mentioned in the note.
61
61
  "entity_type": type of the entity. It should be one of the "Drug", "Form", "Strength", "Frequency", "Route", "Dosage", "Reason", "ADE", or "Duration".
62
62
 
63
- # Output format definition
63
+ ### Output format definition
64
64
  Your output should follow JSON format,
65
65
  if there are one of the entity mentions: Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, or Duration:
66
- [{"entity_text": "<Exact entity mentions as in the note>", "entity_type": "<entity type as listed above>"},
67
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "<entity type as listed above>"}]
68
- if there is no entity mentioned in the given note, just output an empty list:
66
+ [
67
+ {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}},
68
+ {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}}
69
+ ]
70
+ if there is no entity mentioned in the sentence, just output an empty list:
69
71
  []
70
72
 
71
73
  I am only interested in the extracted contents in []. Do NOT explain your answer.
72
74
 
73
- # Examples
75
+ ### Examples
74
76
  Below are some examples:
75
77
 
76
78
  Input: Acetaminophen 650 mg PO BID 5.
77
- Output: [{"entity_text": "Acetaminophen", "entity_type": "Drug"}, {"entity_text": "650 mg", "entity_type": "Strength"}, {"entity_text": "PO", "entity_type": "Route"}, {"entity_text": "BID", "entity_type": "Frequency"}]
79
+ Output: [
80
+ {"entity_text": "Acetaminophen", "attr": {"entity_type": "Drug"}},
81
+ {"entity_text": "650 mg", "attr": {"entity_type": "Strength"}},
82
+ {"entity_text": "attr": {"PO", "entity_type": "Route"}},
83
+ {"entity_text": "BID", "attr": {"entity_type": "Frequency"}}
84
+ ]
78
85
 
79
86
  Input: Mesalamine DR 1200 mg PO BID 2.
80
- Output: [{"entity_text": "Mesalamine DR", "entity_type": "Drug"}, {"entity_text": "1200 mg", "entity_type": "Strength"}, {"entity_text": "BID", "entity_type": "Frequency"}, {"entity_text": "PO", "entity_type": "Route"}]
87
+ Output: [
88
+ {"entity_text": "Mesalamine DR", "attr": {"entity_type": "Drug"}},
89
+ {"entity_text": "1200 mg", "attr": {"entity_type": "Strength"}},
90
+ {"entity_text": "BID", "attr": {"entity_type": "Frequency"}},
91
+ {"entity_text": "PO", "attr": {"entity_type": "Route"}}
92
+ ]
81
93
 
82
94
 
83
- # Input placeholder
84
- Below is the medical note:
95
+ ### Context
96
+ The text below is from the medical note:
85
97
  "{{input}}"
86
98
 
87
99
 
88
100
  Example 3 (multiple entity types with corresponding attributes):
89
101
 
90
- # Task description
91
- This is a named entity recognition task. Given a sentence from a medical note, annotate the events (EVENT) and time expressions (TIMEX3):
92
-
93
- # Schema definition
94
- Your output should contain:
95
- "entity_text": the exact wording as mentioned in the note.
96
- "entity_type": type of the entity. It should be one of the "EVENT" or "TIMEX3".
97
- if entity_type is "EVENT",
98
- "type": the event type as one of the "TEST", "PROBLEM", "TREATMENT", "CLINICAL_DEPT", "EVIDENTIAL", or "OCCURRENCE".
99
- "polarity": whether an EVENT is positive ("POS") or negative ("NAG"). For example, in “the patient reports headache, and denies chills”, the EVENT [headache] is positive in its polarity, and the EVENT [chills] is negative in its polarity.
100
- "modality": whether an EVENT actually occurred or not. Must be one of the "FACTUAL", "CONDITIONAL", "POSSIBLE", or "PROPOSED".
101
-
102
- if entity_type is "TIMEX3",
103
- "type": the type as one of the "DATE", "TIME", "DURATION", or "FREQUENCY".
104
- "val": the numeric value 1) DATE: [YYYY]-[MM]-[DD], 2) TIME: [hh]:[mm]:[ss], 3) DURATION: P[n][Y/M/W/D]. So, “for eleven days” will be
105
- represented as “P11D”, meaning a period of 11 days. 4) R[n][duration], where n denotes the number of repeats. When the n is omitted, the expression denotes an unspecified amount of repeats. For example, “once a day for 3 days” is “R3P1D” (repeat the time interval of 1 day (P1D) for 3 times (R3)), twice every day is “RP12H” (repeat every 12 hours)
106
- "mod": additional information regarding the temporal value of a time expression. Must be one of the:
107
- “NA”: the default value, no relevant modifier is present;
108
- “MORE”, means “more than”, e.g. over 2 days (val = P2D, mod = MORE);
109
- “LESS”, means “less than”, e.g. almost 2 months (val = P2M, mod=LESS);
110
- “APPROX”, means “approximate”, e.g. nearly a week (val = P1W, mod=APPROX);
111
- “START”, describes the beginning of a period of time, e.g. Christmas morning, 2005 (val= 2005-12-25, mod= START).
112
- “END”, describes the end of a period of time, e.g. late last year, (val = 2010, mod = END)
113
- “MIDDLE”, describes the middle of a period of time, e.g. mid-September 2001 (val = 2001-09, mod = MIDDLE)
114
-
115
- # Output format definition
116
- Your output should follow JSON format,
117
- if there are one of the EVENT or TIMEX3 entity mentions:
118
- [
119
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "EVENT", "type": "<event type>", "polarity": "<event polarity>", "modality": "<event modality>"},
120
- {"entity_text": "<Exact entity mentions as in the note>", "entity_type": "TIMEX3", "type": "<TIMEX3 type>", "val": "<time value>", "mod": "<additional information>"}
121
- ...
122
- ]
123
- if there is no entity mentioned in the given note, just output an empty list:
124
- []
125
-
126
- I am only interested in the extracted contents in []. Do NOT explain your answer.
127
-
128
- # Examples
129
- Below are some examples:
130
-
131
- Input: At 9/7/93 , 1:00 a.m. , intravenous fluids rate was decreased to 50 cc&apos;s per hour , total fluids given during the first 24 hours were 140 to 150 cc&apos;s per kilo per day .
132
- Output: [{"entity_text": "intravenous fluids", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
133
- {"entity_text": "decreased", "entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"},
134
- {"entity_text": "total fluids", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
135
- {"entity_text": "9/7/93 , 1:00 a.m.", "entity_type": "TIMEX3", "type": "TIME", "val": "1993-09-07T01:00", "mod": "NA"},
136
- {"entity_text": "24 hours", "entity_type": "TIMEX3", "type": "DURATION", "val": "PT24H", "mod": "NA"}]
137
-
138
- Input: At that time it appeared well adhered to the underlying skin .
139
- Output: [{"entity_text": "it", "entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"},
140
- {"entity_text": "well adhered", "entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}]
141
-
142
-
143
- # Input placeholder
144
- Below is the medical note:
145
- "{{input}}"
102
+     ### Task description
103
+     This is a named entity recognition task. Given a sentence from a medical note, annotate the events (EVENT) and time expressions (TIMEX3):
104
+
105
+     ### Schema definition
106
+     Your output should contain: 
107
+         "entity_text": the exact wording as mentioned in the note.
108
+         "entity_type": type of the entity. It should be one of the "EVENT" or "TIMEX3".
109
+         if entity_type is "EVENT",
110
+             "type": the event type as one of the "TEST", "PROBLEM", "TREATMENT", "CLINICAL_DEPT", "EVIDENTIAL", or "OCCURRENCE".
111
+             "polarity": whether an EVENT is positive ("POS") or negative ("NAG"). For example, in “the patient reports headache, and denies chills”, the EVENT [headache] is positive in its polarity, and the EVENT [chills] is negative in its polarity.
112
+             "modality": whether an EVENT actually occurred or not. Must be one of the "FACTUAL", "CONDITIONAL", "POSSIBLE", or "PROPOSED".
113
+
114
+         if entity_type is "TIMEX3",
115
+             "type": the type as one of the "DATE", "TIME", "DURATION", or "FREQUENCY".
116
+             "val": the numeric value 1) DATE: [YYYY]-[MM]-[DD], 2) TIME: [hh]:[mm]:[ss], 3) DURATION: P[n][Y/M/W/D]. So, “for eleven days” will be 
117
+     represented as “P11D”, meaning a period of 11 days. 4)  R[n][duration], where n denotes the number of repeats. When the n is omitted, the expression denotes an unspecified amount of repeats. For example, “once a day for 3 days” is “R3P1D” (repeat the time interval of 1 day (P1D) for 3 times (R3)), twice every day is “RP12H” (repeat every 12 hours)
118
+             "mod": additional information regarding the temporal value of a time expression. Must be one of the:
119
+                 “NA”: the default value, no relevant modifier is present;  
120
+                 “MORE”, means “more than”, e.g. over 2 days (val = P2D, mod = MORE);  
121
+                 “LESS”, means “less than”, e.g. almost 2 months (val = P2M, mod=LESS); 
122
+                 “APPROX”, means “approximate”, e.g. nearly a week (val = P1W, mod=APPROX);  
123
+                 “START”, describes the beginning of a period of time, e.g.  Christmas morning, 2005 (val= 2005-12-25, mod= START).  
124
+                 “END”, describes the end of a period of time, e.g. late last year, (val = 2010, mod = END)
125
+                 “MIDDLE”, describes the middle of a period of time, e.g. mid-September 2001 (val = 2001-09, mod = MIDDLE) 
126
+
127
+     ### Output format definition
128
+     Your output should follow JSON format. Each element in the list is a dictionary with an "entity_text" key and an "attr" key. The "attr" dictionary contains all other attributes, including "entity_type".
129
+
130
+     For example:
131
+     If there are EVENT or TIMEX3 entity mentions:
132
+         [
133
+             {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "EVENT", "type": "<event type>", "polarity": "<event polarity>", "modality": "<event modality>"}},
134
+             {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "TIMEX3", "type": "<TIMEX3 type>", "val": "<time value>", "mod": "<additional information>"}}
135
+             ...
136
+         ]
137
+     If there is no entity mentioned in the given note, just output an empty list:
138
+         []
139
+
140
+     I am only interested in the extracted contents in []. Do NOT explain your answer.
141
+
142
+     ### Examples
143
+     Below are some examples:
144
+
145
+     Input: At 9/7/93 , 1:00 a.m. , intravenous fluids rate was decreased to 50 cc&apos;s per hour , total fluids given during the first 24 hours were 140 to 150 cc&apos;s per kilo per day .
146
+     Output: [
147
+             {"entity_text": "intravenous fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
148
+             {"entity_text": "decreased", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}},
149
+             {"entity_text": "total fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}}, 
150
+             {"entity_text": "9/7/93 , 1:00 a.m.", "attr": {"entity_type": "TIMEX3", "type": "TIME", "val": "1993-09-07T01:00", "mod": "NA"}},
151
+             {"entity_text": "24 hours", "attr": {"entity_type": "TIMEX3", "type": "DURATION", "val": "PT24H", "mod": "NA"}}
152
+         ]
153
+
154
+     Input: At that time it appeared well adhered to the underlying skin .
155
+     Output: [
156
+             {"entity_text": "it", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
157
+             {"entity_text": "well adhered", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}}
158
+         ]
159
+
160
+     ### Context
161
+     The text below is from the medical note:
162
+     "{{input}}"