What is headache? create pdf on it

Reading File
Reading File
Finding Sources
Searching the Web

headache types classification causes treatment overview 2024

Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && ls -la /tmp/workspace/

Running Command

mkdir -p /tmp/workspace/headache-pdf && python3 << 'EOF' from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, PageBreak, ListFlowable, ListItem) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY from reportlab.pdfgen import canvas doc = SimpleDocTemplate( "/tmp/workspace/headache-pdf/Headache_Medical_Overview.pdf", pagesize=A4, rightMargin=2*cm, leftMargin=2*cm, topMargin=2.5*cm, bottomMargin=2.5*cm, title="Headache - A Comprehensive Medical Overview", author="Orris Medical Reference" ) styles = getSampleStyleSheet() # Custom Styles title_style = ParagraphStyle( 'CustomTitle', parent=styles['Title'], fontSize=26, textColor=colors.HexColor('#1a3a5c'), spaceAfter=8, alignment=TA_CENTER, fontName='Helvetica-Bold' ) subtitle_style = ParagraphStyle( 'Subtitle', parent=styles['Normal'], fontSize=13, textColor=colors.HexColor('#4a6fa5'), spaceAfter=20, alignment=TA_CENTER, fontName='Helvetica' ) h1_style = ParagraphStyle( 'H1', parent=styles['Heading1'], fontSize=16, textColor=colors.HexColor('#1a3a5c'), spaceBefore=18, spaceAfter=6, fontName='Helvetica-Bold', borderPad=4, backColor=colors.HexColor('#e8f0fa'), leftIndent=-6 ) h2_style = ParagraphStyle( 'H2', parent=styles['Heading2'], fontSize=13, textColor=colors.HexColor('#2e5fa3'), spaceBefore=12, spaceAfter=4, fontName='Helvetica-Bold' ) body_style = ParagraphStyle( 'Body', parent=styles['Normal'], fontSize=10.5, leading=15, textColor=colors.HexColor('#222222'), spaceAfter=6, alignment=TA_JUSTIFY, fontName='Helvetica' ) bullet_style = ParagraphStyle( 'Bullet', parent=styles['Normal'], fontSize=10.5, leading=14, textColor=colors.HexColor('#222222'), spaceAfter=3, leftIndent=16, bulletIndent=4, fontName='Helvetica' ) caption_style = ParagraphStyle( 'Caption', parent=styles['Normal'], fontSize=9, textColor=colors.HexColor('#555555'), spaceAfter=4, alignment=TA_CENTER, fontName='Helvetica-Oblique' ) red_flag_style = ParagraphStyle( 'RedFlag', parent=styles['Normal'], fontSize=10.5, leading=14, textColor=colors.HexColor('#8b0000'), spaceAfter=3, leftIndent=16, fontName='Helvetica-Bold' ) story = [] # ─── Cover ─────────────────────────────────────────────────────────────────── story.append(Spacer(1, 1.5*cm)) story.append(Paragraph("HEADACHE", title_style)) story.append(Paragraph("A Comprehensive Medical Overview", subtitle_style)) story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#2e5fa3'), spaceAfter=10)) story.append(Paragraph( "Covering definition, classification, pathophysiology, clinical features, " "diagnosis, treatment, and red flags — based on authoritative medical textbooks " "including Kaplan &amp; Sadock's Comprehensive Textbook of Psychiatry, Bradley and " "Daroff's Neurology in Clinical Practice, and ROSEN's Emergency Medicine.", caption_style )) story.append(Spacer(1, 0.5*cm)) # ─── 1. Definition ──────────────────────────────────────────────────────────── story.append(Paragraph("1. Definition", h1_style)) story.append(Paragraph( "A <b>headache</b> is defined as pain or discomfort in the head, scalp, or neck. It is one " "of the most common neurological complaints worldwide, ranking 14th among global " "disability-adjusted life years (DALYs) in 2019 and being the third greatest source of " "years lost to disability (YLDs), particularly among young females.", body_style )) story.append(Paragraph( "Headaches are broadly categorized as <b>primary</b> (the headache itself is the condition) " "or <b>secondary</b> (headache is a symptom of an underlying disorder). Primary headaches — " "including migraine, tension-type, and cluster — account for nearly 98% of all headaches.", body_style )) # ─── 2. Classification ─────────────────────────────────────────────────────── story.append(Paragraph("2. Classification (ICHD-3)", h1_style)) story.append(Paragraph( "The International Headache Society (IHS) publishes the International Classification of " "Headache Disorders, 3rd edition (ICHD-3). Headaches are divided into three major groups:", body_style )) classification_data = [ ['Group', 'Category', 'Examples'], ['Primary', 'No identifiable underlying cause', 'Migraine, Tension-type, Cluster, TACs'], ['Secondary', 'Caused by another condition', 'SAH, Meningitis, Hypertension, Trauma'], ['Cranial Neuralgias', 'Nerve-related facial/head pain', 'Trigeminal neuralgia, Occipital neuralgia'], ] tbl = Table(classification_data, colWidths=[4*cm, 7*cm, 5.5*cm]) tbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9.5), ('BACKGROUND', (0,1), (-1,1), colors.HexColor('#dce8f9')), ('BACKGROUND', (0,2), (-1,2), colors.HexColor('#eef4ff')), ('BACKGROUND', (0,3), (-1,3), colors.HexColor('#dce8f9')), ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#dce8f9'), colors.HexColor('#eef4ff')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('RIGHTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 5), ('BOTTOMPADDING', (0,0), (-1,-1), 5), ])) story.append(tbl) story.append(Spacer(1, 0.4*cm)) # ─── 3. Primary Headaches ──────────────────────────────────────────────────── story.append(Paragraph("3. Primary Headaches", h1_style)) # 3.1 Tension-type story.append(Paragraph("3.1 Tension-Type Headache (TTH)", h2_style)) story.append(Paragraph( "Tension-type headache is the most common type of primary headache. It is characterized by a " "bilateral, pressing or tightening quality of mild-to-moderate intensity. Unlike migraine, it " "is not aggravated by routine physical activity and is not associated with nausea or vomiting.", body_style )) for item in [ "<b>Location:</b> Bilateral; band-like pressure around the head", "<b>Duration:</b> 30 minutes to 7 days", "<b>Quality:</b> Pressing/tightening (non-pulsating)", "<b>Severity:</b> Mild to moderate", "<b>Associated features:</b> Photophobia or phonophobia (but NOT both), no nausea", "<b>Treatment:</b> OTC analgesics (paracetamol, ibuprofen); tricyclics (amitriptyline) for prevention", ]: story.append(Paragraph(f"• {item}", bullet_style)) story.append(Spacer(1, 0.3*cm)) # 3.2 Migraine story.append(Paragraph("3.2 Migraine", h2_style)) story.append(Paragraph( "Migraine is a disorder characterized by recurrent attacks of headache accompanied by neurologic " "and gastrointestinal symptoms. Presentation is multifaceted, involving vascular, neurologic, GI, " "endocrine, and visual systems. Migraine was ranked the second highest cause of disability globally.", body_style )) story.append(Paragraph("<b>ICHD-3 Diagnostic Criteria — Migraine Without Aura:</b>", body_style)) criteria_data = [ ['Criterion', 'Requirement'], ['A', 'At least 5 attacks fulfilling criteria B-D'], ['B', 'Duration 4–72 hours (untreated or unsuccessfully treated)'], ['C (≥2 of 4)', 'Unilateral • Pulsating • Moderate-severe intensity • Worsened by activity'], ['D (≥1 of 2)', 'Nausea and/or vomiting • Photophobia and phonophobia'], ['E', 'Not better accounted for by another disorder'], ] ctbl = Table(criteria_data, colWidths=[3*cm, 13.5*cm]) ctbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#2e5fa3')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9.5), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#eef4ff'), colors.HexColor('#f9f9f9')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 5), ('BOTTOMPADDING', (0,0), (-1,-1), 5), ])) story.append(ctbl) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph("<b>Migraine With Aura:</b>", body_style)) story.append(Paragraph( "Approximately 20% of migraine sufferers experience aura. Aura consists of reversible neurologic " "symptoms that precede or accompany the headache, lasting 5–60 minutes. Features include:", body_style )) for item in [ "Fully reversible visual symptoms (flickering lights, spots, lines, or scotoma)", "Fully reversible sensory symptoms (pins and needles, numbness)", "Reversible dysphasic speech disturbance", "Symptoms develop gradually over ≥5 minutes; each lasts 5–60 minutes", ]: story.append(Paragraph(f"• {item}", bullet_style)) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph("<b>Migraine Pathophysiology:</b>", body_style)) story.append(Paragraph( "The pathophysiology involves cortical spreading depression (CSD), trigeminovascular activation, " "release of calcitonin gene-related peptide (CGRP), and sensitization of central pain pathways. " "Serotonin dysregulation and genetic predisposition also play important roles.", body_style )) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph("<b>Treatment of Migraine:</b>", body_style)) treatment_data = [ ['Phase', 'Drug Class', 'Examples'], ['Acute (mild)', 'NSAIDs / Analgesics', 'Ibuprofen, Aspirin, Paracetamol'], ['Acute (moderate-severe)', 'Triptans (5-HT1 agonists)', 'Sumatriptan, Rizatriptan, Zolmitriptan'], ['Acute (severe/refractory)', 'Ergotamines / Antiemetics', 'Ergotamine, Metoclopramide'], ['Preventive', 'Beta-blockers', 'Propranolol, Metoprolol'], ['Preventive', 'Tricyclic antidepressants', 'Amitriptyline, Nortriptyline'], ['Preventive', 'Anticonvulsants', 'Valproate, Topiramate'], ['Preventive (new class)', 'Anti-CGRP monoclonal antibodies', 'Erenumab, Fremanezumab, Galcanezumab'], ] ttbl = Table(treatment_data, colWidths=[4*cm, 5.5*cm, 7*cm]) ttbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#dce8f9'), colors.HexColor('#f9f9f9')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 4), ('BOTTOMPADDING', (0,0), (-1,-1), 4), ])) story.append(ttbl) # 3.3 Cluster Headache story.append(Spacer(1, 0.4*cm)) story.append(Paragraph("3.3 Cluster Headache", h2_style)) story.append(Paragraph( "Cluster headache is the most prevalent of the trigeminal autonomic cephalalgias (TACs). " "It is characterized by strictly unilateral, severe, periorbital or temporal pain with ipsilateral " "autonomic features. Attacks last 15–180 minutes and occur in clusters (several attacks per day " "for weeks to months, separated by remission periods).", body_style )) for item in [ "<b>Pain:</b> Unilateral, severe, behind or around one eye", "<b>Duration per attack:</b> 15–180 minutes", "<b>Frequency:</b> 1–8 attacks per day", "<b>Autonomic features:</b> Lacrimation, conjunctival injection, nasal congestion/rhinorrhea, ptosis, miosis", "<b>Acute treatment:</b> 100% oxygen (7–12 L/min), subcutaneous sumatriptan", "<b>Preventive:</b> Verapamil (first-line), corticosteroids, lithium", ]: story.append(Paragraph(f"• {item}", bullet_style)) # ─── Page break before secondary headaches ─────────────────────────────────── story.append(PageBreak()) # ─── 4. Secondary Headaches ────────────────────────────────────────────────── story.append(Paragraph("4. Secondary Headaches", h1_style)) story.append(Paragraph( "Secondary headaches are caused by an identifiable underlying condition. Although less common than " "primary headaches, they are important to recognize because some are life-threatening.", body_style )) secondary_data = [ ['Cause', 'Key Features'], ['Subarachnoid Hemorrhage', '"Worst headache of life" / Thunderclap onset; meningism; LP shows xanthochromia'], ['Meningitis / Encephalitis', 'Fever, nuchal rigidity, photophobia, altered consciousness'], ['Idiopathic Intracranial Hypertension', 'Obese female; papilledema; visual obscurations; pulsatile tinnitus'], ['Hypertensive Emergency', 'BP >180/120 mmHg; headache, visual changes, confusion'], ['Space-occupying Lesion (tumor)', 'Progressive worsening; worse in morning; vomiting without nausea; focal neuro signs'], ['Post-Dural Puncture (Spinal)', 'After LP; positional (worse upright, better supine); treated with blood patch'], ['Giant Cell Arteritis (>50 yrs)', 'Temporal tenderness; jaw claudication; raised ESR/CRP; risk of blindness'], ['Cervicogenic Headache', 'Neck movement triggers; occipital radiation; C2–C3 origin'], ] stbl = Table(secondary_data, colWidths=[6*cm, 10.5*cm]) stbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#8b0000')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#fff0f0'), colors.HexColor('#f9f9f9')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 5), ('BOTTOMPADDING', (0,0), (-1,-1), 5), ])) story.append(stbl) # ─── 5. Red Flags (SNOOP) ──────────────────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(Paragraph("5. Red Flags — The SNOOP Mnemonic", h1_style)) story.append(Paragraph( "The SNOOP mnemonic identifies features that suggest a dangerous secondary cause and mandate " "urgent investigation (MRI/CT, lumbar puncture, blood tests):", body_style )) snoop_data = [ ['Letter', 'Feature', 'Example'], ['S', 'Systemic symptoms / Secondary risk', 'Fever, weight loss, HIV, malignancy'], ['N', 'Neurologic symptoms / signs', 'Confusion, weakness, diplopia, papilledema'], ['O', 'Onset sudden / thunderclap', '"Worst headache of life" — SAH until proven otherwise'], ['O', 'Older age of new onset (>50)', 'Giant cell arteritis, intracranial lesion'], ['P', 'Pattern change / Progressive', 'New headache or increasing frequency/severity'], ] sntbl = Table(snoop_data, colWidths=[2.5*cm, 5*cm, 9*cm]) sntbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#8b0000')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9.5), ('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'), ('TEXTCOLOR', (0,1), (0,-1), colors.HexColor('#8b0000')), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#cc8888')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#fff0f0'), colors.HexColor('#fff8f8')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 5), ('BOTTOMPADDING', (0,0), (-1,-1), 5), ('FONTSIZE', (0,1), (0,-1), 14), ])) story.append(sntbl) # ─── 6. Diagnosis ──────────────────────────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(Paragraph("6. Diagnosis", h1_style)) story.append(Paragraph( "History and physical examination are usually sufficient to diagnose primary headaches, " "provided no high-risk (SNOOP) features are present. Key elements of assessment include:", body_style )) for item in [ "<b>History:</b> Onset, duration, frequency, character, location, severity (1–10), associated symptoms, triggers, medications", "<b>Physical exam:</b> Neurological exam, fundoscopy (papilledema), blood pressure, temporal arteries", "<b>Imaging (MRI preferred):</b> Indicated if any SNOOP features, new onset in cancer patient, or headache with fever and focal deficit", "<b>Lumbar puncture:</b> If CT negative but SAH suspected (xanthochromia at 12 hours post-onset)", "<b>Blood tests:</b> ESR/CRP for GCA, CBC, metabolic panel if secondary cause suspected", ]: story.append(Paragraph(f"• {item}", bullet_style)) # ─── 7. Epidemiology & Burden ───────────────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(Paragraph("7. Epidemiology & Global Burden", h1_style)) epi_data = [ ['Headache Type', 'Global Prevalence', 'Key Demographics'], ['Tension-type', '~38%', 'Equal sex distribution; peaks 30–39 yrs'], ['Migraine', '~14%', 'Female:Male ratio 3:1; peaks 18–44 yrs'], ['Cluster', '~0.1%', 'Male predominance (3:1); onset 20–40 yrs'], ['Chronic Headache (≥15 days/month)', '~3%', 'Often medication-overuse component'], ] epitbl = Table(epi_data, colWidths=[5.5*cm, 4.5*cm, 6.5*cm]) epitbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9.5), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#dce8f9'), colors.HexColor('#eef4ff')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 6), ('TOPPADDING', (0,0), (-1,-1), 5), ('BOTTOMPADDING', (0,0), (-1,-1), 5), ])) story.append(epitbl) # ─── 8. Special Populations ────────────────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(Paragraph("8. Headache in Special Populations", h1_style)) story.append(Paragraph("<b>Pregnancy:</b>", h2_style)) story.append(Paragraph( "Tension headaches are most common during pregnancy. For mild headaches, cognitive behavioral " "therapy, rest, moist heat, massage, and acetaminophen are safe. For severe headaches, tricyclic " "antidepressants (amitriptyline, nortriptyline) may be used. <b>Valproic acid is contraindicated</b> " "in fertile women due to fetal malformation risk. More than 80% of women with migraine improve " "during pregnancy, though 15% continue to have headaches and 5% worsen. " "Migraine with aura increases the risk for peripartum stroke.", body_style )) story.append(Paragraph("<b>Children &amp; Adolescents:</b>", h2_style)) story.append(Paragraph( "Migraine in children tends to be bilateral and of shorter duration. Abdominal migraine and " "cyclic vomiting syndrome are recognized migraine equivalents in children. Ibuprofen and " "sumatriptan nasal spray are approved acute treatments. Non-pharmacological strategies " "(sleep hygiene, hydration, regular meals) are especially important.", body_style )) story.append(Paragraph("<b>Elderly (>50 years):</b>", h2_style)) story.append(Paragraph( "New-onset headache in older adults demands urgent exclusion of secondary causes: giant cell " "arteritis (ESR >50, temporal artery tenderness, risk of blindness), subdural hematoma, " "hypertensive urgency, and intracranial neoplasm. Migraine frequency often decreases with age.", body_style )) # ─── 9. Non-pharmacological Management ────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(Paragraph("9. Non-Pharmacological Management", h1_style)) for item in [ "<b>Trigger identification &amp; avoidance:</b> Stress, sleep deprivation, skipped meals, caffeine, alcohol, hormonal changes, bright light", "<b>Sleep hygiene:</b> Regular sleep schedule is one of the most effective preventive strategies", "<b>Dietary modifications:</b> Avoid tyramine-rich foods (aged cheese, red wine) in migraine", "<b>Stress management:</b> Cognitive behavioral therapy (CBT), biofeedback, mindfulness-based stress reduction", "<b>Physical therapy:</b> Cervical manipulation and physiotherapy for cervicogenic headache and TTH", "<b>Hydration:</b> Dehydration is a common and easily reversible headache trigger", "<b>Exercise:</b> Regular aerobic exercise (≥150 min/week) reduces migraine frequency", "<b>Botulinum toxin (OnabotulinumtoxinA):</b> Approved for chronic migraine prevention (≥15 headache days/month)", ]: story.append(Paragraph(f"• {item}", bullet_style)) # ─── 10. Summary Comparison Table ────────────────────────────────────────── story.append(PageBreak()) story.append(Paragraph("10. Comparative Summary of Primary Headaches", h1_style)) comp_data = [ ['Feature', 'Tension-Type', 'Migraine', 'Cluster'], ['Prevalence', '~38%', '~14%', '~0.1%'], ['Location', 'Bilateral', 'Unilateral (may be bilateral)', 'Unilateral (periorbital)'], ['Quality', 'Pressing/tightening', 'Pulsating/throbbing', 'Severe, stabbing'], ['Severity', 'Mild-moderate', 'Moderate-severe', 'Very severe ("suicide headache")'], ['Duration', '30 min – 7 days', '4 – 72 hours', '15 – 180 minutes'], ['Nausea/Vomiting', 'No', 'Yes', 'No'], ['Photophobia', 'Mild (not both)', 'Yes', 'No'], ['Autonomic features', 'No', 'No', 'Yes (lacrimation, ptosis, rhinorrhea)'], ['Aura', 'No', '20% of cases', 'No'], ['Activity worsens', 'No', 'Yes', 'Patient is restless'], ['Acute Rx', 'Paracetamol/NSAIDs', 'Triptans/NSAIDs', 'O2, Sumatriptan SC'], ['Prophylaxis', 'Amitriptyline', 'Propranolol, Topiramate, Anti-CGRP', 'Verapamil, Lithium'], ] comptbl = Table(comp_data, colWidths=[4.2*cm, 4*cm, 4.5*cm, 3.8*cm]) comptbl.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTNAME', (0,0), (0,-1), 'Helvetica-Bold'), ('TEXTCOLOR', (0,1), (0,-1), colors.HexColor('#1a3a5c')), ('FONTSIZE', (0,0), (-1,0), 10), ('FONTSIZE', (0,1), (-1,-1), 9), ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#eef4ff'), colors.HexColor('#f9f9f9')]), ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('LEFTPADDING', (0,0), (-1,-1), 5), ('TOPPADDING', (0,0), (-1,-1), 4), ('BOTTOMPADDING', (0,0), (-1,-1), 4), ])) story.append(comptbl) # ─── References ────────────────────────────────────────────────────────────── story.append(Spacer(1, 0.5*cm)) story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#2e5fa3'), spaceAfter=6)) story.append(Paragraph("References", h2_style)) refs = [ "Kaplan &amp; Sadock's Comprehensive Textbook of Psychiatry, 11th Ed. — Section 2.11: Neuropsychiatric Aspects of Headache", "Bradley and Daroff's Neurology in Clinical Practice, 8th Ed. — Headache Chapter", "ROSEN's Emergency Medicine: Concepts and Clinical Practice — Headache", "International Headache Society. ICHD-3 — International Classification of Headache Disorders, 3rd Edition (https://ichd-3.org/)", "Swanson's Family Medicine Review — Headache", "Becker WJ. Headache disorders: differentiating and managing the common subtypes. Br J Pain 2015;9(Suppl 1):5–14.", ] for i, ref in enumerate(refs, 1): story.append(Paragraph(f"{i}. {ref}", ParagraphStyle('Ref', parent=styles['Normal'], fontSize=9, leading=13, spaceAfter=3, fontName='Helvetica'))) # Build doc.build(story) print("PDF created successfully!") EOF

Running Command

ls -lh /tmp/workspace/headache-pdf/

Your PDF is ready! Here's a summary of what it covers, followed by the download link:

What is a Headache?

A headache is pain or discomfort in the head, scalp, or neck. It is among the most common neurological complaints globally, ranking 14th in disability-adjusted life years (DALYs) in 2019 and 3rd in years lost to disability (YLDs), especially in young women.
Headaches fall into two broad groups:
  • Primary headaches - the headache is the condition itself (tension-type, migraine, cluster). These account for ~98% of all headaches.
  • Secondary headaches - the headache is a symptom of another underlying disorder (e.g. meningitis, subarachnoid hemorrhage, hypertension).

The Three Main Primary Headaches

Tension-TypeMigraineCluster
QualityPressing/tight bandThrobbing/pulsatingSevere stabbing
LocationBilateralUnilateralPeriorbital (one eye)
Duration30 min – 7 days4 – 72 hours15 – 180 min
NauseaNoYesNo
Autonomic featuresNoNoYes (tearing, ptosis)
Acute RxParacetamol/NSAIDsTriptansO2, SC Sumatriptan

Red Flags (SNOOP)

If any of these are present, urgent investigation is needed:
  • S - Systemic symptoms (fever, weight loss) or secondary risk factors
  • N - Neurologic signs (confusion, weakness, papilledema)
  • O - Onset sudden / thunderclap ("worst headache of life" = SAH until proven otherwise)
  • O - Older age of new onset (>50 yrs)
  • P - Progressive worsening pattern

Download your PDF:

Headache Medical Overview

PDF Document · PDF

The PDF includes: definition, ICHD-3 classification, all 3 primary headache types with full diagnostic criteria, secondary headache causes, red flags (SNOOP), diagnosis approach, treatment tables (including new anti-CGRP drugs), epidemiology, special populations (pregnancy, children, elderly), non-pharmacological management, a full comparative summary table, and references from authoritative textbooks.
This is a shared conversation. Sign in to Orris to start your own chat.