Write about opd cases of ent as many as you now around 30 with prescription and the reason of medicine prescribed and make it in a pdf form

Reading File
Running Command

mkdir -p /home/daytona/workspace/ent-opd && ls /home/daytona/workspace/ent-opd/

Writing File

~/ent-opd/generate_ent_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import KeepTogether

OUTPUT = "/home/daytona/workspace/ent-opd/ENT_OPD_Cases.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=2*cm,
    leftMargin=2*cm,
    topMargin=2*cm,
    bottomMargin=2*cm,
    title="ENT OPD Clinical Cases with Prescriptions",
    author="ENT Department"
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle(
    "TitleStyle",
    parent=styles["Title"],
    fontSize=20,
    textColor=colors.HexColor("#1a3c5e"),
    spaceAfter=6,
    alignment=TA_CENTER,
    fontName="Helvetica-Bold"
)
subtitle_style = ParagraphStyle(
    "SubTitle",
    parent=styles["Normal"],
    fontSize=11,
    textColor=colors.HexColor("#4a6fa5"),
    spaceAfter=4,
    alignment=TA_CENTER,
    fontName="Helvetica-Oblique"
)
case_header_style = ParagraphStyle(
    "CaseHeader",
    parent=styles["Normal"],
    fontSize=13,
    textColor=colors.white,
    spaceAfter=0,
    spaceBefore=0,
    fontName="Helvetica-Bold",
    alignment=TA_LEFT
)
section_label_style = ParagraphStyle(
    "SectionLabel",
    parent=styles["Normal"],
    fontSize=9,
    textColor=colors.HexColor("#1a3c5e"),
    fontName="Helvetica-Bold",
    spaceAfter=1
)
body_style = ParagraphStyle(
    "BodyStyle",
    parent=styles["Normal"],
    fontSize=9,
    textColor=colors.HexColor("#222222"),
    fontName="Helvetica",
    spaceAfter=2,
    leading=13
)
rx_reason_style = ParagraphStyle(
    "RxReason",
    parent=styles["Normal"],
    fontSize=8.5,
    textColor=colors.HexColor("#444444"),
    fontName="Helvetica-Oblique",
    spaceAfter=2,
    leading=12
)
footer_note_style = ParagraphStyle(
    "FooterNote",
    parent=styles["Normal"],
    fontSize=8,
    textColor=colors.HexColor("#888888"),
    fontName="Helvetica-Oblique",
    alignment=TA_CENTER
)

HEADER_BG = colors.HexColor("#1a3c5e")
ROW_BG_1 = colors.HexColor("#eaf0f8")
ROW_BG_2 = colors.white
BORDER_COLOR = colors.HexColor("#b0c4de")

cases = [
    {
        "no": 1,
        "title": "Acute Otitis Media (AOM)",
        "patient": "Age: 6 yrs | Sex: Male | Chief Complaint: Right ear pain, fever (38.5°C), crying for 2 days",
        "diagnosis": "Acute Otitis Media (Right Ear) — bulging erythematous tympanic membrane on otoscopy",
        "rx": [
            ("Amoxicillin 250 mg/5 ml syrup", "5 ml (1 tsp) TDS × 10 days",
             "First-line antibiotic for AOM; covers Streptococcus pneumoniae & H. influenzae"),
            ("Paracetamol 125 mg suppository / syrup", "10 mg/kg TDS PRN",
             "Antipyretic & analgesic for fever and ear pain relief"),
            ("Xylometazoline nasal drops 0.05%", "2 drops each nostril BD × 5 days",
             "Nasal decongestant to relieve Eustachian tube congestion"),
        ],
        "advice": "Warm compress over ear. Follow up in 10 days. Avoid swimming."
    },
    {
        "no": 2,
        "title": "Chronic Suppurative Otitis Media (CSOM) — Tubotympanic Type",
        "patient": "Age: 25 yrs | Sex: Female | Chief Complaint: Painless discharge from left ear for 3 months, mild hearing loss",
        "diagnosis": "CSOM Tubotympanic type — central perforation of left tympanic membrane, mucopurulent discharge",
        "rx": [
            ("Ciprofloxacin + Dexamethasone ear drops", "4 drops affected ear TDS × 2 weeks",
             "Ciprofloxacin: broad-spectrum antibiotic for otorrhoea (Pseudomonas, Staph aureus); Dexamethasone: reduces mucosal inflammation"),
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab BD × 7 days",
             "Systemic beta-lactamase stable antibiotic for persistent/recurrent infection"),
            ("Antihistamine (Cetirizine 10 mg)", "1 tab OD at night × 7 days",
             "Reduces allergic mucosal congestion contributing to Eustachian tube dysfunction"),
        ],
        "advice": "Ear should be kept dry (water precautions). Aural toilet every 3 days. Refer for tympanoplasty if no improvement."
    },
    {
        "no": 3,
        "title": "Otitis Externa (Swimmer's Ear)",
        "patient": "Age: 18 yrs | Sex: Male | Chief Complaint: Right ear pain, itching, scanty discharge after swimming",
        "diagnosis": "Acute diffuse otitis externa — oedematous, erythematous ear canal; tenderness on tragal pressure",
        "rx": [
            ("Neomycin + Polymyxin B + Hydrocortisone ear drops", "4 drops TDS × 7 days",
             "Antibiotics cover Gram-negative/Pseudomonas organisms; Hydrocortisone reduces canal oedema and itch"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals × 5 days",
             "NSAID for analgesia and anti-inflammatory action on canal"),
            ("Clotrimazole 1% ear drops", "3 drops BD (if fungal component suspected)",
             "Antifungal — otomycosis (Aspergillus/Candida) often co-exists after water exposure"),
        ],
        "advice": "Avoid water entry; use ear plugs while bathing. No cotton buds. Ear wick if canal very swollen."
    },
    {
        "no": 4,
        "title": "Sensorineural Hearing Loss (SNHL) — Sudden",
        "patient": "Age: 42 yrs | Sex: Male | Chief Complaint: Sudden loss of hearing in right ear on waking, tinnitus",
        "diagnosis": "Idiopathic Sudden SNHL — audiogram: > 30 dB loss at 3 consecutive frequencies within 72 hrs",
        "rx": [
            ("Prednisolone 60 mg tablet (tapering)", "60 mg OD × 5 days → 40 mg × 5 days → 20 mg × 5 days",
             "Corticosteroid: reduces cochlear inflammation/oedema, improves microcirculation; standard first-line treatment"),
            ("Betahistine 16 mg tablet", "1 tab TDS × 1 month",
             "Histamine analogue: improves inner ear microcirculation; reduces endolymphatic pressure"),
            ("Pantoprazole 40 mg tablet", "1 tab OD before breakfast",
             "Proton pump inhibitor: gastroprotection during high-dose steroid course"),
        ],
        "advice": "Urgent ENT referral for intratympanic steroid injection if oral steroids fail. MRI to exclude acoustic neuroma."
    },
    {
        "no": 5,
        "title": "Benign Paroxysmal Positional Vertigo (BPPV)",
        "patient": "Age: 55 yrs | Sex: Female | Chief Complaint: Episodic vertigo on turning in bed, lasts < 1 min, no hearing loss",
        "diagnosis": "BPPV (posterior canal, right) — positive Dix-Hallpike test right side",
        "rx": [
            ("Betahistine 8 mg tablet", "1 tab TDS × 2 weeks",
             "Reduces endolymphatic hydrops and vestibular symptoms between episodes"),
            ("Prochlorperazine 5 mg tablet", "1 tab TDS PRN for nausea",
             "Vestibular suppressant / antiemetic — controls acute nausea and vomiting during attacks"),
            ("Clonazepam 0.25 mg tablet", "1 tab OD at bedtime (short-term)",
             "Low-dose benzodiazepine for acute vestibular sedation; use ≤ 1 week only"),
        ],
        "advice": "Epley manoeuvre performed in clinic. Brandt-Daroff exercises at home daily. Avoid sudden head movements."
    },
    {
        "no": 6,
        "title": "Allergic Rhinitis — Perennial",
        "patient": "Age: 22 yrs | Sex: Male | Chief Complaint: Sneezing, watery nasal discharge, nasal blockage, itchy eyes — 6 months",
        "diagnosis": "Perennial Allergic Rhinitis — pale, boggy turbinates; positive skin-prick test to house dust mite",
        "rx": [
            ("Fluticasone propionate nasal spray 50 mcg", "2 sprays each nostril OD (morning) × 4 weeks",
             "Intranasal corticosteroid — first-line treatment; reduces mucosal eosinophilic inflammation, nasal polyp growth"),
            ("Cetirizine 10 mg tablet", "1 tab OD at night × 4 weeks",
             "Second-generation non-sedating antihistamine; blocks H1 receptors to relieve sneezing, rhinorrhoea, itch"),
            ("Montelukast 10 mg tablet", "1 tab OD at night × 4 weeks",
             "Leukotriene receptor antagonist; reduces mucosal inflammation, beneficial if concurrent asthma"),
        ],
        "advice": "Allergen avoidance (dust-mite-proof mattress covers). Saline nasal irrigation BD. Consider immunotherapy."
    },
    {
        "no": 7,
        "title": "Acute Sinusitis (Maxillary)",
        "patient": "Age: 30 yrs | Sex: Female | Chief Complaint: Facial pain (cheek area), nasal blockage, thick yellow discharge, fever for 7 days",
        "diagnosis": "Acute Bacterial Maxillary Sinusitis — tenderness over maxillary sinuses; X-ray shows air-fluid level",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS × 10 days",
             "Drug of choice for bacterial sinusitis; covers H. influenzae, S. pneumoniae, anaerobes including beta-lactamase producers"),
            ("Xylometazoline 0.1% nasal drops", "2 drops each nostril BD × 5 days (max)",
             "Alpha-adrenergic decongestant; reduces mucosal swelling, promotes sinus ostial drainage"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals × 5 days",
             "NSAID for facial pain and sinus pressure relief; anti-inflammatory action on mucosal lining"),
        ],
        "advice": "Steam inhalation TDS. Head end elevation while sleeping. Follow up in 2 weeks; CT scan if no improvement."
    },
    {
        "no": 8,
        "title": "Chronic Rhinosinusitis with Nasal Polyps",
        "patient": "Age: 38 yrs | Sex: Male | Chief Complaint: Bilateral nasal blockage, loss of smell, mucoid discharge — 1 year",
        "diagnosis": "Chronic Rhinosinusitis with Nasal Polyps — bilateral pale polyps in middle meatus on endoscopy",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "2 sprays each nostril BD × 3 months",
             "High-potency intranasal steroid; reduces polyp size, mucosal eosinophilia; first-line medical treatment for nasal polyps"),
            ("Prednisolone 0.5 mg/kg tablet", "Tapering dose over 2 weeks",
             "Short course systemic steroid for rapid polyp shrinkage before endoscopic sinus surgery decision"),
            ("Cetirizine 10 mg + Montelukast 10 mg", "1 tab each OD at night × 1 month",
             "Antihistamine + LTRA combination for allergic and leukotriene-mediated inflammatory component"),
        ],
        "advice": "FESS (Functional Endoscopic Sinus Surgery) if medical treatment fails. Saline irrigation postoperatively."
    },
    {
        "no": 9,
        "title": "Deviated Nasal Septum (DNS) with Symptoms",
        "patient": "Age: 28 yrs | Sex: Male | Chief Complaint: Unilateral nasal obstruction (left > right), recurrent headaches",
        "diagnosis": "Deviated Nasal Septum (C-shaped, left) with inferior turbinate hypertrophy — diagnosed on anterior rhinoscopy",
        "rx": [
            ("Budesonide nasal spray 64 mcg", "2 sprays each nostril OD × 4 weeks",
             "Reduces reactive inferior turbinate hypertrophy associated with DNS, improving nasal airflow"),
            ("Cetirizine 10 mg tablet", "1 tab OD at night × 2 weeks",
             "Controls associated allergic component contributing to turbinate swelling"),
            ("Saline nasal drops / spray", "2 sprays each nostril TDS",
             "Moistens dry nasal mucosa, facilitates mucociliary clearance — no pharmacological side effects"),
        ],
        "advice": "Septoplasty + inferior turbinate reduction indicated if symptoms persist > 3 months despite medical therapy."
    },
    {
        "no": 10,
        "title": "Epistaxis (Anterior — Little's Area)",
        "patient": "Age: 14 yrs | Sex: Male | Chief Complaint: Recurrent bleeding from right nostril, 3 episodes in 1 month",
        "diagnosis": "Recurrent anterior epistaxis from Little's area (Kiesselbach's plexus) — telangiectatic vessels visible on anterior rhinoscopy",
        "rx": [
            ("Chlorhexidine + Neomycin nasal cream", "Apply inside nostril BD × 2 weeks",
             "Antibiotic cream reduces nasal vestibule crusting and colonisation (Staph aureus) that precipitates mucosal friability"),
            ("Tranexamic acid 500 mg tablet", "1 tab TDS × 5 days (acute episode)",
             "Antifibrinolytic agent; inhibits plasminogen activation, stabilises clot at bleeding site"),
            ("Vitamin C 500 mg tablet", "1 tab OD × 1 month",
             "Promotes collagen synthesis; strengthens capillary walls in Little's area, reduces recurrence"),
        ],
        "advice": "Chemical cautery (silver nitrate) of bleeding vessel. Avoid nose-picking. Control hypertension if present."
    },
    {
        "no": 11,
        "title": "Acute Tonsillitis — Bacterial",
        "patient": "Age: 12 yrs | Sex: Female | Chief Complaint: Sore throat, painful swallowing, high fever (39°C), bad breath × 3 days",
        "diagnosis": "Acute Bacterial Tonsillitis — bilateral enlarged tonsils with exudate, anterior cervical lymphadenopathy; rapid strep test positive",
        "rx": [
            ("Amoxicillin 500 mg tablet / syrup", "1 tab TDS × 10 days (full course)",
             "Drug of choice for Group A beta-haemolytic Streptococcus; prevents rheumatic fever and peritonsillar abscess"),
            ("Paracetamol 500 mg tablet", "1 tab TDS PRN × 5 days",
             "Antipyretic and analgesic for fever and throat pain"),
            ("Benzydamine hydrochloride 0.15% oral rinse (Difflam)", "15 ml gargle TDS-QID × 7 days",
             "Topical NSAID/local anaesthetic; reduces oropharyngeal inflammation and pain on contact"),
        ],
        "advice": "Cold/warm fluids, soft diet. Rest. If penicillin allergy use Azithromycin. Tonsillectomy if ≥ 7 episodes/year."
    },
    {
        "no": 12,
        "title": "Peritonsillar Abscess (Quinsy)",
        "patient": "Age: 20 yrs | Sex: Male | Chief Complaint: Severe sore throat, trismus, muffled 'hot potato' voice, drooling × 4 days",
        "diagnosis": "Left peritonsillar abscess — bulging of left peritonsillar fold, uvula deviated to right, trismus",
        "rx": [
            ("Injection Benzylpenicillin 2.4 MU IV", "IV 6-hourly × 48 hrs then oral switch",
             "High-dose IV penicillin targets Streptococcus pyogenes (primary pathogen) — inpatient IV regimen required"),
            ("Injection Metronidazole 500 mg IV", "IV TDS × 3 days",
             "Covers anaerobes (Fusobacterium, Bacteroides) which are common in polymicrobial peritonsillar abscesses"),
            ("Injection Dexamethasone 8 mg IV", "Single dose (or 8 mg BD × 2 doses)",
             "Reduces peritonsillar oedema, shortens pain duration, improves mouth opening — evidence-supported adjunct"),
        ],
        "advice": "Needle aspiration or incision & drainage under LA. Interval tonsillectomy after 6 weeks. Airway monitoring."
    },
    {
        "no": 13,
        "title": "Laryngopharyngeal Reflux (LPR)",
        "patient": "Age: 45 yrs | Sex: Female | Chief Complaint: Chronic throat clearing, hoarseness worse in morning, globus sensation × 3 months",
        "diagnosis": "Laryngopharyngeal Reflux — posterior laryngitis, interarytenoid oedema and erythema on laryngoscopy; RSI score > 13",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab BD (30 min before meals) × 3 months",
             "Proton pump inhibitor — reduces gastric acid secretion, first-line treatment for LPR; 3-month trial needed for response"),
            ("Domperidone 10 mg tablet", "1 tab TDS before meals × 4 weeks",
             "Prokinetic agent; accelerates gastric emptying, reduces retrograde oesophageal flow, decreases reflux episodes"),
            ("Almagate / Gaviscon suspension", "10 ml after meals and at bedtime",
             "Alginate barrier forms a raft on gastric contents, physically prevents acid reflux into laryngopharynx"),
        ],
        "advice": "Head end elevation 30°. Avoid late meals, alcohol, coffee, spicy food. Weight reduction if obese."
    },
    {
        "no": 14,
        "title": "Vocal Cord Nodules (Singer's Nodules)",
        "patient": "Age: 32 yrs | Sex: Female (teacher) | Chief Complaint: Progressive hoarseness, voice fatigue, breathiness × 4 months",
        "diagnosis": "Bilateral vocal cord nodules at junction of anterior 1/3 and posterior 2/3 — videolaryngoscopy",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab OD before breakfast × 6 weeks",
             "LPR is a common aggravating factor for nodule formation; acid suppression reduces mucosal irritation"),
            ("Fluticasone inhaler (as laryngeal steroid)", "2 puffs BD (inhale, do not swallow) × 4 weeks",
             "Inhaled steroid reduces mucosal oedema at nodule site when aspirated toward larynx during inhalation"),
            ("Multivitamin with Zinc tablet", "1 tab OD × 1 month",
             "Supports vocal fold mucosal healing; zinc deficiency impairs tissue repair mechanisms"),
        ],
        "advice": "Voice rest is primary treatment. Refer to speech therapist for vocal hygiene training. Microlaryngoscopy if refractory."
    },
    {
        "no": 15,
        "title": "Acute Epiglottitis",
        "patient": "Age: 35 yrs | Sex: Male | Chief Complaint: Sudden severe sore throat, odynophagia, drooling, stridor, toxic appearance",
        "diagnosis": "Acute Epiglottitis — 'cherry-red' epiglottis on laryngoscopy; X-ray lateral neck shows 'thumb sign'",
        "rx": [
            ("Injection Ceftriaxone 2 g IV", "IV OD × 7 days",
             "Third-generation cephalosporin covering H. influenzae type B and streptococcal species — first-line for epiglottitis"),
            ("Injection Dexamethasone 8 mg IV", "IV BD × 3 days",
             "Systemic corticosteroid reduces supraglottic oedema, decreases risk of complete airway obstruction"),
            ("Nebulised Adrenaline 1:1000 — 5 ml", "Nebulise PRN",
             "Alpha-adrenergic vasoconstriction reduces supraglottic oedema acutely while awaiting antibiotic effect"),
        ],
        "advice": "EMERGENCY — secure airway (intubation/tracheostomy) at first sign of obstruction. ICU monitoring. O2 therapy."
    },
    {
        "no": 16,
        "title": "Obstructive Sleep Apnoea (OSA)",
        "patient": "Age: 50 yrs | Sex: Male (BMI 34) | Chief Complaint: Loud snoring, witnessed apnoeic episodes, excessive daytime sleepiness",
        "diagnosis": "Moderate OSA — AHI 22/hr on polysomnography; Epworth Sleepiness Scale 14/24",
        "rx": [
            ("CPAP device prescription", "Auto-CPAP 4–12 cmH2O, nightly use",
             "Continuous Positive Airway Pressure is the gold-standard treatment for moderate-severe OSA; maintains airway patency"),
            ("Montelukast 10 mg tablet", "1 tab OD at night × 1 month (if adenotonsillar component)",
             "Leukotriene antagonist reduces adenoidal and tonsillar lymphoid tissue in OSA with allergic rhinitis"),
            ("Fluticasone nasal spray 50 mcg", "2 sprays each nostril OD × 4 weeks",
             "Treats coexisting nasal obstruction from allergic rhinitis which increases upper airway resistance during sleep"),
        ],
        "advice": "Weight loss (10% body weight reduces AHI by 25%). Avoid alcohol, sedatives. Positional therapy (lateral sleep). ENT surgical review."
    },
    {
        "no": 17,
        "title": "Sialadenitis (Submandibular Gland)",
        "patient": "Age: 48 yrs | Sex: Male | Chief Complaint: Painful swelling under jaw, worse at mealtimes, fever",
        "diagnosis": "Acute bacterial submandibular sialadenitis likely calculus-induced — tender submandibular gland; pus from Wharton's duct; X-ray shows calculus",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS × 10 days",
             "Covers Staphylococcus aureus, Streptococcus viridans, anaerobes common in salivary gland infections"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals × 5 days",
             "NSAID for pain relief and reduction of glandular inflammatory oedema"),
            ("Pilocarpine 5 mg tablet", "1 tab TDS × 1 week",
             "Sialologue (muscarinic agonist); stimulates saliva flow, flushes duct, helps expel small calculi"),
        ],
        "advice": "Gland massage toward duct orifice. Lemon drops to stimulate salivation. Surgical removal of calculus (sialolithotomy) if persistent."
    },
    {
        "no": 18,
        "title": "Parotid Pleomorphic Adenoma",
        "patient": "Age: 40 yrs | Sex: Female | Chief Complaint: Slowly growing painless swelling in front of right ear × 2 years",
        "diagnosis": "Pleomorphic Adenoma of right parotid gland — firm, lobulated, mobile mass below tragus; FNAC: benign mixed tumour",
        "rx": [
            ("Ibuprofen 400 mg tablet", "1 tab BD × 5 days (if tender)",
             "Symptomatic NSAID for any associated discomfort; pleomorphic adenoma is benign and primary treatment is surgical"),
            ("No specific pharmacotherapy required", "—",
             "Pleomorphic adenoma is treated surgically (superficial parotidectomy); medicines are supportive only"),
            ("Multivitamins + Vitamin D3 1000 IU", "1 tab OD preoperatively",
             "Nutritional support for perioperative optimisation of wound healing"),
        ],
        "advice": "Refer for superficial parotidectomy with facial nerve preservation. FNAC +/- MRI for confirmation. Risk: malignant transformation if untreated."
    },
    {
        "no": 19,
        "title": "Branchial Cyst",
        "patient": "Age: 22 yrs | Sex: Male | Chief Complaint: Painless smooth swelling on the left side of neck, anterior to SCM × 6 months",
        "diagnosis": "Branchial cyst (2nd arch) — soft, fluctuant, non-tender swelling at junction of upper 1/3 and lower 2/3 of anterior SCM; FNAC: cholesterol crystals, squamous cells",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg tablet (if infected)", "1 tab TDS × 7 days",
             "If secondary infection of cyst occurs — covers oral flora; helps resolve acute inflammatory episode before surgery"),
            ("Ibuprofen 400 mg", "1 tab TDS × 3 days PRN",
             "Anti-inflammatory to reduce pain and swelling if cyst becomes acutely inflamed"),
            ("No definitive pharmacotherapy", "—",
             "Definitive treatment is surgical excision; medicines are supportive pre-/post-operatively"),
        ],
        "advice": "Surgical excision of complete cyst with tract. Avoid incision & drainage — increases recurrence. Exclude malignancy in older patients."
    },
    {
        "no": 20,
        "title": "Tinnitus — Subjective",
        "patient": "Age: 60 yrs | Sex: Male | Chief Complaint: Continuous high-pitched ringing in both ears for 4 months, associated mild SNHL",
        "diagnosis": "Subjective bilateral tinnitus with presbycusis — audiogram: high-frequency SNHL; no vascular or space-occupying lesion on MRI",
        "rx": [
            ("Betahistine 16 mg tablet", "1 tab TDS × 3 months",
             "Improves cochlear and vestibular microcirculation; reduces endolymphatic hydrops; most widely used agent for tinnitus"),
            ("Clonazepam 0.5 mg tablet", "1 tab OD at bedtime × 4 weeks",
             "Low-dose anxiolytic/vestibular suppressant; reduces tinnitus loudness perception and associated sleep disturbance"),
            ("Ginkgo biloba 120 mg extract", "1 tab BD × 3 months",
             "Increases cochlear blood flow via platelet-activating factor inhibition; modest evidence for tinnitus symptom reduction"),
        ],
        "advice": "Tinnitus retraining therapy (TRT). Hearing aid if significant hearing loss. Avoid caffeine, noise exposure. Reassurance is key."
    },
    {
        "no": 21,
        "title": "Wax Impaction (Cerumen Impaction)",
        "patient": "Age: 35 yrs | Sex: Female | Chief Complaint: Bilateral ear fullness, muffled hearing, itching × 2 weeks",
        "diagnosis": "Bilateral cerumen impaction — complete occlusion of external auditory canal with hard brown wax on otoscopy",
        "rx": [
            ("Carbamide peroxide 6.5% ear drops (Debrox)", "5 drops affected ear(s) BD × 4–5 days",
             "Cerumenolytic agent; releases oxygen, softens and mechanically breaks up impacted wax for easier removal"),
            ("Olive oil / mineral oil ear drops (warm)", "5 drops BD × 4 days before syringing",
             "Lubricates and softens hard impacted wax, facilitating aural syringing / microsuction"),
            ("Chloramphenicol ear drops 0.5%", "4 drops TDS × 5 days (if mild otitis externa)",
             "Topical antibiotic — used only if mucosal inflammation/secondary infection accompanies impaction"),
        ],
        "advice": "Aural syringing or microsuction after 4–5 days of cerumenolytic. Avoid cotton buds. Annual review for wax-prone patients."
    },
    {
        "no": 22,
        "title": "Foreign Body in Ear (Child)",
        "patient": "Age: 4 yrs | Sex: Male | Chief Complaint: Mother noticed child putting a bead in left ear, child pulling at ear",
        "diagnosis": "Inanimate foreign body (plastic bead) in left external auditory canal — confirmed on otoscopy; no perforation",
        "rx": [
            ("Lignocaine (Lidocaine) 2% solution ear drops", "3 drops in ear before removal attempt",
             "Topical anaesthetic — reduces pain and child's movement during instrumentation for foreign body removal"),
            ("Chloramphenicol ear drops 0.5%", "4 drops TDS × 5 days post-removal",
             "Prevents secondary bacterial infection after canal manipulation and any minor mucosal abrasions"),
            ("Paracetamol 120 mg/5 ml syrup", "10 mg/kg TDS PRN × 3 days",
             "Analgesic and antipyretic for post-procedure pain and any associated earache"),
        ],
        "advice": "Foreign body removal under GA if uncooperative or if deep. Do NOT attempt removal of live insects without first killing with mineral oil. NEVER attempt removal if TM perforation suspected."
    },
    {
        "no": 23,
        "title": "Meniere's Disease",
        "patient": "Age: 48 yrs | Sex: Female | Chief Complaint: Episodic vertigo lasting hours, fluctuating hearing loss, tinnitus, aural fullness (left ear)",
        "diagnosis": "Meniere's Disease — clinical triad confirmed; audiogram: low-frequency SNHL left ear; electrocochleography positive",
        "rx": [
            ("Betahistine 24 mg tablet", "1 tab TDS × 3–6 months",
             "Reduces endolymphatic hydrops by improving microvascular permeability in stria vascularis; reduces frequency of attacks"),
            ("Prochlorperazine 5 mg tablet", "1 tab TDS PRN (acute attack)",
             "D2 receptor antagonist with anti-vestibular action; controls acute vertigo, nausea, vomiting during attack"),
            ("Hydrochlorothiazide 25 mg + Triamterene", "1 tab OD in morning × 3 months",
             "Low-salt diuretic reduces endolymph production and sac pressure — second-line to betahistine for attack prevention"),
        ],
        "advice": "Low-salt diet (< 1.5 g Na/day). Avoid caffeine and alcohol. Intratympanic gentamicin or steroid injection for refractory cases."
    },
    {
        "no": 24,
        "title": "Nasal Furunculosis",
        "patient": "Age: 28 yrs | Sex: Male | Chief Complaint: Painful swelling at nasal tip, redness, tender pustule at nasal vestibule × 5 days",
        "diagnosis": "Furunculosis of the nasal vestibule — tender erythematous pustule at right nasal vestibule; Staphylococcus aureus likely",
        "rx": [
            ("Cloxacillin 500 mg capsule", "1 cap QID × 7 days (empty stomach)",
             "Anti-staphylococcal penicillinase-resistant antibiotic — Staph aureus is the primary pathogen in nasal furunculosis"),
            ("Mupirocin 2% nasal ointment", "Apply BD inside vestibule × 5 days",
             "Topical antibiotic effective against MRSA and MSSA; eliminates nasal Staphylococcal colonisation directly"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals × 5 days",
             "NSAID analgesic for the significant local pain associated with furunculosis"),
        ],
        "advice": "NEVER squeeze — risk of cavernous sinus thrombosis via 'danger triangle of face'. Hot fomentation. Admit if cellulitis spreads."
    },
    {
        "no": 25,
        "title": "Pharyngitis — Viral",
        "patient": "Age: 25 yrs | Sex: Female | Chief Complaint: Mild sore throat, scratchy sensation, low-grade fever, runny nose × 2 days",
        "diagnosis": "Acute viral pharyngitis (rhinovirus / adenovirus likely) — mildly erythematous pharynx, no exudate, no lymphadenopathy; negative rapid strep test",
        "rx": [
            ("Paracetamol 500 mg tablet", "1 tab TDS PRN × 3–5 days",
             "Analgesic and antipyretic — symptomatic relief for sore throat and low-grade fever; no antibiotics needed for viral pharyngitis"),
            ("Benzydamine 0.15% gargle / lozenge", "Gargle 15 ml TDS or 1 lozenge every 3 hours",
             "Topical NSAID and local anaesthetic action on oropharyngeal mucosa; reduces throat pain on contact"),
            ("Loratadine 10 mg tablet", "1 tab OD × 5 days",
             "Non-sedating antihistamine for associated rhinorrhoea, post-nasal drip, and sneezing contributing to pharyngeal irritation"),
        ],
        "advice": "Warm saline gargle. Honey-ginger warm drinks. Adequate hydration. Antibiotics NOT indicated. Return if fever persists > 72 hrs."
    },
    {
        "no": 26,
        "title": "Adenoid Hypertrophy (Paediatric)",
        "patient": "Age: 7 yrs | Sex: Male | Chief Complaint: Mouth breathing, snoring, nasal speech, recurrent otitis media × 1 year",
        "diagnosis": "Adenoid hypertrophy with nasopharyngeal obstruction — endoscopic Grade III adenoids; bilateral effusion on tympanometry",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "1 spray each nostril OD × 3 months",
             "Intranasal steroid reduces adenoid lymphoid tissue size; first-line medical treatment with evidence in Grade I–II hypertrophy"),
            ("Montelukast 5 mg chewable tablet", "1 tab OD at night × 3 months",
             "Leukotriene receptor antagonist further reduces adenoid tissue hypertrophy in children with allergic rhinitis component"),
            ("Amoxicillin 250 mg/5 ml syrup", "10 mg/kg TDS × 7 days (if acute infection)",
             "For superimposed bacterial adenoiditis — covers streptococcal and H. influenzae infection of hypertrophic adenoid tissue"),
        ],
        "advice": "Adenoidectomy +/- grommets (ventilation tubes) if medical therapy fails or Grade III–IV with conductive hearing loss."
    },
    {
        "no": 27,
        "title": "Laryngitis — Acute",
        "patient": "Age: 30 yrs | Sex: Male (singer) | Chief Complaint: Sudden hoarseness, voice loss after shouting at a concert, dry throat",
        "diagnosis": "Acute non-infective laryngitis — generalised erythema and oedema of vocal cords; no exudate; no fever",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab BD × 2 weeks",
             "Addresses LPR as a precipitating factor; acid suppression reduces further vocal cord mucosal irritation"),
            ("Dexamethasone 4 mg tablet", "1 tab BD × 3 days (if urgent vocal recovery needed)",
             "Short-course systemic steroid rapidly reduces vocal cord oedema and inflammation; used in professional voice users"),
            ("Mucolytic — Carbocisteine 375 mg capsule", "2 caps TDS × 5 days",
             "Reduces mucous viscosity and secretion adherence to laryngeal mucosa, easing phonation and promoting mucociliary clearance"),
        ],
        "advice": "COMPLETE voice rest for 3–5 days. Humidified air inhalation. Avoid whispering (more harmful than normal voice). Hydration 2L/day."
    },
    {
        "no": 28,
        "title": "Nasal Polyps with Aspirin Sensitivity (Samter's Triad)",
        "patient": "Age: 38 yrs | Sex: Male | Chief Complaint: Bilateral nasal blockage, loss of smell, asthma — known aspirin sensitivity",
        "diagnosis": "Samter's Triad (Aspirin-Exacerbated Respiratory Disease) — bilateral nasal polyps, bronchial asthma, aspirin intolerance; CT scan: pansinusitis",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "2 sprays each nostril BD × 3 months",
             "Intranasal steroid: primary polyp medical treatment; reduces eosinophilic mucosal inflammation typical of AERD"),
            ("Montelukast 10 mg tablet", "1 tab OD at night × 3 months",
             "LTRA is especially important in AERD — arachidonic acid shunting via 5-lipoxygenase produces excess leukotrienes; LTRA directly blocks this pathway"),
            ("Prednisolone 20 mg tablet (tapering)", "20 mg OD × 3 days → 10 mg × 3 days → 5 mg × 3 days",
             "Short-burst oral steroid to rapidly shrink polyps before surgery or to treat acute exacerbation"),
        ],
        "advice": "STRICT aspirin and all NSAIDs avoidance. FESS if medical treatment fails. Aspirin desensitisation therapy in specialist centres."
    },
    {
        "no": 29,
        "title": "Post-Tonsillectomy Reactionary Haemorrhage",
        "patient": "Age: 16 yrs | Sex: Male | Chief Complaint: Fresh bleeding from mouth 6 hours after tonsillectomy, swallowing blood",
        "diagnosis": "Reactionary haemorrhage post-tonsillectomy (within 24 hrs) — tonsillar fossa oozing; BP and HR stable",
        "rx": [
            ("Tranexamic acid 1 g IV infusion", "IV TDS until bleeding controlled",
             "Antifibrinolytic agent prevents clot dissolution at tonsillar fossa; reduces requirement for surgical re-exploration"),
            ("Injection Ceftriaxone 1 g IV", "IV OD × 5 days",
             "Prophylactic broad-spectrum antibiotic post-haemorrhage; prevents secondary infection of raw tonsillar bed"),
            ("IV fluid (Normal Saline / Ringer's Lactate)", "Maintenance rate — 125 ml/hr",
             "Fluid resuscitation; compensates for blood loss; maintains haemodynamic stability pending haemostasis"),
        ],
        "advice": "Return to OT for haemostasis under GA if bleeding persists. Group and crossmatch. Monitor Hb. Keep NBM in case of re-exploration."
    },
    {
        "no": 30,
        "title": "Cholesteatoma (Atticoantral CSOM)",
        "patient": "Age: 30 yrs | Sex: Male | Chief Complaint: Right ear foul-smelling scanty discharge, hearing loss, episodic giddiness × 2 years",
        "diagnosis": "Cholesteatoma — attic perforation with white pearly mass; conductive hearing loss 40 dB; CT temporal bone: bone erosion of ossicles and lateral wall",
        "rx": [
            ("Ciprofloxacin ear drops 0.3%", "4 drops TDS × 2 weeks (pre-operative)",
             "Controls active infection and reduces discharge before surgery; ciprofloxacin covers Pseudomonas aeruginosa common in CSOM"),
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS × 7 days",
             "Systemic antibiotic for active otorrhoea control before planned mastoid surgery; covers mixed oral flora"),
            ("Betahistine 8 mg tablet", "1 tab TDS × 2 weeks (if vestibular symptoms)",
             "Reduces vestibular symptoms (giddiness) arising from inner ear involvement or labyrinthitis secondary to cholesteatoma"),
        ],
        "advice": "SURGICAL — Modified Radical Mastoidectomy / Canal Wall Down procedure is definitive. Medicines are only pre-operative preparation. Annual CT surveillance post-operatively."
    },
]

story = []

# === COVER PAGE ===
story.append(Spacer(1, 1.5*cm))
story.append(Paragraph("ENT OUTPATIENT DEPARTMENT", title_style))
story.append(Paragraph("Clinical Case Studies with Prescriptions", subtitle_style))
story.append(Spacer(1, 0.3*cm))
story.append(HRFlowable(width="100%", thickness=2, color=HEADER_BG))
story.append(Spacer(1, 0.2*cm))

cover_info = [
    ["Department:", "Ear, Nose & Throat (Otorhinolaryngology)"],
    ["Document:", "OPD Case Portfolio with Drug Rationale"],
    ["Total Cases:", "30 Clinical Cases"],
    ["Date:", "June 2026"],
]
cover_table = Table(cover_info, colWidths=[4.5*cm, 12*cm])
cover_table.setStyle(TableStyle([
    ("FONTNAME", (0, 0), (0, -1), "Helvetica-Bold"),
    ("FONTNAME", (1, 0), (1, -1), "Helvetica"),
    ("FONTSIZE", (0, 0), (-1, -1), 10),
    ("TEXTCOLOR", (0, 0), (0, -1), HEADER_BG),
    ("TEXTCOLOR", (1, 0), (1, -1), colors.HexColor("#333333")),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 6),
    ("TOPPADDING", (0, 0), (-1, -1), 6),
]))
story.append(cover_table)
story.append(Spacer(1, 0.4*cm))
story.append(HRFlowable(width="100%", thickness=1, color=BORDER_COLOR))
story.append(Spacer(1, 0.3*cm))

intro = (
    "This document presents 30 representative Ear, Nose & Throat (ENT) outpatient cases "
    "covering common and important conditions across Otology, Rhinology, and Laryngology. "
    "Each case includes patient demographics, presenting complaint, clinical diagnosis, a "
    "complete prescription with dosing schedule, and the pharmacological rationale for each "
    "drug prescribed. This resource is intended for medical students, junior residents, and "
    "healthcare professionals seeking a practical ENT clinical reference."
)
story.append(Paragraph(intro, body_style))
story.append(Spacer(1, 0.4*cm))

# Table of Contents (brief)
toc_data = [["#", "Case Title", "Category"]]
categories = [
    "Otology", "Otology", "Otology", "Otology", "Otology",
    "Rhinology", "Rhinology", "Rhinology", "Rhinology", "Rhinology",
    "Laryngology", "Laryngology", "Laryngology", "Laryngology", "Laryngology",
    "Sleep / Airway", "Salivary Glands", "Salivary Glands", "Neck", "Otology",
    "Otology", "Otology", "Otology", "Rhinology", "Pharyngology",
    "Rhinology", "Laryngology", "Rhinology", "Postoperative", "Otology"
]
for i, c in enumerate(cases):
    toc_data.append([str(c["no"]), c["title"], categories[i]])

toc_table = Table(toc_data, colWidths=[1*cm, 11.5*cm, 4*cm])
toc_table.setStyle(TableStyle([
    ("BACKGROUND", (0, 0), (-1, 0), HEADER_BG),
    ("TEXTCOLOR", (0, 0), (-1, 0), colors.white),
    ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTNAME", (0, 1), (-1, -1), "Helvetica"),
    ("FONTSIZE", (0, 0), (-1, -1), 8.5),
    ("ROWBACKGROUNDS", (0, 1), (-1, -1), [ROW_BG_1, ROW_BG_2]),
    ("GRID", (0, 0), (-1, -1), 0.3, BORDER_COLOR),
    ("TOPPADDING", (0, 0), (-1, -1), 4),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 4),
    ("LEFTPADDING", (0, 0), (-1, -1), 6),
]))
story.append(toc_table)
story.append(PageBreak())

# === CASES ===
for idx, case in enumerate(cases):
    elements = []

    # Case header
    header_data = [[Paragraph(f"  CASE {case['no']:02d}   |   {case['title']}", case_header_style)]]
    header_table = Table(header_data, colWidths=[16.5*cm])
    header_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), HEADER_BG),
        ("TOPPADDING", (0, 0), (-1, -1), 7),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("ROUNDEDCORNERS", [4]),
    ]))
    elements.append(header_table)
    elements.append(Spacer(1, 0.15*cm))

    # Patient info
    elements.append(Paragraph("Patient Details:", section_label_style))
    elements.append(Paragraph(case["patient"], body_style))
    elements.append(Spacer(1, 0.1*cm))

    # Diagnosis
    elements.append(Paragraph("Diagnosis:", section_label_style))
    elements.append(Paragraph(case["diagnosis"], body_style))
    elements.append(Spacer(1, 0.15*cm))

    # Prescription table
    elements.append(Paragraph("Rx — Prescription:", section_label_style))

    rx_header = [
        Paragraph("Drug & Formulation", ParagraphStyle("h", fontName="Helvetica-Bold", fontSize=8.5, textColor=colors.white)),
        Paragraph("Dose / Schedule", ParagraphStyle("h", fontName="Helvetica-Bold", fontSize=8.5, textColor=colors.white)),
        Paragraph("Reason for Prescribing", ParagraphStyle("h", fontName="Helvetica-Bold", fontSize=8.5, textColor=colors.white)),
    ]
    rx_rows = [rx_header]
    for drug, dose, reason in case["rx"]:
        rx_rows.append([
            Paragraph(drug, body_style),
            Paragraph(dose, body_style),
            Paragraph(reason, rx_reason_style)
        ])

    rx_table = Table(rx_rows, colWidths=[4.5*cm, 3.5*cm, 8.5*cm])
    rx_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, 0), colors.HexColor("#2e6da4")),
        ("ROWBACKGROUNDS", (0, 1), (-1, -1), [ROW_BG_1, ROW_BG_2]),
        ("GRID", (0, 0), (-1, -1), 0.3, BORDER_COLOR),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING", (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
        ("LEFTPADDING", (0, 0), (-1, -1), 6),
        ("RIGHTPADDING", (0, 0), (-1, -1), 6),
    ]))
    elements.append(rx_table)
    elements.append(Spacer(1, 0.12*cm))

    # Advice
    elements.append(Paragraph("Advice / Follow-up:", section_label_style))
    elements.append(Paragraph(case["advice"], body_style))
    elements.append(Spacer(1, 0.3*cm))
    elements.append(HRFlowable(width="100%", thickness=0.5, color=BORDER_COLOR))
    elements.append(Spacer(1, 0.3*cm))

    story.append(KeepTogether(elements))

# Footer note
story.append(Spacer(1, 0.5*cm))
story.append(HRFlowable(width="100%", thickness=1, color=HEADER_BG))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
    "Disclaimer: This document is for educational purposes only. All prescriptions must be adapted "
    "to individual patient needs, local guidelines, drug availability, and clinical judgement. "
    "Always verify doses against current formularies before prescribing.",
    footer_note_style
))

doc.build(story)
print(f"PDF generated successfully: {OUTPUT}")
Running Command

python3 /home/daytona/workspace/ent-opd/generate_ent_pdf.py

Running Command

ls -lh /home/daytona/workspace/ent-opd/ENT_OPD_Cases.pdf

The PDF has been generated successfully. Here's your download link:

ENT OPD Cases

PDF Document · PDF


Here is a summary of all 30 ENT OPD cases included in the PDF:
Otology (Ear)
  1. Acute Otitis Media - Amoxicillin, Paracetamol, Xylometazoline nasal drops
  2. CSOM Tubotympanic Type - Ciprofloxacin+Dexamethasone ear drops, Amoxicillin-Clavulanate, Cetirizine
  3. Otitis Externa (Swimmer's Ear) - Neomycin+Polymyxin+HC drops, Ibuprofen, Clotrimazole
  4. Sudden Sensorineural Hearing Loss - Prednisolone (tapering), Betahistine, Pantoprazole
  5. BPPV - Betahistine, Prochlorperazine, Clonazepam
  6. Wax Impaction - Carbamide peroxide drops, Olive oil drops
  7. Foreign Body in Ear - Lignocaine drops, Chloramphenicol drops, Paracetamol
  8. Meniere's Disease - Betahistine 24 mg, Prochlorperazine, Hydrochlorothiazide+Triamterene
  9. Tinnitus - Betahistine, Clonazepam, Ginkgo biloba
  10. Cholesteatoma - Ciprofloxacin ear drops, Amoxicillin-Clavulanate, Betahistine
Rhinology (Nose & Sinuses) 11. Allergic Rhinitis - Fluticasone spray, Cetirizine, Montelukast 12. Acute Maxillary Sinusitis - Amoxicillin-Clavulanate, Xylometazoline, Ibuprofen 13. Chronic Rhinosinusitis with Polyps - Mometasone spray, Prednisolone, Cetirizine+Montelukast 14. DNS with Symptoms - Budesonide spray, Cetirizine, Saline drops 15. Epistaxis - Chlorhexidine+Neomycin cream, Tranexamic acid, Vitamin C 16. Nasal Furunculosis - Cloxacillin, Mupirocin ointment, Ibuprofen 17. Adenoid Hypertrophy - Mometasone spray, Montelukast, Amoxicillin 18. Nasal Polyps / Samter's Triad - Mometasone spray, Montelukast, Prednisolone
Laryngology / Pharyngology 19. Acute Bacterial Tonsillitis - Amoxicillin, Paracetamol, Benzydamine gargle 20. Peritonsillar Abscess (Quinsy) - IV Benzylpenicillin, IV Metronidazole, IV Dexamethasone 21. LPR - Pantoprazole BD, Domperidone, Almagate suspension 22. Vocal Cord Nodules - Pantoprazole, Fluticasone inhaler, Multivitamin+Zinc 23. Acute Epiglottitis - IV Ceftriaxone, IV Dexamethasone, Nebulised Adrenaline 24. Acute Laryngitis - Pantoprazole, Dexamethasone, Carbocisteine 25. Viral Pharyngitis - Paracetamol, Benzydamine gargle, Loratadine
Other ENT 26. OSA - CPAP, Montelukast, Fluticasone nasal spray 27. Submandibular Sialadenitis - Amoxicillin-Clavulanate, Ibuprofen, Pilocarpine 28. Parotid Pleomorphic Adenoma - Supportive (surgical condition) 29. Branchial Cyst - Supportive (surgical condition) 30. Post-Tonsillectomy Haemorrhage - IV Tranexamic acid, IV Ceftriaxone, IV fluids
Each case in the PDF includes a colour-coded prescription table with drug name, dose/schedule, and a detailed pharmacological reason for each medication prescribed.

This pdf is not working make a new one

Running Command

python3 -c "from reportlab.lib.pagesizes import A4; print('reportlab ok')" && python3 -c "import fpdf; print('fpdf ok')" 2>/dev/null || echo "fpdf not available"

Writing File

~/ent-opd/make_ent_pdf.py

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
import textwrap

OUTPUT = "/home/daytona/workspace/ent-opd/ENT_OPD_Cases_v2.pdf"

W, H = A4  # 595.27 x 841.89 points

c = canvas.Canvas(OUTPUT, pagesize=A4)
c.setTitle("ENT OPD Clinical Cases with Prescriptions")

MARGIN_L = 50
MARGIN_R = W - 50
TEXT_W = MARGIN_R - MARGIN_L

# ── colour palette ──────────────────────────────────────────────────────────
DARK_BLUE = colors.HexColor("#1a3c5e")
MID_BLUE  = colors.HexColor("#2e6da4")
LIGHT_BLU = colors.HexColor("#ddeeff")
ROW_ALT   = colors.HexColor("#f4f8ff")
WHITE     = colors.white
BLACK     = colors.black
GREY_LINE = colors.HexColor("#b0c4de")
DARK_GREY = colors.HexColor("#333333")
MED_GREY  = colors.HexColor("#555555")

# ── helpers ─────────────────────────────────────────────────────────────────
def new_page():
    c.showPage()

def draw_page_footer():
    c.setFont("Helvetica-Oblique", 7)
    c.setFillColor(colors.HexColor("#888888"))
    c.drawCentredString(W / 2, 20, "ENT OPD Cases — Educational Reference | For clinical use always verify doses against current formularies")

def wrap(text, width_pts, font, size):
    """Return list of lines that fit within width_pts."""
    c.setFont(font, size)
    words = text.split()
    lines, line = [], ""
    for w in words:
        test = (line + " " + w).strip()
        if c.stringWidth(test, font, size) <= width_pts:
            line = test
        else:
            if line:
                lines.append(line)
            line = w
    if line:
        lines.append(line)
    return lines

def text_block(text, x, y, width, font="Helvetica", size=8.5, color=BLACK, line_h=12):
    c.setFont(font, size)
    c.setFillColor(color)
    lines = wrap(text, width, font, size)
    for ln in lines:
        if y < 40:
            draw_page_footer()
            new_page()
            y = H - 50
        c.drawString(x, y, ln)
        y -= line_h
    return y  # return final y position

def filled_rect(x, y, w, h, fill_color, stroke_color=None):
    c.setFillColor(fill_color)
    if stroke_color:
        c.setStrokeColor(stroke_color)
        c.rect(x, y, w, h, fill=1, stroke=1)
    else:
        c.rect(x, y, w, h, fill=1, stroke=0)

# ============================================================
# COVER PAGE
# ============================================================
# Background header band
filled_rect(0, H - 120, W, 120, DARK_BLUE)

c.setFont("Helvetica-Bold", 22)
c.setFillColor(WHITE)
c.drawCentredString(W / 2, H - 60, "ENT OUTPATIENT DEPARTMENT")

c.setFont("Helvetica-Oblique", 13)
c.setFillColor(LIGHT_BLU)
c.drawCentredString(W / 2, H - 82, "Clinical Case Studies with Prescriptions & Drug Rationale")

c.setFont("Helvetica", 10)
c.setFillColor(WHITE)
c.drawCentredString(W / 2, H - 102, "30 Cases | Otology · Rhinology · Laryngology")

# Info box
filled_rect(MARGIN_L, H - 220, TEXT_W, 85, LIGHT_BLU, GREY_LINE)
info = [
    ("Department :", "Ear, Nose & Throat (Otorhinolaryngology)"),
    ("Document   :", "OPD Case Portfolio with Drug Rationale"),
    ("Total Cases :", "30 Clinical Cases"),
    ("Date        :", "June 2026"),
]
iy = H - 148
for label, val in info:
    c.setFont("Helvetica-Bold", 10); c.setFillColor(DARK_BLUE)
    c.drawString(MARGIN_L + 12, iy, label)
    c.setFont("Helvetica", 10); c.setFillColor(DARK_GREY)
    c.drawString(MARGIN_L + 110, iy, val)
    iy -= 18

# Intro paragraph
intro = (
    "This document presents 30 representative ENT outpatient cases covering common and "
    "important conditions across Otology, Rhinology, and Laryngology. Each case includes "
    "the patient profile, presenting complaint, clinical diagnosis, a full prescription "
    "with dosing schedule, and the pharmacological rationale for every drug prescribed. "
    "Intended for medical students, junior residents, and healthcare professionals."
)
y = H - 240
y = text_block(intro, MARGIN_L, y, TEXT_W, size=9, color=DARK_GREY, line_h=13)

# Table of contents
y -= 14
c.setFont("Helvetica-Bold", 10); c.setFillColor(DARK_BLUE)
c.drawString(MARGIN_L, y, "Table of Contents"); y -= 6
filled_rect(MARGIN_L, y - 2, TEXT_W, 1, DARK_BLUE)
y -= 10

toc_entries = [
    (1,  "Acute Otitis Media",                     "Otology"),
    (2,  "CSOM — Tubotympanic",                     "Otology"),
    (3,  "Otitis Externa (Swimmer's Ear)",           "Otology"),
    (4,  "Sudden SNHL",                             "Otology"),
    (5,  "BPPV",                                    "Otology"),
    (6,  "Allergic Rhinitis — Perennial",            "Rhinology"),
    (7,  "Acute Maxillary Sinusitis",                "Rhinology"),
    (8,  "Chronic Rhinosinusitis with Polyps",       "Rhinology"),
    (9,  "Deviated Nasal Septum",                   "Rhinology"),
    (10, "Epistaxis — Anterior",                    "Rhinology"),
    (11, "Acute Bacterial Tonsillitis",              "Pharyngology"),
    (12, "Peritonsillar Abscess (Quinsy)",           "Pharyngology"),
    (13, "Laryngopharyngeal Reflux (LPR)",           "Laryngology"),
    (14, "Vocal Cord Nodules",                      "Laryngology"),
    (15, "Acute Epiglottitis",                      "Laryngology"),
    (16, "Obstructive Sleep Apnoea (OSA)",           "Sleep / Airway"),
    (17, "Submandibular Sialadenitis",               "Salivary Glands"),
    (18, "Parotid Pleomorphic Adenoma",              "Salivary Glands"),
    (19, "Branchial Cyst",                          "Neck"),
    (20, "Tinnitus — Subjective",                   "Otology"),
    (21, "Cerumen Impaction",                       "Otology"),
    (22, "Foreign Body in Ear",                     "Otology"),
    (23, "Meniere's Disease",                       "Otology"),
    (24, "Nasal Furunculosis",                      "Rhinology"),
    (25, "Viral Pharyngitis",                       "Pharyngology"),
    (26, "Adenoid Hypertrophy (Paediatric)",         "Rhinology"),
    (27, "Acute Laryngitis",                        "Laryngology"),
    (28, "Samter's Triad / AERD Polyps",             "Rhinology"),
    (29, "Post-Tonsillectomy Haemorrhage",           "Postoperative"),
    (30, "Cholesteatoma — Atticoantral CSOM",        "Otology"),
]

col_x = [MARGIN_L, MARGIN_L + 22, MARGIN_L + 280, MARGIN_L + 400]
# header row
filled_rect(col_x[0], y - 2, TEXT_W, 14, MID_BLUE)
c.setFont("Helvetica-Bold", 8); c.setFillColor(WHITE)
for hx, htxt in zip(col_x, ["#", "Case Title", "Category", ""]):
    c.drawString(hx + 3, y + 2, htxt)
y -= 14

for i, (num, title, cat) in enumerate(toc_entries):
    row_bg = LIGHT_BLU if i % 2 == 0 else WHITE
    filled_rect(col_x[0], y - 2, TEXT_W, 13, row_bg)
    c.setFont("Helvetica-Bold", 8); c.setFillColor(DARK_BLUE)
    c.drawString(col_x[0] + 3, y + 2, str(num))
    c.setFont("Helvetica", 8); c.setFillColor(DARK_GREY)
    c.drawString(col_x[1] + 3, y + 2, title)
    c.setFont("Helvetica-Oblique", 7.5); c.setFillColor(MID_BLUE)
    c.drawString(col_x[2] + 3, y + 2, cat)
    y -= 13
    if y < 50:
        draw_page_footer()
        new_page()
        y = H - 50

draw_page_footer()
new_page()

# ============================================================
# CASE DATA
# ============================================================
CASES = [
    {
        "no": 1, "title": "Acute Otitis Media (AOM)",
        "patient": "Age: 6 yrs | Sex: Male | CC: Right ear pain, fever 38.5C, crying for 2 days",
        "diagnosis": "Acute Otitis Media (Right Ear) — bulging erythematous tympanic membrane on otoscopy",
        "rx": [
            ("Amoxicillin 250 mg/5 ml syrup", "5 ml TDS x 10 days",
             "First-line antibiotic for AOM; covers S. pneumoniae & H. influenzae"),
            ("Paracetamol 125 mg syrup", "10 mg/kg TDS PRN",
             "Antipyretic & analgesic for fever and ear pain"),
            ("Xylometazoline 0.05% nasal drops", "2 drops each nostril BD x 5 days",
             "Decongestant to relieve Eustachian tube congestion"),
        ],
        "advice": "Warm compress over ear. Follow up in 10 days. Avoid swimming."
    },
    {
        "no": 2, "title": "CSOM — Tubotympanic Type",
        "patient": "Age: 25 yrs | Sex: Female | CC: Painless left ear discharge 3 months, mild hearing loss",
        "diagnosis": "CSOM Tubotympanic — central perforation of left tympanic membrane, mucopurulent discharge",
        "rx": [
            ("Ciprofloxacin + Dexamethasone ear drops", "4 drops TDS x 2 weeks",
             "Ciprofloxacin covers Pseudomonas/Staph; Dexamethasone reduces mucosal inflammation"),
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab BD x 7 days",
             "Systemic beta-lactamase-stable antibiotic for persistent infection"),
            ("Cetirizine 10 mg tablet", "1 tab OD at night x 7 days",
             "Reduces allergic mucosal congestion contributing to Eustachian tube dysfunction"),
        ],
        "advice": "Keep ear dry (water precautions). Aural toilet every 3 days. Refer for tympanoplasty if no improvement."
    },
    {
        "no": 3, "title": "Otitis Externa (Swimmer's Ear)",
        "patient": "Age: 18 yrs | Sex: Male | CC: Right ear pain, itching, scanty discharge after swimming",
        "diagnosis": "Acute diffuse otitis externa — oedematous erythematous ear canal, tragal tenderness",
        "rx": [
            ("Neomycin + Polymyxin B + Hydrocortisone drops", "4 drops TDS x 7 days",
             "Antibiotics cover Gram-negative/Pseudomonas; Hydrocortisone reduces canal oedema and itch"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals x 5 days",
             "NSAID analgesic and anti-inflammatory for canal pain"),
            ("Clotrimazole 1% ear drops", "3 drops BD x 7 days",
             "Antifungal for co-existing otomycosis (Aspergillus/Candida) after water exposure"),
        ],
        "advice": "Avoid water entry; use earplugs while bathing. No cotton buds. Ear wick if canal very swollen."
    },
    {
        "no": 4, "title": "Sudden Sensorineural Hearing Loss",
        "patient": "Age: 42 yrs | Sex: Male | CC: Sudden right ear deafness on waking, tinnitus",
        "diagnosis": "Idiopathic Sudden SNHL — audiogram >30 dB loss at 3 consecutive frequencies within 72 hrs",
        "rx": [
            ("Prednisolone 60 mg tablet (tapering)", "60 mg x5 days -> 40 mg x5 -> 20 mg x5",
             "Corticosteroid reduces cochlear inflammation/oedema; standard first-line treatment for sudden SNHL"),
            ("Betahistine 16 mg tablet", "1 tab TDS x 1 month",
             "Improves inner ear microcirculation; reduces endolymphatic pressure"),
            ("Pantoprazole 40 mg tablet", "1 tab OD before breakfast",
             "Gastroprotection during high-dose steroid course"),
        ],
        "advice": "Urgent ENT for intratympanic steroid injection if oral steroids fail. MRI to exclude acoustic neuroma."
    },
    {
        "no": 5, "title": "Benign Paroxysmal Positional Vertigo (BPPV)",
        "patient": "Age: 55 yrs | Sex: Female | CC: Episodic vertigo <1 min on turning in bed, no hearing loss",
        "diagnosis": "BPPV posterior canal right — positive Dix-Hallpike test right side",
        "rx": [
            ("Betahistine 8 mg tablet", "1 tab TDS x 2 weeks",
             "Reduces endolymphatic hydrops and vestibular symptoms between episodes"),
            ("Prochlorperazine 5 mg tablet", "1 tab TDS PRN for nausea",
             "D2 antagonist vestibular suppressant; controls acute nausea during attacks"),
            ("Clonazepam 0.25 mg tablet", "1 tab OD bedtime (max 1 week)",
             "Low-dose benzodiazepine for acute vestibular sedation; short-term only"),
        ],
        "advice": "Epley manoeuvre performed in clinic. Brandt-Daroff exercises daily at home. Avoid sudden head movements."
    },
    {
        "no": 6, "title": "Perennial Allergic Rhinitis",
        "patient": "Age: 22 yrs | Sex: Male | CC: Sneezing, watery discharge, nasal blockage, itchy eyes — 6 months",
        "diagnosis": "Perennial Allergic Rhinitis — pale boggy turbinates; positive skin-prick test (house dust mite)",
        "rx": [
            ("Fluticasone propionate nasal spray 50 mcg", "2 sprays each nostril OD x 4 weeks",
             "First-line intranasal steroid; reduces eosinophilic mucosal inflammation and nasal polyp risk"),
            ("Cetirizine 10 mg tablet", "1 tab OD at night x 4 weeks",
             "2nd-generation H1-antihistamine; relieves sneezing, rhinorrhoea, and itching"),
            ("Montelukast 10 mg tablet", "1 tab OD at night x 4 weeks",
             "Leukotriene receptor antagonist; reduces mucosal inflammation; beneficial if concurrent asthma"),
        ],
        "advice": "Allergen avoidance (dust-mite-proof covers). Saline nasal irrigation BD. Consider immunotherapy if refractory."
    },
    {
        "no": 7, "title": "Acute Bacterial Maxillary Sinusitis",
        "patient": "Age: 30 yrs | Sex: Female | CC: Facial pain (cheek), thick yellow discharge, fever for 7 days",
        "diagnosis": "Acute Bacterial Maxillary Sinusitis — maxillary tenderness; X-ray air-fluid level",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS x 10 days",
             "Drug of choice; covers H. influenzae, S. pneumoniae, anaerobes including beta-lactamase producers"),
            ("Xylometazoline 0.1% nasal drops", "2 drops each nostril BD x 5 days (max)",
             "Reduces mucosal swelling, promotes sinus ostial drainage"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals x 5 days",
             "NSAID for facial pain/sinus pressure relief and mucosal anti-inflammatory action"),
        ],
        "advice": "Steam inhalation TDS. Head end elevation during sleep. CT scan if no improvement at 2 weeks."
    },
    {
        "no": 8, "title": "Chronic Rhinosinusitis with Nasal Polyps",
        "patient": "Age: 38 yrs | Sex: Male | CC: Bilateral nasal blockage, loss of smell, mucoid discharge — 1 year",
        "diagnosis": "CRSwNP — bilateral pale polyps in middle meatus on nasal endoscopy",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "2 sprays each nostril BD x 3 months",
             "High-potency intranasal steroid; reduces polyp size and eosinophilic mucosal inflammation"),
            ("Prednisolone 0.5 mg/kg tablet (tapering)", "Tapering dose over 2 weeks",
             "Short systemic steroid for rapid polyp shrinkage before FESS decision"),
            ("Cetirizine 10 mg + Montelukast 10 mg", "1 tab each OD at night x 1 month",
             "Combined antihistamine + LTRA for allergic and leukotriene-mediated inflammatory component"),
        ],
        "advice": "FESS if medical therapy fails. Regular saline irrigation post-operatively. Annual nasal endoscopy."
    },
    {
        "no": 9, "title": "Deviated Nasal Septum (DNS)",
        "patient": "Age: 28 yrs | Sex: Male | CC: Unilateral nasal obstruction (left), recurrent headaches",
        "diagnosis": "DNS C-shaped to left with inferior turbinate hypertrophy — anterior rhinoscopy",
        "rx": [
            ("Budesonide nasal spray 64 mcg", "2 sprays each nostril OD x 4 weeks",
             "Reduces reactive inferior turbinate hypertrophy associated with DNS; improves nasal airflow"),
            ("Cetirizine 10 mg tablet", "1 tab OD at night x 2 weeks",
             "Controls allergic turbinate swelling contributing to obstruction"),
            ("Saline nasal spray", "2 sprays each nostril TDS",
             "Moistens dry nasal mucosa; facilitates mucociliary clearance; no pharmacological side effects"),
        ],
        "advice": "Septoplasty + inferior turbinate reduction if symptoms persist >3 months despite medical therapy."
    },
    {
        "no": 10, "title": "Anterior Epistaxis (Little's Area)",
        "patient": "Age: 14 yrs | Sex: Male | CC: Recurrent bleeding from right nostril — 3 episodes in 1 month",
        "diagnosis": "Recurrent anterior epistaxis from Kiesselbach's plexus — telangiectatic vessels on rhinoscopy",
        "rx": [
            ("Chlorhexidine + Neomycin nasal cream", "Apply inside nostril BD x 2 weeks",
             "Reduces nasal vestibule Staph colonisation that causes mucosal friability and recurrent bleeds"),
            ("Tranexamic acid 500 mg tablet", "1 tab TDS x 5 days (acute episode)",
             "Antifibrinolytic; inhibits plasminogen activation; stabilises clot at bleeding point"),
            ("Vitamin C 500 mg tablet", "1 tab OD x 1 month",
             "Promotes collagen synthesis; strengthens capillary walls in Little's area; reduces recurrence"),
        ],
        "advice": "Chemical cautery (silver nitrate) of bleeding vessel. No nose-picking. Control hypertension if present."
    },
    {
        "no": 11, "title": "Acute Bacterial Tonsillitis",
        "patient": "Age: 12 yrs | Sex: Female | CC: Sore throat, painful swallowing, fever 39C, bad breath x 3 days",
        "diagnosis": "Acute bacterial tonsillitis — exudate on tonsils, cervical lymphadenopathy; rapid strep test positive",
        "rx": [
            ("Amoxicillin 500 mg tablet / syrup", "1 tab TDS x 10 days (full course essential)",
             "DOC for Group A beta-haemolytic Streptococcus; prevents rheumatic fever and quinsy"),
            ("Paracetamol 500 mg tablet", "1 tab TDS PRN x 5 days",
             "Antipyretic and analgesic for fever and throat pain"),
            ("Benzydamine 0.15% oral rinse (Difflam)", "15 ml gargle TDS x 7 days",
             "Topical NSAID + local anaesthetic; reduces oropharyngeal inflammation and contact pain"),
        ],
        "advice": "Soft diet, cold fluids. If penicillin allergy use Azithromycin. Tonsillectomy if >=7 episodes/year."
    },
    {
        "no": 12, "title": "Peritonsillar Abscess (Quinsy)",
        "patient": "Age: 20 yrs | Sex: Male | CC: Severe sore throat, trismus, hot-potato voice, drooling x 4 days",
        "diagnosis": "Left peritonsillar abscess — bulging peritonsillar fold, uvula deviated right, trismus",
        "rx": [
            ("Benzylpenicillin 2.4 MU IV", "IV 6-hourly x 48 hrs then oral switch",
             "High-dose IV penicillin targets S. pyogenes (primary pathogen) — inpatient IV regimen"),
            ("Metronidazole 500 mg IV", "IV TDS x 3 days",
             "Covers anaerobes (Fusobacterium, Bacteroides) common in polymicrobial peritonsillar abscess"),
            ("Dexamethasone 8 mg IV", "Single or BD x 2 doses",
             "Reduces peritonsillar oedema, shortens pain duration, improves trismus — evidence-supported"),
        ],
        "advice": "Needle aspiration or I&D under LA. Interval tonsillectomy at 6 weeks. Monitor airway closely."
    },
    {
        "no": 13, "title": "Laryngopharyngeal Reflux (LPR)",
        "patient": "Age: 45 yrs | Sex: Female | CC: Chronic throat clearing, morning hoarseness, globus x 3 months",
        "diagnosis": "LPR — posterior laryngitis, interarytenoid oedema on laryngoscopy; RSI score >13",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab BD (30 min before meals) x 3 months",
             "PPI reduces gastric acid; 3-month trial is required — LPR responds slower than GORD"),
            ("Domperidone 10 mg tablet", "1 tab TDS before meals x 4 weeks",
             "Prokinetic; accelerates gastric emptying and reduces retrograde oesophageal flow"),
            ("Almagate / Gaviscon suspension", "10 ml after meals and at bedtime",
             "Alginate raft on gastric contents physically prevents acid reflux into laryngopharynx"),
        ],
        "advice": "Elevate head end 30 degrees. Avoid late meals, alcohol, coffee, spicy food. Weight loss if obese."
    },
    {
        "no": 14, "title": "Vocal Cord Nodules (Singer's Nodules)",
        "patient": "Age: 32 yrs | Sex: Female (teacher) | CC: Progressive hoarseness, voice fatigue x 4 months",
        "diagnosis": "Bilateral VF nodules at anterior 1/3 junction — videolaryngoscopy",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab OD before breakfast x 6 weeks",
             "LPR aggravates nodule formation; acid suppression reduces mucosal irritation at nodule site"),
            ("Fluticasone inhaler 125 mcg", "2 puffs BD (inhale toward larynx) x 4 weeks",
             "Inhaled steroid reduces mucosal oedema at nodule site via local anti-inflammatory action"),
            ("Multivitamin + Zinc tablet", "1 tab OD x 1 month",
             "Supports vocal fold mucosal healing; zinc deficiency impairs tissue repair"),
        ],
        "advice": "Voice rest is primary treatment. Refer to speech therapist for vocal hygiene. Microlaryngoscopy if refractory."
    },
    {
        "no": 15, "title": "Acute Epiglottitis",
        "patient": "Age: 35 yrs | Sex: Male | CC: Sudden severe sore throat, drooling, stridor, toxic appearance",
        "diagnosis": "Acute Epiglottitis — cherry-red epiglottis; lateral X-ray neck: thumb sign",
        "rx": [
            ("Ceftriaxone 2 g IV", "IV OD x 7 days",
             "3rd-gen cephalosporin covers H. influenzae type B and streptococcal species — first-line"),
            ("Dexamethasone 8 mg IV", "IV BD x 3 days",
             "Systemic steroid reduces supraglottic oedema; decreases risk of complete airway obstruction"),
            ("Nebulised Adrenaline 1:1000 — 5 ml", "Nebulise PRN",
             "Alpha-adrenergic vasoconstriction rapidly reduces supraglottic oedema while antibiotics take effect"),
        ],
        "advice": "EMERGENCY — secure airway immediately. ICU monitoring. O2 therapy. Intubation/tracheostomy if obstruction."
    },
    {
        "no": 16, "title": "Obstructive Sleep Apnoea (OSA)",
        "patient": "Age: 50 yrs | Sex: Male (BMI 34) | CC: Loud snoring, witnessed apnoeas, daytime sleepiness",
        "diagnosis": "Moderate OSA — AHI 22/hr on polysomnography; Epworth Scale 14/24",
        "rx": [
            ("Auto-CPAP device 4-12 cmH2O", "Nightly use — gold standard",
             "CPAP maintains airway patency by pneumatic splinting of upper airway — reduces AHI to <5"),
            ("Montelukast 10 mg tablet", "1 tab OD at night x 1 month",
             "Leukotriene antagonist reduces adenotonsillar tissue in OSA with allergic rhinitis component"),
            ("Fluticasone nasal spray 50 mcg", "2 sprays each nostril OD x 4 weeks",
             "Treats nasal obstruction from allergic rhinitis which increases upper airway resistance during sleep"),
        ],
        "advice": "Weight loss. Avoid alcohol and sedatives. Lateral sleep position. ENT surgical review for structural causes."
    },
    {
        "no": 17, "title": "Acute Submandibular Sialadenitis",
        "patient": "Age: 48 yrs | Sex: Male | CC: Painful jaw swelling worse at mealtimes, fever",
        "diagnosis": "Bacterial submandibular sialadenitis (calculus-induced) — pus from Wharton's duct; X-ray: calculus",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS x 10 days",
             "Covers S. aureus, S. viridans, anaerobes common in salivary gland infections"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals x 5 days",
             "NSAID for glandular pain and reduction of inflammatory oedema"),
            ("Pilocarpine 5 mg tablet", "1 tab TDS x 1 week",
             "Muscarinic agonist (sialologue); stimulates saliva flow, flushes duct, helps expel small calculi"),
        ],
        "advice": "Gland massage toward duct orifice. Lemon drops to stimulate saliva. Sialolithotomy if calculus persists."
    },
    {
        "no": 18, "title": "Parotid Pleomorphic Adenoma",
        "patient": "Age: 40 yrs | Sex: Female | CC: Slowly enlarging painless swelling in front of right ear x 2 years",
        "diagnosis": "Pleomorphic adenoma right parotid — firm lobulated mobile mass; FNAC: benign mixed tumour",
        "rx": [
            ("Ibuprofen 400 mg tablet (if tender)", "1 tab BD x 5 days PRN",
             "Symptomatic NSAID; primary treatment is surgical (superficial parotidectomy)"),
            ("Vitamin D3 1000 IU + Multivitamin", "1 tab OD perioperatively",
             "Nutritional optimisation for perioperative wound healing"),
            ("No specific pharmacotherapy required", "—",
             "Pleomorphic adenoma is a benign tumour — definitive treatment is surgery, not drugs"),
        ],
        "advice": "Superficial parotidectomy with facial nerve preservation. MRI for pre-op planning. Risk: malignant transformation if untreated."
    },
    {
        "no": 19, "title": "Branchial Cyst (2nd Arch)",
        "patient": "Age: 22 yrs | Sex: Male | CC: Painless smooth neck swelling anterior to SCM x 6 months",
        "diagnosis": "2nd arch branchial cyst — soft fluctuant swelling at upper 1/3 of SCM; FNAC: cholesterol crystals, squamous cells",
        "rx": [
            ("Amoxicillin-Clavulanate 625 mg (if infected)", "1 tab TDS x 7 days",
             "Covers oral flora if secondary infection of cyst occurs; resolves acute inflammation before surgery"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS x 3 days PRN",
             "Anti-inflammatory for pain if cyst becomes acutely inflamed"),
            ("No definitive pharmacotherapy", "—",
             "Definitive treatment is surgical excision of cyst + tract; medicines are supportive only"),
        ],
        "advice": "Surgical excision of complete cyst with tract. Avoid I&D — increases recurrence. Exclude malignancy in older patients."
    },
    {
        "no": 20, "title": "Subjective Tinnitus",
        "patient": "Age: 60 yrs | Sex: Male | CC: Continuous high-pitched ringing in both ears for 4 months, mild hearing loss",
        "diagnosis": "Bilateral subjective tinnitus with presbycusis — audiogram: high-frequency SNHL; MRI: no lesion",
        "rx": [
            ("Betahistine 16 mg tablet", "1 tab TDS x 3 months",
             "Improves cochlear microcirculation; reduces endolymphatic hydrops — most widely used tinnitus agent"),
            ("Clonazepam 0.5 mg tablet", "1 tab OD at bedtime x 4 weeks",
             "Low-dose anxiolytic; reduces tinnitus loudness perception and improves associated sleep disturbance"),
            ("Ginkgo biloba 120 mg extract", "1 tab BD x 3 months",
             "Increases cochlear blood flow via PAF inhibition; modest evidence for tinnitus symptom reduction"),
        ],
        "advice": "Tinnitus retraining therapy (TRT). Hearing aid if significant SNHL. Avoid caffeine and noise. Reassurance is important."
    },
    {
        "no": 21, "title": "Cerumen (Wax) Impaction",
        "patient": "Age: 35 yrs | Sex: Female | CC: Bilateral ear fullness, muffled hearing, itching x 2 weeks",
        "diagnosis": "Bilateral cerumen impaction — complete canal occlusion with hard brown wax on otoscopy",
        "rx": [
            ("Carbamide peroxide 6.5% ear drops", "5 drops BD x 4-5 days",
             "Cerumenolytic; releases oxygen, softens and breaks up impacted wax for easier removal"),
            ("Warm olive oil / mineral oil ear drops", "5 drops BD x 4 days before syringing",
             "Lubricates and softens hard impacted wax, facilitating aural syringing or microsuction"),
            ("Chloramphenicol 0.5% ear drops", "4 drops TDS x 5 days (if mild otitis externa)",
             "Topical antibiotic — only if secondary mucosal inflammation accompanies impaction"),
        ],
        "advice": "Aural syringing or microsuction after cerumenolytic use. No cotton buds. Annual review for wax-prone patients."
    },
    {
        "no": 22, "title": "Foreign Body in Ear (Paediatric)",
        "patient": "Age: 4 yrs | Sex: Male | CC: Mother noticed child inserted bead in left ear, child pulling at ear",
        "diagnosis": "Inanimate foreign body (plastic bead) in left EAC — confirmed on otoscopy; TM intact",
        "rx": [
            ("Lignocaine 2% solution ear drops", "3 drops before removal attempt",
             "Topical anaesthetic; reduces procedural pain and child's movement during foreign body removal"),
            ("Chloramphenicol 0.5% ear drops", "4 drops TDS x 5 days post-removal",
             "Prevents secondary infection after canal manipulation and minor mucosal abrasion"),
            ("Paracetamol 120 mg/5 ml syrup", "10 mg/kg TDS PRN x 3 days",
             "Analgesic for post-procedure pain and associated earache"),
        ],
        "advice": "Remove under GA if uncooperative. Kill live insects with mineral oil first. NEVER attempt if TM perforation suspected."
    },
    {
        "no": 23, "title": "Meniere's Disease",
        "patient": "Age: 48 yrs | Sex: Female | CC: Episodic vertigo lasting hours, fluctuating hearing loss, tinnitus, left aural fullness",
        "diagnosis": "Meniere's Disease — clinical triad confirmed; low-frequency SNHL left ear; electrocochleography positive",
        "rx": [
            ("Betahistine 24 mg tablet", "1 tab TDS x 3-6 months",
             "Reduces endolymphatic hydrops by improving stria vascularis microvascular permeability; reduces attack frequency"),
            ("Prochlorperazine 5 mg tablet", "1 tab TDS PRN (acute attack)",
             "D2 antagonist vestibular suppressant; controls vertigo, nausea, vomiting during acute Meniere's attack"),
            ("Hydrochlorothiazide 25 mg + Triamterene", "1 tab OD in morning x 3 months",
             "Thiazide diuretic reduces endolymph production and endolymphatic sac pressure — second-line adjunct"),
        ],
        "advice": "Low-salt diet (<1.5 g Na/day). Avoid caffeine and alcohol. Intratympanic gentamicin or steroid for refractory cases."
    },
    {
        "no": 24, "title": "Nasal Furunculosis",
        "patient": "Age: 28 yrs | Sex: Male | CC: Painful swelling, redness, pustule at right nasal vestibule x 5 days",
        "diagnosis": "Furunculosis of right nasal vestibule — tender erythematous pustule; S. aureus likely",
        "rx": [
            ("Cloxacillin 500 mg capsule", "1 cap QID x 7 days (empty stomach)",
             "Anti-staphylococcal penicillinase-resistant antibiotic — S. aureus is the primary pathogen"),
            ("Mupirocin 2% nasal ointment", "Apply BD x 5 days",
             "Topical antibiotic effective against MRSA and MSSA; eliminates nasal staphylococcal colonisation"),
            ("Ibuprofen 400 mg tablet", "1 tab TDS after meals x 5 days",
             "NSAID analgesic for the significant local pain of nasal furunculosis"),
        ],
        "advice": "NEVER squeeze — risk of cavernous sinus thrombosis via danger triangle of face. Hot fomentation. Admit if cellulitis spreads."
    },
    {
        "no": 25, "title": "Viral Pharyngitis",
        "patient": "Age: 25 yrs | Sex: Female | CC: Mild sore throat, low-grade fever, runny nose x 2 days",
        "diagnosis": "Acute viral pharyngitis (rhinovirus/adenovirus) — mildly erythematous pharynx; no exudate; negative rapid strep test",
        "rx": [
            ("Paracetamol 500 mg tablet", "1 tab TDS PRN x 3-5 days",
             "Symptomatic analgesic/antipyretic; no antibiotics needed for viral pharyngitis"),
            ("Benzydamine 0.15% gargle / lozenge", "Gargle 15 ml TDS or 1 lozenge every 3 hrs",
             "Topical NSAID + local anaesthetic on oropharyngeal mucosa; reduces throat pain on contact"),
            ("Loratadine 10 mg tablet", "1 tab OD x 5 days",
             "Non-sedating antihistamine for rhinorrhoea and post-nasal drip contributing to pharyngeal irritation"),
        ],
        "advice": "Warm saline gargle. Honey-ginger drinks. Adequate hydration. Antibiotics NOT indicated. Return if fever >72 hrs."
    },
    {
        "no": 26, "title": "Adenoid Hypertrophy (Paediatric)",
        "patient": "Age: 7 yrs | Sex: Male | CC: Mouth breathing, snoring, nasal speech, recurrent otitis media x 1 year",
        "diagnosis": "Adenoid hypertrophy Grade III — endoscopic nasopharyngeal obstruction; bilateral effusion on tympanometry",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "1 spray each nostril OD x 3 months",
             "Intranasal steroid reduces adenoid lymphoid tissue size; evidence-based first-line medical treatment"),
            ("Montelukast 5 mg chewable tablet", "1 tab OD at night x 3 months",
             "LTRA further reduces adenoid hypertrophy in children with allergic rhinitis component"),
            ("Amoxicillin 250 mg/5 ml syrup", "10 mg/kg TDS x 7 days (if acute infection)",
             "For superimposed bacterial adenoiditis — covers Streptococcal and H. influenzae infection"),
        ],
        "advice": "Adenoidectomy +/- grommets if medical therapy fails or Grade III-IV with conductive hearing loss."
    },
    {
        "no": 27, "title": "Acute Laryngitis",
        "patient": "Age: 30 yrs | Sex: Male (singer) | CC: Sudden hoarseness, voice loss after shouting at concert, dry throat",
        "diagnosis": "Acute non-infective laryngitis — generalised vocal cord erythema and oedema; no exudate; afebrile",
        "rx": [
            ("Pantoprazole 40 mg tablet", "1 tab BD x 2 weeks",
             "Addresses LPR as precipitating factor; acid suppression reduces further vocal cord mucosal irritation"),
            ("Dexamethasone 4 mg tablet", "1 tab BD x 3 days",
             "Short systemic steroid rapidly reduces vocal cord oedema; used in professional voice users needing quick recovery"),
            ("Carbocisteine 375 mg capsule", "2 caps TDS x 5 days",
             "Mucolytic; reduces mucus viscosity and adherence to laryngeal mucosa, easing phonation"),
        ],
        "advice": "Complete voice rest 3-5 days. Humidified air inhalation. Avoid whispering (worse than normal voice). 2L hydration/day."
    },
    {
        "no": 28, "title": "Samter's Triad (AERD with Nasal Polyps)",
        "patient": "Age: 38 yrs | Sex: Male | CC: Bilateral nasal blockage, loss of smell, bronchial asthma; aspirin sensitivity",
        "diagnosis": "Aspirin-Exacerbated Respiratory Disease — bilateral nasal polyps, asthma, aspirin intolerance; CT: pansinusitis",
        "rx": [
            ("Mometasone furoate nasal spray 50 mcg", "2 sprays each nostril BD x 3 months",
             "Primary polyp medical treatment; reduces eosinophilic mucosal inflammation typical of AERD"),
            ("Montelukast 10 mg tablet", "1 tab OD at night x 3 months",
             "LTRA especially important in AERD — blocks excess leukotriene production via 5-LOX pathway shunting by aspirin"),
            ("Prednisolone 20 mg tablet (tapering)", "20 mg x3 days -> 10 mg x3 -> 5 mg x3",
             "Short-burst oral steroid to rapidly shrink polyps or treat acute exacerbation before surgery"),
        ],
        "advice": "STRICT aspirin and NSAID avoidance. FESS if medical treatment fails. Aspirin desensitisation in specialist centres."
    },
    {
        "no": 29, "title": "Post-Tonsillectomy Reactionary Haemorrhage",
        "patient": "Age: 16 yrs | Sex: Male | CC: Fresh bleeding from mouth 6 hrs post-tonsillectomy, swallowing blood",
        "diagnosis": "Reactionary haemorrhage post-tonsillectomy (within 24 hrs) — tonsillar fossa oozing; BP and HR stable",
        "rx": [
            ("Tranexamic acid 1 g IV infusion", "IV TDS until bleeding controlled",
             "Antifibrinolytic; prevents clot dissolution at tonsillar fossa; reduces need for surgical re-exploration"),
            ("Ceftriaxone 1 g IV", "IV OD x 5 days",
             "Broad-spectrum antibiotic prevents secondary infection of raw tonsillar bed post-haemorrhage"),
            ("Normal Saline / Ringer's Lactate IV", "125 ml/hr maintenance rate",
             "Fluid resuscitation; compensates blood loss; maintains haemodynamic stability pending haemostasis"),
        ],
        "advice": "Return to OT for haemostasis under GA if bleeding persists. Group and crossmatch blood. Monitor Hb. Keep NBM."
    },
    {
        "no": 30, "title": "Cholesteatoma — Atticoantral CSOM",
        "patient": "Age: 30 yrs | Sex: Male | CC: Right foul-smelling ear discharge, hearing loss, giddiness x 2 years",
        "diagnosis": "Cholesteatoma — attic perforation with white pearly mass; 40 dB CHL; CT: ossicular and lateral wall bone erosion",
        "rx": [
            ("Ciprofloxacin 0.3% ear drops", "4 drops TDS x 2 weeks (pre-operative)",
             "Controls active infection and reduces discharge before surgery; covers Pseudomonas common in CSOM"),
            ("Amoxicillin-Clavulanate 625 mg tablet", "1 tab TDS x 7 days",
             "Systemic antibiotic for active otorrhoea before planned mastoid surgery; covers mixed oral flora"),
            ("Betahistine 8 mg tablet", "1 tab TDS x 2 weeks",
             "Reduces vestibular symptoms from inner ear involvement or labyrinthitis secondary to cholesteatoma"),
        ],
        "advice": "SURGERY REQUIRED — Modified Radical Mastoidectomy is definitive. Medicines are pre-operative preparation only. Annual CT follow-up."
    },
]

# ============================================================
# RENDER CASES
# ============================================================
def draw_case(case, y_start):
    y = y_start

    def need_space(needed):
        nonlocal y
        if y - needed < 55:
            draw_page_footer()
            new_page()
            y = H - 50
        return y

    # Header bar
    y = need_space(22)
    filled_rect(MARGIN_L, y - 14, TEXT_W, 22, DARK_BLUE)
    c.setFont("Helvetica-Bold", 11)
    c.setFillColor(WHITE)
    c.drawString(MARGIN_L + 8, y - 4, f"CASE {case['no']:02d}  |  {case['title']}")
    y -= 20

    # Patient
    y = need_space(28)
    c.setFont("Helvetica-Bold", 8); c.setFillColor(DARK_BLUE)
    c.drawString(MARGIN_L, y, "Patient:"); y -= 1
    y = text_block(case["patient"], MARGIN_L + 55, y + 1, TEXT_W - 58, size=8.5, color=DARK_GREY)
    y -= 3

    # Diagnosis
    y = need_space(28)
    c.setFont("Helvetica-Bold", 8); c.setFillColor(DARK_BLUE)
    c.drawString(MARGIN_L, y, "Diagnosis:"); y -= 1
    y = text_block(case["diagnosis"], MARGIN_L + 65, y + 1, TEXT_W - 68, size=8.5, color=DARK_GREY)
    y -= 5

    # Prescription label
    y = need_space(12)
    c.setFont("Helvetica-Bold", 8.5); c.setFillColor(DARK_BLUE)
    c.drawString(MARGIN_L, y, "Rx — Prescription:"); y -= 4

    # Rx table header
    COL = [MARGIN_L, MARGIN_L + 175, MARGIN_L + 315, MARGIN_L + 315]  # drug | dose | reason
    COL_W = [170, 135, TEXT_W - 320]
    y = need_space(16)
    filled_rect(MARGIN_L, y - 11, TEXT_W, 16, MID_BLUE)
    c.setFont("Helvetica-Bold", 8); c.setFillColor(WHITE)
    for i, hdr in enumerate(["Drug & Formulation", "Dose / Schedule", "Reason for Prescribing"]):
        c.drawString(COL[i] + 3, y - 3, hdr)
    y -= 15

    for row_idx, (drug, dose, reason) in enumerate(case["rx"]):
        row_bg = LIGHT_BLU if row_idx % 2 == 0 else WHITE
        # measure row height
        d_lines = wrap(drug, COL_W[0] - 6, "Helvetica", 8.5)
        do_lines = wrap(dose, COL_W[1] - 6, "Helvetica", 8.5)
        r_lines  = wrap(reason, COL_W[2] - 6, "Helvetica-Oblique", 8)
        row_h = max(len(d_lines), len(do_lines), len(r_lines)) * 11 + 6
        y = need_space(row_h + 4)
        filled_rect(MARGIN_L, y - row_h, TEXT_W, row_h, row_bg, GREY_LINE)
        # draw text in each column
        ty = y - 8
        for ln in d_lines:
            c.setFont("Helvetica", 8.5); c.setFillColor(DARK_GREY)
            c.drawString(COL[0] + 3, ty, ln); ty -= 11
        ty = y - 8
        for ln in do_lines:
            c.setFont("Helvetica", 8.5); c.setFillColor(DARK_GREY)
            c.drawString(COL[1] + 3, ty, ln); ty -= 11
        ty = y - 8
        for ln in r_lines:
            c.setFont("Helvetica-Oblique", 8); c.setFillColor(MED_GREY)
            c.drawString(COL[2] + 3, ty, ln); ty -= 11
        y -= row_h

    y -= 4

    # Advice
    y = need_space(24)
    c.setFont("Helvetica-Bold", 8); c.setFillColor(DARK_BLUE)
    c.drawString(MARGIN_L, y, "Advice / Follow-up:")
    y -= 1
    y = text_block(case["advice"], MARGIN_L + 120, y + 1, TEXT_W - 123, "Helvetica", 8.5, DARK_GREY)
    y -= 6

    # Separator line
    y = need_space(8)
    c.setStrokeColor(GREY_LINE)
    c.setLineWidth(0.5)
    c.line(MARGIN_L, y, MARGIN_R, y)
    y -= 8

    return y


y_cursor = H - 50
for case in CASES:
    y_cursor = draw_case(case, y_cursor)

# Disclaimer on last page
if y_cursor < 80:
    draw_page_footer()
    new_page()
    y_cursor = H - 50

c.setStrokeColor(DARK_BLUE); c.setLineWidth(1)
c.line(MARGIN_L, y_cursor, MARGIN_R, y_cursor); y_cursor -= 10
c.setFont("Helvetica-Oblique", 7.5); c.setFillColor(colors.HexColor("#666666"))
disclaimer = ("Disclaimer: This document is for educational purposes only. All prescriptions must be adapted "
              "to individual patient needs, local drug availability, and current clinical guidelines. "
              "Always verify doses against current formularies before prescribing.")
for ln in wrap(disclaimer, TEXT_W, "Helvetica-Oblique", 7.5):
    c.drawString(MARGIN_L, y_cursor, ln); y_cursor -= 10

draw_page_footer()
c.save()
print(f"PDF saved: {OUTPUT}")
Running Command

python3 /home/daytona/workspace/ent-opd/make_ent_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/ent-opd/ENT_OPD_Cases_v2.pdf && python3 -c " from pypdf import PdfReader r = PdfReader('/home/daytona/workspace/ent-opd/ENT_OPD_Cases_v2.pdf') print(f'Pages: {len(r.pages)}') print(f'First page text snippet: {r.pages[0].extract_text()[:200]}') "

The new PDF is verified - 10 pages, readable text confirmed. Here's your download:

ENT OPD Cases v2

PDF Document · PDF

This version is built with a completely different, simpler rendering engine (direct canvas drawing instead of flowable objects) which is much more compatible across PDF viewers. It contains:
  • 10 pages, all 30 cases
  • Cover page with table of contents
  • Each case has: Patient details, Diagnosis, a colour-coded 3-column prescription table (Drug | Dose | Reason for prescribing), and Advice/Follow-up
  • Cases span all ENT specialties - Otology, Rhinology, Laryngology, Pharyngology, Salivary Glands, Sleep/Airway, and Neck
This is a shared conversation. Sign in to Orris to start your own chat.