attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Make notes of sickle cell anemia under heading of clinical feature all crises Vasoocclusive crises and management for final year mbbs university theory examination peds pdf format

analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/sickle-cell-notes && ls /home/daytona/workspace…

Writing File

~/sickle-cell-notes/generate_notes.py

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

OUTPUT = "/home/daytona/workspace/sickle-cell-notes/Sickle_Cell_Anemia_Notes_MBBS_Final_Year.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2.2*cm, bottomMargin=2.2*cm,
    title="Sickle Cell Anemia - Final Year MBBS Notes",
    author="Pediatrics Notes"
)

W = A4[0] - 4*cm  # usable width

# ── Colour palette ────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a237e")
MED_BLUE    = colors.HexColor("#1565c0")
LIGHT_BLUE  = colors.HexColor("#e3f2fd")
TEAL        = colors.HexColor("#00695c")
TEAL_LIGHT  = colors.HexColor("#e0f2f1")
ORANGE      = colors.HexColor("#e65100")
ORANGE_LITE = colors.HexColor("#fff3e0")
GREEN       = colors.HexColor("#2e7d32")
GREEN_LITE  = colors.HexColor("#e8f5e9")
RED         = colors.HexColor("#c62828")
RED_LITE    = colors.HexColor("#ffebee")
PURPLE      = colors.HexColor("#4a148c")
PURPLE_LITE = colors.HexColor("#f3e5f5")
GREY_BG     = colors.HexColor("#f5f5f5")
BLACK       = colors.black
WHITE       = colors.white

# ── Styles ────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, parent="Normal", **kw):
    s = ParagraphStyle(name, parent=base[parent], **kw)
    return s

TITLE_S = S("Title_S", fontSize=22, textColor=WHITE, alignment=TA_CENTER,
            spaceAfter=4, fontName="Helvetica-Bold", leading=28)

SUB_S   = S("Sub_S",   fontSize=12, textColor=WHITE, alignment=TA_CENTER,
            spaceAfter=2, fontName="Helvetica", leading=16)

H1 = S("H1", fontSize=14, textColor=WHITE, fontName="Helvetica-Bold",
        leading=18, spaceAfter=4, spaceBefore=6)

H2 = S("H2", fontSize=12, textColor=DARK_BLUE, fontName="Helvetica-Bold",
        leading=16, spaceAfter=3, spaceBefore=6,
        borderPad=4, borderColor=MED_BLUE, borderWidth=0)

H3 = S("H3", fontSize=11, textColor=TEAL, fontName="Helvetica-Bold",
        leading=14, spaceAfter=2, spaceBefore=4)

BODY = S("BODY", fontSize=9.5, textColor=BLACK, fontName="Helvetica",
         leading=14, spaceAfter=2, spaceBefore=1, alignment=TA_JUSTIFY)

BULLET = S("BULLET", fontSize=9.5, textColor=BLACK, fontName="Helvetica",
           leading=13, spaceAfter=1, spaceBefore=0,
           leftIndent=14, bulletIndent=4, alignment=TA_LEFT)

SUBBULLET = S("SUBBULLET", fontSize=9, textColor=colors.HexColor("#333333"),
              fontName="Helvetica", leading=12, spaceAfter=1, spaceBefore=0,
              leftIndent=28, bulletIndent=16)

NOTE_S = S("NOTE_S", fontSize=9, textColor=RED, fontName="Helvetica-BoldOblique",
           leading=12, spaceAfter=2)

# ── Helper builders ───────────────────────────────────────────────
def colored_box(text, bg_color, text_style, full_width=True):
    """A single-cell table acting as a colored heading block."""
    t = Table([[Paragraph(text, text_style)]],
              colWidths=[W] if full_width else None)
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg_color),
        ("ROWPADDING", (0,0), (-1,-1), 6),
        ("BOX", (0,0), (-1,-1), 0.5, bg_color),
    ]))
    return t

def h1_box(text, bg=DARK_BLUE):
    return colored_box(text, bg, H1)

def info_box(text, bg=LIGHT_BLUE, text_color=DARK_BLUE):
    style = S(f"ib_{text[:8]}", fontSize=9.5, textColor=text_color,
              fontName="Helvetica", leading=13, alignment=TA_JUSTIFY)
    t = Table([[Paragraph(text, style)]], colWidths=[W])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("ROWPADDING", (0,0), (-1,-1), 7),
        ("BOX", (0,0), (-1,-1), 1, text_color),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return t

def sp(n=0.3):
    return Spacer(1, n*cm)

def hr(color=MED_BLUE, thickness=1):
    return HRFlowable(width="100%", thickness=thickness, color=color, spaceAfter=4, spaceBefore=4)

def bullet(text, sub=False):
    marker = "\u25aa " if sub else "\u2022 "
    style = SUBBULLET if sub else BULLET
    return Paragraph(f"{marker}{text}", style)

def subbullet(text):
    return bullet(text, sub=True)

# ── Crisis table data ─────────────────────────────────────────────
def crises_table():
    header = ["Crisis Type", "Mechanism", "Clinical Features / Notes"]
    data = [header,
        ["Vaso-occlusive\nCrisis (VOC)\n(Pain Crisis)",
         "Obstruction of microcirculation by sickled RBCs \u2192 ischemic injury",
         "\u2022 Most common & characteristic crisis\n"
         "\u2022 Sudden onset severe pain after stress / fever / dehydration / cold\n"
         "\u2022 Pain in femur, tibia, lower vertebrae\n"
         "\u2022 Dactylitis (hand & foot syndrome) in infants \u2013 swelling of fingers & toes\n"
         "\u2022 Kidneys, lungs, CNS, retina may be affected\n"
         "\u2022 Severe crises last 1\u20132 weeks\n"
         "\u2022 Silent VOC \u2192 organ damage & death"],
        ["Acute Chest\nSyndrome (ACS)",
         "VOC involving the lungs (pulmonary microvascular occlusion)",
         "\u2022 Chest pain, cough, tachypnea, dyspnea\n"
         "\u2022 Fever, hypoxemia\n"
         "\u2022 New pulmonary infiltrates on CXR (resembles pneumonia)\n"
         "\u2022 Commonest cause of death in SCD\n"
         "\u2022 Seen after 6 years of age"],
        ["Sequestration\nCrisis\n(Spleen/Liver)",
         "Obstruction of splenic veins by sickled cells \u2192 pooling of peripheral blood in engorged spleen",
         "\u2022 Sudden massive splenomegaly\n"
         "\u2022 Pallor, hypotension, tachycardia \u2192 hypovolaemic shock\n"
         "\u2022 Venous blockade \u2192 recurrent infection by encapsulated bacteria\n"
         "\u2022 2g% Hb reduction\n"
         "\u2022 Autosplenectomy after repeated sequestration (functional asplenia by 6 yrs)"],
        ["Aplastic\nCrisis",
         "Cessation of erythropoiesis in bone marrow\n(Parvovirus B19 most common; also folate deficiency)",
         "\u2022 Pancytopenia (precipitated by Parvovirus B19)\n"
         "\u2022 Severe anaemia with signs of congestive heart failure\n"
         "\u2022 Usually self-limited\n"
         "\u2022 Managed with supportive care; occasionally needs packed RBCs"],
        ["Infectious\nCrises",
         "Functional hyposplenism \u2192 \u2191susceptibility to encapsulated organisms",
         "\u2022 Organisms: H. influenzae, S. pneumoniae (encapsulated)\n"
         "\u2022 Also: Salmonella (osteomyelitis), M. pneumoniae, S. aureus, E. coli\n"
         "\u2022 Every fever must be investigated promptly\n"
         "\u2022 Osteomyelitis (Salmonella is MC organism in SCD)"],
        ["Stroke /\nCerebrovascular",
         "Cerebral vascular occlusion / haemorrhage",
         "\u2022 Unilateral weakness, aphasia, paraesthesia\n"
         "\u2022 Visual symptoms (retinal haemorrhage)\n"
         "\u2022 Risk monitored by Transcranial Doppler (TCD)"],
    ]

    col_w = [W*0.18, W*0.27, W*0.55]
    t = Table(data, colWidths=col_w, repeatRows=1)

    body_style = ParagraphStyle("ts_body", fontSize=8.5, leading=12, fontName="Helvetica",
                                 textColor=BLACK)
    hdr_style  = ParagraphStyle("ts_hdr",  fontSize=9,   leading=13, fontName="Helvetica-Bold",
                                 textColor=WHITE, alignment=TA_CENTER)

    # convert strings to Paragraphs
    new_data = []
    for ri, row in enumerate(data):
        new_row = []
        for ci, cell in enumerate(row):
            if ri == 0:
                new_row.append(Paragraph(cell, hdr_style))
            else:
                new_row.append(Paragraph(cell, body_style))
        new_data.append(new_row)

    t = Table(new_data, colWidths=col_w, repeatRows=1)
    t.setStyle(TableStyle([
        # Header row
        ("BACKGROUND",    (0,0), (-1,0),  DARK_BLUE),
        ("TEXTCOLOR",     (0,0), (-1,0),  WHITE),
        ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
        ("FONTSIZE",      (0,0), (-1,0),  9),
        ("ALIGN",         (0,0), (-1,0),  "CENTER"),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        # Alternating row colors
        ("BACKGROUND",    (0,1), (-1,1),  RED_LITE),
        ("BACKGROUND",    (0,2), (-1,2),  ORANGE_LITE),
        ("BACKGROUND",    (0,3), (-1,3),  GREEN_LITE),
        ("BACKGROUND",    (0,4), (-1,4),  PURPLE_LITE),
        ("BACKGROUND",    (0,5), (-1,5),  TEAL_LIGHT),
        ("BACKGROUND",    (0,6), (-1,6),  LIGHT_BLUE),
        # Grid
        ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
        ("ROWPADDING",    (0,0), (-1,-1), 5),
        ("FONTNAME",      (0,1), (0,-1),  "Helvetica-Bold"),
        ("FONTSIZE",      (0,1), (0,-1),  8.5),
    ]))
    return t

# ── Management table ──────────────────────────────────────────────
def management_table():
    col_w = [W*0.28, W*0.72]
    hdr_s = ParagraphStyle("mh", fontSize=9, fontName="Helvetica-Bold",
                            textColor=WHITE, alignment=TA_CENTER)
    cell_s = ParagraphStyle("mc", fontSize=9, fontName="Helvetica",
                             textColor=BLACK, leading=13)

    rows = [
        [Paragraph("Component", hdr_s), Paragraph("Details", hdr_s)],
        [Paragraph("HYDRATION", ParagraphStyle("mh2", fontSize=9, fontName="Helvetica-Bold",
                                                 textColor=TEAL)),
         Paragraph("• Adequate fluids orally or IV (mainstay of pain crisis treatment)\n"
                   "• Care to avoid overhydration", cell_s)],
        [Paragraph("ANALGESIA", ParagraphStyle("mh3", fontSize=9, fontName="Helvetica-Bold",
                                                textColor=RED)),
         Paragraph("• Oral or IV analgesics for pain episodes\n"
                   "• Step-up analgesia: Paracetamol \u2192 NSAIDs \u2192 Opioids (severe pain)", cell_s)],
        [Paragraph("OXYGEN", ParagraphStyle("mh4", fontSize=9, fontName="Helvetica-Bold",
                                             textColor=MED_BLUE)),
         Paragraph("• Supplemental oxygen for patients with hypoxia / ACS", cell_s)],
        [Paragraph("BLOOD\nTRANSFUSION", ParagraphStyle("mh5", fontSize=9, fontName="Helvetica-Bold",
                                                          textColor=PURPLE)),
         Paragraph("• Packed RBCs: for severe anaemia, aplastic crisis, acute sequestration crisis\n"
                   "• Extended phenotyping required (risk of alloantibodies)\n"
                   "• Cross-match must be done before transfusion (HPLC prior to transfusion)", cell_s)],
        [Paragraph("EXCHANGE\nTRANSFUSION", ParagraphStyle("mh6", fontSize=9, fontName="Helvetica-Bold",
                                                             textColor=ORANGE)),
         Paragraph("• Goal: HbS concentration <30% of Hb\n"
                   "• Sequential removal of HbS from circulation\n"
                   "• Indications:\n"
                   "  \u2013 Cerebrovascular accidents (stroke)\n"
                   "  \u2013 Acute chest syndrome not responding to conservative therapy\n"
                   "  \u2013 Acute sequestration crisis\n"
                   "  \u2013 Priapism not resolving after adequate hydration & analgesia", cell_s)],
        [Paragraph("HYDROXYUREA", ParagraphStyle("mh7", fontSize=9, fontName="Helvetica-Bold",
                                                   textColor=GREEN)),
         Paragraph("• Increases HbF production \u2192 reduces sickling episodes\n"
                   "• Dose: 10\u201315 mg/kg/day (single daily dose)\n"
                   "• Started \u22659 months of age\n"
                   "• Decreases: acute chest syndrome, stroke, pain crises\n"
                   "• Monitor with CBC regularly\n"
                   "• \u2191HbF \u2192 \u2193 sickling", cell_s)],
        [Paragraph("PENICILLIN\nPROPHYLAXIS", ParagraphStyle("mh8", fontSize=9, fontName="Helvetica-Bold",
                                                               textColor=DARK_BLUE)),
         Paragraph("• Oral penicillin from 3 months up to at least 5 years of age\n"
                   "• Prevents infection from encapsulated organisms", cell_s)],
        [Paragraph("IMMUNIZATION", ParagraphStyle("mh9", fontSize=9, fontName="Helvetica-Bold",
                                                   textColor=TEAL)),
         Paragraph("• Pneumococcal vaccine (PCV + PPSV)\n"
                   "• Meningococcal vaccine\n"
                   "• Haemophilus influenzae type B (Hib) vaccine\n"
                   "• All routine immunizations", cell_s)],
        [Paragraph("FOLATE\nSUPPLEMENTATION", ParagraphStyle("mh10", fontSize=9, fontName="Helvetica-Bold",
                                                               textColor=MED_BLUE)),
         Paragraph("• Lifelong folate supplementation (due to chronic haemolysis)", cell_s)],
        [Paragraph("NEWER AGENTS", ParagraphStyle("mh11", fontSize=9, fontName="Helvetica-Bold",
                                                    textColor=ORANGE)),
         Paragraph("• Crizanlizumab: monoclonal Ab against P-selectin \u2192 \u2193 sickled RBC attachment to vessel wall \u2192 \u2193 VOC episodes\n"
                   "• Voxelotor: inhibits HbS polymerization \u2192 \u2193 sickling\n"
                   "• Both likely to be used more widely in future", cell_s)],
        [Paragraph("STEM CELL\nTRANSPLANT", ParagraphStyle("mh12", fontSize=9, fontName="Helvetica-Bold",
                                                             textColor=RED)),
         Paragraph("• Haematopoietic stem cell transplant (HSCT): CURATIVE\n"
                   "• Considered in patients not responding to medical management", cell_s)],
        [Paragraph("MONITORING &\nFOLLOW-UP", ParagraphStyle("mh13", fontSize=9, fontName="Helvetica-Bold",
                                                               textColor=DARK_BLUE)),
         Paragraph("• Screen for gallstones (USG abdomen)\n"
                   "• Transcranial Doppler (TCD): monitor stroke risk\n"
                   "• Regular CBC monitoring\n"
                   "• Genetic counselling and testing for the family", cell_s)],
    ]

    t = Table(rows, colWidths=col_w, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0),  TEAL),
        ("TEXTCOLOR",     (0,0), (-1,0),  WHITE),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
        ("ROWPADDING",    (0,0), (-1,-1), 5),
        ("BACKGROUND",    (0,1), (-1,1),  LIGHT_BLUE),
        ("BACKGROUND",    (0,2), (-1,2),  RED_LITE),
        ("BACKGROUND",    (0,3), (-1,3),  LIGHT_BLUE),
        ("BACKGROUND",    (0,4), (-1,4),  PURPLE_LITE),
        ("BACKGROUND",    (0,5), (-1,5),  ORANGE_LITE),
        ("BACKGROUND",    (0,6), (-1,6),  GREEN_LITE),
        ("BACKGROUND",    (0,7), (-1,7),  LIGHT_BLUE),
        ("BACKGROUND",    (0,8), (-1,8),  TEAL_LIGHT),
        ("BACKGROUND",    (0,9), (-1,9),  LIGHT_BLUE),
        ("BACKGROUND",    (0,10),(-1,10), ORANGE_LITE),
        ("BACKGROUND",    (0,11),(-1,11), RED_LITE),
        ("BACKGROUND",    (0,12),(-1,12), LIGHT_BLUE),
    ]))
    return t

# ── Investigations table ──────────────────────────────────────────
def inv_table():
    col_w = [W*0.3, W*0.7]
    hdr_s = ParagraphStyle("ih", fontSize=9, fontName="Helvetica-Bold",
                            textColor=WHITE, alignment=TA_CENTER)
    cell_s = ParagraphStyle("ic", fontSize=9, fontName="Helvetica",
                             textColor=BLACK, leading=13)

    rows = [
        [Paragraph("Investigation", hdr_s), Paragraph("Findings / Notes", hdr_s)],
        [Paragraph("Peripheral Blood Smear", cell_s),
         Paragraph("• Sickle-shaped RBCs + target cells\n• Howell-Jolly bodies (functional asplenia)\n• Anemia + thrombocytosis\n• Leukocytosis; WBC >20,000/mm³ with left shift = infection", cell_s)],
        [Paragraph("Sickling Test\n(Screening)", cell_s),
         Paragraph("• Induction of sickling by adding 3% sodium metabisulphite\n• Detects presence of sickle Hb but cannot differentiate SS from AS", cell_s)],
        [Paragraph("Hb Electrophoresis /\nHPLC (Gold Standard)", cell_s),
         Paragraph("• HPLC = gold standard, best diagnostic test, quantifies HbS\n• Homozygous (SS disease): HbSS 80–90%\n• Carrier (AS trait): HbAS 35–40%\n• Must be done BEFORE blood transfusion\n• Hb A+S note: HbA + HbS → less severe manifestations", cell_s)],
        [Paragraph("Indirect Bilirubin", cell_s),
         Paragraph("• Elevated due to chronic haemolysis (unconjugated hyperbilirubinaemia)", cell_s)],
        [Paragraph("Chest X-Ray (CXR)", cell_s),
         Paragraph("• Acute chest syndrome: new-onset pulmonary infiltrates resembling pneumonia", cell_s)],
    ]

    t = Table(rows, colWidths=col_w, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0),  MED_BLUE),
        ("TEXTCOLOR",     (0,0), (-1,0),  WHITE),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
        ("ROWPADDING",    (0,0), (-1,-1), 5),
        ("BACKGROUND",    (0,1), (-1,1),  GREY_BG),
        ("BACKGROUND",    (0,2), (-1,2),  LIGHT_BLUE),
        ("BACKGROUND",    (0,3), (-1,3),  GREEN_LITE),
        ("BACKGROUND",    (0,4), (-1,4),  ORANGE_LITE),
        ("BACKGROUND",    (0,5), (-1,5),  RED_LITE),
    ]))
    return t

# ── Build story ───────────────────────────────────────────────────
story = []

# ---- Title Banner ----
title_data = [[Paragraph("SICKLE CELL ANEMIA", TITLE_S)],
              [Paragraph("Final Year MBBS | Pediatrics | University Theory Examination Notes", SUB_S)],
              [Paragraph("Source: Essential Pediatrics (Marrow v5.0, 2024) | IAP Guidelines", SUB_S)]]
title_t = Table(title_data, colWidths=[W])
title_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
    ("ROWPADDING", (0,0), (-1,-1), 7),
    ("BOX",        (0,0), (-1,-1), 2, MED_BLUE),
]))
story += [title_t, sp(0.4)]

# ─── SECTION 1: BASICS ───────────────────────────────────────────
story += [h1_box("1.  BASICS & PATHOPHYSIOLOGY"), sp(0.2)]

story.append(info_box(
    "<b>Definition:</b> Sickle cell anaemia is an <b>autosomal recessive</b> haemoglobinopathy "
    "caused by a <b>point mutation</b> in the beta-globin gene where <b>Glutamate is replaced "
    "by Valine at the 6th position</b> of the beta-globin chain, producing abnormal haemoglobin <b>HbS</b> "
    "(instead of normal HbA).",
    LIGHT_BLUE, DARK_BLUE
))
story.append(sp(0.2))

story.append(Paragraph("<b>Epidemiology (India):</b>", H3))
for t in ["Gene frequency: 4.3% in India",
          "High incidence in <b>tribal populations</b> of Orissa, Maharashtra, Madhya Pradesh, Jharkhand, Gujarat",
          "Autosomal recessive (AR) — both parents must be carriers for disease"]:
    story.append(bullet(t))
story.append(sp(0.2))

story.append(Paragraph("<b>Pathogenesis:</b>", H3))
story.append(info_box(
    "<b>HbS</b> (Sickle Hb) → in the presence of <b>Hypoxia / Dehydration / Fever / Metabolic acidosis</b> → "
    "Deoxygenation → HbS molecules undergo <b>hydrophobic interactions → aggregate into larger polymers → "
    "RBCs become sickle-shaped</b> (irreversibly) → <b>Fragile RBCs</b> → <b>Haemolysis</b> (RBC lifespan only 10–20 days) "
    "AND <b>Obstruction of microcirculation</b> → Ischaemia → Infarction.",
    ORANGE_LITE, ORANGE
))
story.append(sp(0.15))
story.append(Paragraph("<b>Why symptoms appear after 6 months:</b> HbF (fetal Hb) predominates in first 6 months "
                       "and is <b>protective against sickling</b>. Symptoms manifest only when HbF is replaced by HbS.",
                       BODY))
story.append(sp(0.3))

# ─── SECTION 2: CLINICAL FEATURES ───────────────────────────────
story += [h1_box("2.  CLINICAL FEATURES", bg=MED_BLUE), sp(0.2)]

story.append(Paragraph("<b>General Presentation:</b>", H3))
for t in ["Pallor (chronic haemolytic anaemia)",
          "Icterus / jaundice (elevated unconjugated bilirubin from chronic haemolysis)",
          "Splenomegaly (mild, young child); spleen undergoes <b>auto-infarction</b> → usually not palpable after 6 years",
          "Growth retardation",
          "Gallstones (cholelithiasis) — common complication",
          "Functional hyposplenism → <b>Howell-Jolly bodies</b> on peripheral smear"]:
    story.append(bullet(t))
story.append(sp(0.2))

story.append(Paragraph("<b>Cardiovascular / Respiratory Signs:</b>", H3))
for t in ["Tachypnea → suggests pneumonia, CHF, or Acute Chest Syndrome",
          "Hypoxia → commonly seen in Acute Chest Syndrome",
          "Signs of CHF → severe anaemia / aplastic crisis",
          "Hypotension + tachycardia → septic shock or sequestration crisis"]:
    story.append(bullet(t))
story.append(sp(0.2))

story.append(Paragraph("<b>Neurological Signs:</b>", H3))
for t in ["Unilateral weakness, aphasia, paraesthesia",
          "Visual symptoms (retinal haemorrhage)",
          "Stroke / cerebral infarct"]:
    story.append(bullet(t))
story.append(sp(0.2))

story.append(Paragraph("<b>Characteristic Findings:</b>", H3))
story.append(info_box(
    "<b>Dactylitis / Hand & Foot Syndrome:</b> Painful swelling of fingers and toes "
    "— manifests in <b>infancy</b> (earliest presentation of SCD). "
    "Caused by infarction of small bones of hands/feet by sickled RBCs.",
    GREEN_LITE, GREEN
))
story.append(sp(0.3))

# ─── SECTION 3: ALL CRISES ───────────────────────────────────────
story += [h1_box("3.  ALL CRISES IN SICKLE CELL DISEASE", bg=RED), sp(0.15)]

story.append(info_box(
    "<b>Remember:</b> Crises are precipitated by Hypoxia, Dehydration, Fever, Cold, Infection, Stress, Metabolic acidosis",
    RED_LITE, RED
))
story.append(sp(0.2))
story.append(crises_table())
story.append(sp(0.3))

# ─── SECTION 4: VASO-OCCLUSIVE CRISIS (Detailed) ─────────────────
story += [h1_box("4.  VASO-OCCLUSIVE CRISIS (VOC) — DETAILED", bg=ORANGE), sp(0.2)]

story.append(Paragraph("<b>Definition:</b>", H3))
story.append(BODY.__class__(
    "BODY2", parent=base["Normal"],
    fontSize=9.5, textColor=BLACK, fontName="Helvetica",
    leading=14, spaceAfter=2))
story.append(Paragraph(
    "The most common and characteristic crisis in SCD. Caused by <b>obstruction of microcirculation "
    "by sickled RBCs</b>, resulting in <b>ischaemic injury</b> to tissues.",
    BODY))
story.append(sp(0.1))

story.append(Paragraph("<b>Precipitating Factors:</b>", H3))
for t in ["Stress (physical or emotional)",
          "Fever / infection",
          "Dehydration",
          "Cold exposure",
          "Hypoxia",
          "Metabolic acidosis"]:
    story.append(bullet(t))
story.append(sp(0.15))

story.append(Paragraph("<b>Clinical Features of VOC:</b>", H3))
story.append(info_box(
    "<b>Sudden onset of severe, excruciating pain</b> — most common presenting symptom. "
    "Severe crises can last <b>1–2 weeks</b>. "
    "The <b>silent vaso-occlusion</b> (painless) is associated with increased risk of organ damage and death.",
    ORANGE_LITE, ORANGE
))
story.append(sp(0.1))

story.append(Paragraph("<b>Sites Affected:</b>", H3))
data_voc = [
    ["Site", "Presentation"],
    ["Femur, Tibia, Lower Vertebrae", "Bone pain (most common)"],
    ["Hands & Feet (infants)", "Dactylitis — painful swollen fingers/toes (Hand-Foot syndrome)"],
    ["Lungs", "Acute Chest Syndrome (ACS)"],
    ["CNS / Brain", "Stroke, cerebral infarct, seizures"],
    ["Kidneys", "Haematuria, renal papillary necrosis"],
    ["Retina", "Retinal haemorrhage, visual loss"],
    ["Spleen", "Splenic sequestration"],
    ["Penis", "Priapism (painful, prolonged erection)"],
    ["Liver", "Hepatomegaly, hepatic sequestration"],
]
col_w2 = [W*0.38, W*0.62]
cell_s2 = ParagraphStyle("vs2", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=12)
hdr_s2  = ParagraphStyle("vh2", fontSize=9, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER)

voc_rows = []
for ri, row in enumerate(data_voc):
    voc_rows.append([Paragraph(row[0], hdr_s2 if ri==0 else cell_s2),
                     Paragraph(row[1], hdr_s2 if ri==0 else cell_s2)])

voc_t = Table(voc_rows, colWidths=col_w2, repeatRows=1)
voc_t.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  ORANGE),
    ("TEXTCOLOR",     (0,0), (-1,0),  WHITE),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
    ("ROWPADDING",    (0,0), (-1,-1), 5),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, ORANGE_LITE]),
]))
story.append(voc_t)
story.append(sp(0.2))

story.append(Paragraph("<b>Organ Damage from Repeated Silent VOC:</b>", H3))
for t in ["Avascular necrosis of femoral head",
          "Chronic kidney disease / renal failure",
          "Pulmonary hypertension",
          "Retinopathy (proliferative)",
          "Cardiomegaly",
          "Leg ulcers"]:
    story.append(bullet(t))
story.append(sp(0.3))

# ─── SECTION 5: INVESTIGATIONS ───────────────────────────────────
story += [h1_box("5.  INVESTIGATIONS", bg=MED_BLUE), sp(0.2)]
story.append(inv_table())
story.append(sp(0.3))

# ─── SECTION 6: MANAGEMENT ───────────────────────────────────────
story += [h1_box("6.  MANAGEMENT", bg=TEAL), sp(0.15)]

story.append(info_box(
    "<b>KEY PRINCIPLE:</b> <b>Hydration + Analgesia</b> are the mainstays of treatment in a pain crisis. "
    "Avoid overhydration. Oxygen for hypoxia.",
    TEAL_LIGHT, TEAL
))
story.append(sp(0.2))
story.append(management_table())
story.append(sp(0.3))

# ─── SECTION 7: PREVENTIVE CARE ──────────────────────────────────
story += [h1_box("7.  PREVENTIVE CARE & LONG-TERM FOLLOW-UP", bg=GREEN), sp(0.2)]

prev_data = [
    [Paragraph("Intervention", ParagraphStyle("ph", fontSize=9, fontName="Helvetica-Bold",
                                               textColor=WHITE, alignment=TA_CENTER)),
     Paragraph("Details", ParagraphStyle("pd", fontSize=9, fontName="Helvetica-Bold",
                                          textColor=WHITE, alignment=TA_CENTER))],
    [Paragraph("Penicillin prophylaxis", ParagraphStyle("p2", fontSize=9, fontName="Helvetica-Bold", textColor=GREEN)),
     Paragraph("Start at 3 months → continue till at least 5 years of age. Prevents infection from encapsulated organisms.", 
               ParagraphStyle("p3", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Immunization", ParagraphStyle("p4", fontSize=9, fontName="Helvetica-Bold", textColor=TEAL)),
     Paragraph("Pneumococcal (PCV + PPSV), Meningococcal, Hib (H. influenzae B) vaccines + all routine vaccines",
               ParagraphStyle("p5", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Folate supplementation", ParagraphStyle("p6", fontSize=9, fontName="Helvetica-Bold", textColor=PURPLE)),
     Paragraph("Lifelong (due to chronic haemolytic anaemia)",
               ParagraphStyle("p7", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Hydroxyurea", ParagraphStyle("p8", fontSize=9, fontName="Helvetica-Bold", textColor=DARK_BLUE)),
     Paragraph("10–15 mg/kg/day; start ≥9 months; increases HbF → ↓ sickling episodes, ↓ ACS, ↓ stroke, ↓ pain crises; "
               "monitor CBC regularly",
               ParagraphStyle("p9", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Gallstone screening", ParagraphStyle("p10", fontSize=9, fontName="Helvetica-Bold", textColor=ORANGE)),
     Paragraph("Regular USG abdomen",
               ParagraphStyle("p11", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Transcranial Doppler (TCD)", ParagraphStyle("p12", fontSize=9, fontName="Helvetica-Bold", textColor=RED)),
     Paragraph("Monitors cerebrovascular blood flow velocity → identifies risk of stroke",
               ParagraphStyle("p13", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
    [Paragraph("Genetic counselling", ParagraphStyle("p14", fontSize=9, fontName="Helvetica-Bold", textColor=TEAL)),
     Paragraph("Offered to entire family; parents taught to recognise complications; antenatal testing for carriers",
               ParagraphStyle("p15", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))],
]

prev_t = Table(prev_data, colWidths=[W*0.28, W*0.72], repeatRows=1)
prev_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0),  GREEN),
    ("TEXTCOLOR",  (0,0), (-1,0),  WHITE),
    ("VALIGN",     (0,0), (-1,-1), "TOP"),
    ("GRID",       (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
    ("ROWPADDING", (0,0), (-1,-1), 5),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, GREEN_LITE]),
]))
story.append(prev_t)
story.append(sp(0.3))

# ─── SECTION 8: EXAM HIGH-YIELD POINTS ───────────────────────────
story += [h1_box("8.  HIGH-YIELD EXAM POINTS", bg=PURPLE), sp(0.2)]

exam_points = [
    ("<b>Most common / characteristic crisis:</b>", "Vaso-occlusive (pain) crisis"),
    ("<b>Earliest manifestation:</b>", "Dactylitis / Hand-Foot syndrome (infancy)"),
    ("<b>Most common cause of death:</b>", "Acute Chest Syndrome (ACS)"),
    ("<b>Organism in osteomyelitis:</b>", "Salmonella (MC in SCD; unlike normal children where S. aureus is MC)"),
    ("<b>Protective factor:</b>", "HbF (fetal Hb) — explains symptom-free period in first 6 months"),
    ("<b>Gold standard diagnostic test:</b>", "HPLC (quantifies HbS); Hb electrophoresis to differentiate SS vs AS"),
    ("<b>Screening test:</b>", "Sickling test (sodium metabisulphite test)"),
    ("<b>Drug that ↑ HbF:</b>", "Hydroxyurea (10–15 mg/kg/day)"),
    ("<b>Exchange transfusion goal:</b>", "HbS <30%"),
    ("<b>Curative treatment:</b>", "Haematopoietic stem cell transplant (HSCT)"),
    ("<b>Newer drugs:</b>", "Crizanlizumab (anti-P-selectin) + Voxelotor (anti-HbS polymerization)"),
    ("<b>Stroke monitoring:</b>", "Transcranial Doppler (TCD)"),
    ("<b>Spleen after 6 years:</b>", "Auto-infarction → not palpable → functional asplenia → Howell-Jolly bodies"),
    ("<b>Penicillin prophylaxis:</b>", "3 months to at least 5 years of age"),
]

ep_style_k = ParagraphStyle("epk", fontSize=9, fontName="Helvetica-Bold", textColor=PURPLE, leading=12)
ep_style_v = ParagraphStyle("epv", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=12)
ep_rows = [[Paragraph("Key Point", ep_style_k), Paragraph("Answer", ep_style_v)]]
# header
ep_rows[0] = [Paragraph("Key Point", ParagraphStyle("eph", fontSize=9, fontName="Helvetica-Bold",
                                                      textColor=WHITE, alignment=TA_CENTER)),
              Paragraph("Answer", ParagraphStyle("eph2", fontSize=9, fontName="Helvetica-Bold",
                                                  textColor=WHITE, alignment=TA_CENTER))]
for k, v in exam_points:
    ep_rows.append([Paragraph(k, ep_style_k), Paragraph(v, ep_style_v)])

ep_t = Table(ep_rows, colWidths=[W*0.38, W*0.62], repeatRows=1)
ep_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0),  PURPLE),
    ("TEXTCOLOR",  (0,0), (-1,0),  WHITE),
    ("VALIGN",     (0,0), (-1,-1), "TOP"),
    ("GRID",       (0,0), (-1,-1), 0.5, colors.HexColor("#bdbdbd")),
    ("ROWPADDING", (0,0), (-1,-1), 5),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, PURPLE_LITE]),
]))
story.append(ep_t)
story.append(sp(0.3))

# ─── Footer note ─────────────────────────────────────────────────
story.append(hr())
story.append(Paragraph(
    "Notes compiled for Final Year MBBS Pediatrics University Theory Examination | "
    "Source: Essential Pediatrics (Marrow v5.0, 2024), IAP Guidelines | "
    "HbF = Fetal Haemoglobin | HbS = Sickle Haemoglobin | SCD = Sickle Cell Disease | "
    "VOC = Vaso-Occlusive Crisis | ACS = Acute Chest Syndrome | HSCT = Haematopoietic Stem Cell Transplant",
    S("footer_s", fontSize=7.5, textColor=colors.grey, fontName="Helvetica",
      alignment=TA_CENTER, leading=11)
))

# ─── Build ────────────────────────────────────────────────────────
doc.build(story)
print("PDF generated:", OUTPUT)
Running Command

cd /home/daytona/workspace/sickle-cell-notes && python generate_notes.py 2>&1

Editing File

~/sickle-cell-notes/generate_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/sickle-cell-notes/generate_notes.py'
Running Command

cd /home/daytona/workspace/sickle-cell-notes && python generate_notes.py 2>&1

Running Command

ls -lh /home/daytona/workspace/sickle-cell-notes/Sickle_Cell_Anemia_Notes_MBBS_F…

Your PDF notes are ready! Here is the download link:

Sickle Cell Anemia Notes MBBS Final Year

PDF Document · PDF


What's inside the PDF (8 colour-coded sections):

Section 1 - Basics & Pathophysiology
  • Autosomal recessive, point mutation at 6th position of beta-globin (Glu → Val)
  • HbS formation, sickling mechanism, triggers (hypoxia/dehydration/fever/acidosis)
  • Why symptoms appear after 6 months (HbF protective)
Section 2 - Clinical Features
  • Pallor, icterus, splenomegaly, growth retardation, gallstones
  • Dactylitis / Hand-Foot syndrome (earliest manifestation, in infancy)
  • CVS, respiratory, neurological signs
Section 3 - ALL Crises (complete colour-coded table)
CrisisKey Points
Vaso-occlusive (VOC)MC/characteristic; sudden severe pain; bones, dactylitis
Acute Chest SyndromeMC cause of death; CXR infiltrates resembling pneumonia
Sequestration CrisisSpleen engorged; pallor + shock; autosplenectomy risk
Aplastic CrisisParvovirus B19; pancytopenia; supportive Rx
Infectious CrisesEncapsulated organisms; Salmonella osteomyelitis
StrokeTCD monitoring
Section 4 - VOC in Detail
  • Precipitants, sites (with Priapism, renal, retinal), silent VOC, organ damage
Section 5 - Investigations
  • Peripheral smear (Howell-Jolly bodies), Sickling test, HPLC (gold standard), Hb electrophoresis
Section 6 - Management
  • Hydration + Analgesia (mainstay), Oxygen, PRBC, Exchange transfusion (goal HbS <30%), Hydroxyurea, Crizanlizumab, Voxelotor, HSCT (curative)
Section 7 - Preventive Care
  • Penicillin prophylaxis (3 months to 5 yrs), immunizations, hydroxyurea, TCD monitoring, folate, genetic counselling
Section 8 - High-Yield Exam Points
  • 14 key exam Q&A pairs including: gold standard test, curative Rx, newer drugs, Salmonella in osteomyelitis, spleen after 6 yrs, exchange transfusion goal, etc.
This is a shared conversation. Sign in to Orris to start your own chat.