Write a prescription for 25 year old female patient diagnosed with as depression
first-line pharmacological treatment major depressive disorder young adult woman SSRI guideline 2024
| Drug class | Example agents | Typical starting dose |
|---|---|---|
| SSRI | Sertraline, Escitalopram, Fluoxetine | Sertraline 50 mg OD; Escitalopram 10 mg OD |
| SNRI | Venlafaxine, Duloxetine | Venlafaxine XR 37.5-75 mg OD |
| Other 2nd-gen | Bupropion, Mirtazapine | Bupropion SR 150 mg OD |
Create a clinical summary document on depression management for reference
"major depressive disorder"[MeSH Terms] AND "guideline"[pt]
PMID: 38711351
mkdir -p /tmp/workspace/depression-summary && ls -la /tmp/workspace/
~/depression-summary/build_doc.py
from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
doc = Document()
# Default styling
style = doc.styles["Normal"]
style.font.name = "Calibri"
style.font.size = Pt(10.5)
NAVY = RGBColor(0x1F, 0x3A, 0x5F)
GREY = RGBColor(0x55, 0x55, 0x55)
def set_cell_shading(cell, color_hex):
tcPr = cell._tc.get_or_add_tcPr()
shd = OxmlElement('w:shd')
shd.set(qn('w:val'), 'clear')
shd.set(qn('w:color'), 'auto')
shd.set(qn('w:fill'), color_hex)
tcPr.append(shd)
def add_table(headers, rows, widths=None):
table = doc.add_table(rows=1, cols=len(headers))
table.style = 'Light Grid Accent 1'
table.alignment = WD_TABLE_ALIGNMENT.CENTER
hdr_cells = table.rows[0].cells
for i, h in enumerate(headers):
hdr_cells[i].text = h
for p in hdr_cells[i].paragraphs:
for r in p.runs:
r.font.bold = True
r.font.size = Pt(9.5)
r.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
set_cell_shading(hdr_cells[i], "1F3A5F")
for row in rows:
cells = table.add_row().cells
for i, val in enumerate(row):
cells[i].text = str(val)
for p in cells[i].paragraphs:
for r in p.runs:
r.font.size = Pt(9.5)
if widths:
for row in table.rows:
for i, w in enumerate(widths):
row.cells[i].width = Inches(w)
doc.add_paragraph()
return table
def add_note(text):
p = doc.add_paragraph()
run = p.add_run(text)
run.italic = True
run.font.size = Pt(9)
run.font.color.rgb = GREY
def add_source(text):
p = doc.add_paragraph()
run = p.add_run(text)
run.font.size = Pt(8.5)
run.font.color.rgb = GREY
run.italic = True
# ---------------- TITLE PAGE ----------------
title = doc.add_heading("Depression Management", level=0)
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
for run in title.runs:
run.font.color.rgb = NAVY
sub = doc.add_paragraph("Clinical Reference Summary", alignment=WD_ALIGN_PARAGRAPH.CENTER)
sub.runs[0].font.size = Pt(14)
sub.runs[0].font.color.rgb = GREY
sub.runs[0].italic = True
doc.add_paragraph()
disclaimer = doc.add_paragraph()
disclaimer.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = disclaimer.add_run(
"FOR CLINICIAN REFERENCE / EDUCATIONAL USE ONLY\n"
"Not a substitute for individualized clinical judgment, direct patient evaluation, "
"or local prescribing regulations. Verify all doses against current local formulary "
"and product labeling before prescribing."
)
run.font.size = Pt(10)
run.bold = True
run.font.color.rgb = RGBColor(0xB0, 0x00, 0x00)
doc.add_page_break()
# ---------------- TOC (manual) ----------------
doc.add_heading("Contents", level=1)
toc_items = [
"1. Overview & Diagnostic Criteria (DSM-5)",
"2. Severity Classification & Screening Tools",
"3. Differential Diagnosis / Organic Mimics",
"4. Treatment Overview: Stepped-Care Model",
"5. Psychotherapy",
"6. Pharmacotherapy: First-Line Agents",
"7. Antidepressant Classes: Mechanism, Dosing, Side Effects",
"8. Special Populations",
"9. Monitoring & Follow-Up",
"10. Treatment-Resistant Depression",
"11. Duration of Treatment & Relapse Prevention",
"12. Safety: Suicide Risk & Black Box Warnings",
"13. Key References",
]
for item in toc_items:
doc.add_paragraph(item, style="List Bullet")
doc.add_page_break()
# ---------------- 1. Overview & Diagnostic Criteria ----------------
doc.add_heading("1. Overview & Diagnostic Criteria (DSM-5)", level=1)
doc.add_paragraph(
"Major depressive disorder (MDD) is characterized by persistent low mood and/or "
"anhedonia lasting at least 2 weeks, accompanied by associated somatic and cognitive "
"symptoms, causing significant functional impairment. It is one of the leading causes "
"of global disability."
)
doc.add_heading("DSM-5 Criteria (need ≥5 symptoms, ≥2 weeks; must include depressed mood or anhedonia)", level=2)
symptoms = [
"Depressed mood most of the day, nearly every day",
"Markedly diminished interest or pleasure in almost all activities (anhedonia)",
"Significant unintentional weight loss or gain / appetite change",
"Insomnia or hypersomnia",
"Psychomotor agitation or retardation (observable by others)",
"Fatigue or loss of energy",
"Feelings of worthlessness or excessive/inappropriate guilt",
"Diminished concentration or indecisiveness",
"Recurrent thoughts of death or suicidal ideation, with or without a plan",
]
for s in symptoms:
doc.add_paragraph(s, style="List Bullet")
add_note(
"Symptoms must not be attributable to substance use or another medical condition and "
"must cause clinically significant distress or impairment."
)
add_source("Source: DSM-5 (APA, 2013); Tintinalli's Emergency Medicine, Table 289-2, p. 1988")
# ---------------- 2. Severity & Screening ----------------
doc.add_heading("2. Severity Classification & Screening Tools", level=1)
add_table(
["Tool", "Use", "Notes"],
[
["PHQ-2", "Rapid screen (2 questions)", "Positive screen -> proceed to PHQ-9"],
["PHQ-9", "Severity grading & monitoring", "0-4 minimal, 5-9 mild, 10-14 moderate, 15-19 moderately severe, 20-27 severe"],
["HAM-D / MADRS", "Clinician-rated severity, research/specialist use", "Used in trials and specialist follow-up"],
["Columbia Suicide Severity Rating Scale (C-SSRS)", "Suicide risk stratification", "Use at baseline and at each follow-up, especially first 4-12 weeks of treatment"],
],
widths=[1.6, 2.2, 3.0],
)
# ---------------- 3. Differential Diagnosis ----------------
doc.add_heading("3. Differential Diagnosis / Organic Mimics", level=1)
doc.add_paragraph("Always rule out medical and substance-related causes before or alongside starting treatment:")
diffs = [
"Endocrine: hypothyroidism, Cushing syndrome, Addison disease",
"Neurological: stroke, Parkinson disease, dementia, multiple sclerosis",
"Substance-related: withdrawal from alcohol, opioids, stimulants; medication side effects (steroids, beta-blockers, interferon)",
"Other psychiatric: bipolar disorder (screen for hypomania/mania before starting an antidepressant), PTSD, anxiety disorders, substance use disorder",
"Nutritional/metabolic: B12/folate deficiency, anemia",
]
for d in diffs:
doc.add_paragraph(d, style="List Bullet")
add_source("Source: Tintinalli's Emergency Medicine, p. 1988")
# ---------------- 4. Stepped Care ----------------
doc.add_heading("4. Treatment Overview: Stepped-Care Model", level=1)
add_table(
["Severity", "Recommended First Step"],
[
["Mild MDD", "Psychotherapy (CBT/IPT) or watchful waiting with active monitoring; medication generally not first-line"],
["Moderate MDD", "Psychotherapy and/or antidepressant monotherapy - based on patient preference"],
["Moderate-Severe MDD", "Combination of antidepressant + psychotherapy is more effective than either alone"],
["Severe MDD / psychotic features / high suicide risk", "Pharmacotherapy (+/- antipsychotic if psychotic features); consider inpatient care and ECT referral if life-threatening"],
],
widths=[2.2, 4.6],
)
add_source("Source: NICE Guideline NG222 (2022); APA Clinical Practice Guideline; CANMAT 2023 Update (PMID 38711351)")
# ---------------- 5. Psychotherapy ----------------
doc.add_heading("5. Psychotherapy", level=1)
therapies = [
"Cognitive Behavioral Therapy (CBT) - strong evidence across severity levels",
"Interpersonal Therapy (IPT) - focuses on relationship/role transitions",
"Behavioral Activation - structured re-engagement with rewarding activities",
"Problem-Solving Therapy",
"Dialectical Behavior Therapy (DBT) - useful with comorbid emotional dysregulation/self-harm",
]
for t in therapies:
doc.add_paragraph(t, style="List Bullet")
doc.add_paragraph(
"Psychotherapy is first-line for mild-moderate MDD and is recommended in combination "
"with medication for moderate-severe MDD."
)
# ---------------- 6. Pharmacotherapy First Line ----------------
doc.add_heading("6. Pharmacotherapy: First-Line Agents", level=1)
doc.add_paragraph(
"SSRIs, SNRIs, and other second-generation antidepressants (bupropion, mirtazapine, "
"vortioxetine) are considered first-line pharmacologic options. Choice is guided by "
"side-effect profile, comorbidities, prior response, drug interactions, patient preference, "
"and cost - not by superior average efficacy, since head-to-head differences between most "
"agents are modest (ACP network meta-analysis, PMID 36689750)."
)
add_table(
["Class", "Representative Agents", "Typical Starting Dose*"],
[
["SSRI", "Sertraline, Escitalopram, Fluoxetine, Citalopram, Paroxetine", "Sertraline 50 mg OD; Escitalopram 10 mg OD; Fluoxetine 20 mg OD"],
["SNRI", "Venlafaxine XR, Duloxetine, Desvenlafaxine", "Venlafaxine XR 37.5-75 mg OD; Duloxetine 30-60 mg OD"],
["NDRI", "Bupropion", "Bupropion SR 150 mg OD (avoid in seizure disorder/eating disorder)"],
["Atypical", "Mirtazapine", "Mirtazapine 15 mg nocte (sedating, appetite stimulant)"],
["Multimodal", "Vortioxetine", "10 mg OD"],
],
widths=[1.3, 2.7, 2.8],
)
add_note("*Starting doses are illustrative only; titrate per response/tolerability and local product labeling.")
# ---------------- 7. Classes: mechanism/side effects ----------------
doc.add_heading("7. Antidepressant Classes: Mechanism & Side Effects", level=1)
add_table(
["Class", "Mechanism", "Common Side Effects", "Key Cautions"],
[
["SSRI", "Blocks serotonin reuptake", "GI upset, headache, sexual dysfunction, insomnia/somnolence", "Hyponatremia (elderly), GI bleed risk, activation/anxiety early on, discontinuation syndrome"],
["SNRI", "Blocks serotonin + norepinephrine reuptake", "As above + hypertension, sweating", "Monitor BP; discontinuation syndrome"],
["Bupropion", "NE/dopamine reuptake inhibitor", "Insomnia, dry mouth, appetite suppression", "Contraindicated in seizure disorder, eating disorders; lowers seizure threshold"],
["Mirtazapine", "Alpha-2 antagonist; 5-HT2/3 antagonist", "Sedation, increased appetite/weight gain", "Useful when insomnia/weight loss are prominent"],
["TCA", "Blocks NE/serotonin reuptake, anticholinergic", "Anticholinergic effects, sedation, weight gain, cardiac conduction effects", "Dangerous in overdose (QT/arrhythmia); avoid in cardiac disease/elderly"],
["MAOI", "Inhibits monoamine oxidase", "Orthostatic hypotension, insomnia", "Dietary tyramine restriction; serious drug interactions (serotonin syndrome)"],
],
widths=[1.0, 1.7, 2.3, 2.0],
)
add_source("Source: Stahl's Essential Psychopharmacology; Maudsley Prescribing Guidelines in Psychiatry, 15th ed.")
# ---------------- 8. Special Populations ----------------
doc.add_heading("8. Special Populations", level=1)
pops = [
("Pregnancy/breastfeeding", "Weigh risk of untreated depression vs. medication exposure; sertraline generally preferred; avoid paroxetine in pregnancy (cardiac malformation signal); involve obstetric/psychiatric shared care."),
("Women of reproductive age", "Discuss pregnancy plans/contraception when initiating; some agents carry teratogenicity or neonatal adaptation risk."),
("Adolescents", "SSRIs (fluoxetine has strongest evidence) preferred; combine with CBT/IPT; close monitoring for suicidality, especially first weeks (FDA black box warning for under-25s)."),
("Elderly", "Start low, go slow; SSRI/SNRI preferred over TCA; monitor for hyponatremia, falls, drug interactions (polypharmacy)."),
("Renal/hepatic impairment", "Dose-adjust; avoid agents with active renally-cleared metabolites where relevant; consult local renal drug handbook."),
("Bipolar spectrum features", "Screen before starting antidepressant monotherapy - risk of triggering mania/mixed states; consider mood stabilizer first."),
]
for label, text in pops:
p = doc.add_paragraph()
r = p.add_run(label + ": ")
r.bold = True
p.add_run(text)
# ---------------- 9. Monitoring ----------------
doc.add_heading("9. Monitoring & Follow-Up", level=1)
mon = [
"Review within 1-2 weeks of starting (especially patients <25 years, or with elevated suicide risk), then every 2-4 weeks until response.",
"Full therapeutic effect typically takes 4-6 weeks at an adequate dose.",
"Reassess with PHQ-9 or equivalent at each visit to track response.",
"If <20-25% improvement by 2-4 weeks at adequate dose, consider dose optimization or switching.",
"Monitor side effects, adherence, and emergent suicidality at every visit.",
]
for m in mon:
doc.add_paragraph(m, style="List Bullet")
# ---------------- 10. TRD ----------------
doc.add_heading("10. Treatment-Resistant Depression (TRD)", level=1)
doc.add_paragraph(
"TRD is generally defined as inadequate response to at least two adequate trials "
"(adequate dose and duration, typically 4-6 weeks) of different antidepressant classes."
)
doc.add_heading("Step-wise options", level=2)
trd_steps = [
"Optimize: confirm adherence, adequate dose/duration, reassess diagnosis (bipolar, substance use, medical cause)",
"Switch: to a different agent within or across classes (e.g., SSRI to SNRI or mirtazapine)",
"Augment: atypical antipsychotic (e.g., aripiprazole, quetiapine XR), lithium, or T3 thyroid hormone added to existing antidepressant",
"Combine: two antidepressants with complementary mechanisms (e.g., SSRI/SNRI + mirtazapine)",
"Neuromodulation: electroconvulsive therapy (ECT) - most effective for severe/refractory/psychotic depression; repetitive transcranial magnetic stimulation (rTMS)",
"Interventional/novel: esketamine (intranasal) or IV ketamine for TRD, under specialist supervision; psilocybin/other psychedelics remain investigational/specialist-only",
]
for s in trd_steps:
doc.add_paragraph(s, style="List Bullet")
add_source("Source: Kaplan & Sadock's Comprehensive Textbook of Psychiatry, 'Treatment-Resistant Depression'; Maudsley Prescribing Guidelines in Psychiatry, 15th ed., Table 3.5")
# ---------------- 11. Duration ----------------
doc.add_heading("11. Duration of Treatment & Relapse Prevention", level=1)
dur = [
"Continue antidepressant for at least 6-9 months after achieving remission of a first episode (CANMAT).",
"Stopping before 6 months is associated with higher relapse/recurrence.",
"Consider longer maintenance (1-2 years or indefinite) for recurrent depression (>=2-3 prior episodes), residual symptoms, or high-severity episodes.",
"Taper gradually rather than abrupt discontinuation to reduce discontinuation symptoms (particularly with paroxetine, venlafaxine).",
]
for d in dur:
doc.add_paragraph(d, style="List Bullet")
add_source("Source: CANMAT 2023 Update, PMID 38711351")
# ---------------- 12. Safety ----------------
doc.add_heading("12. Safety: Suicide Risk & Warnings", level=1)
safety = [
"Assess suicide risk at diagnosis and at every follow-up visit, particularly in the first weeks of treatment or after dose changes.",
"FDA black box warning: increased suicidal thinking/behavior risk in children, adolescents, and young adults (<25 years) starting antidepressants - warrants close monitoring.",
"Screen for bipolar disorder before starting an antidepressant alone (risk of manic switch).",
"Counsel on serotonin syndrome risk with drug combinations (e.g., SSRI + MAOI, triptans, tramadol, St John's Wort).",
"Caution with SSRIs and NSAID/anticoagulant co-use (increased GI bleeding risk).",
]
for s in safety:
doc.add_paragraph(s, style="List Bullet")
# ---------------- 13. References ----------------
doc.add_heading("13. Key References", level=1)
refs = [
"Diagnostic and Statistical Manual of Mental Disorders, 5th ed. (DSM-5). American Psychiatric Association, 2013.",
"Tintinalli's Emergency Medicine: A Comprehensive Study Guide - Table 289-2, p. 1988.",
"Kaplan & Sadock's Comprehensive Textbook of Psychiatry - 'Treatment-Resistant Depression.'",
"The Maudsley Prescribing Guidelines in Psychiatry, 15th ed. - Chapter 3, Depression.",
"Stahl's Essential Psychopharmacology: Neuroscientific Basis and Practical Applications.",
"Lam RW, Kennedy SH, et al. CANMAT 2023 Update on Clinical Guidelines for Management of Major Depressive Disorder in Adults. Can J Psychiatry. 2024. PMID: 38711351.",
"Gartlehner G, Dobrescu A, et al. Nonpharmacologic and Pharmacologic Treatments of Adult Patients With Major Depressive Disorder: Systematic Review and Network Meta-analysis (ACP Guideline). Ann Intern Med. 2023. PMID: 36689750.",
"Harter M, Prien P, et al. Clinical Practice Guideline: The Diagnosis and Treatment of Unipolar Depression - National Disease Management Guideline. Dtsch Arztebl Int. 2023. PMID: 37070271.",
"NICE Guideline NG222: Depression in adults: treatment and management. National Institute for Health and Care Excellence, 2022.",
]
for r in refs:
doc.add_paragraph(r, style="List Bullet")
doc.add_paragraph()
footer = doc.add_paragraph()
footer.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = footer.add_run("End of document. For educational/reference use only - not a substitute for individualized clinical assessment.")
run.italic = True
run.font.size = Pt(9)
run.font.color.rgb = GREY
doc.save("/tmp/workspace/depression-summary/Depression_Management_Clinical_Summary.docx")
print("saved")
cd /tmp/workspace/depression-summary && python3 build_doc.py
~/depression-summary/build_doc.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/depression-summary/build_doc.py'
~/depression-summary/build_doc.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/depression-summary/build_doc.py'
doc.add_paragraph() without alignment kwarg issue (that one already creates empty paragraph then sets alignment, fine). Let's run again.cd /tmp/workspace/depression-summary && python3 build_doc.py
cd /tmp/workspace/depression-summary && python3 -c " from docx import Document doc = Document('Depression_Management_Clinical_Summary.docx') print('Paragraphs:', len(doc.paragraphs)) print('Tables:', len(doc.tables)) for p in doc.paragraphs[:15]: if p.text.strip(): print(f'[{p.style.name}] {p.text[:80]}') " && ls -la Depression_Management_Clinical_Summary.docx
Depression Management Clinical Summary
Word Document · DOCX