Spaces:
Sleeping
Sleeping
File size: 10,988 Bytes
1921336 eebe34f 1921336 5f3eeaf eebe34f 5f3eeaf eebe34f 5f3eeaf eebe34f 5f3eeaf eebe34f 5f3eeaf eebe34f 5f3eeaf 1921336 eebe34f 1921336 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"prompts = [\n",
" {\n",
" \"id\": \"id_0\",\n",
" \"prompt\": \"\"\"You are a proficient assistant tasked with summarizing medical dialogue between a doctor and a patient. Provide a careful and accurate summary based solely on the conversation. Each word is important, and missing any crucial information could have serious consequences. Use only the information from the conversation, and if something is unclear or cannot be accurately summarized, indicate it with \"N/A.\" Follow a step-by-step approach to ensure completeness .\"\"\",\n",
" \"author\": \"Shunxi Wu\",\n",
" \"metric\": {\n",
" \"Rouge\": 0.14,\n",
" \"winning_number\": 10\n",
" },\n",
" \"url\": \"https://docs.google.com/spreadsheets/d/1ui9ccRkzeMWAiJiRgr2ClpYTAK4uFhX44aXi0WDJY8Q/edit?gid=1699794338#gid=1699794338&range=D2\"\n",
" },\n",
" {\n",
" \"id\": \"id_1\",\n",
" \"prompt\": \"\"\"You are a proficient assistant that helps summarize medical dialogue after the communication between the doctor and the patient, Think step by step and strictly follow the form of the example provided, structure the summary into:\n",
"1.CHIEF COMPLAINT:\n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"2. HISTORY OF PRESENT ILLNESS: \n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"3. MEDICAL HISTORY: \n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"4. PHYSICAL EXAM: \n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"5. RESULTS: \n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"6. ASSESSMENT: \n",
"<leave blank row>\n",
"<fill in> \n",
"<leave blank row>\n",
"\n",
"You are autoregressive and carefully provide summarization based on the conversation. Since you are autoregressive, each token of the conversation should be considered important, and you cannot lose any important information. \n",
"Use only the information from the conversation, and if something is unclear or cannot be accurately summarized, indicate it with \"\"N/A.\"\" Follow a step-by-step approach to ensure completeness and adhere strictly to the provided example format.\"\"\",\n",
" \"author\": \"Shunxi Wu\",\n",
" \"metric\": {\n",
" \"Rouge\": 0.14,\n",
" \"winning_number\": 12\n",
" },\n",
" \"url\": \"https://docs.google.com/spreadsheets/d/1ui9ccRkzeMWAiJiRgr2ClpYTAK4uFhX44aXi0WDJY8Q/edit?gid=1699794338#gid=1699794338&range=D3\"\n",
" },\n",
" {\n",
" \"id\": \"id_2\",\n",
" \"prompt\": \"Summarize this conversation. Tell me about the Patient's history, current condition, and treatment plan\",\n",
" \"author\": \"Taru Mishra\",\n",
" \"metric\": {\n",
" \"Rouge\": 0.15,\n",
" \"winning_number\": 3\n",
" },\n",
" \"url\": \"https://docs.google.com/spreadsheets/d/1ui9ccRkzeMWAiJiRgr2ClpYTAK4uFhX44aXi0WDJY8Q/edit?gid=1699794338#gid=1699794338&range=D4\"\n",
" },\n",
" {\n",
" \"id\": \"id_3\",\n",
" \"prompt\": \"\"\"Here is a dialogue:\n",
"DR: You mentioned having a cough for 2 days and a\n",
"fever since last night along with being short of breath.\n",
"Is that correct?\n",
"PT: yes , correct\n",
"DR: I appreciate your concern for preventing spread. Do\n",
"you feel like you are unable to move around as usual?\n",
"PT: I’m definitely weaker and low energy the fever\n",
"went down to 99 this morning\n",
"DR: Have you taken any medications or tried anything\n",
"else to help you with your symptoms?\n",
"PT: lots of fluids and vitamin c. lozenges to minimize\n",
"coughing\n",
"DR: do you have any medical conditions or have you\n",
"been on any medications\n",
"PT: no, none\n",
"DR: alright. When you had a fever, did you take\n",
"medicine like tylenol to bring the fever down?\n",
"PT: I didn’t\n",
"First, important details from the text are extracted. The important facts that the patient states are that they had a cough for 2 days, a fever since last night, shortness of breath, weaker and low energy, fever going down to 99, lots of fluid and vitamin c taken to minimize coughing, no medical conditions, and didn't take medicine like tylenol to bring the fever down.\n",
"Next, they are synthesized into a summary with the important details directly copied word-for-word from the text. In this case, we copy \"\"cough for 2 days\"\", \"\"a fever since last night\"\", \"\"short of breath\"\", \"\"weaker and low energy\"\", \"\"fever went down to 99 this morning\"\", \"\"lots of fluids and vitamin c lozenges to minimize coughing\"\", and \"\"take medicine like tylenol to bring the fever down\"\". We add connecting words, and we arrive at the summary:\n",
"The patient mentioned having a cough for 2 days and a fever since last night with being short of breath. The patient is weaker and low energy, and their fever went down to 99 this morning. The patient took lots of fluids and vitamin c lozenges to minimize coughing. The patient does not have any medical conditions or medications. The patient didn't take medicine like tylenol to bring the fever down.\n",
"Here is a dialogue, apply the same process but only output the summary:\"\"\",\n",
" \"author\": \"Eric Chen\",\n",
" \"metric\": {\n",
" \"Rouge\": 0.11,\n",
" \"winning_number\": 8\n",
" },\n",
" \"url\": \"https://docs.google.com/spreadsheets/d/1ui9ccRkzeMWAiJiRgr2ClpYTAK4uFhX44aXi0WDJY8Q/edit?gid=1699794338#gid=1699794338&range=D5\"\n",
" },\n",
" {\n",
" \"id\": \"id_4\",\n",
" \"prompt\": \"\"\"Here is a dialogue:\n",
"DR: You mentioned having a cough for 2 days and a\n",
"fever since last night along with being short of breath.\n",
"Is that correct?\n",
"PT: yes , correct\n",
"DR: I appreciate your concern for preventing spread. Do\n",
"you feel like you are unable to move around as usual?\n",
"PT: I’m definitely weaker and low energy the fever\n",
"went down to 99 this morning\n",
"DR: Have you taken any medications or tried anything\n",
"else to help you with your symptoms?\n",
"PT: lots of fluids and vitamin c. lozenges to minimize\n",
"coughing\n",
"DR: do you have any medical conditions or have you\n",
"been on any medications\n",
"PT: no, none\n",
"DR: alright. When you had a fever, did you take\n",
"medicine like tylenol to bring the fever down?\n",
"PT: I didn’t\n",
"DR: ok alright let me do a quick physical exam now with a thermometer, it seems like your temperature is 98 now\n",
"PT: okay \n",
"DR: it seems like your infection is going away, just make sure to keep resting\n",
"PT: okay\n",
"First, important details from the text are extracted. The important facts that the patient states are that they had a cough for 2 days, a fever since last night, shortness of breath, weaker and low energy, fever going down to 99, lots of fluid and vitamin c taken to minimize coughing, no medical conditions, and didn't take medicine like tylenol to bring the fever down.\n",
"Next, they are synthesized into a summary with the important details directly copied word-for-word from the text. In this case, we copy \"\"cough for 2 days\"\", \"\"a fever since last night\"\", \"\"short of breath\"\", \"\"weaker and low energy\"\", \"\"fever went down to 99 this morning\"\", \"\"lots of fluids and vitamin c lozenges to minimize coughing\"\", \"\"take medicine like tylenol to bring the fever down\"\", \"\"thermometer\"\", \"\"temperature is 98 now\"\", \"\"infection is going away\"\", and \"\"make sure to keep resting\"\".\n",
"Then, we sort these details into the categories that they are relevant to. There are five categories, CHIEF COMPLAINT, HISTORY OF PRESENT ILLNESS, PHYSICAL EXAM, RESULTS, and ASSESSMENT. Details are split if they belong to multiple categories. Sorted they are CHIEF COMPLAINT: cough, fever, HISTORY OF PRESENT ILLNESS: cough for 2 days, a fever since last night, short of breath, weaker and low energy, fever went to 99 this morning, lots of fluids and vitamin c lozenges to minimize coughing, didn't take tylenol to bring the fever down, PHYSICAL EXAM: thermometer, RESULTS: temperature is 98, ASSESSMENT: infection is going away, make sure to keep resting.\n",
"Finally, we add connecting words, and add the relevant section headers and we arrive at the summary:\n",
"\n",
"CHIEF COMPLAINT\n",
"\n",
"The patient has a cough and a fever.\n",
"\n",
"HISTORY OF PRESENT ILLNESS\n",
"\n",
"The patient has had a cough for 2 days, a fever since last night, and is weaker, low energy, and short of breath. The patient's fever went down to 99 this morning. The patient has taken lots of fluids and vitamin c lozenges to minimize coughing. The patient didn't take tylenol to bring the fever down.\n",
"\n",
"PHYSICAL EXAM\n",
"\n",
"The doctor used a thermometer to test the patient's temperature.\n",
"\n",
"RESULTS\n",
"\n",
"The patient's temperature is 98 degrees.\n",
"\n",
"ASSESSMENT\n",
"\n",
"The patient's infection is going away and the patient needs to rest.\n",
"\n",
"Here is a dialogue, apply the same process but only output the summary:\"\"\",\n",
" \"author\": \"Eric Chen\",\n",
" \"metric\": {\n",
" \"Rouge\": 0.2,\n",
" \"winning_number\": 13\n",
" },\n",
" \"url\": \"https://docs.google.com/spreadsheets/d/1ui9ccRkzeMWAiJiRgr2ClpYTAK4uFhX44aXi0WDJY8Q/edit?gid=1699794338#gid=1699794338&range=D6\"\n",
" },\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"with open(\"prompt.json\", \"w\") as f:\n",
" json.dump(prompts, f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|