site

files for beauhilton.com
git clone https://git.beauhilton.com/site.git
Log | Files | Refs

claude-notes.md (14371B)


      1 # Writing clinical notes using AI - a practical experience
      2 
      3 <time id="post-date">2024-04-09</time>
      4 
      5 <p id="post-excerpt">
      6     With Claude 3 Opus (a newish ChatGPT4 competitor) as my copilot, I wrote a pretty darn good SOAP note
      7     for an (invented yet realistic) new consult visit. It took a little massaging to get it right,
      8     but boy howdy, it did a great job. Here are the prompts and outputs. 
      9     This stuff has serious potential for streamlining the boring and tedious parts of the job.
     10 </p>
     11 
     12 ## LLM, the Great and Terrible
     13 
     14 [Claude](https://www.anthropic.com/claude) 
     15 is one of several new kids on the block in the land of highly capable Large Language Models (LLMs),
     16 and is comparable to (but exceeding in certain aspects) the incumbent ChatGPT4.
     17 
     18 I decided to see how it would do writing a SOAP note for an imaginary (but common and realistic)
     19 new patient consult in an oncology clinic.
     20 
     21 Why "the Great and Terrible?" Everybody knows by now that LLMs are great at a lot of things,
     22 including writing coherent and fluent English
     23 and conforming to pretty much any common text format you can find online
     24 (from legal documents to Python or JavaScript code).
     25 Most folks also know that LLMs aim to please,
     26 and will make up the details they lack in order to satisfy your request,
     27 so their output cannot be trusted too far, particularly in technical areas.
     28 My goal in this was to see how close I could get to a usable clinic note,
     29 with full awareness that it was going to hallucinate and require a tune-up on the back end.
     30 In other words, I am confident LLMs are "terrible" in certain ways,
     31 but needed convincing that they are "great" in this particular arena.
     32 
     33 ## Round 1: The Initial Prompt
     34 
     35 I asked Claude for the following:
     36 
     37 > please write a maximally billable SOAP-style medical note 
     38 for an office visit with a new patient with likely stage III esophageal squamous cell carcinoma. 
     39 Note that we discussed the need for full staging 
     40 with FDG-PET CT to determine the final course of action, 
     41 and the risks and benefits of a CROSS-style chemoradiotherapy regimen if stage III disease is confirmed 
     42 vs systemic therapy if stage IV disease is confirmed. 
     43 The patient describes mild dysphagia to solid foods but minimal weight loss, 
     44 has no notable physical exam findings, 
     45 and labs are unremarkable other than mild anemia. 
     46 I reviewed the available cross-sectional imaging and concur with the radiologist's report.
     47 
     48 And here's the output:
     49 
     50 ---
     51 
     52 Here is a maximally billable SOAP-style medical note for the patient encounter you described:
     53 
     54 S (Subjective): 
     55 62 yo M with newly diagnosed esophageal cancer presents to oncology clinic to establish care and discuss treatment options. 
     56 Reports mild dysphagia to solid foods x 3 weeks 
     57 but denies significant weight loss, odynophagia, chest pain, nausea/vomiting, hematemesis, melena, hematochezia, or other GI symptoms. 
     58 ROS negative except as above. 
     59 PMH notable for HTN, HLD, and GERD. 
     60 FH neg for GI malignancies. 
     61 SH former smoker, quit 10 years ago, 30 pack-year history. 
     62 Married, retired accountant, lives at home with wife. 
     63 Medications include lisinopril, atorvastatin, omeprazole. 
     64 No known allergies.
     65 
     66 O (Objective):  
     67 Vitals: Temp 98.6 F, BP 128/78, HR 72, RR 14, 98% RA, Wt 180 lb, Ht 70 in  
     68 General: NAD, well-appearing. HEENT: PERRL, EOMI, oral mucosa moist. Neck: no LAD. CV: RRR, no m/r/g. Pulm: CTAB. Abd: soft, NT/ND, no masses. Ext: no c/c/e, 2+ pulses.  
     69 Recent EGD: Esophageal mass 30 cm from incisors, partially obstructing lumen, biopsies c/w squamous cell carcinoma. 
     70 CT chest/abd/pelvis: 5 cm distal esophageal mass, obliterating 75% of lumen. 
     71 2 cm regional lymph node. No distant metastases identified. 
     72 Radiologist assessment: T3N1M0, clinical stage III.
     73 Labs: CBC: WBC 6.8, Hgb 11.5, Plt 225. CMP nl except Alb 3.2. CEA 5.2.  
     74 
     75 A (Assessment):
     76 - Esophageal squamous cell carcinoma, clinical stage III (T3N1M0). Awaiting PET/CT for full staging and treatment planning.
     77 - Dysphagia secondary to above. Tolerating po currently without significant loss. Monitor symptoms, intake closely.
     78 - H/o GERD on omeprazole. Continue current therapy. 
     79 - Anemia, likely anemia of chronic disease but will evaluate as outpatient.  
     80 
     81 P (Plan):
     82 1. Will obtain FDG-PET/CT scan to complete staging. 
     83 2. If no distant metastatic disease, recommend neoadjuvant chemoradiotherapy per CROSS regimen (carboplatin/paclitaxel q week x 5 + 41.4 Gy in 23 fractions). 
     84 Discussed expected toxicities including fatigue, esophagitis, nausea, neutropenia and importance of close monitoring. 
     85 3. If metastatic disease identified, will pursue systemic chemotherapy, likely FOLFOX or EOX regimen, rather than local therapy. May require palliative measures for dysphagia (stent, dilation prn).
     86 4. Check iron studies, B12, folate. Replace as indicated.
     87 5. Nutrition consult. Encourage high calorie/protein foods.
     88 6. RTC in 1 week to review PET/CT results and finalize treatment plan. Sooner prn for worsening dysphagia, intolerance of po.
     89 
     90 ---
     91 
     92 The LLM has added in a host of things I didn’t ask it for specifically but do appreciate it including, 
     93 which is what I hoped for when I asked for a “maximally billable note” - 
     94 e.g. the review of systems, PMH, FH, SH, a reasonable assessment and plan for the anemia, RTC, etc. 
     95 Certain aspects are completely fabricated 
     96 (age, vital signs, the specifics of the radiology report, labs).
     97 Some things are technically correct 
     98 but not what I would do (e.g. very few people in the US use the EOX regimen), 
     99 so would need adjusting. 
    100 I was a bit surprised that it went ahead and put in the general plan for CROSS too - those details are correct.
    101 
    102 ## Round 2: The Placeholder Marks
    103 
    104 I asked Claude to replace the invented values with placeholder marks so I could fill them in later:
    105 
    106 > That's pretty good. Instead of inventing vital signs, imaging reports, and lab values, please write it again to instead put in \*\*\* placeholder marks in these areas so I can fill them in later.
    107 
    108 Claude obliged, creating a SOAP note template with *** all over the place. It was a bit too much, as you can see:
    109 
    110 ---
    111 
    112 Sure, here's the revised SOAP note with placeholder marks:
    113 
    114 S (Subjective):
    115 *** yo M with newly diagnosed esophageal cancer presents to oncology clinic to establish care and discuss treatment options. 
    116 Reports mild dysphagia to solid foods x *** weeks 
    117 but denies significant weight loss, odynophagia, chest pain, nausea/vomiting, hematemesis, melena, hematochezia, or other GI symptoms. 
    118 ROS negative except as above. 
    119 PMH notable for ***. 
    120 FH *** for GI malignancies. 
    121 SH *** smoker, quit *** years ago, *** pack-year history. 
    122 ***, ***, lives ***. 
    123 Medications include ***. 
    124 *** allergies.
    125 
    126 O (Objective):
    127 Vitals: Temp *** F, BP ***/**, HR ***, RR ***, ***% RA, Wt *** lb, Ht *** in
    128 General: ***. HEENT: ***. Neck: ***. CV: ***. Pulm: ***. Abd: ***. Ext: ***.
    129 Recent EGD: Esophageal mass *** cm from incisors, partially obstructing lumen, biopsies c/w squamous cell carcinoma. 
    130 CT chest/abd/pelvis: *** cm distal esophageal mass, obliterating ***% of lumen. 
    131 *** cm regional lymph node. No distant metastases identified. 
    132 Radiologist assessment: T***N***M***, clinical stage ***.
    133 Labs: CBC: WBC ***, Hgb ***, Plt ***. CMP *** except ***. CEA ***.
    134 
    135 A (Assessment):
    136 - Esophageal squamous cell carcinoma, clinical stage *** (T***N***M***). Awaiting PET/CT for full staging and treatment planning.
    137 - Dysphagia secondary to above. *** tolerating po currently without significant *** loss. Monitor symptoms, intake closely.
    138 - *** on ***. Continue current therapy.
    139 - Anemia, likely anemia of chronic disease but will evaluate as outpatient.
    140 
    141 P (Plan):
    142 1. Will obtain FDG-PET/CT scan to complete staging.
    143 2. If no distant metastatic disease, recommend neoadjuvant chemoradiotherapy per CROSS regimen (carboplatin/paclitaxel q week x 5 + 41.4 Gy in 23 fractions). 
    144 Discussed expected toxicities including fatigue, esophagitis, nausea, neutropenia and importance of close monitoring.
    145 3. If metastatic disease identified, will pursue systemic chemotherapy, likely FOLFOX or EOX regimen, rather than local therapy. May require palliative measures for dysphagia (stent, dilation prn).
    146 4. Check iron studies, B12, folate. Replace as indicated.
    147 5. Nutrition consult. Encourage high calorie/protein foods.
    148 6. RTC in *** week(s) to review PET/CT results and finalize treatment plan. Sooner prn for worsening dysphagia, intolerance of po.
    149 
    150 ---
    151 
    152 ## Round 3: The Goldilocks Zone
    153 
    154 Finally, I hit what seems to be a sweet spot:
    155 
    156 > Forget what I said, please only put in \*\*\* placeholders for vital signs and imaging. It's ok to make up values for everything else.
    157 
    158 It still needs fixing, but isn't so full of \*\*\* that it's jarring (or impossible to parse - what does "*** on ***" mean? Anything, and nothing, that's what.)
    159 
    160 ---
    161 
    162 Understood. Here's the updated SOAP note with *** placeholders for vital signs and imaging only:
    163 
    164 S (Subjective):
    165 62 yo M with newly diagnosed esophageal cancer presents to oncology clinic to establish care and discuss treatment options. 
    166 Reports mild dysphagia to solid foods x 3 weeks but denies significant weight loss, odynophagia, chest pain, nausea/vomiting, hematemesis, melena, hematochezia, or other GI symptoms. 
    167 ROS negative except as above. 
    168 PMH notable for HTN, HLD, and GERD. 
    169 FH neg for GI malignancies. 
    170 SH former smoker, quit 10 years ago, 30 pack-year history. 
    171 Married, retired accountant, lives at home with wife. 
    172 Medications include lisinopril, atorvastatin, omeprazole. 
    173 No known allergies.
    174 
    175 O (Objective):
    176 Vitals: Temp *** F, BP ***/**, HR ***, RR ***, ***% RA, Wt 180 lb, Ht 70 in
    177 General: NAD, well-appearing. HEENT: PERRL, EOMI, oral mucosa moist. Neck: no LAD. CV: RRR, no m/r/g. Pulm: CTAB. Abd: soft, NT/ND, no masses. Ext: no c/c/e, 2+ pulses.
    178 Recent EGD: Esophageal mass *** cm from incisors, partially obstructing lumen, biopsies c/w squamous cell carcinoma. 
    179 CT chest/abd/pelvis: *** cm distal esophageal mass, obliterating ***% of lumen. *** cm regional lymph node. No distant metastases identified. 
    180 Radiologist assessment: T***N***M***, clinical stage ***.
    181 Labs: CBC: WBC 6.8, Hgb 11.5, Plt 225. CMP nl except Alb 3.2. CEA 5.2.
    182 
    183 A (Assessment):
    184 - Esophageal squamous cell carcinoma, clinical stage III (T3N1M0). Awaiting PET/CT for full staging and treatment planning.
    185 - Dysphagia secondary to above. Tolerating po currently without significant weight loss. Monitor symptoms, intake closely.
    186 - H/o GERD on omeprazole. Continue current therapy.
    187 - Anemia, likely anemia of chronic disease but will evaluate as outpatient.
    188 
    189 P (Plan):
    190 1. Will obtain FDG-PET/CT scan to complete staging.
    191 2. If no distant metastatic disease, recommend neoadjuvant chemoradiotherapy per CROSS regimen (carboplatin/paclitaxel q week x 5 + 41.4 Gy in 23 fractions). 
    192 Discussed expected toxicities including fatigue, esophagitis, nausea, neutropenia and importance of close monitoring.
    193 3. If metastatic disease identified, will pursue systemic chemotherapy, likely FOLFOX or EOX regimen, rather than local therapy. May require palliative measures for dysphagia (stent, dilation prn).
    194 4. Check iron studies, B12, folate. Replace as indicated.
    195 5. Nutrition consult. Encourage high calorie/protein foods.
    196 6. RTC in 1 week to review PET/CT results and finalize treatment plan. Sooner prn for worsening dysphagia, intolerance of po.
    197 
    198 ---
    199 
    200 
    201 ## The Verdict
    202 
    203 Overall, writing the first LLM prompt, 
    204 copying the result into the chart, 
    205 and adjusting it for correctness would take about 5 minutes. 
    206 Improving the prompt as I did adds some time, 
    207 but you can keep whatever prompt engineering bits you figure out for future use.
    208 You could also build yourself a custom template and ask it to fill it out,
    209 which would likely prevent many of the hallucinations 
    210 (e.g. prepopulate placeholders for the vitals, labs, imaging,
    211 and tell the LLM to leave those alone).
    212 
    213 Really, not bad for concise yet comprehensive documentation of a new consult. 
    214 For subsequent visits, copying the note forward 
    215 and adjusting for new details would be more efficient than going back to the LLM.
    216 
    217 Here's the crazy thing about all of the above: 
    218 the LLM did not ingest any PHI whatsoever - 
    219 I gave it a general description of the case only.
    220 No HIPAA is violated. 
    221 No EMR integration is necessary - this would work as well in CPRS as it would in Epic.
    222 Together, these two features are powerful, and means you can use this starting today. 
    223 
    224 I know a lot of organizations are nervous about LLMs and AI in medicine in general,
    225 but I'm not certain I understand the hesitation in this particular arena.
    226 The responsibility is still yours for accurate documentation.
    227 The plan is also still yours, developed together with the patient.
    228 Many efficiencies can be gained without needing HIPAA-violating specifics,
    229 and without somehow asking the AI to become the doctor.
    230 
    231 Also, as a friend pointed out the other day,
    232 many, many clinical notes are chock full of mistakes,
    233 whether typos or things copied forward and not corrected,
    234 or more egregious things like true mistakes in clinical reasoning.
    235 It seems to me, based on my brief experience,
    236 that using a smarter Clippy would serve more to cut down these kinds of errors,
    237 rather than propagating sins worse than those we already commit.
    238 No electronic tool, whether a copy button in Epic or a powerful LLM,
    239 is any kind of replacement for being a good clinician or an excuse for shoddy work.
    240 But, on the same token\*, I also don't insist on counting RBCs myself for every CBC I order - 
    241 this is a good technological cognate, 
    242 since I need to be able to recognize the situations in which the automated counter doesn't tell the whole truth,
    243 know when the results in the computer are fishy,
    244 and be able to do the visual inspection myself if necessary,
    245 but most of the time I can just order the CBC and go on my merry way.
    246 
    247 \* ha, "token." There's an LLM dad joke for ya.
    248 
    249 P.S. I asked Claude to write a blog post summarizing my experience
    250 and including the prompts and outputs.
    251 It mostly sucked and needed a complete rewrite. 
    252 But then again, I didn't try very hard on the prompt.
    253 I've tried asking it to write insurance request letters (e.g. for the FDG-PET CT,
    254 which sometimes gets rejected out of hand even though it's 2024),
    255 consult request letters, consult response letters, and patient summary letters.
    256 Those were all pretty good, minimal tweaking needed.