Write about 25+ medicine opd pt cases with their prescriptions for practice and education purposes also give reasons why are we prescribing it and make it in a pdf form
mkdir -p /home/daytona/workspace/opd-cases && ls /home/daytona/workspace/opd-cases/
~/opd-cases/generate_opd_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether, PageBreak
)
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate
from reportlab.lib.colors import HexColor
# Color palette
DARK_BLUE = HexColor("#1a3a5c")
MED_BLUE = HexColor("#2563a8")
LIGHT_BLUE = HexColor("#dbeafe")
TEAL = HexColor("#0d7377")
LIGHT_TEAL = HexColor("#d4f4f5")
ORANGE = HexColor("#e05c00")
LIGHT_ORANGE= HexColor("#fff3e0")
GREEN = HexColor("#166534")
LIGHT_GREEN = HexColor("#dcfce7")
RED = HexColor("#991b1b")
LIGHT_RED = HexColor("#fee2e2")
GRAY_BG = HexColor("#f8fafc")
GRAY_BORDER = HexColor("#cbd5e1")
WHITE = colors.white
BLACK = colors.black
OUTPUT = "/home/daytona/workspace/opd-cases/OPD_Patient_Cases_Educational.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="Medicine OPD Patient Cases – Educational Reference",
author="Orris Medical Education"
)
W = A4[0] - 3.6*cm # usable width
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
"MainTitle", parent=styles["Title"],
fontSize=22, textColor=WHITE,
spaceAfter=4, alignment=TA_CENTER,
fontName="Helvetica-Bold"
)
subtitle_style = ParagraphStyle(
"SubTitle", parent=styles["Normal"],
fontSize=11, textColor=LIGHT_BLUE,
spaceAfter=2, alignment=TA_CENTER,
fontName="Helvetica"
)
case_title_style = ParagraphStyle(
"CaseTitle", parent=styles["Normal"],
fontSize=13, textColor=WHITE,
fontName="Helvetica-Bold", alignment=TA_LEFT,
spaceAfter=0, spaceBefore=0, leading=16
)
section_label = ParagraphStyle(
"SectionLabel", parent=styles["Normal"],
fontSize=8.5, textColor=MED_BLUE,
fontName="Helvetica-Bold", spaceBefore=4, spaceAfter=1,
textTransform="uppercase"
)
body_style = ParagraphStyle(
"Body", parent=styles["Normal"],
fontSize=9.5, textColor=HexColor("#1e293b"),
fontName="Helvetica", spaceAfter=2, leading=13
)
bullet_style = ParagraphStyle(
"Bullet", parent=styles["Normal"],
fontSize=9.5, textColor=HexColor("#1e293b"),
fontName="Helvetica", spaceAfter=1, leading=13,
leftIndent=12, bulletIndent=0
)
rx_drug_style = ParagraphStyle(
"RxDrug", parent=styles["Normal"],
fontSize=9.5, textColor=DARK_BLUE,
fontName="Helvetica-Bold", spaceAfter=1, leading=13,
leftIndent=10
)
reason_style = ParagraphStyle(
"Reason", parent=styles["Normal"],
fontSize=9, textColor=HexColor("#374151"),
fontName="Helvetica-Oblique", spaceAfter=1, leading=12,
leftIndent=22
)
footer_style = ParagraphStyle(
"Footer", parent=styles["Normal"],
fontSize=7.5, textColor=HexColor("#94a3b8"),
fontName="Helvetica", alignment=TA_CENTER
)
warning_style = ParagraphStyle(
"Warning", parent=styles["Normal"],
fontSize=8.5, textColor=RED,
fontName="Helvetica-Bold", alignment=TA_CENTER
)
# ─── DATA: 25 OPD Cases ────────────────────────────────────────────────────────
cases = [
# 1
{
"num": 1,
"title": "Hypertension (Primary/Essential)",
"color": DARK_BLUE,
"patient": "Mr. Ramesh Kumar | 52 yr | Male | Clerk",
"cc": "Headache, dizziness, occasional blurred vision for 3 months",
"vitals": "BP: 158/96 mmHg | PR: 82/min | Weight: 82 kg | BMI: 28.4",
"history": "No known DM or heart disease. Smoker (10 cigarettes/day). Family history of HTN in father.",
"exam": "S1 S2 normal, no murmurs. Fundus: Grade II hypertensive retinopathy.",
"ix": "CBC, RFT, LFT, Lipid profile, ECG, Urine R/M – all normal. Serum creatinine 0.9 mg/dL.",
"diagnosis": "Primary Hypertension (Stage 1)",
"prescription": [
("Tab. Amlodipine 5 mg", "1-0-0 (morning)", "Dihydropyridine CCB – first-line for primary HTN; lowers peripheral vascular resistance; well tolerated."),
("Tab. Telmisartan 40 mg", "0-0-1 (night)", "ARB – blocks AT1 receptors; renoprotective; preferred over ACEi due to better tolerability (no cough)."),
("Tab. Aspirin 75 mg (EC)", "1-0-0 after food", "Antiplatelet – indicated for primary prevention given his CV risk factors (smoking + HTN + age >45)."),
("Tab. Atorvastatin 10 mg", "0-0-1", "Statin – for dyslipidemia risk reduction; also pleiotropic vascular protection."),
],
"advice": "Low-salt diet (<5g NaCl/day), stop smoking, 30 min brisk walk daily, weight reduction target BMI <25. Follow up in 4 weeks.",
"tag_color": DARK_BLUE,
},
# 2
{
"num": 2,
"title": "Type 2 Diabetes Mellitus",
"color": HexColor("#7c3aed"),
"patient": "Mrs. Sunita Devi | 48 yr | Female | Housewife",
"cc": "Polyuria, polydipsia, weight loss for 2 months; fatigue",
"vitals": "BP: 126/80 mmHg | PR: 76/min | Weight: 72 kg | BMI: 27.3",
"history": "No previous diagnosis of DM. Family history: mother has T2DM. No known drug allergy.",
"exam": "No pallor, no edema. Fundus normal. No peripheral neuropathy.",
"ix": "FBS: 198 mg/dL | PPBS: 286 mg/dL | HbA1c: 8.4% | Lipids: mildly elevated TG. Urine: glucose 2+, no protein.",
"diagnosis": "Type 2 Diabetes Mellitus (newly diagnosed)",
"prescription": [
("Tab. Metformin 500 mg", "1-0-1 with meals (titrate to 1g BD)", "Biguanide – first-line T2DM drug; reduces hepatic glucose output; weight-neutral; low hypoglycemia risk; cardioprotective."),
("Tab. Glimepiride 1 mg", "1-0-0 before breakfast", "Sulfonylurea – stimulates insulin secretion; used as add-on when metformin alone insufficient at HbA1c >8%."),
("Tab. Atorvastatin 10 mg", "0-0-1", "Diabetics have high CV risk; statin therapy reduces major adverse cardiac events."),
("Tab. Folic acid 5 mg", "1-0-0", "Metformin depletes B12/folate over time; prophylactic supplementation recommended."),
],
"advice": "Diabetic diet (low glycemic index foods), portion control, 45 min walking 5 days/week. SMBG fasting and post-meal. HbA1c recheck in 3 months.",
"tag_color": HexColor("#7c3aed"),
},
# 3
{
"num": 3,
"title": "Community-Acquired Pneumonia (CAP)",
"color": TEAL,
"patient": "Mr. Anil Sharma | 34 yr | Male | Teacher",
"cc": "High fever (102°F), productive cough with yellowish sputum, right-sided chest pain for 5 days",
"vitals": "Temp: 38.9°C | PR: 104/min | RR: 22/min | SpO2: 96% RA | BP: 118/76",
"history": "Previously healthy. No TB contact. No recent travel. Not vaccinated for pneumococcus.",
"exam": "Dull percussion, increased vocal fremitus, crepitations right lower lobe. No wheeze.",
"ix": "CXR: Right lower lobe consolidation. WBC: 14,200 (neutrophilia). CRP: 48. Sputum AFB: negative.",
"diagnosis": "Community-Acquired Pneumonia (CURB-65 score: 1 – mild, outpatient eligible)",
"prescription": [
("Tab. Amoxicillin-Clavulanate 625 mg", "1-1-1 after food × 7 days", "Beta-lactam + beta-lactamase inhibitor; covers S. pneumoniae, H. influenzae, and atypicals; first-line for outpatient CAP."),
("Tab. Azithromycin 500 mg", "1-0-0 × 5 days", "Macrolide – covers atypical organisms (Mycoplasma, Chlamydophila, Legionella); synergistic with beta-lactam."),
("Tab. Paracetamol 650 mg", "1-1-1-1 SOS for fever/pain", "Antipyretic and analgesic for pleuritic chest pain and fever control."),
("Syp. Bromhexine 8 mg/5mL", "10 mL TID after food", "Mucolytic – reduces sputum viscosity; eases expectoration."),
],
"advice": "Adequate hydration (>2L/day), steam inhalation, postural drainage. Return immediately if SpO2 <93%, worsening dyspnea, or no improvement in 48 hrs.",
"tag_color": TEAL,
},
# 4
{
"num": 4,
"title": "Iron Deficiency Anemia",
"color": RED,
"patient": "Ms. Priya Nair | 28 yr | Female | Nurse",
"cc": "Fatigue, exertional breathlessness, pallor, hair fall for 3 months",
"vitals": "BP: 108/70 mmHg | PR: 96/min | RR: 18/min | Temp: 37°C",
"history": "Heavy menstrual bleeding (cycle 3/35 days, soaks 6 pads/day). Vegetarian. No GI symptoms.",
"exam": "Pallor (conjunctival, palmar). Koilonychia. Angular stomatitis. No hepatosplenomegaly.",
"ix": "Hb: 7.8 g/dL | MCV: 64 fL | MCH: 19 pg | Serum ferritin: 6 ng/mL | TIBC: elevated | S. iron: low. PBS: microcytic hypochromic.",
"diagnosis": "Iron Deficiency Anemia (severe) secondary to menorrhagia",
"prescription": [
("Tab. Ferrous Sulfate 200 mg (elemental Fe 60 mg)", "1-0-1 on empty stomach", "Iron replacement – corrects iron deficit; taken between meals for maximum absorption (ascorbic acid enhances it)."),
("Tab. Vitamin C 500 mg", "1-0-1 (with iron tablet)", "Reduces Fe3+ to Fe2+ in gut; significantly increases non-heme iron absorption by 2-3×."),
("Tab. Folic Acid 5 mg", "1-0-0", "Folate supports RBC maturation; often co-deficient in nutritional anemia, especially in young women."),
("Tab. Tranexamic Acid 500 mg", "1-1-1 during menstruation (max 5 days)", "Antifibrinolytic – reduces menstrual blood loss; first-line non-hormonal treatment for menorrhagia."),
],
"advice": "Iron-rich foods (green leafy vegetables, legumes, jaggery). Avoid tea/coffee with meals (tannins inhibit iron absorption). Gynaecology referral for menorrhagia evaluation. Repeat CBC in 4 weeks.",
"tag_color": RED,
},
# 5
{
"num": 5,
"title": "Acute Gastroenteritis",
"color": ORANGE,
"patient": "Master Ravi Singh | 8 yr | Male | Student",
"cc": "Loose watery stools (8 episodes/day), vomiting (3×), mild crampy abdominal pain for 1 day",
"vitals": "Temp: 38.2°C | PR: 110/min | BP: 100/66 mmHg | Weight: 24 kg",
"history": "Ate outside food 12 hours ago. No blood in stools. No similar family members affected. Immunizations up to date.",
"exam": "Mild dehydration: dry lips, slightly sunken eyes, skin turgor mildly decreased. Abdomen: soft, mild tenderness. No guarding.",
"ix": "Stool R/M: no RBCs, few WBCs. No ova/cysts. Stool culture pending.",
"diagnosis": "Acute Gastroenteritis with Mild Dehydration",
"prescription": [
("ORS (WHO formula)", "200 mL after each loose stool", "Oral rehydration – cornerstone of AGE management; replaces fluid and electrolytes lost; prevents severe dehydration."),
("Zinc Sulfate 20 mg dispersible tab", "1 tab OD × 14 days", "WHO recommendation – reduces stool frequency and duration; replenishes depleted zinc; decreases future diarrheal episodes."),
("Syp. Ondansetron 4 mg/5 mL", "4 mg (5 mL) TID SOS for vomiting", "5-HT3 antagonist antiemetic – controls vomiting, allowing oral rehydration to succeed; avoids IV fluids."),
("Probiotic (Saccharomyces boulardii 250 mg)", "1 cap BD × 5 days", "Restores gut flora; evidence supports reduction in duration of acute diarrhea in children."),
],
"advice": "Continue breastfeeding/normal feeding. BRAT diet (banana, rice, apple, toast). Ensure hand hygiene. Return immediately if child becomes lethargic, unable to drink, or passes bloody stools.",
"tag_color": ORANGE,
},
# 6
{
"num": 6,
"title": "Bronchial Asthma (Mild Persistent)",
"color": HexColor("#0891b2"),
"patient": "Ms. Kavitha Reddy | 22 yr | Female | Student",
"cc": "Recurrent episodes of wheeze, breathlessness, nocturnal cough 3-4 times/month; triggered by dust and cold",
"vitals": "BP: 112/72 | PR: 82/min | RR: 18/min | SpO2: 98% | Temp: 37°C",
"history": "Known atopy; allergic rhinitis. Sister has asthma. No current attack.",
"exam": "Bilateral polyphonic expiratory wheeze. No accessory muscle use. PEFR: 68% predicted.",
"ix": "Spirometry: FEV1/FVC = 0.68 (obstructive pattern); reversibility +18% post-bronchodilator. IgE elevated. Eosinophils: 7%.",
"diagnosis": "Bronchial Asthma – Mild Persistent (GINA Step 2)",
"prescription": [
("Inhaler: Budesonide 200 mcg MDI (ICS)", "2 puffs BD (with spacer)", "Inhaled corticosteroid – reduces airway inflammation; cornerstone of persistent asthma control; prevents exacerbations."),
("Inhaler: Salbutamol 100 mcg MDI (SABA)", "2 puffs SOS (max 4× daily)", "Short-acting bronchodilator – rapid relief of acute bronchospasm; used as rescue inhaler only (not scheduled)."),
("Tab. Montelukast 10 mg", "0-0-1 at bedtime", "Leukotriene receptor antagonist – anti-inflammatory; effective for allergic asthma and associated rhinitis; additive to ICS."),
("Tab. Cetirizine 10 mg", "0-0-1", "Second-generation antihistamine – manages co-existing allergic rhinitis which can trigger/worsen asthma."),
],
"advice": "Correct inhaler technique demonstration. Use spacer with MDI. Avoid dust, smoke, cold air. Asthma action plan provided. PEFR diary. Follow-up in 4-6 weeks.",
"tag_color": HexColor("#0891b2"),
},
# 7
{
"num": 7,
"title": "Acute Urinary Tract Infection (UTI)",
"color": HexColor("#b45309"),
"patient": "Mrs. Lalitha Menon | 35 yr | Female | Accountant",
"cc": "Burning micturition, increased frequency, lower abdominal discomfort for 3 days. No fever.",
"vitals": "BP: 118/76 | PR: 74/min | Temp: 37.1°C | No costovertebral angle tenderness",
"history": "3rd episode in the past year. No catheter use. Not pregnant. No known drug allergy.",
"exam": "Mild suprapubic tenderness on deep palpation. No renal angle tenderness. No vaginal discharge.",
"ix": "Urine R/M: pus cells 20-25/HPF, RBC 3-4/HPF, bacteria (gram-negative rods). Urine culture pending.",
"diagnosis": "Uncomplicated Acute Cystitis (Lower UTI)",
"prescription": [
("Tab. Nitrofurantoin 100 mg (modified release)", "1-0-1 after food × 5 days", "First-line for uncomplicated lower UTI; concentrated in urine; low resistance rates; not used for upper UTI."),
("Tab. Phenazopyridine 200 mg", "1-1-1 × 2 days (symptomatic)", "Urinary analgesic – quickly relieves burning micturition and frequency; warn patient urine turns orange."),
("Tab. Ibuprofen 400 mg", "1-1-1 SOS after food × 3 days", "NSAID for suprapubic discomfort and anti-inflammatory effect in lower urinary tract."),
],
"advice": "Increase water intake to >2L/day. Void after intercourse. Front-to-back wiping. Cranberry juice may help. Urine culture and sensitivity report review in 48 hrs. If fever or loin pain develops – attend ER.",
"tag_color": HexColor("#b45309"),
},
# 8
{
"num": 8,
"title": "Hypothyroidism",
"color": HexColor("#4f46e5"),
"patient": "Mrs. Deepa Iyer | 42 yr | Female | Teacher",
"cc": "Weight gain (6 kg in 4 months), cold intolerance, constipation, dry skin, fatigue, hair thinning",
"vitals": "BP: 134/88 | PR: 58/min (bradycardia) | Weight: 78 kg | Temp: 36.5°C",
"history": "Previously treated for postpartum thyroiditis 5 years ago. Family history: mother on levothyroxine.",
"exam": "Dry, rough skin. Periorbital puffiness. Slow relaxing ankle reflexes. Non-pitting edema hands/face. Thyroid: mildly enlarged, firm.",
"ix": "TSH: 18.4 mIU/L (high) | Free T4: 0.6 ng/dL (low) | Anti-TPO: 420 IU/mL (elevated). CBC: mild normocytic anemia. Lipids: LDL elevated.",
"diagnosis": "Primary Hypothyroidism (Hashimoto's Thyroiditis)",
"prescription": [
("Tab. Levothyroxine (L-T4) 50 mcg", "1 tab empty stomach, 30 min before breakfast", "Synthetic T4 – hormone replacement; converts to active T3 peripherally; taken fasting for optimal absorption (not with calcium, iron, or antacids)."),
("Tab. Atorvastatin 10 mg", "0-0-1", "Hypothyroidism causes secondary dyslipidemia (elevated LDL/TG); statin needed while thyroid normalizes; recheck lipids after euthyroid state achieved."),
],
"advice": "Recheck TSH + Free T4 after 6 weeks to titrate dose (target TSH 0.5-2.5 mIU/L). Do not take L-T4 with coffee, calcium, or iron supplements. No abrupt dose changes. Lifelong therapy.",
"tag_color": HexColor("#4f46e5"),
},
# 9
{
"num": 9,
"title": "Peptic Ulcer Disease (Duodenal Ulcer)",
"color": HexColor("#be123c"),
"patient": "Mr. Suresh Pillai | 44 yr | Male | Driver",
"cc": "Epigastric pain relieved by food, nocturnal pain waking from sleep, heartburn for 6 weeks",
"vitals": "BP: 120/80 | PR: 78/min | Weight: 68 kg | Temp: 37°C",
"history": "Chronic NSAID use for back pain. H. pylori positive (Rapid Urease Test). Smoker. No hematemesis/melena.",
"exam": "Mild epigastric tenderness. No guarding/rigidity. No hepatosplenomegaly.",
"ix": "UGI Endoscopy: 0.8 cm duodenal ulcer. H. pylori RUT: positive. H. pylori serology: positive.",
"diagnosis": "H. pylori-positive Duodenal Ulcer",
"prescription": [
("Tab. Omeprazole 20 mg", "1-0-1 (before meals) × 4 weeks, then OD × 4 weeks", "PPI – suppresses gastric acid by irreversibly inhibiting H+/K+ ATPase; heals ulcer; component of H. pylori triple therapy."),
("Tab. Clarithromycin 500 mg", "1-0-1 × 14 days", "Macrolide antibiotic – part of H. pylori triple therapy; inhibits bacterial protein synthesis."),
("Tab. Amoxicillin 1g", "1-0-1 × 14 days", "Penicillin antibiotic – synergistic with clarithromycin in H. pylori eradication; attacks cell wall."),
("Tab. Sucralfate 1g", "1-1-1-1 (1 hr before meals + bedtime) × 4 weeks", "Cytoprotective – forms gel over ulcer base; protects from acid/pepsin; promotes ulcer healing."),
],
"advice": "Stop NSAIDs (switch to paracetamol). Stop smoking (delays ulcer healing). Avoid spicy foods, alcohol, caffeine. H. pylori eradication confirmed by urea breath test 4 weeks after completing antibiotics.",
"tag_color": HexColor("#be123c"),
},
# 10
{
"num": 10,
"title": "Acute Migraine",
"color": HexColor("#7e22ce"),
"patient": "Ms. Ananya Krishnan | 26 yr | Female | Software Engineer",
"cc": "Severe throbbing unilateral headache (right side), nausea, vomiting, photophobia lasting 12-16 hours, 3-4 episodes/month",
"vitals": "BP: 116/74 | PR: 78/min | Temp: 37°C | Neurological exam: normal",
"history": "Headaches since age 18. Associated with menstrual cycle. Triggers: sleep deprivation, bright screens, stress. No aura.",
"exam": "Photosensitive. No papilledema. No focal neurological deficits. Normal fundus.",
"ix": "MRI brain: normal. No red flags.",
"diagnosis": "Migraine without Aura (>4 attacks/month – needs prophylaxis)",
"prescription": [
("Tab. Sumatriptan 50 mg", "1 tab at headache onset; repeat after 2 hrs if needed (max 2 tabs/attack)", "5-HT1B/1D agonist (triptan) – causes vasoconstriction of dilated meningeal vessels; blocks CGRP release; specific migraine abortive treatment."),
("Tab. Naproxen 500 mg", "1-0-1 SOS during attack × 3 days", "NSAID – effective for acute migraine; can be used alone or with triptan for better response."),
("Tab. Metoclopramide 10 mg", "1 tab SOS during attack (before sumatriptan)", "Antiemetic + prokinetic – relieves nausea/vomiting; also enhances absorption of oral analgesics by improving gastric motility."),
("Tab. Propranolol 40 mg", "1-0-1 (prophylaxis – daily)", "Beta-blocker – first-line migraine prophylaxis; reduces frequency and severity; especially useful if no contraindication (asthma, diabetes)."),
],
"advice": "Maintain migraine diary (triggers, frequency). Regular sleep schedule. Limit screen time. Avoid trigger foods (chocolate, cheese, wine). Reassess prophylaxis response at 8-12 weeks.",
"tag_color": HexColor("#7e22ce"),
},
# 11
{
"num": 11,
"title": "Rheumatoid Arthritis (Early)",
"color": HexColor("#0f766e"),
"patient": "Mrs. Rekha Joshi | 38 yr | Female | Bank Employee",
"cc": "Bilateral symmetric swelling and pain in small joints of hands and feet, morning stiffness >1 hour for 3 months",
"vitals": "BP: 120/78 | PR: 80/min | Temp: 37.2°C | Weight: 61 kg",
"history": "No skin rash, no dry eyes/mouth, no photosensitivity. Family history: aunt with RA.",
"exam": "Swelling, warmth, tenderness of bilateral MCP joints 2nd-4th, PIP joints, both wrists. No deformity yet.",
"ix": "RF: 64 IU/mL (positive) | Anti-CCP: 180 U/mL (strongly positive) | ESR: 68 | CRP: 32 | CBC: mild normocytic anemia. X-ray hands: periarticular osteopenia, no erosions yet.",
"diagnosis": "Rheumatoid Arthritis (Early, Seropositive – DAS28: 5.2 – Moderate Activity)",
"prescription": [
("Tab. Methotrexate (MTX) 7.5 mg", "Once weekly (Sunday) – escalate to 15-20 mg/week at 4 weeks", "DMARD – anchor drug for RA; inhibits dihydrofolate reductase; reduces joint inflammation and prevents erosions; disease-modifying effect."),
("Tab. Folic Acid 5 mg", "Daily (except MTX day)", "Given with MTX to reduce side effects (mucositis, hepatotoxicity, GI upset) by replenishing folate without reducing efficacy."),
("Tab. Hydroxychloroquine 200 mg", "1-0-1 (with meals)", "DMARD – anti-inflammatory; synergistic with MTX; used in combination DMARD therapy for moderate RA."),
("Tab. Prednisolone 10 mg", "1-0-0 × 4 weeks then taper", "Short-term bridge therapy while DMARDs take effect (onset 4-12 weeks); powerful anti-inflammatory."),
("Tab. Pantoprazole 40 mg", "1-0-0 before breakfast", "PPI gastroprotection during steroid therapy; prevents steroid-induced peptic ulcer."),
],
"advice": "Monthly LFT + CBC during MTX therapy. Annual eye exam for hydroxychloroquine. Physiotherapy referral. Avoid live vaccines during immunosuppression. Rheumatology follow-up in 4 weeks.",
"tag_color": HexColor("#0f766e"),
},
# 12
{
"num": 12,
"title": "Depressive Disorder (Moderate)",
"color": HexColor("#1d4ed8"),
"patient": "Mr. Vikram Nair | 31 yr | Male | IT Professional",
"cc": "Low mood, anhedonia, sleep disturbance (early morning awakening), poor concentration, loss of appetite for 6 weeks. PHQ-9 score: 14",
"vitals": "BP: 114/76 | PR: 72/min | Temp: 37°C. No suicidal ideation at present.",
"history": "No previous psychiatric history. Recent job loss. No substance use. No thyroid disease. No family psychiatric history.",
"exam": "Unkempt appearance, poor eye contact, psychomotor retardation. No psychotic features. Cognitively intact.",
"ix": "TFTs: normal. CBC: normal. Blood glucose: normal. PHQ-9: 14 (moderate depression).",
"diagnosis": "Moderate Depressive Episode (ICD-11: 6A70.1)",
"prescription": [
("Tab. Sertraline 50 mg", "1-0-0 (morning) × 4 weeks, then review for dose increase", "SSRI – first-line antidepressant; inhibits serotonin reuptake; broad efficacy, good tolerability, low overdose risk; takes 2-4 weeks for effect."),
("Tab. Clonazepam 0.25 mg", "0-0-0.5 at bedtime × 2 weeks only", "Benzodiazepine – short-term use for insomnia and anxiety while waiting for SSRI to take effect; must avoid prolonged use due to dependence."),
("Tab. Melatonin 3 mg", "1 tab 30 min before bedtime", "Circadian regulator – helps restore sleep architecture; safe long-term; non-addictive alternative to maintain sleep."),
],
"advice": "Psychiatric referral for CBT (Cognitive Behavioural Therapy). Antidepressants take 4-6 weeks for full effect. Do NOT stop abruptly. Safety plan discussed. Emergency contact provided. Follow-up in 2 weeks.",
"tag_color": HexColor("#1d4ed8"),
},
# 13
{
"num": 13,
"title": "Acute Gout Attack",
"color": HexColor("#dc2626"),
"patient": "Mr. Rajesh Mehta | 55 yr | Male | Business Owner",
"cc": "Sudden onset severe pain, swelling, redness and warmth in right big toe since last night; unable to walk",
"vitals": "BP: 148/92 | PR: 90/min | Temp: 38.0°C | Weight: 92 kg",
"history": "History of similar attacks (3rd episode). Drinks alcohol regularly. On hydrochlorothiazide for hypertension.",
"exam": "Right 1st MTP joint: hot, red, exquisitely tender, swollen. Tophi absent. No kidney stones.",
"ix": "Serum uric acid: 9.8 mg/dL | WBC: 13,200 | CRP: 42 | Renal function: normal. Joint aspirate: monosodium urate crystals (needle-shaped, negatively birefringent).",
"diagnosis": "Acute Gouty Arthritis – Right 1st MTP Joint",
"prescription": [
("Tab. Indomethacin 50 mg", "1-1-1 with food × 5 days (then reduce)", "NSAID – first-line acute gout treatment; potent anti-inflammatory; very effective for acute attack; take with food to reduce GI side effects."),
("Tab. Pantoprazole 40 mg", "1-0-0", "PPI – gastroprotection during NSAID use; prevents peptic ulcer."),
("Tab. Colchicine 0.5 mg", "1 tab every 8 hrs on day 1, then BD × 7 days", "Inhibits microtubule polymerization; blocks neutrophil migration to joint; most effective when started early in attack."),
("Tab. Allopurinol 100 mg", "1-0-0 (start AFTER acute attack resolves – at 2-4 weeks)", "Xanthine oxidase inhibitor – urate-lowering therapy; DO NOT start during acute attack (can worsen/prolong it); long-term prophylaxis."),
],
"advice": "Rest and ice the affected joint. Avoid alcohol, red meat, seafood, fructose-rich drinks. Change diuretic from thiazide to alternative antihypertensive (thiazides raise uric acid). Target serum uric acid <6 mg/dL.",
"tag_color": HexColor("#dc2626"),
},
# 14
{
"num": 14,
"title": "COPD – Stable (Moderate)",
"color": HexColor("#78350f"),
"patient": "Mr. Balram Das | 62 yr | Male | Farmer",
"cc": "Progressive breathlessness on exertion, chronic productive cough (white sputum), 2-3 acute exacerbations/year",
"vitals": "BP: 138/86 | PR: 88/min | RR: 20/min | SpO2: 93% | Temp: 37°C",
"history": "Smoker (40 pack-years). Currently smokes. No TB. No occupational dust exposure.",
"exam": "Barrel chest, pursed-lip breathing. Hyper-resonant chest. Bilateral coarse crepitations. No clubbing.",
"ix": "Spirometry: FEV1 58% predicted, FEV1/FVC 0.62 (post-bronchodilator – obstructive, not fully reversible). CXR: hyperinflation, flattened diaphragm. ABG: pH 7.38, pCO2 46, pO2 72.",
"diagnosis": "COPD GOLD Group B (mMRC Grade 2, FEV1 50-80% – Moderate)",
"prescription": [
("Inhaler: Tiotropium 18 mcg Handihaler", "1 inhalation OD (morning)", "Long-acting muscarinic antagonist (LAMA) – bronchodilation via M3 blockade; reduces hyperinflation and exacerbation frequency; first-line COPD maintenance."),
("Inhaler: Formoterol 12 mcg MDI", "2 puffs BD", "Long-acting beta-2 agonist (LABA) – sustained bronchodilation; additive to LAMA; improves exercise tolerance."),
("Inhaler: Budesonide 200 mcg MDI (ICS)", "2 puffs BD", "Added as ICS/LABA combo in patients with frequent exacerbations; reduces airway inflammation."),
("Tab. Azithromycin 250 mg", "3 times weekly (prophylactic)", "Prophylactic macrolide in COPD with frequent exacerbations; anti-inflammatory and antibiotic effects; reduces exacerbation rate."),
("Tab. N-Acetylcysteine 600 mg", "1-0-1", "Mucolytic + antioxidant; reduces sputum viscosity and oxidative stress; evidence for reducing exacerbations."),
],
"advice": "STOP SMOKING (most effective intervention – offer counselling + nicotine replacement). Pulmonary rehabilitation. Annual influenza and pneumococcal vaccination. Maintain SpO2 >92%. Oxygen therapy if SpO2 persistently <88%.",
"tag_color": HexColor("#78350f"),
},
# 15
{
"num": 15,
"title": "Urticaria (Acute Allergic)",
"color": HexColor("#b45309"),
"patient": "Ms. Fatima Begum | 24 yr | Female | Student",
"cc": "Sudden onset widespread itchy wheals all over body, 2 hours after eating shrimp. No facial swelling or breathlessness.",
"vitals": "BP: 118/76 | PR: 96/min | SpO2: 99% | Temp: 37.1°C | No stridor",
"history": "No previous allergy history. No other medications. No angioedema family history.",
"exam": "Multiple erythematous, raised, itchy wheals on trunk, arms, back. No angioedema. No wheeze. No rash on face.",
"ix": "No investigations needed for acute urticaria. Advised serum IgE and skin prick test as outpatient later.",
"diagnosis": "Acute Allergic Urticaria (food-triggered)",
"prescription": [
("Tab. Cetirizine 10 mg", "1-0-1 × 7 days (then OD if needed)", "Second-generation H1 antihistamine – first-line for urticaria; non-sedating; blocks histamine at H1 receptors; reduces itching and wheal formation."),
("Tab. Ranitidine 150 mg", "1-0-1 × 5 days", "H2 antihistamine – combined H1+H2 blockade more effective for urticaria than H1 alone; reduces refractory cases."),
("Tab. Prednisolone 20 mg", "1-0-0 × 3 days (tapering course)", "Oral corticosteroid – for moderate-severe acute urticaria; reduces mast cell mediator release; not for long-term use."),
("Inj. Chlorpheniramine 10 mg IM (if needed in clinic)", "Stat if severe itching at presentation", "Parenteral first-generation antihistamine – rapid onset; used for acute severe presentation."),
],
"advice": "Strictly avoid shrimp and all shellfish. Carry antihistamine at all times. If throat swelling or breathing difficulty occurs - call emergency and use self-injectable epinephrine (Epipen) if available. Allergy specialist referral.",
"tag_color": HexColor("#b45309"),
},
# 16
{
"num": 16,
"title": "Pulmonary Tuberculosis (New Case)",
"color": HexColor("#15803d"),
"patient": "Mr. Dinesh Chauhan | 29 yr | Male | Construction Worker",
"cc": "Cough >3 weeks (productive), evening fever, night sweats, weight loss 5 kg/3 months, occasional blood-tinged sputum",
"vitals": "BP: 110/72 | PR: 96/min | RR: 20/min | Temp: 38.3°C (evening) | Weight: 52 kg",
"history": "Close contact with TB patient (roommate). No prior TB treatment. Non-smoker. HIV status unknown.",
"exam": "Wasted appearance. Left upper zone: dull percussion, bronchial breath sounds, crepitations.",
"ix": "Sputum AFB (2 samples): 2+ | Sputum CBNAAT (GeneXpert): MTB detected, RIF susceptible | CXR: Left upper lobe cavity + infiltrates | HIV ELISA: Negative | LFT: Normal.",
"diagnosis": "Pulmonary Tuberculosis – New Smear Positive (Drug Sensitive)",
"prescription": [
("HRZE Fixed-Dose Combination (FDC)", "2 tabs OD (Intensive Phase × 2 months): Isoniazid 75mg + Rifampicin 150mg + Pyrazinamide 400mg + Ethambutol 275mg per tab", "Standard RNTCP/NTEP first-line 4-drug intensive phase; kills actively dividing bacilli (H,R), eliminates semi-dormant bacilli (Z), prevents resistance."),
("HR FDC (Continuation Phase)", "2 tabs OD × 4 months: Isoniazid 75mg + Rifampicin 150mg per tab", "Continuation phase eliminates residual persisting organisms; prevents relapse."),
("Tab. Pyridoxine (B6) 10 mg", "1-0-0 daily throughout therapy", "Isoniazid depletes pyridoxine → peripheral neuropathy; B6 supplementation prevents INH-induced neuropathy."),
],
"advice": "Register under NTEP/RNTCP. DOT (Directly Observed Treatment) mandatory. Notify contacts for screening. Rifampicin turns body fluids orange-red (normal). LFT monthly. Return immediately if jaundice occurs. Nutritional support.",
"tag_color": HexColor("#15803d"),
},
# 17
{
"num": 17,
"title": "Dengue Fever (Non-severe)",
"color": HexColor("#b91c1c"),
"patient": "Mr. Arun Pillai | 20 yr | Male | College Student",
"cc": "High fever (104°F), severe headache, retro-orbital pain, bone/muscle ache, rash for 4 days. Lethargic.",
"vitals": "BP: 108/68 | PR: 96/min | Temp: 39.5°C | SpO2: 98% | No bleeding",
"history": "During dengue season. Mosquito exposure. No travel outside city. Dengue in locality.",
"exam": "Flushed face. Petechial rash (scattered). Hepatomegaly (mild). No signs of plasma leakage. Tourniquet test: borderline.",
"ix": "NS1 antigen: Positive | CBC: WBC 3,200 (leucopenia), Platelets: 95,000 (falling) | Hematocrit: 42% | Dengue IgM/IgG: Pending.",
"diagnosis": "Dengue Fever (Group B – monitored outpatient)",
"prescription": [
("Tab. Paracetamol 500-1000 mg", "1-1-1-1 (max 4g/day) SOS for fever/pain", "ONLY safe antipyretic in dengue. NSAIDs (ibuprofen, aspirin, diclofenac) are ABSOLUTELY CONTRAINDICATED – increase bleeding risk and risk of Reye syndrome."),
("ORS / oral fluids", "2-3 L/day – coconut water, ORS, juice, soups", "Oral rehydration to prevent plasma volume depletion; crucial in febrile phase."),
("Tab. Vitamin C 500 mg", "1-0-1", "Antioxidant; some evidence for platelet support and reduction of oxidative stress in dengue; safe adjunct."),
],
"advice": "STRICT WARNING: Do NOT give aspirin, ibuprofen, or diclofenac. Daily CBC monitoring (platelets + hematocrit). Return IMMEDIATELY if: warning signs (persistent vomiting, abdominal pain, bleeding, cold clammy skin, no urine >6 hrs). Hospitalize if platelets <50,000.",
"tag_color": HexColor("#b91c1c"),
},
# 18
{
"num": 18,
"title": "Chronic Kidney Disease – Stage 3",
"color": HexColor("#1e40af"),
"patient": "Mr. Subramaniam | 61 yr | Male | Retired",
"cc": "Fatigue, ankle edema, decreased urine output, loss of appetite. Known DM + HTN for 10 years.",
"vitals": "BP: 154/96 | PR: 84/min | Weight: 74 kg | No fever",
"history": "DM on Metformin, HTN on Amlodipine. Poor medication compliance. Recent NSAID use for knee pain.",
"exam": "Bilateral pitting pedal edema (2+). Pallor. No asterixis. No pericardial rub.",
"ix": "S. Creatinine: 2.8 mg/dL | eGFR: 26 mL/min/1.73m² (CKD Stage 3b) | Urine protein:creatinine ratio: 0.65 | CBC: Hb 9.2 g/dL | S. K: 5.4 mEq/L | S. Bicarbonate: 18 mEq/L | S. Phosphate: 5.6 mg/dL.",
"diagnosis": "Chronic Kidney Disease Stage 3b – Diabetic Nephropathy",
"prescription": [
("Tab. Telmisartan 40 mg", "0-0-1", "ARB – lowers intraglomerular pressure; reduces proteinuria; slows CKD progression in diabetic nephropathy; monitor K+ levels."),
("Tab. Furosemide 40 mg", "1-0-0", "Loop diuretic – manages fluid overload/edema; preferred over thiazides at eGFR <30; monitor electrolytes."),
("Tab. Sodium Bicarbonate 500 mg", "1-0-1", "Corrects metabolic acidosis (HCO3 <22); bicarbonate supplementation slows CKD progression."),
("Inj. Erythropoietin 4000 IU SC", "Once weekly", "ESA – corrects CKD-associated anemia (EPO deficiency); target Hb 10-12 g/dL; monitor BP."),
("Tab. Calcium Carbonate 500 mg (with meals)", "1-1-1", "Phosphate binder – binds dietary phosphate in gut; prevents hyperphosphatemia-induced renal osteodystrophy."),
],
"advice": "STOP NSAIDs permanently (nephrotoxic). STOP Metformin (contraindicated eGFR <30 – risk of lactic acidosis). Switch diabetes management to Insulin. Protein restriction 0.8g/kg/day. Nephrology referral for dialysis planning. Avoid nephrotoxic drugs.",
"tag_color": HexColor("#1e40af"),
},
# 19
{
"num": 19,
"title": "Anxiety Disorder (Generalized Anxiety)",
"color": HexColor("#6d28d9"),
"patient": "Ms. Shalini Gupta | 33 yr | Female | Marketing Manager",
"cc": "Excessive worry about multiple daily issues, restlessness, muscle tension, poor sleep, palpitations, difficulty concentrating for 6+ months. GAD-7: 16.",
"vitals": "BP: 124/82 | PR: 96/min (sinus tachycardia) | Thyroid exam: normal",
"history": "No panic attacks. No phobias. Stressful work environment. Coffee intake: 5 cups/day. No substance use. No cardiac disease.",
"exam": "Mildly anxious. No tremor. No exophthalmos. Normal cardiovascular exam.",
"ix": "TFTs: Normal | ECG: Sinus tachycardia | CBC, glucose: Normal | GAD-7: 16 (severe).",
"diagnosis": "Generalized Anxiety Disorder (GAD-7 Severe)",
"prescription": [
("Tab. Escitalopram 10 mg", "1-0-0 (morning) × 6-12 months", "SSRI – first-line pharmacotherapy for GAD; anxiolytic and antidepressant; takes 4-6 weeks for full anxiolytic effect; reduces worry and physical anxiety symptoms."),
("Tab. Buspirone 5 mg", "1-0-1 (titrate to 10 mg BD over 2 weeks)", "Partial 5-HT1A agonist – non-benzodiazepine anxiolytic; no dependence/sedation risk; additive with SSRI; well-suited for chronic GAD."),
("Tab. Propranolol 10 mg", "1-0-1 SOS for palpitations/somatic anxiety", "Beta-blocker – manages somatic anxiety symptoms (tachycardia, tremor) without CNS sedation."),
],
"advice": "Psychiatry/psychology referral for CBT (most effective long-term treatment for GAD). Cut caffeine to <1 cup/day. Regular aerobic exercise. Diaphragmatic breathing and progressive muscle relaxation. Follow-up in 3 weeks.",
"tag_color": HexColor("#6d28d9"),
},
# 20
{
"num": 20,
"title": "Acute Sinusitis (Bacterial)",
"color": HexColor("#0369a1"),
"patient": "Mr. Karthik Subramanian | 30 yr | Male | Sales Executive",
"cc": "Facial pain/pressure (maxillary), nasal congestion, thick yellow-green nasal discharge, post-nasal drip, headache worsening on bending for 10 days",
"vitals": "BP: 118/78 | PR: 80/min | Temp: 38.1°C",
"history": "Upper respiratory tract infection 2 weeks ago. No asthma. No nasal polyps. First episode.",
"exam": "Tenderness over bilateral maxillary sinuses. Nasal mucosa congested. Posterior pharynx: purulent drip. No orbital swelling.",
"ix": "Clinical diagnosis. X-ray sinuses: bilateral maxillary opacification. No CT needed for uncomplicated case.",
"diagnosis": "Acute Bacterial Rhinosinusitis (persisting >10 days with double-sickening pattern)",
"prescription": [
("Tab. Amoxicillin-Clavulanate 625 mg", "1-1-1 after food × 10-14 days", "First-line antibiotic for bacterial sinusitis; covers S. pneumoniae, H. influenzae, Moraxella catarrhalis; beta-lactamase resistant."),
("Nasal Spray: Mometasone Furoate 50 mcg", "2 sprays each nostril OD × 3 months", "Intranasal corticosteroid – reduces mucosal edema and inflammation; improves sinus drainage; evidence-based adjunct for sinusitis."),
("Tab. Levocetirizine 5 mg", "0-0-1 at bedtime", "Antihistamine – reduces allergic mucosal component if present; relieves post-nasal drip."),
("Steam inhalation with Menthol crystals", "3 × daily for 10 mins", "Warm steam loosens secretions and improves mucociliary clearance; relieves nasal congestion."),
],
"advice": "Nasal saline irrigation (Jala Neti or NeilMed rinse) BD. Stay well hydrated. Elevate head of bed. If no improvement in 72 hrs or orbital/neurological symptoms develop – urgent ENT referral + CT sinuses.",
"tag_color": HexColor("#0369a1"),
},
# 21
{
"num": 21,
"title": "Osteoarthritis – Knee",
"color": HexColor("#854d0e"),
"patient": "Mrs. Meena Pillai | 64 yr | Female | Housewife",
"cc": "Bilateral knee pain worse on walking and climbing stairs, joint stiffness <30 min on waking, crepitus, swelling for 2 years",
"vitals": "BP: 146/88 | PR: 76/min | Weight: 80 kg | BMI: 32",
"history": "No morning stiffness >30 min (rules out inflammatory arthritis). No fever. HTN on Amlodipine.",
"exam": "Bilateral knee: bony enlargement, crepitus on movement, reduced flexion (110° bilaterally). No warmth or significant swelling.",
"ix": "X-ray knees (standing): joint space narrowing, osteophytes, subchondral sclerosis (KL Grade II). RF: Negative. Anti-CCP: Negative. CRP: 8 (mildly elevated).",
"diagnosis": "Bilateral Knee Osteoarthritis (KL Grade II)",
"prescription": [
("Tab. Paracetamol 500 mg", "1-1-1 (scheduled, not just SOS)", "First-line analgesic for OA – safest with regular use; avoids GI, renal, CV risks of NSAIDs especially in elderly HTN patient."),
("Tab. Celecoxib 200 mg", "1-0-0 after food SOS (not daily)", "COX-2 selective NSAID – better GI safety than non-selective NSAIDs; used when paracetamol insufficient; monitor BP and renal function."),
("Cap. Glucosamine 1500 mg + Chondroitin 1200 mg", "1-0-0", "Nutraceutical – modest evidence for symptom relief in knee OA; may have mild chondroprotective effect; well tolerated."),
("Topical Diclofenac 1% gel", "Apply to knees BD", "Topical NSAID – local anti-inflammatory effect with minimal systemic absorption; evidence-based for knee OA (NICE guidelines recommend)."),
],
"advice": "Weight loss (target BMI <27) – every 1 kg lost reduces knee load by 4 kg. Physiotherapy (quadriceps strengthening). Avoid prolonged standing/squatting/stair climbing when possible. Knee support brace. Orthopedic referral if progressing to Grade III-IV.",
"tag_color": HexColor("#854d0e"),
},
# 22
{
"num": 22,
"title": "Atrial Fibrillation (Paroxysmal – New Onset)",
"color": HexColor("#dc2626"),
"patient": "Mr. Sudhir Lal | 67 yr | Male | Retired Officer",
"cc": "Palpitations, mild breathlessness, light-headedness since this morning. No chest pain. No syncope.",
"vitals": "BP: 144/90 | PR: 132/min (irregular) | RR: 20/min | SpO2: 96% | ECG: AF confirmed",
"history": "Known HTN. Recently started thyroid medication. Alcohol use. No prior cardiac history.",
"exam": "Irregularly irregular pulse. Soft S1. No signs of heart failure. JVP not elevated.",
"ix": "ECG: Absent P waves, irregular RR intervals – confirmed AF | Echo: EF 58%, mild LA dilatation, no thrombus | TSH: 0.3 (borderline low) | CBC, electrolytes: normal. CHA2DS2-VASc: 3.",
"diagnosis": "New-onset Paroxysmal Atrial Fibrillation (CHA2DS2-VASc 3 – anticoagulation indicated)",
"prescription": [
("Tab. Bisoprolol 2.5 mg", "1-0-1 (titrate to target HR <80/min)", "Beta-blocker – rate control strategy; reduces ventricular rate in AF; first-line for rate control in non-pre-excitation AF."),
("Tab. Rivaroxaban 20 mg", "0-0-1 with evening meal", "NOAC – oral anticoagulation (CHA2DS2-VASc ≥2 in men); prevents cardioembolic stroke; preferred over warfarin (no routine INR monitoring needed)."),
("Tab. Amiodarone 200 mg", "1-1-1 × 1 week (loading), then 1-0-0 (maintenance)", "Class III antiarrhythmic – for rhythm control (cardioversion and maintenance); effective if patient not spontaneously converting."),
],
"advice": "Cardiology urgent referral. No alcohol (strong AF trigger). Treat subclinical thyroid. If on anticoagulation – avoid NSAIDs/aspirin (bleeding risk). Cardioversion may be considered if AF persists >48 hrs after adequate anticoagulation.",
"tag_color": HexColor("#dc2626"),
},
# 23
{
"num": 23,
"title": "Childhood Febrile Seizure",
"color": HexColor("#d97706"),
"patient": "Baby Arjun | 2.5 yr | Male | Child",
"cc": "Generalized tonic-clonic seizure for 2 minutes (self-terminated) during fever. First episode.",
"vitals": "Temp: 39.8°C | PR: 132/min | SpO2: 98% (post-ictal) | BP: 88/56 | RR: 28/min",
"history": "Fever for 1 day (possible URTI). No prior seizure. Developmental milestones normal. Family history: uncle had childhood febrile seizures.",
"exam": "Alert (post-ictal). No focal neurological signs. Mild pharyngeal congestion. No neck stiffness. No Kernig's sign.",
"ix": "CBC: WBC 12,800 (viral pattern). CRP: 12. Blood glucose: 88 mg/dL. Urine: no infection. LP not indicated (no meningism).",
"diagnosis": "Simple Febrile Seizure (duration <15 min, generalized, first episode)",
"prescription": [
("Syp. Paracetamol 15 mg/kg/dose", "Every 6 hours for fever (oral)", "First-line antipyretic – reduces fever to prevent recurrence of febrile seizure; paracetamol preferred over aspirin (Reye syndrome risk in children)."),
("Syp. Ibuprofen 10 mg/kg/dose", "Every 8 hours alternating with paracetamol", "NSAID antipyretic – alternating with paracetamol for sustained fever control; more effective fever reduction."),
("Rectal Diazepam 0.5 mg/kg", "Keep at home SOS – use if seizure recurs and lasts >3-5 min", "Benzodiazepine rescue – for seizure lasting >5 min or cluster seizures; rectal route convenient for home emergency use."),
],
"advice": "Parent education: febrile seizures are common (3-5% children) and generally not dangerous for simple type. Place child on side during seizure (recovery position). Do NOT put anything in mouth. Do NOT restrain. Call emergency if seizure >5 mins. Reassure about good prognosis. No long-term anticonvulsant needed for simple febrile seizure.",
"tag_color": HexColor("#d97706"),
},
# 24
{
"num": 24,
"title": "Chronic Liver Disease / Liver Cirrhosis",
"color": HexColor("#059669"),
"patient": "Mr. Pramod Verma | 50 yr | Male | Businessman",
"cc": "Abdominal distension (ascites), ankle edema, jaundice, fatigue for 2 months",
"vitals": "BP: 100/64 | PR: 96/min | Weight: 68 kg | Temp: 37°C",
"history": "Alcohol use disorder (750 mL whiskey/day for 15 years). Stopped 1 month ago. No IV drug use. No blood transfusion.",
"exam": "Jaundice. Leukonychia. Palmar erythema. Spider angioma (×5 on trunk). Splenomegaly. Shifting dullness (ascites). No asterixis currently.",
"ix": "LFT: Total bilirubin 4.2 mg/dL | AST/ALT: 120/58 (AST:ALT>2 – alcoholic pattern) | Albumin 2.6 g/dL | INR: 1.8 | Platelets: 88,000 | USG: Cirrhotic liver, moderate ascites, splenomegaly | Child-Pugh score: B (8 pts).",
"diagnosis": "Liver Cirrhosis – Alcoholic – Child-Pugh B with Ascites",
"prescription": [
("Tab. Spironolactone 100 mg", "1-0-0 (morning)", "Aldosterone antagonist – first-line for cirrhotic ascites; blocks aldosterone-mediated Na/water retention; natriuretic; prevents diuretic-induced hypokalemia."),
("Tab. Furosemide 40 mg", "1-0-0 (morning)", "Loop diuretic – added to spironolactone for better ascites mobilization; maintain spironolactone:furosemide ratio 100:40 to balance potassium."),
("Tab. Propranolol 20 mg", "1-0-1", "Non-selective beta-blocker – reduces portal hypertension; primary prophylaxis of variceal bleeding; reduces risk of SBP and HE."),
("Tab. Rifaximin 400 mg", "1-1-1", "Non-absorbed gut antibiotic – reduces ammonia-producing gut bacteria; prevention of hepatic encephalopathy recurrence."),
("Tab. Zinc 50 mg", "1-0-0", "Cirrhosis causes zinc deficiency; zinc is a cofactor for urea cycle enzymes; supplementation reduces ammonia and HE risk."),
],
"advice": "ABSOLUTE ALCOHOL ABSTINENCE. Hepatology referral for endoscopy (esophageal varices screening). Restrict sodium (<2g/day) and fluid. Daily weight monitoring. Drain ascites if tense (therapeutic paracentesis). HCC surveillance (USG + AFP every 6 months). Hepatitis B/C serology.",
"tag_color": HexColor("#059669"),
},
# 25
{
"num": 25,
"title": "Acute Pyelonephritis",
"color": HexColor("#7c3aed"),
"patient": "Mrs. Sheela Thomas | 32 yr | Female | Nurse",
"cc": "High fever (103°F), rigors, right loin pain, nausea, vomiting, dysuria for 2 days",
"vitals": "BP: 102/66 | PR: 112/min | Temp: 39.6°C | RR: 22/min",
"history": "Recurrent UTIs. Currently 10 weeks pregnant (incidental finding). No known drug allergies.",
"exam": "Right costovertebral angle tenderness (marked). Suprapubic tenderness. No peritoneal signs.",
"ix": "Urine R/M: pus cells 50-60/HPF, bacteria (gram-negative). Urine culture: E. coli (pending sensitivity) | CBC: WBC 16,400 | CRP: 86 | S. Creatinine: 1.0 mg/dL | USG KUB: Right kidney echogenic with mild pyelectasis. No obstruction.",
"diagnosis": "Acute Pyelonephritis (in Pregnancy – Outpatient-eligible after initial IV therapy)",
"prescription": [
("Inj. Ceftriaxone 1g IV", "BD × 48 hrs (in-clinic/hospital)", "Third-generation cephalosporin – safe in pregnancy; covers gram-negative uropathogens (E. coli, Klebsiella); parenteral for initial severe pyelonephritis treatment."),
("Tab. Cefixime 200 mg", "1-0-1 × 14 days (step-down after IV)", "Oral 3rd-gen cephalosporin – safe in pregnancy; continues coverage after parenteral therapy; completes 14-day course for pyelonephritis."),
("Tab. Paracetamol 500 mg", "1-1-1-1 SOS for fever/pain", "Safe antipyretic analgesic in pregnancy; NSAIDs CONTRAINDICATED in pregnancy (fetal renal toxicity, premature closure of ductus arteriosus)."),
("IV Fluid: Normal Saline 1L", "Over 6 hrs (dehydration management)", "Maintains hydration; flushes urinary tract; corrects hemodynamic instability from fever and vomiting."),
],
"advice": "Obstetrics referral (pregnancy + UTI risk). Urine culture sensitivity review – adjust antibiotic if needed. Repeat urine culture 1 week after completing therapy. Monthly urine cultures for rest of pregnancy. Consider prophylactic nitrofurantoin after treatment (avoid in 3rd trimester).",
"tag_color": HexColor("#7c3aed"),
},
# 26
{
"num": 26,
"title": "Hypothyroidism in Pregnancy",
"color": HexColor("#0891b2"),
"patient": "Mrs. Divya Menon | 27 yr | Female | Teacher | 14 weeks pregnant",
"cc": "Fatigue, constipation, cold intolerance, mild puffiness – routine antenatal labs revealed abnormal thyroid",
"vitals": "BP: 110/72 | PR: 68/min | Weight: 61 kg | Temp: 36.8°C",
"history": "G2P1A0. Previously had subclinical hypothyroidism; was not on treatment. No goitre.",
"exam": "Mild periorbital puffiness. No goitre. Uterine size appropriate for dates. Fetal heart sounds present.",
"ix": "TSH: 6.8 mIU/L (>2.5 is abnormal in T1-T2 pregnancy) | Free T4: 0.8 ng/dL (low-normal) | Anti-TPO: 312 IU/mL | Anomaly scan pending.",
"diagnosis": "Overt Hypothyroidism in Pregnancy (Autoimmune – Hashimoto's)",
"prescription": [
("Tab. Levothyroxine 75 mcg", "1 tab empty stomach, 30 min before breakfast", "Thyroid hormone replacement – mandatory in pregnancy; untreated maternal hypothyroidism causes fetal neurodevelopmental impairment (IQ reduction, cretinism); target TSH <2.5 mIU/L in pregnancy."),
("Tab. Folic acid 5 mg", "1-0-0", "Mandatory supplementation in pregnancy; prevents neural tube defects; especially important in 1st trimester."),
("Iron + Folic acid antenatal tab", "1-0-0 (separate from LT4 by 4 hours)", "Iron can interfere with levothyroxine absorption – must be taken at least 4 hours apart; continued for anemia prevention."),
],
"advice": "TSH recheck every 4 weeks throughout pregnancy. Post-delivery: reduce LT4 dose by 30% and recheck at 6 weeks postpartum. Obstetrics co-management. Take L-T4 NEVER with iron/calcium. Important: fetal thyroid development depends on adequate maternal T4 supply in first trimester.",
"tag_color": HexColor("#0891b2"),
},
# 27 – bonus
{
"num": 27,
"title": "Scabies",
"color": HexColor("#16a34a"),
"patient": "Master Raju & Family | 6 yr + 4 family members",
"cc": "Intensely itchy rash especially at night, spreading to family members over 3 weeks. Small bumps between fingers, wrist, axilla, groin.",
"vitals": "Temp: 37°C | PR: 88/min | No fever",
"history": "New housemaid joined 4 weeks ago. All family members affected. Several family members treated for 'allergy' elsewhere without relief.",
"exam": "Linear burrows in finger webs, wrists. Papular rash on trunk, inner thighs. Excoriations. Secondary impetiginization on some lesions.",
"ix": "Dermoscopy/skin scraping: Sarcoptes scabiei mites/eggs confirmed.",
"diagnosis": "Scabies (with secondary bacterial infection) – Index case and contacts",
"prescription": [
("Cream: Permethrin 5%", "Apply from neck to toes at night; wash off after 8-12 hrs; REPEAT after 1 week", "Neurotoxin to mites – first-line scabicide; kills Sarcoptes scabiei and eggs; must treat ALL household contacts simultaneously on same night."),
("Syp./Tab. Ivermectin 200 mcg/kg single dose", "Single dose (weight-based), repeat after 2 weeks if needed", "Oral scabicide – alternative to permethrin or used in crusted/Norwegian scabies; systemic action; treat all contacts."),
("Calamine lotion + 1% Hydrocortisone cream", "Apply after permethrin wash-off, TID for itch", "Antipruritic – relieves post-scabies itch which can persist 2-4 weeks after successful treatment (hypersensitivity reaction)."),
("Tab. Cetirizine 5 mg (child dose)", "0-0-1 for itch", "Antihistamine – reduces itch; helps with sleep disrupted by nocturnal pruritus."),
("Tab. Amoxicillin-Clavulanate 312.5 mg (child dose)", "1-1-1 × 5 days", "For secondary impetiginization – treats S. aureus/Streptococcal superinfection of excoriated lesions."),
],
"advice": "Treat ALL household contacts on the SAME night (even if asymptomatic). Wash all clothes, bedding, towels in hot water (>60°C) and sun-dry. Items that cannot be washed: seal in plastic bag for 1 week (mites die without host). Itch may persist 2-4 weeks after cure – does NOT mean treatment failure.",
"tag_color": HexColor("#16a34a"),
},
]
# ─── BUILD PDF ─────────────────────────────────────────────────────────────────
story = []
# ── COVER HEADER ──
cover_table = Table(
[[Paragraph("Medicine OPD Patient Cases", title_style)],
[Paragraph("25+ Clinical Cases with Prescriptions and Pharmacological Rationale", subtitle_style)],
[Paragraph("For Medical Education & Practice Purposes Only", ParagraphStyle("sub2", parent=subtitle_style, fontSize=9, textColor=HexColor("#bfdbfe")))]],
colWidths=[W]
)
cover_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("ROUNDEDCORNERS", [8]),
("TOPPADDING", (0,0), (-1,-1), 16),
("BOTTOMPADDING", (0,0), (-1,-1), 14),
("LEFTPADDING", (0,0), (-1,-1), 20),
("RIGHTPADDING", (0,0), (-1,-1), 20),
]))
story.append(cover_table)
story.append(Spacer(1, 0.35*cm))
# Disclaimer
disclaimer_data = [[Paragraph(
"<b>EDUCATIONAL DISCLAIMER:</b> These cases are hypothetical, constructed for undergraduate/postgraduate medical education. "
"Prescriptions represent commonly accepted clinical practice and are NOT a substitute for individualized clinical judgment. "
"Always verify drug doses, interactions, and contraindications before prescribing in real practice.",
ParagraphStyle("disc", parent=styles["Normal"], fontSize=8, textColor=RED, fontName="Helvetica",
alignment=TA_CENTER, leading=11)
)]]
disc_table = Table(disclaimer_data, colWidths=[W])
disc_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_RED),
("BOX", (0,0), (-1,-1), 1, RED),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 12),
("RIGHTPADDING", (0,0), (-1,-1), 12),
("ROUNDEDCORNERS", [6]),
]))
story.append(disc_table)
story.append(Spacer(1, 0.3*cm))
# ── CASES ──
for c in cases:
col = c["tag_color"]
light_col = LIGHT_BLUE # default background for content boxes
# ---- Case Header bar ----
header_data = [[
Paragraph(f"Case {c['num']:02d}", ParagraphStyle("cnum", parent=styles["Normal"],
fontSize=9, textColor=WHITE, fontName="Helvetica-Bold")),
Paragraph(c["title"], case_title_style),
]]
header_table = Table(header_data, colWidths=[1.5*cm, W-1.5*cm])
header_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), col),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
("ROUNDEDCORNERS", [6]),
]))
# ---- Patient info row ----
info_data = [[
Paragraph(f"<b>Patient:</b> {c['patient']}", body_style),
Paragraph(f"<b>Chief Complaint:</b> {c['cc']}", body_style),
]]
info_table = Table(info_data, colWidths=[W*0.38, W*0.62])
info_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), GRAY_BG),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("VALIGN", (0,0), (-1,-1), "TOP"),
("BOX", (0,0), (-1,-1), 0.5, GRAY_BORDER),
]))
# ---- Vitals + History + Exam + Ix (2-col layout) ----
left_content = [
Paragraph("Vitals", section_label),
Paragraph(c["vitals"], body_style),
Paragraph("History", section_label),
Paragraph(c["history"], body_style),
]
right_content = [
Paragraph("Examination", section_label),
Paragraph(c["exam"], body_style),
Paragraph("Investigations", section_label),
Paragraph(c["ix"], body_style),
]
from reportlab.platypus import ListFlowable
left_cell = left_content
right_cell = right_content
clincial_data = [[left_cell, right_cell]]
clinical_table = Table(clincial_data, colWidths=[W*0.49, W*0.49])
clinical_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (0,-1), HexColor("#f0f4ff")),
("BACKGROUND", (1,0), (1,-1), HexColor("#f0fff4")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("BOX", (0,0), (-1,-1), 0.5, GRAY_BORDER),
("INNERGRID", (0,0), (-1,-1), 0.3, GRAY_BORDER),
]))
# ---- Diagnosis banner ----
diag_data = [[
Paragraph("DIAGNOSIS:", ParagraphStyle("dxlabel", parent=styles["Normal"],
fontSize=9, textColor=col, fontName="Helvetica-Bold")),
Paragraph(c["diagnosis"], ParagraphStyle("dxtxt", parent=styles["Normal"],
fontSize=9.5, textColor=DARK_BLUE, fontName="Helvetica-Bold")),
]]
diag_table = Table(diag_data, colWidths=[2.2*cm, W-2.2*cm])
diag_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("BOX", (0,0), (-1,-1), 1, col),
]))
# ---- Prescription ----
rx_header_data = [[Paragraph("Rx PRESCRIPTION & PHARMACOLOGICAL RATIONALE",
ParagraphStyle("rxhdr", parent=styles["Normal"], fontSize=9, textColor=WHITE,
fontName="Helvetica-Bold", alignment=TA_CENTER))]]
rx_header_table = Table(rx_header_data, colWidths=[W])
rx_header_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), col),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
rx_rows = []
for i, (drug, dose, reason) in enumerate(c["prescription"]):
bg = WHITE if i % 2 == 0 else HexColor("#f8f9ff")
drug_cell = [
Paragraph(f"▶ {drug}", rx_drug_style),
Paragraph(f" Dose: {dose}", ParagraphStyle("dose", parent=styles["Normal"],
fontSize=8.5, textColor=HexColor("#64748b"), fontName="Helvetica-Oblique",
leftIndent=22, spaceAfter=1)),
Paragraph(f" Reason: {reason}", reason_style),
]
row_table = Table([[drug_cell]], colWidths=[W])
row_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("BOX", (0,0), (-1,-1), 0.3, GRAY_BORDER),
]))
rx_rows.append(row_table)
# ---- Advice ----
advice_data = [[
Paragraph("ADVICE & FOLLOW-UP:", ParagraphStyle("advlbl", parent=styles["Normal"],
fontSize=8.5, textColor=GREEN, fontName="Helvetica-Bold", leftIndent=0)),
Paragraph(c["advice"], ParagraphStyle("advtxt", parent=styles["Normal"],
fontSize=9, textColor=HexColor("#1e3a2f"), fontName="Helvetica", leading=12))
]]
advice_table = Table(advice_data, colWidths=[2.8*cm, W-2.8*cm])
advice_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_GREEN),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("VALIGN", (0,0), (-1,-1), "TOP"),
("BOX", (0,0), (-1,-1), 1, GREEN),
]))
# ---- Assemble case block ----
case_elements = [
header_table,
info_table,
clinical_table,
diag_table,
rx_header_table,
] + rx_rows + [
advice_table,
Spacer(1, 0.4*cm),
]
# Wrap in KeepTogether to avoid splits, but allow page breaks between cases
story.append(KeepTogether(case_elements[:6])) # header + first few elements together
for el in case_elements[6:]:
story.append(el)
story.append(HRFlowable(width=W, thickness=1.5, color=col, spaceAfter=8, spaceBefore=4))
# ── FOOTER ──
story.append(Spacer(1, 0.5*cm))
footer_data = [[
Paragraph(
"This document is produced for educational and training purposes only. "
"It does not constitute medical advice and must not be used as a clinical decision-making tool. "
"Always consult current national guidelines and senior clinicians before prescribing. "
"Drug doses and regimens may vary by institution, patient weight, renal/hepatic function, and local resistance patterns. "
"Orris Medical Education | 2026",
footer_style
)
]]
footer_table = Table(footer_data, colWidths=[W])
footer_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), HexColor("#f1f5f9")),
("BOX", (0,0), (-1,-1), 0.5, GRAY_BORDER),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 12),
("RIGHTPADDING", (0,0), (-1,-1), 12),
]))
story.append(footer_table)
# ── BUILD ──
doc.build(story)
print(f"PDF successfully generated: {OUTPUT}")
~/opd-cases/generate_opd_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/opd-cases/generate_opd_pdf.py'