~/covid-psm-notes/generate_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, mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import ListFlowable, ListItem
OUTPUT = "/tmp/workspace/covid-psm-notes/COVID19_PSM_Notes.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────
BLUE_DARK = colors.HexColor("#1a3a5c")
BLUE_MID = colors.HexColor("#2d6ea5")
BLUE_LIGHT = colors.HexColor("#daeaf7")
TEAL = colors.HexColor("#17a589")
TEAL_LIGHT = colors.HexColor("#d1f2eb")
RED = colors.HexColor("#c0392b")
RED_LIGHT = colors.HexColor("#fadbd8")
ORANGE = colors.HexColor("#e67e22")
ORANGE_LIGHT = colors.HexColor("#fdebd0")
GREY_LIGHT = colors.HexColor("#f2f3f4")
GREY_MED = colors.HexColor("#d5d8dc")
WHITE = colors.white
BLACK = colors.black
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=2*cm, bottomMargin=2*cm
)
styles = getSampleStyleSheet()
# Custom styles
def S(name, **kw):
return ParagraphStyle(name, **kw)
title_style = S("DocTitle",
fontSize=22, textColor=WHITE, alignment=TA_CENTER,
fontName="Helvetica-Bold", spaceAfter=4, spaceBefore=4)
subtitle_style = S("DocSub",
fontSize=12, textColor=BLUE_LIGHT, alignment=TA_CENTER,
fontName="Helvetica", spaceAfter=2)
h1 = S("H1",
fontSize=13, textColor=WHITE, fontName="Helvetica-Bold",
spaceBefore=10, spaceAfter=4, leftIndent=0)
h2 = S("H2",
fontSize=11, textColor=BLUE_DARK, fontName="Helvetica-Bold",
spaceBefore=8, spaceAfter=3, leftIndent=0,
borderPad=2)
h3 = S("H3",
fontSize=10, textColor=TEAL, fontName="Helvetica-Bold",
spaceBefore=6, spaceAfter=2, leftIndent=0)
body = S("Body",
fontSize=9, textColor=BLACK, fontName="Helvetica",
spaceBefore=2, spaceAfter=2, leftIndent=4,
leading=13, alignment=TA_JUSTIFY)
bullet = S("Bullet",
fontSize=9, textColor=BLACK, fontName="Helvetica",
spaceBefore=1, spaceAfter=1, leftIndent=12,
bulletIndent=4, leading=12)
highlight_box = S("HighlightBox",
fontSize=9, textColor=BLUE_DARK, fontName="Helvetica",
spaceBefore=2, spaceAfter=2, leftIndent=6,
leading=13, backColor=BLUE_LIGHT, borderPad=6)
warning_box = S("WarningBox",
fontSize=9, textColor=RED, fontName="Helvetica-Bold",
spaceBefore=2, spaceAfter=2, leftIndent=6,
leading=13, backColor=RED_LIGHT, borderPad=6)
caption = S("Caption",
fontSize=8, textColor=colors.grey, fontName="Helvetica-Oblique",
alignment=TA_CENTER, spaceBefore=1, spaceAfter=4)
# ── Helper functions ─────────────────────────────────────────────────────────
def section_header(text, level=1):
"""Returns a coloured section header block."""
if level == 1:
bg = BLUE_DARK
st = h1
elif level == 2:
bg = BLUE_MID
st = S("H2W", fontSize=11, textColor=WHITE, fontName="Helvetica-Bold",
spaceBefore=8, spaceAfter=3)
else:
bg = TEAL
st = S("H3W", fontSize=10, textColor=WHITE, fontName="Helvetica-Bold",
spaceBefore=6, spaceAfter=2)
t = Table([[Paragraph(text, st)]], colWidths=[18*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), 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),
("ROUNDEDCORNERS", [4,4,4,4]),
]))
return t
def make_table(headers, rows, col_widths=None, header_bg=BLUE_MID, zebra=True):
"""Generic styled table."""
data = [[Paragraph(f"<b>{h}</b>", S("TH", fontSize=8, textColor=WHITE,
fontName="Helvetica-Bold", leading=11)) for h in headers]]
for row in rows:
data.append([Paragraph(str(c), S("TD", fontSize=8, textColor=BLACK,
fontName="Helvetica", leading=11)) for c in row])
if col_widths is None:
col_widths = [18*cm / len(headers)] * len(headers)
t = Table(data, colWidths=col_widths, repeatRows=1)
style = [
("BACKGROUND", (0,0), (-1,0), header_bg),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8),
("GRID", (0,0), (-1,-1), 0.4, GREY_MED),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 5),
("RIGHTPADDING", (0,0), (-1,-1), 5),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, GREY_LIGHT] if zebra else [WHITE]),
]
t.setStyle(TableStyle(style))
return t
def bp(text):
return Paragraph(f"• {text}", bullet)
def para(text):
return Paragraph(text, body)
def sp(n=4):
return Spacer(1, n)
def hr():
return HRFlowable(width="100%", thickness=0.5, color=GREY_MED, spaceAfter=4, spaceBefore=4)
# ── COVER PAGE ───────────────────────────────────────────────────────────────
def cover_page():
elems = []
# Big coloured header box
cover_table = Table(
[[Paragraph("COVID-19", S("CT1", fontSize=36, textColor=WHITE,
fontName="Helvetica-Bold", alignment=TA_CENTER))],
[Paragraph("(SARS-CoV-2)", S("CT2", fontSize=16, textColor=BLUE_LIGHT,
fontName="Helvetica", alignment=TA_CENTER))],
[Paragraph("Comprehensive PSM Notes", S("CT3", fontSize=18, textColor=WHITE,
fontName="Helvetica-Bold", alignment=TA_CENTER))],
[Paragraph("Epidemiology · Pathophysiology · Clinical Features · Diagnosis\n"
"Treatment · Vaccines · Public Health Programs · India Response",
S("CT4", fontSize=10, textColor=BLUE_LIGHT,
fontName="Helvetica", alignment=TA_CENTER, leading=16))]],
colWidths=[18*cm]
)
cover_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), BLUE_DARK),
("TOPPADDING", (0,0), (-1,-1), 14),
("BOTTOMPADDING", (0,0), (-1,-1), 14),
("LEFTPADDING", (0,0), (-1,-1), 16),
("RIGHTPADDING", (0,0), (-1,-1), 16),
]))
elems.append(Spacer(1, 1.5*cm))
elems.append(cover_table)
elems.append(sp(12))
# Key stats boxes
stats = [
("700 M+", "Cases Worldwide"),
("7 M+", "Deaths Worldwide"),
("R₀ ~6", "Basic Reproduction No."),
("Jan 16, 2021", "India Vaccination Start"),
]
stat_data = [[
Table([[Paragraph(v, S("SV", fontSize=16, textColor=BLUE_DARK,
fontName="Helvetica-Bold", alignment=TA_CENTER))],
[Paragraph(l, S("SL", fontSize=8, textColor=colors.grey,
fontName="Helvetica", alignment=TA_CENTER))]],
colWidths=[4.2*cm])
for v, l in stats
]]
stat_table = Table(stat_data, colWidths=[4.4*cm]*4)
stat_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), BLUE_LIGHT),
("GRID", (0,0), (-1,-1), 0.5, BLUE_MID),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("ALIGN", (0,0), (-1,-1), "CENTER"),
]))
elems.append(stat_table)
elems.append(sp(10))
# Disclaimer
disc = Table([[Paragraph(
"Sources: Harrison's Principles of Internal Medicine 22E (2025) · Goldman-Cecil Medicine · "
"Sherris & Ryan's Medical Microbiology 8E · Braunwald's Heart Disease · "
"MoHFW India · WHO · ICMR",
S("Disc", fontSize=7.5, textColor=colors.grey, fontName="Helvetica-Oblique",
alignment=TA_CENTER))]],
colWidths=[18*cm])
disc.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), GREY_LIGHT),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
]))
elems.append(disc)
elems.append(PageBreak())
return elems
# ── BUILD DOCUMENT ───────────────────────────────────────────────────────────
story = []
story += cover_page()
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 1 - INTRODUCTION & CLASSIFICATION
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("1. INTRODUCTION & CLASSIFICATION", 1))
story.append(sp(4))
story.append(para("<b>Full Name:</b> Coronavirus Disease 2019 (COVID-19)"))
story.append(para("<b>Causative Agent:</b> Severe Acute Respiratory Syndrome Coronavirus 2 (SARS-CoV-2)"))
story.append(para("<b>Family:</b> Coronaviridae | <b>Genus:</b> Betacoronavirus | <b>ICTV name:</b> Betacoronavirus pandemicum"))
story.append(para("<b>Genome:</b> Single-stranded, positive-sense RNA (~30,000 nucleotides — one of the largest RNA viral genomes)"))
story.append(sp(4))
story.append(bp("<b>Structural proteins:</b> S (Spike), E (Envelope), M (Membrane), N (Nucleocapsid)"))
story.append(bp("Spike protein RBD binds <b>ACE2</b> receptor; primed by <b>TMPRSS2</b> protease"))
story.append(bp("RNA-dependent RNA polymerase (RdRp) — error-prone, drives variant generation"))
story.append(sp(6))
story.append(section_header("Related Human Coronaviruses", 3))
story.append(sp(3))
story.append(make_table(
["Virus", "Disease", "Year", "Genome Identity with SARS-CoV-2"],
[["SARS-CoV-1", "SARS epidemic", "2002–03", "~80%"],
["MERS-CoV", "MERS", "2012, 2015, 2018", "~50%"],
["HCoV-OC43 / HCoV-HKU1", "Common cold", "Endemic", "~50%"],
["SARS-CoV-2", "COVID-19 Pandemic", "2019–present", "Reference strain"]],
col_widths=[4*cm, 4*cm, 3*cm, 7*cm]
))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 2 - EPIDEMIOLOGY
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("2. EPIDEMIOLOGY (PSM Core)", 1))
story.append(sp(4))
story.append(section_header("2.1 Key Timeline", 2))
story.append(sp(3))
story.append(make_table(
["Date", "Event"],
[["December 2019", "Cluster of viral pneumonia in Wuhan, Hubei province, China"],
["Jan 11–12, 2020", "Genomic sequence of SARS-CoV-2 published"],
["January 21, 2020", "First US case (Washington State)"],
["January 30, 2020", "WHO declared Public Health Emergency of International Concern (PHEIC)"],
["March 11, 2020", "WHO declared Global Pandemic"],
["January 16, 2021", "India COVID-19 vaccination program launched"],
["May 5, 2023", "WHO declared end to global COVID-19 emergency"],
["September 2024", ">700 million cases and >7 million deaths worldwide"]],
col_widths=[4.5*cm, 13.5*cm]
))
story.append(sp(6))
story.append(section_header("2.2 Reservoir, Source & Transmission", 2))
story.append(sp(3))
story.append(bp("<b>Natural reservoir:</b> Horseshoe bats (presumed); possible intermediate host"))
story.append(bp("<b>R₀ (Basic Reproduction Number):</b> Peaks ~6 (seasonal influenza: 1–2); Omicron estimated 10–18"))
story.append(sp(4))
story.append(make_table(
["Route", "Details"],
[["Respiratory droplets (PRIMARY)", "Droplets from coughing/sneezing landing on mucous membranes of others"],
["Aerosol/Airborne", "Short-range aerosol; long-distance airborne unlikely"],
["Fomite/Contact", "Hand-to-face transfer after touching contaminated surfaces"],
["Asymptomatic transmission", "Major driver — many asymptomatic individuals transmit virus freely"]],
col_widths=[5*cm, 13*cm]
))
story.append(sp(4))
story.append(section_header("Surface Stability of SARS-CoV-2", 3))
story.append(sp(3))
story.append(make_table(
["Surface", "Stability"],
[["Aerosol", "~2–4 hours"], ["Plastic", "~72 hours"], ["Steel", "~48 hours"],
["Cardboard", "~24 hours"], ["Copper", "~8 hours"]],
col_widths=[6*cm, 12*cm], header_bg=TEAL
))
story.append(sp(6))
story.append(section_header("2.3 Risk Factors for Severe Disease", 2))
story.append(sp(3))
story.append(para("<b>Age</b> is the PRINCIPAL risk factor:"))
story.append(bp(">95% of COVID-19 deaths in persons >45 years"))
story.append(bp(">80% of deaths in persons >65 years"))
story.append(bp("Male sex associated with higher risk (OR ~1.8)"))
story.append(sp(4))
story.append(make_table(
["Comorbidity Category", "Examples"],
[["Obesity", "BMI >25 (overweight), ≥30 (obese), ≥40 (severe obesity) — progressive risk increase"],
["Chronic lung disease", "COPD, moderate–severe asthma, cystic fibrosis, pulmonary hypertension"],
["Cancer / Immunosuppression", "Hematologic malignancies, solid organ transplant, HIV, steroids"],
["Cardiovascular", "Hypertension, heart failure, CAD, cardiomyopathies, stroke"],
["Metabolic", "Diabetes mellitus (Type 1 & 2), chronic liver disease (cirrhosis)"],
["Renal", "Chronic kidney disease"],
["Hematologic", "Sickle cell disease, thalassemia"],
["Neurological", "Cognitive impairment, Down syndrome, cerebrovascular disease"],
["Pregnancy", "Higher risk of severe illness, preterm birth"]],
col_widths=[5.5*cm, 12.5*cm]
))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 3 - PATHOPHYSIOLOGY
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("3. PATHOPHYSIOLOGY", 1))
story.append(sp(4))
story.append(section_header("3.1 Viral Entry Mechanism", 2))
story.append(sp(3))
story.append(make_table(
["Step", "Event"],
[["1", "Virus enters via respiratory tract; nasopharyngeal/oropharyngeal cells are initial targets"],
["2", "Spike protein RBD binds ACE2 (Angiotensin-Converting Enzyme 2) receptor"],
["3", "TMPRSS2 primes Spike protein; S1/S2 cleavage by cellular cathepsins allows fusion"],
["4", "Virus enters cell; RNA released; RdRp drives replication"],
["5", "Spreads to bronchial epithelium, alveolar cells, vascular endothelium, macrophages"]],
col_widths=[1*cm, 17*cm], header_bg=TEAL
))
story.append(sp(4))
story.append(Paragraph(
"<b>PSM Key Point:</b> ACE2 receptors in lungs, heart, kidneys, intestines, brain → explains multi-organ involvement. "
"Mutations in RBD increase ACE2 affinity → more infectious variants.",
highlight_box))
story.append(sp(6))
story.append(section_header("3.2 Stages of Disease Progression", 2))
story.append(sp(3))
story.append(make_table(
["Stage", "Timing", "Pathology", "Clinical Picture"],
[["1 — Early Infection", "Days 1–5", "Viral replication in upper airway; innate immune response", "Mild symptoms or asymptomatic"],
["2 — Pulmonary Phase", "Days 5–10", "Lower airway invasion; bilateral pneumonia; ACE2 downregulation disrupts RAAS → pulmonary edema", "Dyspnoea, hypoxia, ground-glass opacities on CT"],
["3 — Hyperinflammatory", "Days 10+", "Cytokine Storm: massive IL-6, TNF-α, IL-1β, IL-8, IFN-γ → ARDS", "Severe hypoxia, ICU admission"],
["4 — Coagulopathy", "Concurrent with Stage 3", "Endothelial damage + cytokines → hypercoagulability; DIC; VTE", "DVT, PE, stroke, limb ischaemia"]],
col_widths=[3.5*cm, 3*cm, 6*cm, 5.5*cm]
))
story.append(sp(4))
story.append(section_header("3.3 Key Laboratory Correlates of Severity", 2))
story.append(sp(3))
story.append(make_table(
["Parameter", "Direction", "Significance"],
[["Lymphocytes", "↓ (Lymphopenia)", "Impaired adaptive immunity"],
["IL-6, TNF-α, Ferritin, CRP", "↑↑ (markedly)", "Cytokine storm markers — predict severe disease"],
["D-dimer, Prothrombin time", "↑", "Coagulopathy, DIC, VTE risk"],
["LDH, Liver enzymes", "↑", "Multi-organ involvement"],
["Troponin, CPK", "↑", "Cardiac injury"],
["Creatinine", "↑", "Acute kidney injury"],
["Platelets", "↓ (Thrombocytopenia)", "Consumption in coagulopathy"]],
col_widths=[5*cm, 4*cm, 9*cm], header_bg=RED
))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 4 - CLINICAL FEATURES
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("4. CLINICAL FEATURES", 1))
story.append(sp(4))
story.append(para("<b>Incubation Period:</b> Typically 4–5 days after exposure; range 1–14 days (nearly always within 14 days)"))
story.append(sp(6))
story.append(section_header("4.1 Spectrum of Illness", 2))
story.append(sp(3))
story.append(make_table(
["Severity", "Definition", "Approx %"],
[["Asymptomatic/Presymptomatic", "SARS-CoV-2 positive, no symptoms", "20–40%"],
["Mild", "Symptoms (fever, cough); SpO₂ normal; no dyspnoea", "40–50%"],
["Moderate", "SpO₂ ≥94%; lower respiratory tract disease", "~15%"],
["Severe", "SpO₂ <94%; RR >30/min; lung infiltrates >50%", "5–10%"],
["Critical", "Respiratory failure, shock, multi-organ failure/dysfunction", "1–5%"]],
col_widths=[4.5*cm, 10.5*cm, 3*cm]
))
story.append(sp(6))
story.append(section_header("4.2 Symptoms by System", 2))
story.append(sp(3))
story.append(make_table(
["System", "Symptoms"],
[["General/Constitutional", "Fever, fatigue, myalgia, headache"],
["Respiratory", "Cough, dyspnoea, sore throat"],
["Neurological (HALLMARK)", "Sudden onset ANOSMIA (loss of smell) + DYSGEUSIA (loss of taste); encephalopathy; delirium"],
["Gastrointestinal", "Nausea, vomiting, diarrhoea"],
["Dermatological", "Diverse rashes; 'COVID toes' (pernio/chilblains-like)"],
["Psychiatric", "Fatigue, depression, anxiety, sleep disturbance, cognitive deficit, PTSD"]],
col_widths=[4.5*cm, 13.5*cm]
))
story.append(sp(6))
story.append(section_header("4.3 Complications", 2))
story.append(sp(3))
story.append(make_table(
["System", "Complications"],
[["Pulmonary", "ARDS (MOST COMMON SEVERE COMPLICATION) — requires O₂/mechanical ventilation"],
["Cardiovascular", "Myocarditis, pericarditis, heart failure, arrhythmia, myocardial injury"],
["Thrombotic", "PE, DVT, DIC, stroke, limb ischaemia (COVID-19 coagulopathy)"],
["Renal", "Acute kidney injury — may require dialysis"],
["Neurological", "Encephalopathy, seizures, ataxia, motor/sensory deficits, Guillain-Barré"],
["Paediatric", "MIS-C: multisystem inflammatory syndrome in children — persistent fever, multi-organ, elevated CRP; most common in Black/Latino children 3–12 yrs"],
["Long COVID (PASC)", "Symptoms persisting ≥3 months: fatigue, brain fog, dyspnoea, chest pain, depression, PTSD, ↑ suicidal ideation"]],
col_widths=[4*cm, 14*cm]
))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 5 - DIAGNOSIS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("5. DIAGNOSIS", 1))
story.append(sp(4))
story.append(make_table(
["Test", "Details", "Notes"],
[["RT-PCR (GOLD STANDARD)", "Reverse transcription PCR; converts viral RNA to cDNA; nasopharyngeal swab most common; saliva for mass screening", "High sensitivity; requires reference lab"],
["Rapid Antigen Test", "Point-of-care; detects viral antigens", "Less sensitive; useful for mass screening, home testing"],
["Antibody (IgM/IgG)", "Serological detection of immune response", "NOT for acute diagnosis; used for seroprevalence studies"],
["Chest X-Ray", "Bilateral consolidation + ground-glass opacities (lower zones)", "May be normal early; used for management"],
["Chest CT", "Ground-glass opacification ± consolidation; pleural thickening; septal thickening; air bronchograms", "More sensitive than CXR; for management NOT primary diagnosis"],
["Lung Ultrasound", "Detects some COVID-19 lung abnormalities", "Bedside utility in ICU"]],
col_widths=[4*cm, 9*cm, 5*cm]
))
story.append(sp(4))
story.append(section_header("WHO Clinical Case Definitions (PSM)", 3))
story.append(sp(3))
story.append(bp("<b>Suspected case:</b> Acute febrile illness OR acute respiratory illness with epidemiological link"))
story.append(bp("<b>Probable case:</b> Suspected case with typical CT findings but RT-PCR negative/unavailable"))
story.append(bp("<b>Confirmed case:</b> Positive RT-PCR regardless of symptoms"))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 6 - TREATMENT
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("6. TREATMENT", 1))
story.append(sp(4))
story.append(section_header("6.1 Outpatient Treatment — Mild/Moderate Disease (High-Risk Patients)", 2))
story.append(sp(3))
story.append(para("Antiviral drugs should be started within <b>5 days of symptom onset</b> for maximum benefit:"))
story.append(sp(3))
story.append(make_table(
["Drug", "Mechanism", "Dose", "Notes"],
[["Nirmatrelvir/Ritonavir (Paxlovid) ★ FIRST LINE", "Protease inhibitor + CYP3A4 booster",
"300 mg/100 mg BD × 5 days PO", "Drug of choice; check drug interactions carefully"],
["Remdesivir", "RdRp inhibitor (nucleoside analog)",
"200 mg IV day 1 → 100 mg IV daily × 3 days", "Outpatient 3-day IV course; for high-risk"],
["Molnupiravir", "RdRp error induction (lethal mutagenesis)",
"800 mg BD × 5 days PO", "Third-line; AVOID in pregnancy"]],
col_widths=[4.5*cm, 4*cm, 4.5*cm, 5*cm]
))
story.append(sp(3))
story.append(Paragraph("<b>NOT recommended:</b> Ivermectin (no proven benefit); aspirin or anticoagulants (unless other indications).", warning_box))
story.append(sp(6))
story.append(section_header("6.2 Hospitalized Patients — Severe/Critical COVID-19", 2))
story.append(sp(3))
story.append(section_header("A. Antiviral", 3))
story.append(sp(2))
story.append(bp("<b>Remdesivir</b> 200 mg IV day 1, then 100 mg/day for up to 5–10 days"))
story.append(bp("Speeds recovery; mortality benefit limited to non-ventilated patients"))
story.append(bp("Recommended by both US NIH guidelines and WHO for patients requiring supplemental O₂"))
story.append(sp(4))
story.append(section_header("B. Corticosteroids (BACKBONE of Severe COVID Treatment)", 3))
story.append(sp(2))
story.append(make_table(
["Drug", "Dose", "Effect", "Indication"],
[["Dexamethasone ★ FIRST LINE", "6 mg/day PO or IV × 10 days or discharge",
"↓ Mortality ~20% (O₂); ↓ ~35% (ventilated)", "ALL patients requiring O₂"],
["Prednisone (alternative)", "40 mg/day", "Equivalent to dexamethasone", "If dexamethasone unavailable"],
["Methylprednisolone (alt)", "32 mg/day", "Equivalent", "If dexamethasone unavailable"],
["Hydrocortisone (alt)", "160 mg/day", "Equivalent", "If dexamethasone unavailable"]],
col_widths=[4.5*cm, 4*cm, 5*cm, 4.5*cm], header_bg=ORANGE
))
story.append(Paragraph("<b>WARNING:</b> Dexamethasone is NOT beneficial and may harm patients NOT requiring oxygen.", warning_box))
story.append(sp(4))
story.append(section_header("C. Anti-inflammatory / Immunomodulatory Agents", 3))
story.append(sp(2))
story.append(make_table(
["Drug", "Class", "Dose", "Indication", "Mortality Benefit"],
[["Tocilizumab ★", "IL-6 receptor blocker", "8 mg/kg IV (max 800 mg) × 1–2 doses",
"Rapidly deteriorating; on steroids; elevated inflammation; ICU transfer", "~15% reduction"],
["Sarilumab", "IL-6 blocker", "Per protocol",
"Alternative to tocilizumab", "Limited data"],
["Baricitinib ★", "JAK inhibitor", "4 mg/day PO × 14 days",
"Added to steroids + elevated inflammatory markers", "~40% mortality reduction at day 28"],
["Tofacitinib", "JAK inhibitor", "10 mg BD PO × 14 days",
"Alternative JAK inhibitor", "Benefit shown"],
["Abatacept / Infliximab", "Alternative immunomodulators", "Per protocol",
"When first-line agents unavailable", "Alternative agents"]],
col_widths=[3.5*cm, 3.5*cm, 4*cm, 4*cm, 3*cm]
))
story.append(sp(4))
story.append(section_header("D. Combined Therapy Guidelines", 3))
story.append(sp(2))
story.append(make_table(
["Clinical Scenario", "Recommended Regimen"],
[["Requires O₂ but NOT ventilated (standard hospitalized)", "Remdesivir + Dexamethasone"],
["Minimal O₂ requirement only", "Remdesivir alone"],
["Rapidly deteriorating on above; high-flow O₂/ventilation/ICU; elevated inflammation",
"Add Tocilizumab OR Baricitinib to corticosteroids"],
["Refractory hypoxia", "ECMO considered; continue immunomodulators"]],
col_widths=[6*cm, 12*cm], header_bg=TEAL
))
story.append(sp(4))
story.append(section_header("E. Anticoagulation", 3))
story.append(sp(2))
story.append(bp("<b>Prophylactic anticoagulation</b> recommended for ALL hospitalized COVID-19 patients"))
story.append(bp("<b>Therapeutic anticoagulation</b> for confirmed VTE — requires expert consultation"))
story.append(bp("NOT recommended in outpatients without other indications"))
story.append(sp(4))
story.append(section_header("F. Supportive Care", 3))
story.append(sp(2))
story.append(make_table(
["Intervention", "Details"],
[["Supplemental O₂", "Target SpO₂ ≥94%; nasal cannula → HFNC → NIV → intubation"],
["Mechanical ventilation", "Lung-protective strategy: low tidal volume 6 mL/kg IBW"],
["Prone positioning", "Improves oxygenation in ARDS; ≥16 hours/day"],
["ECMO", "Extracorporeal membrane oxygenation for refractory ARDS"],
["Antipyretics", "Acetaminophen PREFERRED over NSAIDs"],
["Antibiotics", "NOT routinely indicated; consider if bacterial co-infection suspected"]],
col_widths=[4.5*cm, 13.5*cm], header_bg=TEAL
))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 7 - VACCINES
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("7. VACCINES", 1))
story.append(sp(4))
story.append(section_header("7.1 Types of COVID-19 Vaccines", 2))
story.append(sp(3))
story.append(make_table(
["Platform", "Mechanism", "Examples"],
[["mRNA", "Lipid nanoparticle-encapsulated mRNA encodes spike protein; host cells produce spike → immune response",
"Pfizer-BioNTech (Comirnaty), Moderna (Spikevax)"],
["Adenoviral Vector", "Non-replicating viral vector delivers spike gene",
"AstraZeneca/Covishield (ChAdOx1), Janssen/J&J (Ad26), Sputnik V"],
["Inactivated Virus", "Killed SARS-CoV-2 induces immune response",
"Covaxin (BBV152), Sinovac (CoronaVac), Sinopharm"],
["Protein Subunit", "Recombinant spike protein + adjuvant",
"Novavax (Nuvaxovid), Corbevax, Covovax"],
["DNA/Plasmid", "Plasmid DNA delivered intradermally via needle-free device",
"ZyCoV-D (India — world's first DNA vaccine for COVID)"]],
col_widths=[4*cm, 8*cm, 6*cm]
))
story.append(sp(6))
story.append(section_header("7.2 Key Vaccine Characteristics (WHO/US-Authorized)", 2))
story.append(sp(3))
story.append(make_table(
["Feature", "Pfizer-BioNTech mRNA", "Moderna mRNA", "J&J (Janssen)", "Novavax Protein"],
[["Type", "mRNA", "mRNA", "Adenovirus vector", "Protein subunit + Matrix-M adjuvant"],
["Minimum Age", "≥6 months", "≥6 months", "≥18 years", "≥12 years"],
["Primary Series", "2 doses (≥5 yrs)\n3 doses (6 mo–4 yrs)", "2 doses", "1 dose", "2 doses"],
["Interval", "3–8 weeks", "4–8 weeks", "Single dose", "3–8 weeks"],
["Booster", "Approved ≥5 yrs", "Approved", "Not approved", "Not approved"],
["Immunocompromised", "3-dose primary + boosters", "3-dose primary + boosters", "2-dose primary + mRNA booster", "2 doses + mRNA booster"]],
col_widths=[4*cm, 3.5*cm, 3.5*cm, 3.5*cm, 3.5*cm]
))
story.append(sp(6))
story.append(section_header("7.3 Vaccine Adverse Effects", 2))
story.append(sp(3))
story.append(make_table(
["Adverse Effect", "Vaccine Type", "Frequency", "Management"],
[["Local reaction (pain, swelling, redness)", "All", "Common", "Symptomatic"],
["Systemic (fatigue, headache, fever, myalgia)", "All (esp. after dose 2)", "Common", "Symptomatic; usually 1–2 days"],
["Myocarditis/Pericarditis", "mRNA vaccines and Novavax", "Rare (mainly adolescent/young adult males)", "Conservative; generally mild-moderate course"],
["VITT (thrombocytopenia + thrombosis)", "Adenoviral vector (AZ, J&J)", "Very rare", "IVIG + anticoagulation; AVOID heparin"],
["Anaphylaxis", "All", "Very rare (~2–5/million doses)", "Epinephrine; 15–30 min observation post-vaccination"]],
col_widths=[4.5*cm, 4*cm, 3.5*cm, 6*cm], header_bg=RED
))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 8 - PUBLIC HEALTH MEASURES
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("8. PUBLIC HEALTH MEASURES & CONTROL (PSM)", 1))
story.append(sp(4))
story.append(section_header("8.1 Non-Pharmaceutical Interventions (NPIs)", 2))
story.append(sp(3))
story.append(make_table(
["Measure", "Definition", "Purpose"],
[["Social Distancing", "Stay ≥6 ft from others in public", "Reduce droplet/aerosol exposure"],
["Social Isolation", "Stay away from others when infected", "Source control"],
["Quarantine", "Stay home 14 days after potential exposure", "Interrupt transmission chain"],
["Lockdown", "Restrict movement; close non-essential services", "Reduce overall Re below 1"],
["Masking", "Surgical/N95/KN95 face masks", "Reduce droplet inhalation + exhalation"],
["Hand Hygiene", "Soap & water ≥20 sec; alcohol-based sanitizers", "Prevent fomite transmission"],
["Respiratory Etiquette", "Cover cough/sneeze; dispose tissues", "Source control"],
["Travel Restrictions", "Restrict inter-regional/international travel", "Slow geographic spread"],
["School/Workplace Closures", "Remote learning and work-from-home", "Reduce community transmission"]],
col_widths=[4*cm, 7*cm, 7*cm]
))
story.append(sp(6))
story.append(section_header("8.2 Key Epidemiological Indicators (PSM)", 2))
story.append(sp(3))
story.append(make_table(
["Indicator", "Formula", "COVID-19 Value"],
[["Attack Rate (AR)", "New cases / At-risk population × 100", "Varied widely by wave and variant"],
["Case Fatality Rate (CFR)", "Deaths / Confirmed cases × 100", "~1–3% globally (higher early; lower with Omicron/vaccination)"],
["Infection Fatality Rate (IFR)", "Deaths / Estimated total infections × 100", "~0.5–1% (overall population)"],
["Test Positivity Rate (TPR)", "Positive tests / Total tests × 100", "WHO threshold: <5% considered controlled"],
["R effective (Re)", "Actual transmission rate in partial immunity", "<1 = epidemic declining"],
["Herd Immunity Threshold", "1 - 1/R₀", "~83–90% for COVID-19 (R₀ ~6)"]],
col_widths=[4.5*cm, 7*cm, 6.5*cm], header_bg=TEAL
))
story.append(sp(6))
story.append(section_header("8.3 Infection Prevention & Control (IPC) in Healthcare", 2))
story.append(sp(3))
story.append(bp("<b>Standard precautions:</b> All patients — hand hygiene (WHO 5 moments), gloves, gown, respiratory etiquette"))
story.append(bp("<b>Droplet + Contact precautions:</b> All suspected/confirmed COVID-19 patients"))
story.append(bp("<b>Airborne precautions</b> for Aerosol-Generating Procedures (AGPs): intubation, bronchoscopy, suctioning, CPR, nebulization"))
story.append(bp("<b>PPE for AGPs:</b> N95 respirator (FFP2/FFP3), goggles/face shield, gown, gloves"))
story.append(bp("<b>Negative pressure rooms</b> for AGPs where available"))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 9 - VARIANTS OF CONCERN
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("9. VARIANTS OF CONCERN (VOCs)", 1))
story.append(sp(4))
story.append(make_table(
["WHO Name", "Lineage", "Origin", "Key Features"],
[["Alpha", "B.1.1.7", "United Kingdom", "~50% more transmissible than original strain"],
["Beta", "B.1.351", "South Africa", "Partial vaccine escape; reduced neutralization"],
["Gamma", "P.1", "Brazil", "Reinfection risk; immune evasion"],
["Delta", "B.1.617.2", "India", "Very high transmissibility; severe disease; R₀ ~6–7"],
["Omicron", "B.1.1.529", "South Africa", "HIGHEST transmissibility (R₀ ~10–18); partial vaccine evasion; less severe disease generally"]],
col_widths=[2.5*cm, 3.5*cm, 4*cm, 8*cm]
))
story.append(sp(4))
story.append(para("<b>WHO Classification:</b> Variants Under Monitoring (VUM) → Variants of Interest (VOI) → Variants of Concern (VOC)"))
story.append(bp("WHO Technical Advisory Group on SARS-CoV-2 Virus Evolution monitors variants"))
story.append(bp("WHO CoViNet launched 2024 for early coronavirus detection and variant tracking"))
story.append(bp("WHO Technical Advisory Group on COVID-19 Vaccine Composition assesses VOC impact on vaccine performance"))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 10 - INDIA VACCINATION PROGRAM
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("10. INDIA'S COVID-19 VACCINATION PROGRAM", 1))
story.append(sp(4))
story.append(section_header("10.1 Program Overview", 2))
story.append(sp(3))
story.append(bp("<b>Launch Date:</b> January 16, 2021 (launched at 3,006 vaccination centres)"))
story.append(bp("<b>Ministry:</b> Ministry of Health and Family Welfare (MoHFW)"))
story.append(bp("<b>Platform:</b> CoWIN (Covid Vaccine Intelligence Network) — registration, scheduling, certificates, cold chain monitoring"))
story.append(bp("165,714 people vaccinated on Day 1; 631,417 in first three days"))
story.append(sp(6))
story.append(section_header("10.2 Vaccines Used in India", 2))
story.append(sp(3))
story.append(make_table(
["Vaccine", "Type", "Manufacturer", "Approved"],
[["Covishield ★ (most used >81% doses)", "Adenoviral vector (ChAdOx1)", "Serum Institute of India (SII) — AstraZeneca license", "Jan 1, 2021"],
["Covaxin (BBV152) ★ (indigenous)", "Inactivated whole-virus", "Bharat Biotech + ICMR + National Institute of Virology", "Jan 2, 2021"],
["Sputnik V", "Adenoviral vector (rAd26+rAd5)", "Dr. Reddy's Laboratories (Gamaleya license)", "Apr 2021"],
["Moderna (Spikevax)", "mRNA", "Moderna / SII production", "Jun 2021"],
["Corbevax", "Protein subunit (RBD)", "Biological E + Dynavax + Baylor College", "Dec 2021"],
["Covovax", "Protein subunit", "SII (Novavax technology)", "Dec 2021"],
["ZyCoV-D", "DNA plasmid (needle-free)", "Zydus Cadila — world's first DNA COVID vaccine", "Aug 2021"],
["Johnson & Johnson", "Adenoviral vector (Ad26)", "Janssen/J&J", "Aug 2021"]],
col_widths=[5*cm, 4*cm, 6.5*cm, 2.5*cm]
))
story.append(sp(6))
story.append(section_header("10.3 Vaccine Efficacy — India's Key Vaccines", 2))
story.append(sp(3))
story.append(make_table(
["Vaccine", "Efficacy — Symptomatic COVID", "Efficacy — Severe COVID", "Notes"],
[["Covishield (AstraZeneca/ChAdOx1)", "~70–79%", "~95% against severe disease",
"Most widely deployed; >81% of India's doses"],
["Covaxin (BBV152)", "77.8% (130 confirmed cases eval)", "93.4%",
"63.6% vs asymptomatic; 65.2% vs Delta; 100% Indian indigenous"],
["Corbevax (RBD subunit)", "~90% (Novavax data)", "High protection",
"Used for 12–14 year age group in India"]],
col_widths=[4.5*cm, 4.5*cm, 4*cm, 5*cm]
))
story.append(sp(6))
story.append(section_header("10.4 Rollout Phases in India", 2))
story.append(sp(3))
story.append(make_table(
["Phase", "Period", "Priority Group"],
[["Phase 1", "Jan 16, 2021", "Healthcare Workers (HCW)"],
["Phase 2", "Feb 1, 2021", "Frontline Workers (FLW) — police, military, municipal workers"],
["Phase 3", "Mar 1, 2021", "≥60 years and ≥45 years with comorbidities"],
["Phase 4", "Apr 1, 2021", "All adults ≥45 years"],
["Phase 5", "May 1, 2021", "All adults ≥18 years"],
["Phase 6", "Jan 3, 2022", "Adolescents 15–18 years (Covaxin)"],
["Phase 7 (Precaution dose)", "Jan 10, 2022", "HCW, FLW, and adults ≥60 years (booster)"],
["Extended", "Apr 2022", "12–14 years (Corbevax); booster for all adults ≥18 years"]],
col_widths=[4*cm, 4*cm, 10*cm]
))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 11 - INDIA COVID MANAGEMENT PROGRAMS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("11. INDIA'S COVID-19 MANAGEMENT PROGRAMS", 1))
story.append(sp(4))
story.append(section_header("11.1 Surveillance Systems", 2))
story.append(sp(3))
story.append(make_table(
["System", "Role"],
[["IDSP (Integrated Disease Surveillance Programme)", "COVID-19 integrated as notifiable disease; district/state/national surveillance network"],
["NCDC (National Centre for Disease Control)", "National coordination and epidemiological investigation"],
["ICMR (Indian Council of Medical Research)", "Testing guidelines, research, Covaxin co-development, clinical trial oversight"],
["CoWIN Platform", "Vaccine management: registration, scheduling, certificate, adverse event reporting, cold chain monitoring"],
["Aarogya Setu App", "Digital contact tracing using Bluetooth + GPS; voluntary self-reporting"]],
col_widths=[5.5*cm, 12.5*cm]
))
story.append(sp(6))
story.append(section_header("11.2 Containment Strategy", 2))
story.append(sp(3))
story.append(bp("<b>Cluster Containment Strategy:</b> Used for localized outbreaks — define containment zone + buffer zone; active case-finding, testing, contact tracing, quarantine"))
story.append(bp("<b>Zone Classification:</b> Red (hotspot/high risk), Orange (limited spread), Green (no active cases)"))
story.append(bp("<b>Three-tier response:</b> District → State → National levels"))
story.append(sp(6))
story.append(section_header("11.3 India Clinical Management Protocol (MoHFW)", 2))
story.append(sp(3))
story.append(make_table(
["Severity", "Management"],
[["Mild", "Home isolation; symptomatic (paracetamol); pulse oximetry monitoring; telemedicine follow-up; avoid unnecessary antibiotics"],
["Moderate", "Hospitalization; low-flow O₂; Remdesivir; steroids; anticoagulation prophylaxis; monitor SpO₂"],
["Severe/Critical", "ICU; high-flow O₂/NIV/mechanical ventilation; Dexamethasone; Remdesivir; Tocilizumab/Baricitinib; therapeutic anticoagulation; ECMO if refractory"]],
col_widths=[3*cm, 15*cm], header_bg=RED
))
story.append(sp(6))
story.append(section_header("11.4 Social Support Programs During COVID", 2))
story.append(sp(3))
story.append(make_table(
["Program", "Purpose"],
[["PM CARES Fund", "Emergency financial resource for COVID-19 response and healthcare"],
["Pradhan Mantri Garib Kalyan Anna Yojana", "Free food grains to 800 million beneficiaries during COVID lockdowns"],
["One Nation One Ration Card", "Portability of food security during lockdown-driven migration"],
["ECLGS (Emergency Credit Line Guarantee Scheme)", "Financial support to MSMEs affected by lockdowns"],
["PM Garib Kalyan Package", "Direct cash transfers to women Jan Dhan account holders, farmers, daily wage workers"]],
col_widths=[6*cm, 12*cm]
))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 12 - GLOBAL RESPONSE
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("12. GLOBAL RESPONSE FRAMEWORKS", 1))
story.append(sp(4))
story.append(make_table(
["Program/Initiative", "Description"],
[["COVAX", "WHO + GAVI + CEPI initiative for equitable global vaccine access; target: 20% coverage in each participating country by end-2021; India key supplier through SII"],
["WHO Solidarity Trial", "International adaptive RCT testing multiple COVID-19 treatments simultaneously across 30+ countries"],
["WHO CoViNet (2024)", "Global coronavirus surveillance network for early detection and variant tracking"],
["ACT-Accelerator", "WHO framework: Access to COVID-19 Tools — vaccines, diagnostics, therapeutics, health system strengthening"],
["IHR Emergency Committee", "Advised WHO Director-General on PHEIC status; met regularly throughout pandemic"]],
col_widths=[5*cm, 13*cm]
))
story.append(sp(8))
story.append(PageBreak())
# ═══════════════════════════════════════════════════════════════════════════
# SECTION 13 - QUICK REVISION TABLE
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("13. HIGH-YIELD QUICK REVISION — PSM EXAM TABLE", 1))
story.append(sp(4))
story.append(make_table(
["Topic", "Key Fact"],
[["Causative agent", "SARS-CoV-2 — Betacoronavirus"],
["Receptor", "ACE2 (Angiotensin-Converting Enzyme 2) + TMPRSS2"],
["Genome", "Positive-sense, single-stranded RNA; ~30,000 nucleotides"],
["R₀", "~6 (Omicron ~10–18); seasonal flu ~1–2"],
["Incubation period", "4–5 days typically; max 14 days"],
["Primary transmission", "Respiratory droplets"],
["Surface stability", "Plastic: 72h | Steel: 48h | Cardboard: 24h | Copper: 8h"],
["Gold standard diagnosis", "RT-PCR (nasopharyngeal swab)"],
["WHO PHEIC declared", "January 30, 2020"],
["WHO pandemic declared", "March 11, 2020"],
["WHO ended PHEIC", "May 5, 2023"],
["Global cases (Sep 2024)", ">700 million cases; >7 million deaths"],
["Herd immunity threshold", "~83–90% (based on R₀ ~6)"],
["Best drug — mild high-risk outpatients", "Nirmatrelvir/Ritonavir (Paxlovid)"],
["Best antiviral — hospitalized", "Remdesivir (200→100 mg IV)"],
["Backbone of severe COVID treatment", "Dexamethasone 6 mg/day × 10 days"],
["IL-6 blocker (hospital)", "Tocilizumab (~15% mortality reduction)"],
["JAK inhibitor (hospital)", "Baricitinib (~40% mortality reduction at day 28)"],
["India vaccination launch", "January 16, 2021"],
["India indigenous vaccine", "Covaxin (BBV152) — Bharat Biotech + ICMR + NIV"],
["Most used vaccine in India", "Covishield (>81% of doses)"],
["India vaccine platform", "CoWIN (Covid Vaccine Intelligence Network)"],
["VITT", "Vaccine-Induced Immune Thrombocytopenia & Thrombosis — adenoviral vector vaccines; treat with IVIG (NOT heparin)"],
["Myocarditis post-vaccine", "mRNA vaccines; mainly adolescent/young adult males; usually mild"],
["Long COVID definition", "Symptoms persisting ≥3 months post-infection (PASC)"],
["MIS-C", "Multisystem inflammatory syndrome in children; most common: Black/Latino children 3–12 yrs"],
["Anosmia + Dysgeusia", "Hallmark neurological features of COVID-19"],
["PPE for AGPs", "N95 + goggles/face shield + gown + gloves"]],
col_widths=[7*cm, 11*cm], header_bg=BLUE_DARK
))
story.append(sp(8))
# ── Footer section ──────────────────────────────────────────────────────────
story.append(hr())
story.append(Paragraph(
"Sources: Harrison's Principles of Internal Medicine 22nd Ed. (2025, McGraw Hill) · Goldman-Cecil Medicine International Edition · "
"Sherris & Ryan's Medical Microbiology 8th Ed. · Braunwald's Heart Disease · Washington Manual of Medical Therapeutics · "
"MoHFW India · WHO COVID-19 Guidelines · ICMR · Bharat Biotech · Serum Institute of India",
S("Footer", fontSize=7.5, textColor=colors.grey, fontName="Helvetica-Oblique",
alignment=TA_CENTER, leading=11)
))
# ── Build PDF ────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")