{ "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", "\n", " \n", "\n", "2. HISTORY OF PRESENT ILLNESS: \n", "\n", " \n", "\n", "3. MEDICAL HISTORY: \n", "\n", " \n", "\n", "4. PHYSICAL EXAM: \n", "\n", " \n", "\n", "5. RESULTS: \n", "\n", " \n", "\n", "6. ASSESSMENT: \n", "\n", " \n", "\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 }