A52 year old male attending OPD with fever, cough breathlessness investigation shows Bordatella pertussis . Plan therapy according to disease stage and suggest care plan gor his asymptomatic 6 year nephew staying in the same house . Plan therapyA52 year old male attending OPD with fever, cough breathlessness investigation shows Bordatella pertussis . Plan therapy according to disease stage and suggest care plan gor his asymptomatic 6 year nephew staying in the same house . Plan therapy
"pertussis" AND "treatment" AND "adults"
Bordetella pertussis treatment adults stage-based therapy azithromycin 2024 CDC guidelines
https://www.cdc.gov/pertussis/hcp/clinical-care/index.html
| Stage | Duration | Key Features |
|---|---|---|
| Incubation | 7-10 days | Asymptomatic |
| Catarrhal | 1-2 weeks | Rhinorrhea, low-grade fever, mild cough, sneezing, malaise |
| Paroxysmal | 2-4 weeks | Repetitive paroxysmal cough with inspiratory whoop, post-tussive vomiting, lymphocytosis; B. pertussis most contagious |
| Convalescent | 3-4 weeks (or longer) | Diminishing paroxysms; secondary complications (pneumonia, seizures) can emerge |
"Antibiotic treatment does not reduce the severity or duration of illness at any phase. The goal of antibiotic therapy is to decrease infectivity and carriage." - Rosen's Emergency Medicine
| Stage | Value of Antibiotics | Recommendation |
|---|---|---|
| Catarrhal (within 1-3 weeks of cough onset) | High - can shorten clinical course AND reduce infectivity | Treat immediately |
| Early Paroxysmal | Moderate - reduces carriage and transmission, less impact on symptoms | Still treat |
| Late Paroxysmal / Convalescent | Minimal clinical benefit, but reduces infectivity | Treat within 3 weeks of cough onset |
| Beyond 3 weeks | No clinical benefit; treat only if household includes infants or high-risk contacts | Individualize |
Important cardiac caveat for this 52-year-old male: Azithromycin can prolong the QT interval. Before prescribing, screen for: pre-existing QT prolongation, bradyarrhythmias, uncompensated heart failure, concurrent QT-prolonging drugs (Class IA or III antiarrhythmics), hypokalemia, or hypomagnesemia. If any are present, use clarithromycin or TMP-SMX instead. This is particularly relevant for a middle-aged male who may have undiagnosed cardiovascular risk. - CDC Treatment Guidelines
"Postexposure prophylaxis with an appropriate macrolide is recommended for household contacts of a pertussis case."
| Measure | Detail |
|---|---|
| Isolation of index patient | Droplet precautions for at least 5 days after starting antibiotics (or 3 weeks from cough onset if untreated) |
| Hand hygiene | Regular handwashing; especially before contact with the child |
| Cough etiquette | Index patient to wear surgical mask when around the nephew |
| Separate sleeping area | If feasible, reduce close contact during the infectious period |
| Notification | Notify the child's school/pediatrician about the household exposure |
| Other household contacts | All unvaccinated or incompletely vaccinated household members should also receive PEP |
| 52-Year-Old Male (Index Case) | 6-Year-Old Nephew (Close Contact) | |
|---|---|---|
| Status | Confirmed pertussis | Asymptomatic household contact |
| Primary drug | Azithromycin 500 mg Day 1, then 250 mg Days 2-5 | Azithromycin 10 mg/kg Day 1, then 5 mg/kg Days 2-5 |
| Goal of treatment | Reduce infectivity and carriage; treat complications | Postexposure prophylaxis - prevent disease |
| Supportive care | O2, hydration, droplet isolation | Symptom monitoring x21 days |
| Vaccination | Tdap booster if not given | Verify/complete DTaP series |
| Cardiac screening | ECG before azithromycin | Not required (young age, low risk) |
| Hospitalization | If pneumonia/hypoxia/severe paroxysms | Outpatient unless symptomatic |
Create a printable patient discharge sheet with antibiotic adherence & warning signs for the 52-year-old
ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "created"
mkdir -p /tmp/workspace/pertussis-discharge && python3 << 'EOF' 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, WD_ALIGN_VERTICAL from docx.oxml.ns import qn from docx.oxml import OxmlElement import datetime doc = Document() # ── Page margins ────────────────────────────────────────────────────────────── from docx.shared import Inches section = doc.sections[0] section.page_width = Inches(8.27) # A4 section.page_height = Inches(11.69) section.left_margin = Inches(0.75) section.right_margin = Inches(0.75) section.top_margin = Inches(0.6) section.bottom_margin = Inches(0.6) # ── Colour palette ──────────────────────────────────────────────────────────── DARK_BLUE = RGBColor(0x00, 0x44, 0x88) MED_BLUE = RGBColor(0x00, 0x6F, 0xC2) LIGHT_BLUE = RGBColor(0xD6, 0xEA, 0xF8) RED = RGBColor(0xC0, 0x39, 0x2B) ORANGE = RGBColor(0xE6, 0x7E, 0x22) GREEN = RGBColor(0x1A, 0x7A, 0x4A) DARK_GRAY = RGBColor(0x2C, 0x3E, 0x50) LIGHT_GRAY = RGBColor(0xF2, 0xF3, 0xF4) WHITE = RGBColor(0xFF, 0xFF, 0xFF) # ── Helper utilities ────────────────────────────────────────────────────────── def set_cell_bg(cell, rgb: RGBColor): tc = cell._tc tcPr = tc.get_or_add_tcPr() shd = OxmlElement('w:shd') hex_color = f"{rgb[0]:02X}{rgb[1]:02X}{rgb[2]:02X}" shd.set(qn('w:val'), 'clear') shd.set(qn('w:color'), 'auto') shd.set(qn('w:fill'), hex_color) tcPr.append(shd) def set_cell_borders(cell, top=None, bottom=None, left=None, right=None): tc = cell._tc tcPr = tc.get_or_add_tcPr() tcBorders = OxmlElement('w:tcBorders') for side, val in [('top', top), ('bottom', bottom), ('left', left), ('right', right)]: if val: el = OxmlElement(f'w:{side}') el.set(qn('w:val'), val.get('val', 'single')) el.set(qn('w:sz'), val.get('sz', '8')) el.set(qn('w:space'), '0') el.set(qn('w:color'), val.get('color', '000000')) tcBorders.append(el) tcPr.append(tcBorders) def add_colored_run(para, text, bold=False, italic=False, size=11, color=DARK_GRAY, font_name='Arial'): run = para.add_run(text) run.bold = bold run.italic = italic run.font.size = Pt(size) run.font.color.rgb = color run.font.name = font_name return run def banner(doc, text, bg=DARK_BLUE, fg=WHITE, size=15, space_before=8, space_after=4): """Full-width colored heading band.""" tbl = doc.add_table(rows=1, cols=1) tbl.alignment = WD_TABLE_ALIGNMENT.CENTER tbl.style = 'Table Grid' cell = tbl.cell(0, 0) set_cell_bg(cell, bg) cell.width = Inches(6.77) p = cell.paragraphs[0] p.alignment = WD_ALIGN_PARAGRAPH.CENTER r = p.add_run(text) r.bold = True r.font.size = Pt(size) r.font.color.rgb = fg r.font.name = 'Arial' # remove table borders for side in ['top','bottom','left','right']: set_cell_borders(cell, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) p.paragraph_format.space_before = Pt(space_before) p.paragraph_format.space_after = Pt(space_after) doc.add_paragraph() # small gap return tbl def section_header(doc, text, color=MED_BLUE, size=12): p = doc.add_paragraph() p.paragraph_format.space_before = Pt(6) p.paragraph_format.space_after = Pt(2) r = p.add_run(f" {text}") r.bold = True r.font.size = Pt(size) r.font.color.rgb = color r.font.name = 'Arial' # underline via shading table tbl = doc.add_table(rows=1, cols=1) tbl.style = 'Table Grid' cell = tbl.cell(0,0) set_cell_bg(cell, LIGHT_BLUE) inner = cell.paragraphs[0] inner.alignment = WD_ALIGN_PARAGRAPH.LEFT rr = inner.add_run(f" {text}") rr.bold = True rr.font.size = Pt(size) rr.font.color.rgb = DARK_BLUE rr.font.name = 'Arial' for side in ['top','bottom','left','right']: set_cell_borders(cell, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) inner.paragraph_format.space_before = Pt(3) inner.paragraph_format.space_after = Pt(3) doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # HEADER BLOCK # ══════════════════════════════════════════════════════════════════════════════ # Hospital name banner ht = doc.add_table(rows=1, cols=1) ht.alignment = WD_TABLE_ALIGNMENT.CENTER ht.style = 'Table Grid' hc = ht.cell(0,0) set_cell_bg(hc, DARK_BLUE) hp = hc.paragraphs[0] hp.alignment = WD_ALIGN_PARAGRAPH.CENTER hr1 = hp.add_run("PATIENT DISCHARGE INSTRUCTION SHEET") hr1.bold = True; hr1.font.size = Pt(17); hr1.font.color.rgb = WHITE; hr1.font.name = 'Arial' hp.paragraph_format.space_before = Pt(8) hp.paragraph_format.space_after = Pt(2) hp2 = hc.add_paragraph() hp2.alignment = WD_ALIGN_PARAGRAPH.CENTER hr2 = hp2.add_run("Infectious Disease / Respiratory Unit") hr2.font.size = Pt(11); hr2.font.color.rgb = RGBColor(0xAE,0xD6,0xF1); hr2.font.name = 'Arial' hp2.paragraph_format.space_before = Pt(0) hp2.paragraph_format.space_after = Pt(8) for side in ['top','bottom','left','right']: set_cell_borders(hc, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) doc.add_paragraph() # Patient details table pt_tbl = doc.add_table(rows=3, cols=4) pt_tbl.style = 'Table Grid' pt_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER labels = [ ("Patient Name:", "________________________"), ("Date of Discharge:", datetime.date.today().strftime("%d %B %Y")), ("Age / Sex:", "52 Years / Male"), ("MRN / IP No:", "________________________"), ("Diagnosis:", "Bordetella pertussis (Whooping Cough)"), ("Treating Physician:", "________________________"), ] idx = 0 for row in pt_tbl.rows: row.height = Pt(22) for i in range(0, 4, 2): lbl_cell = row.cells[i] val_cell = row.cells[i+1] set_cell_bg(lbl_cell, LIGHT_BLUE) lp = lbl_cell.paragraphs[0] lp.alignment = WD_ALIGN_PARAGRAPH.LEFT lr = lp.add_run(f" {labels[idx][0]}") lr.bold = True; lr.font.size = Pt(9.5); lr.font.color.rgb = DARK_BLUE; lr.font.name = 'Arial' vp = val_cell.paragraphs[0] vp.alignment = WD_ALIGN_PARAGRAPH.LEFT vr = vp.add_run(f" {labels[idx][1]}") vr.font.size = Pt(9.5); vr.font.color.rgb = DARK_GRAY; vr.font.name = 'Arial' idx += 1 doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 1 — YOUR DIAGNOSIS # ══════════════════════════════════════════════════════════════════════════════ diag_tbl = doc.add_table(rows=1, cols=1) diag_tbl.style = 'Table Grid' dc = diag_tbl.cell(0,0) set_cell_bg(dc, MED_BLUE) dp = dc.paragraphs[0] dp.alignment = WD_ALIGN_PARAGRAPH.LEFT dr = dp.add_run(" SECTION 1 — YOUR DIAGNOSIS") dr.bold = True; dr.font.size = Pt(12); dr.font.color.rgb = WHITE; dr.font.name = 'Arial' dp.paragraph_format.space_before = Pt(4); dp.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(dc, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) p_diag = doc.add_paragraph() p_diag.paragraph_format.space_before = Pt(4) p_diag.paragraph_format.space_after = Pt(2) add_colored_run(p_diag, "You have been diagnosed with ", size=10.5, color=DARK_GRAY) add_colored_run(p_diag, "PERTUSSIS (Whooping Cough)", bold=True, size=10.5, color=MED_BLUE) add_colored_run(p_diag, ", caused by the bacterium ", size=10.5, color=DARK_GRAY) add_colored_run(p_diag, "Bordetella pertussis", italic=True, size=10.5, color=DARK_GRAY) add_colored_run(p_diag, ". This is a highly contagious respiratory infection.", size=10.5, color=DARK_GRAY) bullets_diag = [ "The infection goes through stages: Catarrhal (cold-like) → Paroxysmal (severe cough) → Convalescent (recovery).", "In adults, the classic 'whoop' sound may be absent. You may have prolonged cough, breathlessness, and fatigue.", "You are INFECTIOUS to others for up to 3 weeks from cough onset, or for 5 days after starting antibiotics.", "Recovery can take 6–10 weeks. Your antibiotic shortens the infectious period and reduces spread to others.", ] for b in bullets_diag: bp = doc.add_paragraph(style='List Bullet') bp.paragraph_format.left_indent = Inches(0.3) bp.paragraph_format.space_before = Pt(1); bp.paragraph_format.space_after = Pt(1) br = bp.add_run(b) br.font.size = Pt(10); br.font.name = 'Arial'; br.font.color.rgb = DARK_GRAY doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 2 — ANTIBIOTIC SCHEDULE # ══════════════════════════════════════════════════════════════════════════════ ab_tbl = doc.add_table(rows=1, cols=1) ab_tbl.style = 'Table Grid' ac = ab_tbl.cell(0,0) set_cell_bg(ac, GREEN) ap = ac.paragraphs[0] ap.alignment = WD_ALIGN_PARAGRAPH.LEFT ar = ap.add_run(" SECTION 2 — ANTIBIOTIC SCHEDULE & ADHERENCE GUIDE") ar.bold = True; ar.font.size = Pt(12); ar.font.color.rgb = WHITE; ar.font.name = 'Arial' ap.paragraph_format.space_before = Pt(4); ap.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(ac, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) # Prescribed drug table doc.add_paragraph() pt2 = doc.add_paragraph() add_colored_run(pt2, " Prescribed Antibiotic: ", bold=True, size=11, color=DARK_BLUE) add_colored_run(pt2, "AZITHROMYCIN", bold=True, size=12, color=GREEN) drug_tbl = doc.add_table(rows=7, cols=5) drug_tbl.style = 'Table Grid' drug_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER col_widths = [Inches(0.5), Inches(1.1), Inches(1.2), Inches(1.8), Inches(2.17)] headers = ["Day", "Date", "Dose", "Timing", "Notes"] for i, (hdr, w) in enumerate(zip(headers, col_widths)): cell = drug_tbl.rows[0].cells[i] cell.width = w set_cell_bg(cell, DARK_BLUE) hp = cell.paragraphs[0] hp.alignment = WD_ALIGN_PARAGRAPH.CENTER hr = hp.add_run(hdr) hr.bold = True; hr.font.size = Pt(10); hr.font.color.rgb = WHITE; hr.font.name = 'Arial' rows_data = [ ("1", "________", "500 mg (2 tabs of 250 mg)", "Once daily — morning with food", "First/loading dose"), ("2", "________", "250 mg (1 tab of 250 mg)", "Once daily — morning with food", ""), ("3", "________", "250 mg (1 tab of 250 mg)", "Once daily — morning with food", ""), ("4", "________", "250 mg (1 tab of 250 mg)", "Once daily — morning with food", ""), ("5", "________", "250 mg (1 tab of 250 mg)", "Once daily — morning with food", "Complete full course"), ("Alt.", "", "Clarithromycin 500 mg", "Twice daily x 7 days (if macrolide switched)", "If azithromycin not tolerated"), ] for r_idx, row_data in enumerate(rows_data): row = drug_tbl.rows[r_idx + 1] bg = LIGHT_GRAY if r_idx % 2 == 0 else WHITE for c_idx, val in enumerate(row_data): cell = row.cells[c_idx] set_cell_bg(cell, bg) cp = cell.paragraphs[0] cp.alignment = WD_ALIGN_PARAGRAPH.CENTER if c_idx <= 1 else WD_ALIGN_PARAGRAPH.LEFT cr = cp.add_run(f" {val}") cr.font.size = Pt(9.5); cr.font.name = 'Arial' cr.font.color.rgb = RED if r_idx == 5 else DARK_GRAY cr.bold = (c_idx == 0) doc.add_paragraph() # Adherence tips box adh_tbl = doc.add_table(rows=1, cols=1) adh_tbl.style = 'Table Grid' adc = adh_tbl.cell(0,0) set_cell_bg(adc, RGBColor(0xE8, 0xF8, 0xF0)) adp_head = adc.paragraphs[0] add_colored_run(adp_head, " IMPORTANT ANTIBIOTIC RULES — Please Read Carefully:", bold=True, size=10.5, color=GREEN) adherence_points = [ "Take the FULL 5-day course even if you feel better after 1-2 days. Stopping early allows bacteria to survive.", "Take each dose at the SAME TIME every day (e.g., every morning after breakfast).", "If you miss a dose: Take it as soon as you remember. If it is almost time for your next dose, skip the missed dose — do NOT double up.", "Do NOT take antacids (e.g., Gelusil, Digene) within 2 hours of azithromycin — they can reduce absorption.", "Avoid alcohol during the antibiotic course.", "Store tablets at room temperature, away from moisture and direct sunlight.", "You remain infectious to others until you complete 5 days of antibiotics — avoid close contact with infants, elderly, and immunocompromised persons.", ] for pt_txt in adherence_points: adp = adc.add_paragraph() adp.paragraph_format.left_indent = Inches(0.2) adp.paragraph_format.space_before = Pt(1); adp.paragraph_format.space_after = Pt(1) adpr = adp.add_run(f" ✓ {pt_txt}") adpr.font.size = Pt(9.5); adpr.font.name = 'Arial'; adpr.font.color.rgb = DARK_GRAY adp_foot = adc.add_paragraph() adp_foot.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(adc, **{side: {'val':'single','sz':'8','color':'1A7A4A'}}) doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 3 — WARNING SIGNS (RED FLAGS) # ══════════════════════════════════════════════════════════════════════════════ ws_tbl = doc.add_table(rows=1, cols=1) ws_tbl.style = 'Table Grid' wc = ws_tbl.cell(0,0) set_cell_bg(wc, RED) wp = wc.paragraphs[0] wp.alignment = WD_ALIGN_PARAGRAPH.LEFT wr = wp.add_run(" SECTION 3 — WARNING SIGNS: GO TO HOSPITAL IMMEDIATELY") wr.bold = True; wr.font.size = Pt(12); wr.font.color.rgb = WHITE; wr.font.name = 'Arial' wp.paragraph_format.space_before = Pt(4); wp.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(wc, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) doc.add_paragraph() # Two-column warning signs warn_tbl = doc.add_table(rows=1, cols=2) warn_tbl.style = 'Table Grid' warn_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER left_warnings = [ ("🚨 Severe breathlessness", "Rapid breathing, inability to complete a sentence, bluish lips or fingertips (cyanosis) — call emergency services immediately."), ("🚨 High fever (>103°F / 39.5°C)", "Fever returning or worsening after initial improvement — may indicate pneumonia or secondary bacterial infection."), ("🚨 Coughing up blood", "Any blood-stained sputum or frank hemoptysis — go to the Emergency Department immediately."), ("🚨 Chest pain", "Sharp or pressure-type chest pain, especially during or after coughing episodes."), ("🚨 Fainting / Blackouts", "Cough-induced loss of consciousness (syncope) — common in adults with pertussis; requires evaluation."), ] right_warnings = [ ("🚨 Heart palpitations / Irregular heartbeat", "Especially important if you are taking azithromycin — this drug can rarely cause an abnormal heart rhythm. Stop the drug and seek medical attention."), ("🚨 Convulsions / Seizures", "Any fits or loss of bodily control — extremely serious complication."), ("🚨 Severe vomiting", "Unable to keep down water or food after every coughing spell for >24 hours — risk of dehydration."), ("🚨 Confusion or unusual drowsiness", "New onset confusion, extreme fatigue, or difficulty staying awake — may indicate low oxygen or neurological complication."), ("🚨 Rib pain after coughing", "Fracture of ribs can occur from severe coughing — sudden sharp chest wall pain after a paroxysm."), ] for col_idx, (warnings, cell) in enumerate(zip([left_warnings, right_warnings], warn_tbl.rows[0].cells)): set_cell_bg(cell, RGBColor(0xFF, 0xF5, 0xF5)) for title, desc in warnings: hp = cell.add_paragraph() if col_idx == 0 and warnings.index((title, desc)) == 0 else cell.add_paragraph() hp.paragraph_format.space_before = Pt(3); hp.paragraph_format.space_after = Pt(1) hp.paragraph_format.left_indent = Inches(0.1) hr_title = hp.add_run(f"{title}\n") hr_title.bold = True; hr_title.font.size = Pt(10); hr_title.font.color.rgb = RED; hr_title.font.name = 'Arial' hr_desc = hp.add_run(f" {desc}") hr_desc.font.size = Pt(9); hr_desc.font.color.rgb = DARK_GRAY; hr_desc.font.name = 'Arial' cell.paragraphs[0].paragraph_format.space_before = Pt(5) for side in ['top','bottom','left','right']: set_cell_borders(cell, **{side: {'val':'single','sz':'8','color':'C0392B'}}) doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 4 — ISOLATION & HOME CARE # ══════════════════════════════════════════════════════════════════════════════ iso_tbl = doc.add_table(rows=1, cols=1) iso_tbl.style = 'Table Grid' ic = iso_tbl.cell(0,0) set_cell_bg(ic, ORANGE) icp = ic.paragraphs[0] icp.alignment = WD_ALIGN_PARAGRAPH.LEFT icr = icp.add_run(" SECTION 4 — HOME ISOLATION & SELF-CARE") icr.bold = True; icr.font.size = Pt(12); icr.font.color.rgb = WHITE; icr.font.name = 'Arial' icp.paragraph_format.space_before = Pt(4); icp.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(ic, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) iso_points = [ ("Stay home for isolation:", "Do NOT go to work, public places, or crowded areas for at least 5 days after starting antibiotics."), ("Wear a surgical mask:", "Wear a mask at home, especially around children under 1 year, elderly, or pregnant women."), ("Cover coughs:", "Always cover your mouth and nose with a tissue or your elbow when coughing. Dispose of tissues immediately."), ("Hand hygiene:", "Wash hands with soap and water for at least 20 seconds after coughing, blowing nose, or touching your face."), ("Rest & sleep:", "Get adequate rest. Avoid physical exertion that can trigger coughing paroxysms."), ("Hydration:", "Drink plenty of fluids (water, clear soups, ORS if vomiting). Aim for at least 8 glasses of water daily."), ("Diet:", "Eat small, frequent meals. Large meals can trigger vomiting after coughing spells."), ("Avoid triggers:", "Avoid cigarette smoke, dust, strong perfumes, cold air — all can trigger severe coughing fits."), ("Household contacts:", "Your 6-year-old nephew and all household members should receive antibiotic prophylaxis (azithromycin). Consult your doctor."), ] iso_inner = doc.add_table(rows=len(iso_points), cols=2) iso_inner.style = 'Table Grid' iso_inner.alignment = WD_TABLE_ALIGNMENT.CENTER for r_idx, (lbl, val) in enumerate(iso_points): bg = LIGHT_GRAY if r_idx % 2 == 0 else WHITE lc = iso_inner.rows[r_idx].cells[0] vc = iso_inner.rows[r_idx].cells[1] set_cell_bg(lc, bg); set_cell_bg(vc, bg) lc.width = Inches(1.8); vc.width = Inches(4.97) lp = lc.paragraphs[0] lp.paragraph_format.left_indent = Inches(0.1) lr = lp.add_run(lbl) lr.bold = True; lr.font.size = Pt(9.5); lr.font.color.rgb = ORANGE; lr.font.name = 'Arial' vp = vc.paragraphs[0] vp.paragraph_format.left_indent = Inches(0.1) vr = vp.add_run(val) vr.font.size = Pt(9.5); vr.font.color.rgb = DARK_GRAY; vr.font.name = 'Arial' doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 5 — FOLLOW-UP PLAN # ══════════════════════════════════════════════════════════════════════════════ fu_tbl = doc.add_table(rows=1, cols=1) fu_tbl.style = 'Table Grid' fc = fu_tbl.cell(0,0) set_cell_bg(fc, MED_BLUE) fp = fc.paragraphs[0] fp.alignment = WD_ALIGN_PARAGRAPH.LEFT fr = fp.add_run(" SECTION 5 — FOLLOW-UP APPOINTMENTS") fr.bold = True; fr.font.size = Pt(12); fr.font.color.rgb = WHITE; fr.font.name = 'Arial' fp.paragraph_format.space_before = Pt(4); fp.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(fc, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) fu_inner = doc.add_table(rows=5, cols=3) fu_inner.style = 'Table Grid' fu_inner.alignment = WD_TABLE_ALIGNMENT.CENTER fu_headers = ["When", "Purpose", "Date / Notes"] for i, h in enumerate(fu_headers): cell = fu_inner.rows[0].cells[i] set_cell_bg(cell, LIGHT_BLUE) hp = cell.paragraphs[0] hr = hp.add_run(f" {h}") hr.bold = True; hr.font.size = Pt(10); hr.font.color.rgb = DARK_BLUE; hr.font.name = 'Arial' fu_rows = [ ("After 5 days (Day 6)", "Review antibiotic completion; check symptom progress; chest auscultation", "Date: ___________"), ("After 3 weeks", "Assess resolution of cough; chest X-ray review if pneumonia was suspected", "Date: ___________"), ("After 6 weeks", "Final recovery assessment; Tdap booster vaccine if not yet given", "Date: ___________"), ("URGENT — Any time", "Any of the Warning Signs listed above (Section 3)", "Go to Emergency Department"), ] for r_idx, (when, purpose, notes) in enumerate(fu_rows): bg = WHITE if r_idx % 2 == 0 else LIGHT_GRAY for c_idx, val in enumerate([when, purpose, notes]): cell = fu_inner.rows[r_idx + 1].cells[c_idx] set_cell_bg(cell, RED if r_idx == 3 and c_idx == 0 else bg) cp = cell.paragraphs[0] cr = cp.add_run(f" {val}") cr.font.size = Pt(9.5); cr.font.name = 'Arial' cr.font.color.rgb = WHITE if r_idx == 3 and c_idx == 0 else DARK_GRAY cr.bold = (r_idx == 3) doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # FOOTER # ══════════════════════════════════════════════════════════════════════════════ foot_tbl = doc.add_table(rows=1, cols=2) foot_tbl.style = 'Table Grid' foot_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER fl = foot_tbl.rows[0].cells[0] fr2 = foot_tbl.rows[0].cells[1] set_cell_bg(fl, DARK_BLUE); set_cell_bg(fr2, DARK_BLUE) flp = fl.paragraphs[0] flp.alignment = WD_ALIGN_PARAGRAPH.LEFT flr = flp.add_run(f" Issued on: {datetime.date.today().strftime('%d %B %Y')} Reviewed by: Dr. ___________________") flr.font.size = Pt(9); flr.font.color.rgb = RGBColor(0xAE,0xD6,0xF1); flr.font.name = 'Arial' flp.paragraph_format.space_before = Pt(4); flp.paragraph_format.space_after = Pt(4) frp = fr2.paragraphs[0] frp.alignment = WD_ALIGN_PARAGRAPH.RIGHT frr = frp.add_run(" Emergency Helpline: 108 | Hospital: ____________________ ") frr.font.size = Pt(9); frr.font.color.rgb = RGBColor(0xAE,0xD6,0xF1); frr.font.name = 'Arial' frp.paragraph_format.space_before = Pt(4); frp.paragraph_format.space_after = Pt(4) for side in ['top','bottom','left','right']: set_cell_borders(fl, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) set_cell_borders(fr2, **{side: {'val':'none','sz':'0','color':'FFFFFF'}}) # ───────────────────────────────────────────────────────────────────────────── output_path = "/tmp/workspace/pertussis-discharge/Pertussis_Discharge_Sheet_52yM.docx" doc.save(output_path) print(f"Saved: {output_path}") EOF
python3 -c " from docx import Document doc = Document('/tmp/workspace/pertussis-discharge/Pertussis_Discharge_Sheet_52yM.docx') print('Paragraphs:', len(doc.paragraphs)) print('Tables:', len(doc.tables)) for i, t in enumerate(doc.tables): print(f'Table {i}: {len(t.rows)} rows x {len(t.columns)} cols') print('File size:', __import__('os').path.getsize('/tmp/workspace/pertussis-discharge/Pertussis_Discharge_Sheet_52yM.docx'), 'bytes') "
Pertussis Discharge Sheet 52yM
Word Document · DOCX
| Section | Contents |
|---|---|
| Header | Hospital banner + patient details fill-in (name, MRN, date, diagnosis) |
| Section 1 - Your Diagnosis | Plain-language explanation of pertussis stages; what to expect as a 52-year-old adult |
| Section 2 - Antibiotic Schedule | Day-by-day Azithromycin dose table (Day 1: 500 mg, Days 2-5: 250 mg) with date fill-in boxes; clarithromycin alternate row; 7-point adherence checklist in a green box |
| Section 3 - Warning Signs | Two-column red-flag table with 10 conditions requiring immediate hospital attendance - including QT/cardiac warning specific to azithromycin, cyanosis, rib fracture, fainting, and confusion |
| Section 4 - Home Isolation & Self-Care | 9-row table covering mask use, hand hygiene, diet, fluid intake, trigger avoidance, and household contact prophylaxis reminder |
| Section 5 - Follow-up Plan | Structured visit schedule: Day 6, Week 3, Week 6, and urgent ED instruction |
| Footer | Issue date, doctor signature line, emergency helpline (108) |