~/micronutrients-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, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import PageBreak
OUTPUT = "/home/daytona/workspace/micronutrients-notes/Micronutrients_Notes.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm,
topMargin=2.2*cm, bottomMargin=2.2*cm,
)
W, H = A4
# ββ Colours ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DARK_TEAL = colors.HexColor("#005F6B")
MED_TEAL = colors.HexColor("#008891")
LIGHT_TEAL = colors.HexColor("#E0F4F4")
ORANGE = colors.HexColor("#E07B39")
LIGHT_ORANGE= colors.HexColor("#FFF3EC")
YELLOW_HL = colors.HexColor("#FFF9C4")
DARK_GREY = colors.HexColor("#2D2D2D")
MID_GREY = colors.HexColor("#555555")
LIGHT_GREY = colors.HexColor("#F5F5F5")
RED_SOFT = colors.HexColor("#C0392B")
GREEN_SOFT = colors.HexColor("#1A7A4A")
PURPLE = colors.HexColor("#5B2C8D")
LIGHT_PURPLE= colors.HexColor("#F0E8FA")
TABLE_HEADER= colors.HexColor("#2C3E50")
# ββ Styles ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ss = getSampleStyleSheet()
def style(name, parent="Normal", **kw):
s = ParagraphStyle(name, parent=ss[parent], **kw)
return s
TITLE_STYLE = style("Title2", fontSize=22, textColor=colors.white,
fontName="Helvetica-Bold", alignment=TA_CENTER,
spaceAfter=4, leading=26)
SUBTITLE_STYLE = style("Subtitle2", fontSize=11, textColor=colors.white,
fontName="Helvetica", alignment=TA_CENTER,
spaceAfter=2)
H1 = style("H1", fontSize=15, textColor=colors.white,
fontName="Helvetica-Bold", spaceBefore=6, spaceAfter=4,
leading=18, leftIndent=0)
H2 = style("H2", fontSize=12, textColor=DARK_TEAL,
fontName="Helvetica-Bold", spaceBefore=8, spaceAfter=3,
leading=15)
H3 = style("H3", fontSize=10.5, textColor=ORANGE,
fontName="Helvetica-Bold", spaceBefore=5, spaceAfter=2,
leading=13)
BODY = style("Body2", fontSize=9.5, textColor=DARK_GREY,
fontName="Helvetica", spaceAfter=3, leading=14,
alignment=TA_JUSTIFY)
BULLET = style("Bullet2", fontSize=9.5, textColor=DARK_GREY,
fontName="Helvetica", spaceAfter=2, leading=13,
leftIndent=14, firstLineIndent=-10)
SMALL = style("Small2", fontSize=8.5, textColor=MID_GREY,
fontName="Helvetica-Oblique", spaceAfter=2, leading=12)
IMPORTANT = style("Important", fontSize=9.5, textColor=RED_SOFT,
fontName="Helvetica-Bold", spaceAfter=2, leading=13)
NOTE = style("Note", fontSize=9, textColor=GREEN_SOFT,
fontName="Helvetica-BoldOblique", spaceAfter=2,
leading=12, leftIndent=8)
CELL_HDR = style("CellHdr", fontSize=9, textColor=colors.white,
fontName="Helvetica-Bold", alignment=TA_CENTER,
leading=12)
CELL_BODY= style("CellBody", fontSize=9, textColor=DARK_GREY,
fontName="Helvetica", alignment=TA_LEFT, leading=12)
CELL_BODY_C=style("CellBodyC", fontSize=9, textColor=DARK_GREY,
fontName="Helvetica", alignment=TA_CENTER, leading=12)
MEMORY = style("Memory", fontSize=9, textColor=PURPLE,
fontName="Helvetica-BoldOblique", spaceAfter=2,
leading=12, leftIndent=8)
story = []
# ββ Helper builders ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def title_block(title, subtitle=""):
"""Big coloured title banner."""
data = [[Paragraph(title, TITLE_STYLE)]]
if subtitle:
data.append([Paragraph(subtitle, SUBTITLE_STYLE)])
t = Table(data, colWidths=[doc.width])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_TEAL),
("TOPPADDING", (0,0), (-1,-1), 10),
("BOTTOMPADDING",(0,0),(-1,-1),10),
("LEFTPADDING", (0,0), (-1,-1), 12),
("RIGHTPADDING",(0,0), (-1,-1), 12),
("ROUNDEDCORNERS", [6]),
]))
return t
def section_header(text, color=DARK_TEAL):
"""Coloured section banner."""
data = [[Paragraph(text, H1)]]
t = Table(data, colWidths=[doc.width])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING",(0,0),(-1,-1), 10),
("ROUNDEDCORNERS", [4]),
]))
return t
def highlight_box(text, bg=LIGHT_TEAL, border=MED_TEAL, style=BODY):
data = [[Paragraph(text, style)]]
t = Table(data, colWidths=[doc.width])
t.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), bg),
("BOX", (0,0),(-1,-1), 1, border),
("TOPPADDING",(0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING",(0,0),(-1,-1), 10),
("RIGHTPADDING",(0,0),(-1,-1), 10),
("ROUNDEDCORNERS",[4]),
]))
return t
def make_table(headers, rows, col_widths=None, zebra=True):
if col_widths is None:
n = len(headers)
col_widths = [doc.width / n] * n
header_row = [Paragraph(h, CELL_HDR) for h in headers]
data = [header_row]
for r in rows:
data.append([Paragraph(str(c), CELL_BODY) for c in r])
t = Table(data, colWidths=col_widths, repeatRows=1)
style_cmds = [
("BACKGROUND", (0,0), (-1,0), TABLE_HEADER),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING",(0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 6),
("RIGHTPADDING",(0,0),(-1,-1), 6),
("VALIGN",(0,0),(-1,-1),"TOP"),
]
if zebra:
for i in range(1, len(data)):
if i % 2 == 0:
style_cmds.append(("BACKGROUND",(0,i),(-1,i), LIGHT_GREY))
t.setStyle(TableStyle(style_cmds))
return t
def b(text): return f"<b>{text}</b>"
def i(text): return f"<i>{text}</i>"
def bi(text): return f"<b><i>{text}</i></b>"
def red(text): return f'<font color="#C0392B"><b>{text}</b></font>'
def green(text): return f'<font color="#1A7A4A"><b>{text}</b></font>'
def teal(text): return f'<font color="#008891"><b>{text}</b></font>'
def orange(text): return f'<font color="#E07B39"><b>{text}</b></font>'
def purple(text): return f'<font color="#5B2C8D"><b>{text}</b></font>'
def bullet(text): return Paragraph(f"β’ {text}", BULLET)
def sub_bullet(text): return Paragraph(f" β¦ {text}", BULLET)
def body(text): return Paragraph(text, BODY)
def sp(h=4): return Spacer(1, h)
def hr(): return HRFlowable(width="100%", thickness=0.5,
color=colors.HexColor("#CCCCCC"),
spaceAfter=4, spaceBefore=4)
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# COVER
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(Spacer(1, 2*cm))
story.append(title_block(
"MICRONUTRIENTS IN HEALTH & DISEASE",
"Essential Pediatrics β Chapter 8 | Study Notes"
))
story.append(sp(12))
toc_items = [
"1. Vitamin A Deficiency & Xerophthalmia",
"2. Vitamin B12 (Cobalamin) Deficiency",
"3. Vitamin K β Hemorrhagic Disease of the Newborn",
"4. Trace Elements (Iron, Zinc, Copper, Iodine, Selenium)",
]
for item in toc_items:
story.append(Paragraph(item, style("TOC", fontSize=11,
textColor=DARK_TEAL, fontName="Helvetica-Bold",
spaceBefore=6, leading=16)))
story.append(PageBreak())
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SECTION 1 β VITAMIN A
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(section_header("1. VITAMIN A DEFICIENCY & XEROPHTHALMIA", DARK_TEAL))
story.append(sp(6))
story.append(Paragraph(H2.fontName and "Basic Facts", H2))
story.append(bullet(f"{b('Chemical name:')} Retinol | {b('Type:')} Fat-soluble vitamin"))
story.append(bullet(f"Absorbed in intestine as part of {b('chylomicrons')}"))
story.append(bullet(f"Derived from {b('carotenoids')} (provitamin A) in plants β converted to retinol β stored as {b('retinol palmitate')} in liver"))
story.append(bullet(f"Active forms: {red('Retinal')} + {red('Retinoic acid')}"))
story.append(sp(4))
story.append(Paragraph("Physiological Functions", H2))
story.append(Paragraph("Night Vision", H3))
story.append(bullet(f"Retinol β {b('retinal')}"))
story.append(bullet(f"In eye: {b('11-cis-retinal')} binds opsins β {b('rhodopsin')}"))
story.append(bullet(f"Light: 11-cis-retinal isomerizes to {b('all-trans-retinal')} β dissociates from opsins ({i('bleaching')}) β signal via optic nerve"))
story.append(bullet(f"all-trans-retinal recycled back to 11-cis-retinal via enzymatic reactions"))
story.append(bullet(red("Deficiency β inhibits rhodopsin reformation β NIGHT BLINDNESS")))
story.append(sp(3))
story.append(Paragraph("Growth", H3))
story.append(bullet("Retinal + retinoic acid β bind intracellular receptors β regulate gene expression β proteins for growth and cell differentiation"))
story.append(sp(3))
story.append(Paragraph("Maintenance of Epithelial Tissue", H3))
story.append(bullet("Required for glycoprotein and mucus production + down-regulation of keratin synthesis"))
story.append(bullet("Deficiency β drying of epithelial surfaces + excessive keratin formation β corneal integrity break β infections"))
story.append(sp(5))
story.append(Paragraph("Sources", H2))
story.append(make_table(
["Type", "Foods"],
[
["Plant (provitamin A)", "Carrots, dark-green leafy vegetables, squash, oranges, tomatoes; Ξ²-carotene is the major carotenoid"],
["Animal (preformed retinol)", "Liver, shark/cod liver oil, egg yolk, whole milk, butter"],
["Fortified foods", "Processed foods, infant formulas"],
],
col_widths=[5.5*cm, doc.width-5.5*cm]
))
story.append(sp(5))
story.append(Paragraph("Recommended Daily Allowance", H2))
story.append(make_table(
["Age Group", "RDA"],
[
["Infants", "300β400 Β΅g"],
["Children", "400β600 Β΅g"],
["Adolescents", "750 Β΅g"],
["Pregnant women", "800 Β΅g"],
],
col_widths=[8*cm, doc.width-8*cm]
))
story.append(sp(3))
story.append(highlight_box(
f"Conversions: 1 Β΅g retinol equivalent (RE) = {b('3.3 IU')} | 30 mg retinol = {b('100,000 IU')} vitamin A",
bg=LIGHT_TEAL, border=MED_TEAL
))
story.append(sp(5))
story.append(Paragraph("Clinical Features of Deficiency", H2))
story.append(Paragraph("Mild Deficiency", H3))
story.append(bullet(f"{b('Follicular hyperkeratosis')} β rough skin with raised hyperkeratotic patches (toad skin)"))
story.append(bullet(f"{b('Defective dark adaptation')} β {red('Night blindness')} (characteristic early feature)"))
story.append(bullet(f"{b('Xerophthalmia')} β dry ocular epithelium"))
story.append(bullet(f"{b('Bitot spots')} β foam-like silvery lesions on temporal bulbar conjunctiva (keratinization + mucus/bacteria/debris)"))
story.append(sp(3))
story.append(Paragraph("Severe Deficiency", H3))
story.append(bullet(f"Corneal xerosis β corneal opacity β ulceration β {red('Keratomalacia')} (irreversible)"))
story.append(bullet("Bilateral corneal opacification + corneal perforation"))
story.append(bullet(red("Leading cause of blindness in preschool children in developing countries")))
story.append(bullet("Loss of mucosal integrity (respiratory + GI) β impaired immunity β severe infections, especially measles (β mortality)"))
story.append(sp(5))
story.append(Paragraph("WHO Classification of Xerophthalmia (Table 8.1)", H2))
story.append(make_table(
["Primary Signs", "Secondary Signs"],
[
["X1A β Conjunctival xerosis", "XN β Night blindness"],
["X1B β Bitot's spots", "XF β Fundal changes"],
["X2 β Corneal xerosis", "XS β Corneal scarring"],
["X3A β Corneal ulceration (<1/3 cornea)", ""],
["X3B β Corneal ulceration (>1/3 cornea)", ""],
],
col_widths=[doc.width/2, doc.width/2]
))
story.append(sp(5))
story.append(Paragraph("High-Risk Groups & Diagnosis", H2))
story.append(bullet("Malnourished children; fat malabsorption (celiac disease, liver disease)"))
story.append(bullet(f"Serum retinol: {red('β€15 Β΅g/dL')} (normal: 20β80 Β΅g/dL) β {i('not essential for diagnosis')}"))
story.append(sp(5))
story.append(Paragraph("Treatment", H2))
story.append(make_table(
["Age", "Oral Dose", "Schedule"],
[
["< 6 months", "50,000 IU", "Day 1, Day 2, Week 4"],
["6β12 months", "100,000 IU", "Day 1, Day 2, Week 4"],
["> 1 year", "200,000 IU", "Day 1, Day 2, Week 4"],
],
col_widths=[4.5*cm, 5*cm, doc.width-9.5*cm]
))
story.append(sp(3))
story.append(bullet("Persistent vomiting/malabsorption β parenteral (half oral dose for >6β12 months; 75% for <6 months)"))
story.append(highlight_box(
f"{red('EMERGENCY:')} Corneal clouding β parenteral 50,000β100,000 IU (15β30 mg retinol) immediately",
bg=colors.HexColor("#FDECEA"), border=RED_SOFT, style=BODY
))
story.append(bullet("Keratomalacia: local antibiotic drops + ointment + eye padding"))
story.append(sp(5))
story.append(Paragraph("Prevention (India)", H2))
story.append(bullet(f"Public health problem: Bitot spots in preschool β₯0.5%; xerophthalmia 5β20% in school-going children"))
story.append(bullet(f"{b('National Prophylaxis Program against Nutritional Blindness')} (1970) β expanded to 6β59 months"))
story.append(make_table(
["Age / Event", "Dose"],
[
["9 months (with measles vaccine)", "100,000 IU"],
["15β18 months (with DPT booster)", "200,000 IU"],
["Every 6 months till age 5 years", "200,000 IU"],
["Measles / severe malnutrition (<1 yr)", "100,000 IU"],
["Measles / severe malnutrition (β₯1 yr)", "200,000 IU"],
],
col_widths=[doc.width*0.6, doc.width*0.4]
))
story.append(sp(3))
story.append(highlight_box(
green("Vitamin A supplementation significantly decreases mortality in children with measles"),
bg=colors.HexColor("#E8F8EF"), border=GREEN_SOFT
))
story.append(sp(5))
story.append(Paragraph("Carotenemia", H2))
story.append(bullet("Excess carotene intake (carrots) β deposition in keratin and subcutaneous fat"))
story.append(bullet(f"Yellow skin (face, palms, soles) β {red('sclerae NOT involved')} (differentiates from jaundice)"))
story.append(bullet("Resolves within 2β6 weeks of stopping intake"))
story.append(sp(5))
story.append(Paragraph("Hypervitaminosis A & Teratogenicity", H2))
story.append(bullet(f"Occurs with {b('>50,000 IU/day')} for several weeks (fish liver oil, therapeutic preps, topical retinol for acne)"))
story.append(bullet(f"{b('Acute:')} Pseudotumor cerebri β vomiting, irritability, bulging fontanel, diplopia, headache"))
story.append(bullet(f"{b('Chronic:')} Anorexia, dry skin, alopecia, painful joints, hepatosplenomegaly"))
story.append(bullet(f"{red('Teratogenic')} in high doses in early gestation"))
story.append(highlight_box(
f"WHO pregnancy limit: β€{b('10,000 IU/day')} (3000 Β΅g RE) OR weekly {b('25,000 IU')} (7500 Β΅g RE)",
bg=LIGHT_ORANGE, border=ORANGE
))
story.append(PageBreak())
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SECTION 2 β VITAMIN B12
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(section_header("2. VITAMIN B12 (COBALAMIN) DEFICIENCY", colors.HexColor("#8E44AD")))
story.append(sp(6))
story.append(Paragraph("Physiological Roles", H2))
story.append(make_table(
["Role", "Mechanism", "Effect of Deficiency"],
[
["Methionine synthesis",
"Homocysteine + folate β Methionine + 5-methylTHF (folate regeneration)",
"Folate trapped; β DNA/RNA synthesis β megaloblastic anemia"],
["Succinyl CoA synthesis",
"Methylmalonyl CoA β Succinyl CoA",
"β Methylmalonyl CoA β fatty acid synthesis defect + myelin sheath degeneration"],
],
col_widths=[3.5*cm, 8*cm, doc.width-11.5*cm]
))
story.append(sp(5))
story.append(Paragraph("Requirements", H2))
story.append(make_table(
["Group", "Daily Requirement"],
[
["Infants", "0.3 Β΅g/day"],
["Older children", "0.5 Β΅g/day"],
["Adolescents", "2.0 Β΅g/day"],
],
col_widths=[8*cm, doc.width-8*cm]
))
story.append(sp(3))
story.append(bullet(f"Large body pool in liver; {b('long half-life')} β sufficient for several years"))
story.append(sp(5))
story.append(Paragraph("Sources", H2))
story.append(bullet(f"{b('Animal sources only:')} meat, milk, eggs, fish, liver, heart, muscle"))
story.append(bullet("Intestinal bacteria of certain species produce B12 in their gut β humans must depend on animal sources"))
story.append(highlight_box(
red("Strict vegans and exclusively breastfed infants of vegan mothers are at high risk of B12 deficiency"),
bg=colors.HexColor("#FDECEA"), border=RED_SOFT
))
story.append(sp(5))
story.append(Paragraph("Absorption", H2))
story.append(bullet(f"B12 binds {b('Intrinsic Factor (IF)')} β glycoprotein from gastric parietal cells"))
story.append(bullet(f"Absorbed by receptor-mediated process in {b('ileum')}"))
story.append(bullet(f"Absence of IF β {red('Pernicious anemia')}"))
story.append(bullet("Passive diffusion absorbs small fraction (useful with mega-doses in malabsorption)"))
story.append(sp(5))
story.append(Paragraph("Clinical Features of Deficiency", H2))
story.append(Paragraph("Hematological", H3))
story.append(bullet("Megaloblastic anemia"))
story.append(bullet(f"Peripheral smear: {b('hypersegmented neutrophils')} (β₯5 lobes in β₯5% neutrophils, or β₯6 lobes in a single neutrophil)"))
story.append(bullet("Immature macrocytes (MCV >100 fL), thrombocytopenia"))
story.append(bullet("β Plasma homocysteine + methylmalonic acid"))
story.append(sp(3))
story.append(Paragraph("Neurological", H3))
story.append(bullet(f"Delayed neurodevelopment, seizures, fine tremor, movement disorder β {red('Infantile Tremor Syndrome')}"))
story.append(bullet(f"{b('Subacute combined degeneration:')} demyelination of posterior + lateral columns of spinal cord + peripheral nerves"))
story.append(bullet("Exclusively breastfed infants of deficient mothers at high risk"))
story.append(bullet("Hyperpigmentation of knuckles and nail beds (Fig. 8.9b)"))
story.append(sp(5))
story.append(Paragraph("Diagnosis", H2))
story.append(bullet(f"Serum cobalamin {red('<200 pg/mL')}"))
story.append(bullet("β Plasma homocysteine + methylmalonic acid"))
story.append(sp(5))
story.append(Paragraph("Treatment", H2))
story.append(make_table(
["Route", "Regimen"],
[
["IM (cyanocobalamin / hydroxycobalamin)",
"1000 Β΅g/day Γ 2 weeks β weekly Γ 2β3 weeks β monthly"],
["Oral (if malabsorption)", "500β1000 Β΅g/day"],
["Intrinsic factor defect", "Lifelong parenteral therapy"],
],
col_widths=[6*cm, doc.width-6*cm]
))
story.append(sp(3))
story.append(bullet("Reticulocytosis in 2β4 days; Hb returns to normal in 4β6 weeks"))
story.append(PageBreak())
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SECTION 3 β VITAMIN K / HDN
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(section_header("3. VITAMIN K β HEMORRHAGIC DISEASE OF THE NEWBORN (HDN)", ORANGE))
story.append(sp(6))
story.append(Paragraph("Basic Facts", H2))
story.append(make_table(
["Form", "Source"],
[
["K1 β Phylloquinone", "Derived from plants"],
["K2 β Menaquinone", "Synthesized by intestinal bacteria"],
],
col_widths=[6*cm, doc.width-6*cm]
))
story.append(sp(4))
story.append(Paragraph("Nutritional Requirements", H2))
story.append(make_table(
["Group", "RDA"],
[
["Newborns / Infants", "3β5 Β΅g/day"],
["> 2 years", "10 Β΅g/day"],
["Older children", "10β30 Β΅g/day"],
["Adult women", "90 Β΅g/day"],
["Adult men", "120 Β΅g/day"],
],
col_widths=[8*cm, doc.width-8*cm]
))
story.append(sp(4))
story.append(Paragraph("Absorption & Metabolism", H2))
story.append(bullet(f"Fat-soluble β requires {b('bile and pancreatic juice')}"))
story.append(bullet(f"Absorbed in {b('jejunum')} β chylomicrons β lymph β circulation"))
story.append(bullet(f"{b('Liver')} = primary site of storage and action"))
story.append(sp(4))
story.append(Paragraph("Physiological Function", H2))
story.append(bullet(f"Cofactor for {b('post-translational hepatic carboxylation')} of glutamic acid β gamma-carboxyglutamic acid"))
story.append(bullet(f"Vitamin K-dependent clotting factors: {red('II (prothrombin), VII, IX, X')}"))
story.append(bullet("Facilitates chelation of calcium ions to glutamate + platelet phosphatide β essential for coagulation cascade"))
story.append(sp(5))
story.append(Paragraph("Why Newborns are Especially Prone to Deficiency", H2))
story.append(highlight_box(
f"1. Vitamin K {red('does NOT cross placenta')} β’ "
f"2. Newborns lack adequate intestinal flora to synthesize K endogenously β’ "
f"3. {red('Breast milk is a poor source')} of vitamin K",
bg=LIGHT_ORANGE, border=ORANGE
))
story.append(sp(5))
story.append(Paragraph("Hemorrhagic Disease of the Newborn (HDN)", H2))
story.append(body(f"{b('Definition:')} Syndrome of severe systemic bleeding due to vitamin K deficiency in the newborn period"))
story.append(sp(3))
story.append(Paragraph("Clinical Features", H3))
story.append(bullet(f"Bleeding from: {b('skin (ecchymosis), GI tract, nasal cavity, umbilical stump')}"))
story.append(bullet(f"{red('Intracranial hemorrhage')} β seizures (life-threatening)"))
story.append(sp(3))
story.append(Paragraph("Lab Findings", H3))
story.append(bullet(f"Undetectable plasma vitamin K"))
story.append(bullet(f"β {b('PIVKA')} (Protein Induced by Vitamin K Absence) β uncarboxylated prothrombin"))
story.append(bullet(f"{red('Prolonged PT + aPTT')}"))
story.append(bullet(green("Normal platelet counts")))
story.append(sp(4))
story.append(Paragraph("Classification by Age of Onset", H2))
story.append(make_table(
["Type", "Onset", "Cause"],
[
["Early", "< 24 hours",
"Maternal drugs (primidone, warfarin, phenytoin) β antagonize vitamin K"],
["Classic", "First week of life",
"Normal breastfed babies not given vitamin K at birth"],
["Late", "1β12 weeks",
"Underlying liver disease or defects in vitamin K metabolism"],
],
col_widths=[2.5*cm, 3.5*cm, doc.width-6*cm]
))
story.append(sp(5))
story.append(Paragraph("Treatment & Prophylaxis", H2))
story.append(bullet(f"{b('Treatment:')} IV Vitamin K + Fresh Frozen Plasma"))
story.append(highlight_box(
f"{green('PROPHYLAXIS:')} Routine administration of {b('0.5β1 mg Vitamin K IM')} at birth to ALL healthy newborns",
bg=colors.HexColor("#E8F8EF"), border=GREEN_SOFT
))
story.append(bullet("Infants with liver disease/vitamin K metabolism defects β higher dose IV vitamin K + FFP"))
story.append(PageBreak())
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SECTION 4 β TRACE ELEMENTS
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(section_header("4. TRACE ELEMENTS", colors.HexColor("#1A7A4A")))
story.append(sp(6))
story.append(highlight_box(
f"11 'major' elements = 99% of body weight (C, H, O, N, Na, K, Ca, P, S, Cl, Mg). "
f"Trace elements are the remaining minerals β function as cofactors for enzyme systems "
f"(metal-ion-activated enzymes or {b('metalloenzymes')}).",
bg=LIGHT_TEAL, border=MED_TEAL
))
story.append(sp(6))
# IRON
story.append(Paragraph("IRON (Fe)", H2))
story.append(bullet(f"{red('Most common nutritional problem')} among infants and young children"))
story.append(bullet(f"NFHS-V (2019β21): {red('67% of children')} aged 6 monthsβ5 years were anemic"))
story.append(bullet(f"{b('Functions:')} hemoglobin, myoglobin, cytochromes; DNA synthesis, cognitive function, immune function, physical performance, social-emotional development"))
story.append(bullet(f"{b('Deficiency:')} iron deficiency anemia, impaired cognitive and physical function; Anemia-Mukt Bharat Initiative (Chapter 13)"))
story.append(sp(6))
# ZINC
story.append(Paragraph("ZINC (Zn)", H2))
story.append(bullet(f"{b('Second most common')} trace element in the body after iron"))
story.append(bullet(f">200 zinc-dependent enzymatic reactions"))
story.append(Paragraph("Functions", H3))
story.append(bullet("Regulates gene transcription and cellular protein synthesis"))
story.append(bullet(f"Component of {b('zinc finger proteins')}"))
story.append(bullet(f"DNA polymerase and RNA polymerase are zinc-dependent"))
story.append(bullet(f"{b('Thymidine kinase')} is zinc-dependent"))
story.append(bullet(f"{b('Zinc superoxide dismutase')} β antioxidant"))
story.append(bullet("Required for functioning of immune, epidermal, GI, CNS, skeletal, reproductive systems"))
story.append(sp(3))
story.append(Paragraph("Sources & Absorption", H3))
story.append(bullet("Mainly animal protein: liver, meat, fish, nuts, eggs"))
story.append(bullet("Plants/legumes: lower bioavailability (phytates β absorption)"))
story.append(bullet(f"{b('~90%')} of total body zinc in bone and skeletal muscle"))
story.append(bullet("Zinc loosely bound to albumin in systemic circulation"))
story.append(sp(3))
story.append(Paragraph("Zinc Deficiency β Clinical Features", H3))
story.append(bullet(f"{b('Poor physical growth')} β most prominent feature (delayed sexual maturation/hypogonadism in adolescents)"))
story.append(bullet("Impaired immune function, anorexia, diarrhea, alopecia, dermatitis, skeletal abnormalities"))
story.append(bullet("Infants, children, adolescents, pregnant/lactating women have increased demand"))
story.append(sp(3))
story.append(Paragraph("Acrodermatitis Enteropathica", H3))
story.append(make_table(
["Feature", "Details"],
[
["Genetics", "Autosomal recessive"],
["Cause", "Impaired intestinal zinc transporter protein ZIP4"],
["Onset", "Early infancy"],
["Skin lesions", "Eczematous lesions perioral, perineum, buttocks, acral areas"],
["Other features", "Alopecia, diarrhea, impaired wound healing, impaired immunity, skeletal abnormalities"],
["Treatment", "Zinc sulfate or zinc acetate supplementation"],
],
col_widths=[4*cm, doc.width-4*cm]
))
story.append(sp(6))
# COPPER
story.append(Paragraph("COPPER (Cu)", H2))
story.append(bullet("Component of several metalloenzymes for oxidative metabolism"))
story.append(bullet(f"Transported in blood by {b('ceruloplasmin')} (main transport protein)"))
story.append(bullet(f"{b('Sources:')} meats, liver, seafood, nuts, seeds"))
story.append(bullet(f"{b('Deficiency:')} infrequent; secondary to malabsorption, liver disease, prolonged dialysis"))
story.append(bullet("Features: sideroblastic anemia unresponsive to iron therapy, neurological problems"))
story.append(bullet(f"{b('Wilson disease')} β copper transport disrupted (excess accumulation in liver, brain, cornea)"))
story.append(bullet(f"{b('Menkes disease')} β X-linked; impaired copper absorption; steely hair, neurodegeneration"))
story.append(sp(6))
# IODINE
story.append(Paragraph("IODINE (I)", H2))
story.append(bullet(f"Essential for {b('thyroxine (T4)')} and {b('triiodothyronine (T3)')} synthesis"))
story.append(bullet("Key role in body growth and brain development, especially fetal brain"))
story.append(sp(3))
story.append(Paragraph("Sources", H3))
story.append(bullet("Naturally iodine-rich: sea water, sea plants/seafood"))
story.append(bullet("Iodine-deficient areas in India: Himalayan belt and Ganges valley"))
story.append(sp(3))
story.append(Paragraph("Recommended Daily Intake", H3))
story.append(make_table(
["Group", "RDI"],
[
["Children 6β12 years", "120 Β΅g/day"],
["Pregnant/lactating women", "150 Β΅g/day"],
["> 12 years / adults", "150 Β΅g/day"],
],
col_widths=[8*cm, doc.width-8*cm]
))
story.append(sp(4))
story.append(Paragraph("Iodine Deficiency Disorders (IDD)", H3))
story.append(make_table(
["Stage", "Key Features"],
[
["Fetus",
"Abortions, stillbirths, congenital anomalies, endemic cretinism, β perinatal mortality, neonatal hypothyroidism"],
["Neonate",
"Neonatal goiter, neonatal hypothyroidism"],
["Child/Adolescent",
"Goiter, subclinical hypothyroidism, impaired mental function, retarded physical development"],
],
col_widths=[3.5*cm, doc.width-3.5*cm]
))
story.append(sp(3))
story.append(Paragraph("Endemic Cretinism", H3))
story.append(bullet(f"{b('Neurological cretinism')} (damage before thyroid maturation): deaf-mutism, spastic diplegia"))
story.append(bullet(f"{b('Myxedematous cretinism')}: hypothyroidism, dwarfism"))
story.append(sp(3))
story.append(Paragraph("Urinary Iodine Assessment", H3))
story.append(make_table(
["Urinary Iodine", "Status"],
[
["< 20 Β΅g/day", "Severe deficiency"],
["20β49 Β΅g/day", "Moderate deficiency"],
["50β99 Β΅g/day", "Mild insufficiency"],
["< 100 Β΅g/day", "Iodine insufficiency in a community"],
],
col_widths=[5*cm, doc.width-5*cm]
))
story.append(sp(3))
story.append(highlight_box(
f"{green('PREVENTION:')} Universal Iodization of Salt β target iodine at manufacturing plants: {b('30 ppm')}; at distribution: {b('15 ppm')} (National Iodine Deficiency Disorders Control Program, India)",
bg=colors.HexColor("#E8F8EF"), border=GREEN_SOFT
))
story.append(sp(6))
# SELENIUM
story.append(Paragraph("SELENIUM (Se)", H2))
story.append(bullet(f"Constituent of {b('glutathione peroxidase')} (major antioxidant enzyme)"))
story.append(bullet("Part of deiodinase enzyme β helps maintain normal thyroid function and immune function"))
story.append(bullet(f"{b('Keshan disease')}: selenium deficiency β {red('fatal cardiomyopathy')} (endemic in parts of Africa/China)"))
story.append(bullet("Deficiency features: cardiomyopathy, hair whitening, neurological findings, low plasma ceruloplasmin, neutropenia, anemia"))
story.append(sp(6))
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# MEMORY AIDS
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(section_header("QUICK MEMORY AIDS", colors.HexColor("#2C3E50")))
story.append(sp(6))
memory_items = [
f"{purple('Vit A treatment doses:')} 50k / 100k / 200k IU for <6m / 6-12m / >1yr β repeat Day 1, Day 2, Week 4",
f"{purple('HDN classification:')} Early (<24h) = maternal drugs | Classic (week 1) = no K at birth | Late (1β12 wks) = liver disease",
f"{purple('Vitamin K-dependent factors:')} II, VII, IX, X β remember '1972 + 10'",
f"{purple('B12 deficiency triad:')} Megaloblastic anemia + Subacute combined degeneration + Infantile tremor syndrome",
f"{purple('Zinc deficiency hallmark:')} Acrodermatitis enteropathica β ZIP4 mutation, autosomal recessive",
f"{purple('Carotenemia vs jaundice:')} Yellow skin in both BUT sclerae are CLEAR in carotenemia",
f"{purple('PIVKA = ')} Protein Induced by Vitamin K Absence (uncarboxylated prothrombin) β marker of HDN",
f"{purple('Pernicious anemia = ')} absent Intrinsic Factor β B12 malabsorption β megaloblastic anemia + subacute combined degeneration",
f"{purple('Carotenemia resolves in:')} 2β6 weeks after stopping carotene intake",
f"{purple('Iodine targets (India salt):')} 30 ppm at manufacturing | 15 ppm at distribution",
]
for item in memory_items:
data = [[Paragraph(f"β
{item}", MEMORY)]]
t = Table(data, colWidths=[doc.width])
t.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), LIGHT_PURPLE),
("BOX",(0,0),(-1,-1), 0.5, PURPLE),
("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",[3]),
]))
story.append(t)
story.append(sp(4))
story.append(sp(8))
story.append(Paragraph(
"Source: Essential Pediatrics, Chapter 8 β Micronutrients in Health and Disease",
style("Footer", fontSize=8, textColor=MID_GREY, alignment=TA_CENTER,
fontName="Helvetica-Oblique")
))
# ββ Build βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
doc.build(story)
print(f"PDF saved to: {OUTPUT}")