Create a ppt on headache?
headache AND management
International Headache Society headache red flags diagnosis treatment guidance migraine tension headache
headache types migraine tension cluster headache clinical diagram
~/
mkdir -p "/tmp/workspace/headache-presentation/src" "/tmp/workspace/headache-presentation/output" && python - <<'PY' from pptx import Presentation from pptx.util import Inches, Pt from pptx.dml.color import RGBColor from pptx.enum.shapes import MSO_SHAPE from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.enum.dml import MSO_THEME_COLOR from pptx.enum.shapes import MSO_CONNECTOR OUT='/tmp/workspace/headache-presentation/output/Headache_Educational_Presentation.pptx' prs=Presentation(); prs.slide_width=Inches(13.333); prs.slide_height=Inches(7.5) blank=prs.slide_layouts[6] # palette NAVY=RGBColor(18,42,66); BLUE=RGBColor(31,113,173); TEAL=RGBColor(36,159,155); RED=RGBColor(204,71,73); ORANGE=RGBColor(237,151,60); BG=RGBColor(246,249,252); INK=RGBColor(35,48,62); MUTED=RGBColor(94,110,126); WHITE=RGBColor(255,255,255); PALE=RGBColor(224,239,248); PALE2=RGBColor(234,246,244) def rect(slide,x,y,w,h,fill, radius=False, line=None): s=slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE if radius else MSO_SHAPE.RECTANGLE, Inches(x), Inches(y), Inches(w), Inches(h)); s.fill.solid();s.fill.fore_color.rgb=fill s.line.color.rgb = line if line else fill return s def text(slide,x,y,w,h,content,size=20,color=INK,bold=False,align=PP_ALIGN.LEFT, font='Aptos', valign=MSO_ANCHOR.TOP): tb=slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h));tf=tb.text_frame; tf.clear();tf.word_wrap=True;tf.margin_left=0;tf.margin_right=0;tf.margin_top=0;tf.margin_bottom=0;tf.vertical_anchor=valign for i,line in enumerate(content.split('\n')): p=tf.paragraphs[0] if i==0 else tf.add_paragraph();p.text=line;p.alignment=align;p.space_after=Pt(3) for r in p.runs:r.font.name=font;r.font.size=Pt(size);r.font.bold=bold;r.font.color.rgb=color return tb def base(slide,n,title,subtitle=None): rect(slide,0,0,13.333,7.5,BG);rect(slide,0,0,13.333,.16,TEAL) text(slide,.62,.40,11.6,.45,title,27,NAVY,True) if subtitle:text(slide,.62,.93,11.6,.28,subtitle,11,MUTED) text(slide,.62,7.12,11.6,.18,'HEADACHE | EDUCATIONAL OVERVIEW',8,MUTED,False) text(slide,12.15,7.08,.55,.20,f'{n:02d}',9,TEAL,True,PP_ALIGN.RIGHT) def pill(slide,x,y,w,label,fill=PALE,color=BLUE): rect(slide,x,y,w,.38,fill,True);text(slide,x,y+.08,w,.17,label,10,color,True,PP_ALIGN.CENTER) def card(slide,x,y,w,h,heading,body,accent=BLUE): rect(slide,x,y,w,h,WHITE,True,RGBColor(217,227,235));rect(slide,x,y,.09,h,accent) text(slide,x+.28,y+.22,w-.5,.31,heading,15,NAVY,True) text(slide,x+.28,y+.65,w-.5,h-.82,body,12,INK) def note(slide,content): notes=slide.notes_slide.notes_text_frame;notes.text=content # 1 title s=prs.slides.add_slide(blank);rect(s,0,0,13.333,7.5,NAVY);rect(s,0,0,13.333,.18,TEAL) # abstract head circles for x,y,r,c in [(10.4,1.0,1.65,BLUE),(11.5,2.1,1.1,TEAL),(9.55,2.75,.8,ORANGE),(10.4,4.1,1.3,RGBColor(26,74,109))]: sh=s.shapes.add_shape(MSO_SHAPE.OVAL, Inches(x), Inches(y), Inches(r), Inches(r));sh.fill.solid();sh.fill.fore_color.rgb=c;sh.line.color.rgb=c text(s,.72,1.15,8.5,.6,'HEADACHE',42,WHITE,True) text(s,.75,1.95,7.6,.44,'A practical clinical overview',22,RGBColor(191,221,239)) text(s,.76,3.05,7.8,1.3,'Recognize primary headache patterns, identify danger signs, and use a structured approach to evaluation and management.',18,WHITE) pill(s,.78,5.28,2.35,'MIGRAINE',PALE,BLUE);pill(s,3.3,5.28,2.75,'TENSION-TYPE',PALE2,TEAL);pill(s,6.25,5.28,2.25,'CLUSTER',RGBColor(254,237,220),ORANGE) text(s,.78,6.55,7.5,.2,'For teaching and study use - not individual medical advice',9,RGBColor(186,205,220));note(s,'Introduce headache as a common symptom with a wide differential diagnosis. Emphasize that this deck focuses on pattern recognition and safety-netting.') # 2 scope s=prs.slides.add_slide(blank);base(s,2,'Why headaches matter','Most are primary headache disorders, but a small subset signal urgent secondary disease.') card(s,.65,1.55,3.85,4.65,'A common clinical problem','Headache is one of the most frequent neurologic complaints. The first task is to distinguish a primary syndrome from a secondary cause.',TEAL) card(s,4.75,1.55,3.85,4.65,'The clinical goal','Use history and examination to classify the pattern, screen for red flags, decide whether testing is needed, and match treatment to the diagnosis.',BLUE) card(s,8.85,1.55,3.85,4.65,'The safety principle','A new, abrupt, progressive, or neurologically abnormal presentation deserves urgent consideration of secondary causes.',RED) note(s,'The diagnosis is often clinical. A careful history and neurologic examination are more informative than indiscriminate testing in long-standing typical headache patterns.') # 3 classification s=prs.slides.add_slide(blank);base(s,3,'Classify before you treat','Start with the fundamental divide: primary versus secondary headache.') rect(s,.72,1.55,5.75,4.75,PALE,True);text(s,1.05,1.9,5.1,.4,'PRIMARY HEADACHES',22,BLUE,True);text(s,1.05,2.55,4.9,.42,'The disorder itself is the headache.',16,INK) for i,(h,b,c) in enumerate([('Migraine','Often episodic, disabling, with nausea and sensitivity to light or sound.',BLUE),('Tension-type','Usually bilateral, pressing or tightening, mild to moderate.',TEAL),('Trigeminal autonomic','Cluster headache is the classic example: severe unilateral attacks with autonomic signs.',ORANGE)]): y=3.2+i*.85;rect(s,1.05,y,.12,.48,c,True);text(s,1.35,y,4.7,.2,h,14,NAVY,True);text(s,1.35,y+.25,4.65,.38,b,10,MUTED) rect(s,6.85,1.55,5.75,4.75,RGBColor(254,237,237),True);text(s,7.18,1.9,5.1,.4,'SECONDARY HEADACHES',22,RED,True);text(s,7.18,2.55,4.9,.42,'Another condition is causing the headache.',16,INK) text(s,7.18,3.27,4.7,2.05,'Examples:\n• Vascular disease or subarachnoid hemorrhage\n• CNS infection or inflammation\n• Mass lesion or raised intracranial pressure\n• Hypertensive emergency, glaucoma, medication overuse',13,INK) pill(s,7.18,5.78,3.7,'Never assume “just migraine” in a new pattern',RGBColor(255,220,220),RED) note(s,'Primary headache disorders include migraine, tension-type headache, and trigeminal autonomic cephalalgias. Secondary headaches arise from another pathology and should be considered whenever warning features appear.') # 4 headache phenotypes s=prs.slides.add_slide(blank);base(s,4,'Recognize common primary headache patterns','The pattern is more useful than the pain descriptor alone.') cols=[(.65,'MIGRAINE','Unilateral or bilateral\nPulsating\nModerate to severe\nWorse with routine activity\nNausea, photophobia, phonophobia',BLUE), (4.55,'TENSION-TYPE','Bilateral\nPressing or tightening\nMild to moderate\nNot aggravated by activity\nNo prominent nausea',TEAL),(8.45,'CLUSTER','Strictly unilateral orbital/temporal\nVery severe\n15-180 minute attacks\nRestlessness\nTearing, nasal congestion, ptosis',ORANGE)] for x,h,b,c in cols: rect(s,x,1.55,3.55,4.82,WHITE,True,RGBColor(217,227,235));rect(s,x,1.55,3.55,.65,c,True);text(s,x+.25,1.76,3.05,.25,h,16,WHITE,True,PP_ALIGN.CENTER);text(s,x+.34,2.55,2.88,3.1,b,15,INK) note(s,'Compare the phenotypes. Migraine commonly includes nausea and light or sound sensitivity. Tension-type headache is typically pressing or tightening. Cluster attacks are short, extremely severe, and have ipsilateral cranial autonomic symptoms.') # 5 red flags s=prs.slides.add_slide(blank);base(s,5,'Red flags: screen for secondary headache','A warning feature changes the urgency and the investigation threshold.') items=[('S','Systemic symptoms or disease','Fever, weight loss, cancer, immunosuppression'),('N','Neurologic deficit','Focal signs, confusion, seizure, papilledema'),('O','Onset sudden','Thunderclap or maximal intensity within seconds to minutes'),('O','Older age at new onset','New headache after age 50 years'),('P','Pattern change','Progressive course, positional or exertional trigger, pregnancy/postpartum')] for i,(l,h,b) in enumerate(items): y=1.4+i*1.03;rect(s,.75,y,.58,.58,RED,True);text(s,.75,y+.12,.58,.2,l,18,WHITE,True,PP_ALIGN.CENTER);text(s,1.55,y+.05,3.2,.22,h,15,NAVY,True);text(s,4.45,y+.06,7.2,.3,b,13,INK);rect(s,1.55,y+.55,10.4,.02,RGBColor(220,227,233)) text(s,.78,6.62,11.5,.25,'Act urgently for thunderclap onset, meningism, altered consciousness, focal deficit, seizure, or papilledema.',12,RED,True) note(s,'Use a red-flag framework such as SNOOP. This is not a diagnosis rule. The overall clinical context and examination determine urgency. Sudden severe headache with maximal intensity at onset is a medical emergency until proven otherwise.') # 6 assessment s=prs.slides.add_slide(blank);base(s,6,'A structured clinical assessment','History and examination guide classification and testing.') steps=[('1','History','Onset and time course; location; quality; severity; duration; frequency; triggers; associated symptoms; medications.'),('2','Examination','Vitals, general examination, complete neurologic examination, and fundoscopy when indicated.'),('3','Decide on tests','Test when a secondary cause is suspected. Avoid routine imaging for stable, typical primary headache with a normal examination.'),('4','Document pattern','Use a headache diary to record days, severity, associated symptoms, acute medications, triggers, and functional impact.')] for i,(n,h,b) in enumerate(steps): x=.7+(i%2)*6.15;y=1.45+(i//2)*2.48;rect(s,x,y,5.62,1.9,WHITE,True,RGBColor(217,227,235));rect(s,x+.23,y+.3,.58,.58,TEAL if i<2 else BLUE,True);text(s,x+.23,y+.42,.58,.2,n,16,WHITE,True,PP_ALIGN.CENTER);text(s,x+1.02,y+.25,4.2,.25,h,16,NAVY,True);text(s,x+1.02,y+.65,4.1,.85,b,11,INK) note(s,'For many patients with a typical long-standing headache pattern, history and physical examination are sufficient. Additional tests should be targeted rather than ordered as a routine battery.') # 7 management s=prs.slides.add_slide(blank);base(s,7,'Management principles','Treat the attack, reduce recurrence, and avoid treatment-related headache.') card(s,.65,1.45,3.8,4.92,'1. Acute treatment','Use an appropriate early acute therapy for the diagnosed syndrome. For migraine, options may include simple analgesics or NSAIDs, and migraine-specific therapy such as a triptan when appropriate. Add antiemetic therapy when needed.',BLUE) card(s,4.77,1.45,3.8,4.92,'2. Prevention','Consider preventive therapy when attacks are frequent, disabling, prolonged, or acute treatment is ineffective or overused. Choice depends on diagnosis, comorbidity, contraindications, and patient preferences.',TEAL) card(s,8.89,1.45,3.8,4.92,'3. Self-management','Regular sleep, hydration, meals, activity, stress management, trigger awareness, and a headache diary can help. Discuss caffeine and analgesic use honestly.',ORANGE) text(s,.72,6.65,11.9,.22,'Medication selection and dosing require clinician review, especially during pregnancy and with cardiovascular, renal, hepatic, or gastrointestinal disease.',10,RED,True) note(s,'Avoid presenting a medication list as universal. Tailor acute and preventive therapy to the headache type and individual contraindications. Emphasize nonpharmacologic strategies and a diary.') # 8 medication overuse s=prs.slides.add_slide(blank);base(s,8,'Medication-overuse headache','Frequent acute-medication use can perpetuate a chronic headache cycle.') rect(s,.8,1.55,3.25,4.8,RGBColor(254,237,220),True);text(s,1.1,1.95,2.6,.32,'THE CYCLE',18,ORANGE,True);text(s,1.13,2.7,2.42,2.9,'Headache\n↓\nFrequent rescue medication\n↓\nShort relief\n↓\nMore frequent headache\n↓\nEscalating medication use',16,INK,False,PP_ALIGN.CENTER) card(s,4.45,1.55,3.75,4.8,'Suspect it when','Headache becomes frequent or daily in a person using acute treatments often. Risk relates to the drug type and number of treatment days per month.',RED) card(s,8.55,1.55,3.75,4.8,'Clinical response','Review all prescription and nonprescription drugs. Plan withdrawal or reduction with appropriate support, treat the underlying headache disorder, and provide follow-up.',TEAL) note(s,'Medication overuse is an important secondary headache diagnosis. The specific threshold differs by medication class. Do not ask patients to make abrupt medication changes without clinician guidance, especially with opioids or combination agents.') # 9 urgent s=prs.slides.add_slide(blank);base(s,9,'When to escalate urgently','Safety-net instructions are part of every headache consultation.') rect(s,.75,1.45,11.8,1.02,RGBColor(255,225,225),True);text(s,1.05,1.72,11.15,.28,'Seek emergency assessment for a first or worst thunderclap headache, neurologic deficit, seizure, altered consciousness, fever with neck stiffness, or visual loss.',16,RED,True,PP_ALIGN.CENTER) for i,(h,b,c) in enumerate([('Same-day evaluation','New headache in pregnancy or postpartum; cancer or immunosuppression; new onset after age 50; progressive pattern.',ORANGE),('Prompt review','Increasing frequency, changed phenotype, ineffective treatment, medication overuse concern, or functional decline.',BLUE),('Routine follow-up','Stable primary headache needing prevention review, diary interpretation, trigger counseling, or treatment adjustment.',TEAL)]): x=.75+i*4.02;rect(s,x,3.08,3.72,2.62,WHITE,True,RGBColor(217,227,235));rect(s,x,3.08,3.72,.16,c);text(s,x+.25,3.55,3.1,.3,h,16,NAVY,True,PP_ALIGN.CENTER);text(s,x+.33,4.23,3.0,.82,b,12,INK,False,PP_ALIGN.CENTER) note(s,'This slide provides a simple triage framework. The exact timing depends on the patient and local services. Any red flag warrants clinical judgment and potential urgent imaging, lumbar puncture, or specialty review.') # 10 recap s=prs.slides.add_slide(blank);base(s,10,'Take-home messages','Use a pattern-based approach and keep secondary causes in view.') for i,(h,b,c) in enumerate([('Classify','Primary versus secondary is the first decision.',BLUE),('Recognize','Migraine, tension-type, and cluster have distinct patterns.',TEAL),('Screen','Red flags and abnormal examination findings drive urgent work-up.',RED),('Individualize','Treatment should match the syndrome, comorbidity, and medication-use pattern.',ORANGE)]): y=1.5+i*1.2;rect(s,.92,y,.62,.62,c,True);text(s,.92,y+.15,.62,.2,str(i+1),18,WHITE,True,PP_ALIGN.CENTER);text(s,1.85,y+.03,2.5,.25,h,18,NAVY,True);text(s,4.1,y+.09,7.7,.28,b,15,INK) text(s,.92,6.5,11.5,.25,'Key clinical rule: a stable typical pattern and normal neurologic examination support a primary headache diagnosis, but a changing or red-flag pattern needs reassessment.',12,NAVY,True) note(s,'Summarize the four actions: classify, recognize, screen, and individualize. Invite questions.') # sources slide s=prs.slides.add_slide(blank);base(s,11,'Sources and further reading','Selected references used to develop this educational overview.') refs=["Bradley and Daroff's Neurology in Clinical Practice. Headache and diagnostic testing sections.","Goldman-Cecil Medicine. Headache pathobiology, clinical manifestations, and diagnosis sections.","International Headache Society. International Classification of Headache Disorders, 3rd edition (ICHD-3).", "American Academy of Family Physicians. Approach to Acute Headache in Adults; Acute Migraine Headache: Treatment Strategies.","Recent evidence update: medication-overuse headache network meta-analysis, PMID 40011869 (2025)."] for i,r in enumerate(refs): y=1.45+i*.85;rect(s,.8,y,.3,.3,TEAL,True);text(s,1.32,y-.02,10.5,.38,r,13,INK) text(s,.8,6.35,11.7,.38,'This presentation is for education and does not replace local protocols, specialist judgment, or individualized medical care.',12,RED,True) note(s,'References are included for study. Consult current local guidelines and medication labels when treating individual patients.') prs.save(OUT) print(OUT) PY python - <<'PY' from pptx import Presentation p=Presentation('/tmp/workspace/headache-presentation/output/Headache_Educational_Presentation.pptx') print('slides=',len(p.slides)) for i,s in enumerate(p.slides,1): t=' | '.join(sh.text.replace('\n',' / ') for sh in s.shapes if hasattr(sh,'text') and sh.text.strip()) print(i, t[:150]) PY
python - <<'PY' from pptx import Presentation from pathlib import Path path=Path('/tmp/workspace/headache-presentation/output/Headache_Educational_Presentation.pptx') prs=Presentation(path) assert len(prs.slides)==11 assert all(any(getattr(sh,'has_text_frame',False) and sh.text.strip() for sh in slide.shapes) for slide in prs.slides) assert path.stat().st_size > 30000 print(f'OK: {len(prs.slides)} slides; {path.stat().st_size} bytes') PY