Diff of /prompts/prompt.py [000000] .. [0f1df3]

Switch to unified view

a b/prompts/prompt.py
1
SYSTEMPROMPT = {
2
    'tjh': 'You are an experienced doctor in the field of COVID-19 treatment.',
3
    'mimic-iv': 'You are an experienced doctor in Intensive Care Unit (ICU) treatment.',
4
}
5
USERPROMPT = '''I will provide you with medical information from multiple Intensive Care Unit (ICU) visits of a patient, each characterized by a fixed number of features.
6
7
{INPUT_FORMAT_DESCRIPTION}
8
9
{TASK_DESCRIPTION_AND_RESPONSE_FORMAT}
10
11
In situations where the data does not allow for a reasonable conclusion, respond with the phrase `I do not know` without any additional explanation.
12
13
{UNIT_RANGE_CONTEXT}
14
15
{EXAMPLE}
16
17
Now please predict the patient below:
18
The patient is a {SEX}, aged {AGE} years.
19
The patient had {LENGTH} visits that occurred at {RECORD_TIME_LIST}.
20
Details of the features for each visit are as follows:
21
22
{DETAIL}
23
24
{RESPONSE_FORMAT}
25
RESPONSE:
26
'''
27
28
UNIT = {
29
    'tjh': 'prompts/tjh/unit.json',
30
    'mimic-iv': 'prompts/mimic-iv/unit.json',
31
}
32
33
REFERENCE_RANGE = {
34
    'tjh': 'prompts/tjh/range.json',
35
    'mimic-iv': 'prompts/mimic-iv/range.json',
36
}
37
38
INPUT_FORMAT_DESCRIPTION = {
39
    'string': 'Present multiple visit data of a patient in one batch. Represent each feature within this data as a string of values, separated by commas.',
40
    'list': 'Display multiple visit data of a patient in one batch, expressing each feature as a list of values, separated by commas.',
41
    'batches': 'Organize visit data of a patient into separate batches, each batch corresponding to one visit.',
42
}
43
44
MISSING_VALUE_DESCRIPTION = ' Missing values are represented as `nan`.'
45
46
INSTRUCTING_MISSING_VALUE = 'Values followed by `**` are initially not a number and imputed through Last Observation Carried Forward(LOCF) method. If a large number of values of a certain feature are filled, you need to consider that the credibility of the analysis results for that feature is relatively low.'
47
48
TASK_DESCRIPTION_AND_RESPONSE_FORMAT = {
49
    'outcome': {
50
        'upon-discharge': 'Your task is to assess the provided medical data and analyze the health records from ICU visits to determine the likelihood of the patient not surviving their hospital stay. Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of death.',
51
        '1month': 'Your task is to assess the provided medical data and analyze the health records from ICU visits to determine the likelihood of death within 30 days post-discharge. Include cases where a patient does not survive their hospital stay. Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of death.',
52
        '6months': 'Your task is to assess the provided medical data and analyze the health records from ICU visits to determine the likelihood of death within 6 months post-discharge. Include cases where a patient does not survive their hospital stay. Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of death.',
53
    },
54
    'los': 'Your task is to evaluate the provided medical data to estimate the remaining duration of the ICU stay. Consider the progression of health across multiple visits to forecast the length of intensive care needed. Please respond with a sequence of integers with each one indicating the number of days expected in the ICU during their current visit.',
55
    'readmission': 'Your task is to analyze the medical history to predict the probability of readmission within 30 days post-discharge. Include cases where a patient passes away within 30 days from the discharge date. Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of readmission.',
56
    'multitask': 'Your task is to assess the provided medical data and analyze the health records from ICU visits to determine the likelihood of the patient not surviving their hospital stay and predict the probability of readmission within 30 days post-discharge including cases where a patient passes away within 30 days from the discharge date. Please respond with 2 floating-point numbers between 0 and 1, the first one is the likelihood of death and the second one is the likelihood of readmission, where a higher number suggests a greater likelihood of death or readmission. Do not include any additional explanation.'
57
}
58
59
RESPONSE_FORMAT = {
60
    'outcome': 'Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of death. Do not include any additional explanation.',
61
    'los': 'Please respond with a sequence of integers with each one indicating the number of days expected in the ICU during their current visit. Do not include any additional explanation.',
62
    'readmission': 'Please respond with only a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of readmission. Do not include any additional explanation.',
63
    'multitask': 'Please respond with 2 floating-point numbers between 0 and 1, the first one is the likelihood of death and the second one is the likelihood of readmission, where a higher number suggests a greater likelihood of death or readmission. Do not include any additional explanation.',
64
    'cot': 'Please follow the Chain-of-Thought Analysis Process and respond with a floating-point number between 0 and 1 or `I do not know` at last.'
65
}
66
67
EXAMPLE = {
68
    'tjh': {
69
        'outcome': [
70
'''
71
Input information of a patient:
72
The patient is a male, aged 52.0 years.
73
The patient had 5 visits that occurred at 2020-02-09, 2020-02-10, 2020-02-13, 2020-02-14, 2020-02-17.
74
Details of the features for each visit are as follows:
75
- Hypersensitive cardiac troponinI: "1.9, 1.9, 1.9, 1.9, 1.9"
76
- hemoglobin: "139.0, 139.0, 142.0, 142.0, 142.0"
77
- Serum chloride: "103.7, 103.7, 104.2, 104.2, 104.2"
78
......
79
80
RESPONSE:
81
0.25
82
''',
83
'''
84
Input information of a patient:
85
The patient is a female, aged 71.0 years.
86
The patient had 5 visits that occurred at 2020-02-01, 2020-02-02, 2020-02-09, 2020-02-10, 2020-02-11.
87
Details of the features for each visit are as follows:
88
- Hypersensitive cardiac troponinI: "5691.05, 11970.22, 9029.88, 6371.5, 3638.55"
89
- hemoglobin: "105.68, 132.84, 54.19, 136.33, 123.69"
90
- Serum chloride: "89.18, 101.54, 90.35, 103.99, 102.06"
91
......
92
93
RESPONSE:
94
0.85
95
''',
96
'''
97
Input information of a patient:
98
The patient is a female, aged 53.0 years.
99
The patient had 5 visits that occurred at 2020-01-20, 2020-01-22, 2020-01-27, 2020-01-28, 2020-01-29.
100
Details of the features for each visit are as follows:
101
- Hypersensitive cardiac troponinI: "14.98, 51.49, 49.99, 23.52, 67.93"
102
- hemoglobin: "140.19, 122.73, 116.95, 114.34, 161.72"
103
- Serum chloride: "101.94, 98.23, 92.9, 94.47, 99.78"
104
......
105
106
RESPONSE:
107
0.3
108
''',
109
        ],
110
        'los': [
111
'''
112
Input information of a patient:
113
The patient is a male, aged 52.0 years.
114
The patient had 5 visits that occurred at 2020-02-09, 2020-02-10, 2020-02-13, 2020-02-14, 2020-02-17.
115
Details of the features for each visit are as follows:
116
- Hypersensitive cardiac troponinI: "1.9, 1.9, 1.9, 1.9, 1.9"
117
- hemoglobin: "139.0, 139.0, 142.0, 142.0, 142.0"
118
- Serum chloride: "103.7, 103.7, 104.2, 104.2, 104.2"
119
......
120
121
RESPONSE:
122
9, 8, 5, 4, 1
123
'''
124
        ]
125
    },
126
    'mimic-iv': {
127
        'outcome': [
128
'''
129
Input information of a patient:
130
The patient is a female, aged 52 years.
131
The patient had 4 visits that occurred at 0, 1, 2, 3.
132
Details of the features for each visit are as follows:
133
- Capillary refill rate: "unknown, unknown, unknown, unknown"
134
- Glascow coma scale eye opening: "Spontaneously, Spontaneously, Spontaneously, Spontaneously"
135
- Glascow coma scale motor response: "Obeys Commands, Obeys Commands, Obeys Commands, Obeys Commands"
136
......
137
138
RESPONSE:
139
0.3
140
''',
141
'''
142
Input information of a patient:
143
The patient is a male, aged 49 years.
144
The patient had 4 visits that occurred at 0, 1, 2, 3.
145
Details of the features for each visit are as follows:
146
- Capillary refill rate: "unknown, unknown, unknown, unknown"
147
- Glascow coma scale eye opening: "To speech, To speech, To speech, Spontaneously"
148
- Glascow coma scale motor response: "Abnorm extensn, Obeys Commands, No Response, Localizes Pain"
149
......
150
151
RESPONSE:
152
0.9
153
''',
154
'''
155
Input information of a patient:
156
The patient is a female, aged 68 years.
157
The patient had 5 visits that occurred at 0, 1, 2, 3, 4.
158
Details of the features for each visit are as follows:
159
- Capillary refill rate: "unknown, unknown, unknown, unknown, unknown"
160
- Glascow coma scale eye opening: "Spontaneously, Spontaneously, Spontaneously, Spontaneously, Spontaneously"
161
- Glascow coma scale motor response: "Obeys Commands, Obeys Commands, Obeys Commands, Obeys Commands, Obeys Commands"
162
......
163
164
RESPONSE:
165
0.25
166
''',
167
        ],
168
        'readmission': [
169
'''
170
Input information of a patient:
171
The patient is a female, aged 52 years.
172
The patient had 4 visits that occurred at 0, 1, 2, 3.
173
Details of the features for each visit are as follows:
174
- Capillary refill rate: "unknown, unknown, unknown, unknown"
175
- Glascow coma scale eye opening: "Spontaneously, Spontaneously, Spontaneously, Spontaneously"
176
- Glascow coma scale motor response: "Obeys Commands, Obeys Commands, Obeys Commands, Obeys Commands"
177
......
178
179
RESPONSE:
180
0.3
181
''',
182
        ],
183
        'multitask': [
184
'''
185
Input information of a patient:
186
The patient is a female, aged 52 years.
187
The patient had 4 visits that occurred at 0, 1, 2, 3.
188
Details of the features for each visit are as follows:
189
- Capillary refill rate: "unknown, unknown, unknown, unknown"
190
- Glascow coma scale eye opening: "Spontaneously, Spontaneously, Spontaneously, Spontaneously"
191
- Glascow coma scale motor response: "Obeys Commands, Obeys Commands, Obeys Commands, Obeys Commands"
192
......
193
194
RESPONSE:
195
0.3, 0.4
196
''',
197
        ]
198
    },
199
}
200
201
COT = {
202
    'tjh': '',
203
    'mimic-iv': '''
204
Please follow the Chain-of-Thought Analysis Process:
205
206
1. Analyze the data step by step, For example:
207
   - Blood pressure shows a slight downward trend, indicating...
208
   - Heart rate is stable, suggesting...
209
   - Lab results indicate [specific condition or lack thereof]...
210
   - The patient underwent [specific intervention], which could mean...
211
212
2. Make Intermediate Conclusions:
213
   - Draw intermediate conclusions from each piece of data. For example:
214
     - If a patient's blood pressure is consistently low, it might indicate poor cardiovascular function.
215
     - The patient's cardiovascular function is [conclusion].
216
     - [Other intermediate conclusions based on data].
217
218
3. Aggregate the Findings:
219
   - After analyzing each piece of data, aggregate these findings to form a comprehensive view of the patient's condition.
220
   - Summarize key points from the initial analysis and intermediate conclusions.
221
222
Aggregated Findings:
223
- Considering the patient's vital signs and lab results, the overall health status is...
224
225
4. Final Assessment:
226
   - Conclude with an assessment of the patient's likelihood of not surviving their hospital stay.
227
   - Provide a floating-point number between 0 and 1, where a higher number suggests a greater likelihood of death.
228
   - If the data is insufficient or ambiguous, conclude with "I do not know."
229
230
[0.XX] or "I do not know."
231
232
Here is an example of Input Information and Response:
233
Example #1:
234
Input information of a patient:
235
The patient is a female, aged 52 years.
236
The patient had 4 visits that occurred at 0, 1, 2, 3.
237
Details of the features for each visit are as follows:
238
- Mean blood pressure: "83.42, 79.5, 73.92, 73.0"
239
- Heart Rate: "83.56, 82.55, 81.5, 81.75"
240
- Respiratory rate: "16.05, 13.9, 16.53, 27.39"
241
......
242
243
RESPONSE:
244
1. Analyze the data step by step:
245
   - Blood pressure shows a slight downward trend, which might indicate a gradual decline in cardiovascular stability.
246
   - Heart rate is stable, which is a good sign, suggesting no immediate cardiac distress.
247
   - The respiratory rate initially is stable, but there is a significant increase in the last reading, which could indicate respiratory distress, possibly due to a lung infection, pulmonary embolism, or other respiratory complications.
248
249
2. Make Intermediate Conclusions:
250
   - The decreasing blood pressure could be a sign of worsening heart function or infection-related hypotension.
251
   - Stable heart rate is reassuring but does not completely rule out underlying issues.
252
   - The sudden increase in respiratory rate is concerning, indicating potential acute respiratory problems.
253
254
3. Aggregate the Findings:
255
   - The patient is possibly facing a cardiovascular challenge, compounded by an infection and electrolyte imbalance.
256
257
Aggregated Findings:
258
- Combining the trends in blood pressure, heart rate, and respiratory rate, it appears that the patient's condition is deteriorating, particularly in terms of cardiovascular and respiratory function.
259
260
4. Final Assessment:
261
0.75
262
'''
263
}