mkdir -p /tmp/workspace/vitamins-flashcards && python3 - << 'PYEOF'
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Table, TableStyle, Paragraph,
Spacer, PageBreak, HRFlowable)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.pdfgen import canvas
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate
# ββ Color palette ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DARK_BLUE = colors.HexColor('#1a237e')
MED_BLUE = colors.HexColor('#283593')
LIGHT_BLUE = colors.HexColor('#e8eaf6')
FAT_COLOR = colors.HexColor('#e65100') # orange β fat-soluble header
FAT_LIGHT = colors.HexColor('#fff3e0')
WATER_COLOR = colors.HexColor('#1565c0') # blue β water-soluble header
WATER_LIGHT = colors.HexColor('#e3f2fd')
EXAM_COLOR = colors.HexColor('#2e7d32') # green β exam Q&A
EXAM_LIGHT = colors.HexColor('#e8f5e9')
Q_COLOR = colors.HexColor('#4a148c') # purple β question
A_COLOR = colors.HexColor('#1b5e20') # dark green β answer
GRAY_LIGHT = colors.HexColor('#f5f5f5')
GRAY_MED = colors.HexColor('#e0e0e0')
WHITE = colors.white
OUTPUT = '/tmp/workspace/vitamins-flashcards/Vitamins_Flashcards.pdf'
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.5*cm, leftMargin=1.5*cm,
topMargin=1.8*cm, bottomMargin=1.8*cm,
title='Vitamins Flashcards β Biochemistry Quick Review',
author='Orris Medical'
)
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
title_style = S('Title', fontSize=22, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold', leading=28)
sub_style = S('Sub', fontSize=11, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica', leading=14)
sec_style = S('Sec', fontSize=13, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold', leading=16)
body_style = S('Body', fontSize=9, textColor=colors.black, alignment=TA_LEFT, fontName='Helvetica', leading=12)
bold_style = S('Bold', fontSize=9, textColor=DARK_BLUE, alignment=TA_LEFT, fontName='Helvetica-Bold', leading=12)
q_style = S('Q', fontSize=9, textColor=Q_COLOR, alignment=TA_LEFT, fontName='Helvetica-Bold', leading=13)
a_style = S('A', fontSize=9, textColor=A_COLOR, alignment=TA_LEFT, fontName='Helvetica', leading=13)
label_style = S('Label', fontSize=8, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold', leading=10)
cell_h_style = S('CellH', fontSize=9, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold', leading=12)
cell_b_style = S('CellB', fontSize=8, textColor=colors.black, alignment=TA_LEFT, fontName='Helvetica', leading=11)
coenz_h_style = S('CoH', fontSize=8, textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold', leading=11)
coenz_b_style = S('CoB', fontSize=8, textColor=colors.black, alignment=TA_LEFT, fontName='Helvetica', leading=11)
# βββ helper: flashcard row βββββββββββββββββββββββββββββββββββββββββββββββββββββ
def flashcard(vit_label, vit_name, color_bg, color_header,
rows, # list of (field_name, value)
defic_label='Deficiency Disease',
width=17*cm):
"""Returns a Table that looks like a flash card."""
col_w = [3.5*cm, width - 3.5*cm]
data = []
# header row
data.append([
Paragraph(vit_label, label_style),
Paragraph(vit_name, cell_h_style)
])
for field, val in rows:
data.append([
Paragraph(field, S('fld', fontSize=7.5, textColor=WHITE,
alignment=TA_CENTER, fontName='Helvetica-Bold', leading=10)),
Paragraph(val, cell_b_style)
])
t = Table(data, colWidths=col_w, repeatRows=0)
# base style
ts = [
('BACKGROUND', (0,0), (0,0), color_header),
('BACKGROUND', (1,0), (1,0), color_header),
('BACKGROUND', (0,1), (0,-1), color_header),
('BACKGROUND', (1,1), (1,-1), color_bg),
('GRID', (0,0), (-1,-1), 0.4, WHITE),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('ROUNDEDCORNERS', [5]),
]
t.setStyle(TableStyle(ts))
return t
# βββ helper: exam Q&A card ββββββββββββββββββββββββββββββββββββββββββββββββββββ
def qa_card(q_num, question, answer, width=17*cm):
col_w = [1*cm, width - 1*cm]
data = [
[Paragraph(f'Q{q_num}', label_style), Paragraph(question, q_style)],
[Paragraph('A', label_style), Paragraph(answer, a_style)],
]
t = Table(data, colWidths=col_w)
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (0,0), Q_COLOR),
('BACKGROUND', (1,0), (1,0), colors.HexColor('#f3e5f5')),
('BACKGROUND', (0,1), (0,1), EXAM_COLOR),
('BACKGROUND', (1,1), (1,1), EXAM_LIGHT),
('GRID', (0,0), (-1,-1), 0.4, GRAY_MED),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 6),
('ROUNDEDCORNERS', [4]),
]))
return t
# βββ helper: section banner βββββββββββββββββββββββββββββββββββββββββββββββββββ
def banner(text, bg, width=17*cm):
data = [[Paragraph(text, sec_style)]]
t = Table(data, colWidths=[width])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), bg),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 10),
('ROUNDEDCORNERS', [6]),
]))
return t
def sp(h=0.25*cm): return Spacer(1, h)
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# BUILD STORY
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story = []
# βββ COVER ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
cov_data = [[Paragraph('VITAMINS', title_style)],
[Paragraph('Biochemistry Quick-Review Flashcards', sub_style)],
[Paragraph('Fat-Soluble Β· Water-Soluble Β· Coenzymes Β· Exam Q&A', sub_style)]]
cov = Table(cov_data, colWidths=[17*cm])
cov.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), DARK_BLUE),
('TOPPADDING', (0,0), (-1,-1), 14),
('BOTTOMPADDING', (0,0), (-1,-1), 14),
('LEFTPADDING', (0,0), (-1,-1), 10),
('ROUNDEDCORNERS', [10]),
]))
story += [cov, sp(0.4*cm)]
# classification mini-table
cls_head = [
Paragraph('FAT-SOLUBLE', S('ch', fontSize=9, textColor=WHITE,
alignment=TA_CENTER, fontName='Helvetica-Bold', leading=12)),
Paragraph('WATER-SOLUBLE', S('ch2', fontSize=9, textColor=WHITE,
alignment=TA_CENTER, fontName='Helvetica-Bold', leading=12)),
]
cls_data = [
cls_head,
[Paragraph('A Β· D Β· E Β· K\nStored in liver/fat\nToxicity possible',
S('cv', fontSize=8, textColor=colors.black, alignment=TA_CENTER,
fontName='Helvetica', leading=11)),
Paragraph('B1 B2 B3 B5 B6 B7 B9 B12 Β· Vit C\nNot stored β daily intake needed\nExcreted in urine',
S('cv2', fontSize=8, textColor=colors.black, alignment=TA_CENTER,
fontName='Helvetica', leading=11))],
]
cls_t = Table(cls_data, colWidths=[8.5*cm, 8.5*cm])
cls_t.setStyle(TableStyle([
('BACKGROUND', (0,0),(0,0), FAT_COLOR),
('BACKGROUND', (1,0),(1,0), WATER_COLOR),
('BACKGROUND', (0,1),(0,1), FAT_LIGHT),
('BACKGROUND', (1,1),(1,1), WATER_LIGHT),
('GRID', (0,0),(-1,-1), 0.5, WHITE),
('TOPPADDING', (0,0),(-1,-1), 6),
('BOTTOMPADDING', (0,0),(-1,-1), 6),
('ALIGN', (0,0),(-1,-1), 'CENTER'),
('VALIGN', (0,0),(-1,-1), 'MIDDLE'),
('ROUNDEDCORNERS', [6]),
]))
story += [cls_t, sp(0.5*cm)]
# βββ FAT-SOLUBLE SECTION ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story += [banner('πΆ FAT-SOLUBLE VITAMINS (A Β· D Β· E Β· K)', FAT_COLOR), sp()]
fat_cards = [
('VIT A', 'Vitamin A β Retinol', [
('Sources', 'Plants: Ξ²-Carotene (dark leafy veg, carrots, mango)\nAnimals: Retinyl esters (liver, egg yolk, dairy)'),
('Active forms', 'Retinol Β· Retinal (vision) Β· Retinoic acid (cell differentiation)'),
('Functions', 'Rhodopsin synthesis (night vision) Β· Epithelial integrity Β· Immune regulation'),
('Deficiency', 'βΆ Night blindness (1st sign) βΆ Bitot\'s spots βΆ Xerophthalmia βΆ Keratomalacia\nβΆ Follicular hyperkeratosis (toad skin)'),
('Toxicity', 'βΆ Teratogenic in pregnancy βΆ Pseudotumor cerebri βΆ Hepatotoxicity'),
('Lab test', 'Carr-Price reaction β blue-green colour'),
]),
('VIT D', 'Vitamin D β Calciferol', [
('Synthesis', 'Skin (UV-B): 7-Dehydrocholesterol β Cholecalciferol (D3)\nDiet: Ergocalciferol (D2) from plants'),
('Activation', 'Liver β 25-OH D3 (Calcidiol) [storage/transport, measured in blood]\nKidney β 1,25-(OH)βD3 (Calcitriol) [MOST ACTIVE FORM]'),
('Functions', 'β Intestinal CaΒ²βΊ absorption Β· β Phosphate absorption Β· Bone mineralisation\nParathyroid hormone (PTH) stimulates renal 1Ξ±-hydroxylase'),
('Deficiency', 'Children β RICKETS (bow legs, rachitic rosary, craniotabes)\nAdults β OSTEOMALACIA (bone pain, muscle weakness)'),
('Toxicity', 'Hypercalcaemia Β· Hypercalciuria Β· Metastatic calcification Β· Renal stones'),
]),
('VIT E', 'Vitamin E β Tocopherols', [
('Active form', 'Ξ±-Tocopherol (most potent)'),
('Functions', 'Antioxidant β protects cell membrane lipids from peroxidation\nScavenges free radicals; protects RBCs from haemolysis'),
('Deficiency', 'Premature infants β Haemolytic anaemia\nAdults (malabsorption) β Spinocerebellar ataxia Β· Peripheral neuropathy'),
('Toxicity', 'High doses antagonise Vitamin K β β Bleeding risk'),
('Sources', 'Vegetable oils Β· Nuts Β· Wheat germ Β· Green leafy vegetables'),
]),
('VIT K', 'Vitamin K β Phylloquinone / Menaquinone', [
('Types', 'K1 (Phylloquinone) β plants Β· K2 (Menaquinone) β gut bacteria Β· K3 (Menadione) β synthetic'),
('Mechanism', 'Cofactor for Ξ³-Glutamyl carboxylase\nβ Post-translational Ξ³-carboxylation of Glu residues\nβ Activates clotting factors II, VII, IX, X + Protein C, S'),
('Deficiency', 'βΆ Prolonged PT/INR Β· Bleeding Β· Haemorrhagic disease of newborn\nβΆ Neonates receive IM Vit K at birth (sterile gut = no K2)'),
('Warfarin', 'Blocks Vit K epoxide reductase (VKOR) β no Vit K recycling β anticoagulation\nAntidote: Vitamin K (IV/oral) + Fresh frozen plasma (FFP)'),
]),
]
for label, name, rows in fat_cards:
story += [flashcard(label, name, FAT_LIGHT, FAT_COLOR, rows), sp(0.3*cm)]
story.append(PageBreak())
# βββ WATER-SOLUBLE SECTION ββββββββββββββββββββββββββββββββββββββββββββββββββββ
story += [banner('π§ WATER-SOLUBLE VITAMINS (B-Complex Β· Vitamin C)', WATER_COLOR), sp()]
water_cards = [
('B1', 'Thiamine β Vitamin B1', [
('Active form', 'TPP β Thiamine PyroPhosphate'),
('Functions', '1. Pyruvate dehydrogenase (Pyruvate β Acetyl-CoA)\n2. Ξ±-Ketoglutarate dehydrogenase (Ξ±-KG β Succinyl-CoA)\n3. Transketolase (Pentose phosphate pathway)'),
('Deficiency β Beriberi', 'Wet Beriberi: Dilated cardiomyopathy, high-output heart failure, oedema\nDry Beriberi: Peripheral neuropathy (motor + sensory)'),
('Deficiency β Wernicke-Korsakoff', 'Wernicke: Confusion + Ataxia + Ophthalmoplegia (triad) β alcoholics\nKorsakoff: Anterograde amnesia + Confabulation (irreversible)'),
('Cause', 'Polished rice diet Β· Chronic alcoholism Β· Prolonged TPN without supplementation'),
]),
('B2', 'Riboflavin β Vitamin B2', [
('Active forms', 'FMN (Flavin Mononucleotide) Β· FAD (Flavin Adenine Dinucleotide)'),
('Functions', 'Electron carrier in oxidation-reduction reactions\nETC (Complex I, II) Β· Ξ²-Oxidation Β· TCA cycle'),
('Deficiency', 'βΆ Angular stomatitis (fissures at mouth corners)\nβΆ Cheilosis (cracked lips) Β· Glossitis (magenta tongue)\nβΆ Corneal vascularisation Β· Scrotal/vulval dermatitis'),
('Sources', 'Milk Β· Eggs Β· Liver Β· Green vegetables'),
]),
('B3', 'Niacin β Vitamin B3', [
('Active forms', 'NADβΊ / NADH Β· NADPβΊ / NADPH'),
('Synthesis', '60 mg Tryptophan β 1 mg Niacin (requires B6)\nRequires B2 and B6 for conversion'),
('Functions', 'Oxidation-reduction: Glycolysis Β· TCA cycle Β· Ξ²-Oxidation Β· Fatty acid synthesis'),
('Deficiency β Pellagra', '4 Ds: Dermatitis (photosensitive, Casal\'s necklace) Β· Diarrhea Β· Dementia Β· Death'),
('Drug link', 'INH (Isoniazid) β B6 deficiency β β TrpβNiacin conversion β Pellagra\nGive Niacin + B6 prophylactically with INH'),
('Pharmacology','High-dose Niacin: β LDL Β· β TG Β· β HDL (flushing side effect β prevent with aspirin)'),
]),
('B5', 'Pantothenic Acid β Vitamin B5', [
('Active form', 'Coenzyme A (CoA) β contains Ξ²-Alanine from pantothenic acid'),
('Functions', 'Acetyl-CoA carrier: Fatty acid synthesis Β· TCA cycle Β· Cholesterol synthesis\nAcyl-carrier protein (ACP) in fatty acid synthase complex'),
('Deficiency', '"Burning feet syndrome" β rare\nDermatitis Β· Alopecia Β· Adrenal insufficiency'),
]),
('B6', 'Pyridoxine β Vitamin B6', [
('Active form', 'PLP β Pyridoxal Phosphate'),
('Functions', '1. Transamination (amino acid metabolism)\n2. Decarboxylation (neurotransmitter synthesis)\n3. Heme synthesis (ALA synthase)\n4. Converts Trp β Niacin\n5. Glycogenolysis (glycogen phosphorylase)'),
('Deficiency', 'βΆ Peripheral neuropathy Β· Sideroblastic anaemia\nβΆ Convulsions in neonates Β· Seborrhoeic dermatitis\nβΆ Cheilosis Β· Glossitis'),
('Drug link', 'INH, Isoniazid, Hydralazine, Penicillamine β B6 deficiency'),
('Neurotransmitters made', 'Serotonin Β· GABA Β· Dopamine Β· Noradrenaline Β· Histamine'),
]),
('B7', 'Biotin β Vitamin B7', [
('Active form', 'Biocytin (enzyme-bound biotin) β COβ carrier'),
('Functions', '1. Pyruvate carboxylase (Pyruvate β OAA)\n2. Acetyl-CoA carboxylase (Acetyl-CoA β Malonyl-CoA)\n3. Propionyl-CoA carboxylase\n4. Ξ²-Methylcrotonyl-CoA carboxylase'),
('Deficiency', 'βΆ Alopecia Β· Dermatitis Β· Neurological symptoms\nβΆ "Biotin deficiency face" (periorificial dermatitis)'),
('Avidin', 'Raw egg white β Avidin binds biotin β blocks absorption\nCooked egg white: avidin denatured β biotin absorbed normally'),
]),
('B9', 'Folic Acid β Vitamin B9', [
('Active form', 'THF β TetraHydroFolate (one-carbon carrier)'),
('Activation', 'Folate β Dihydrofolate (DHF) β [DHFR] β THF'),
('Functions', '1. Thymidylate synthesis (dTMP for DNA)\n2. Purine synthesis\n3. Homocysteine β Methionine (with B12)'),
('Deficiency', 'βΆ Megaloblastic (macrocytic) anaemia\nβΆ Neural tube defects (periconceptional supplementation 400 mcg/day)\nβΆ Hyperhomocysteinaemia'),
('Drug link', 'Methotrexate Β· Trimethoprim block DHFR β folate deficiency\nRescue: Leucovorin (folinic acid) bypasses DHFR'),
('B9 vs B12', 'BOTH β Megaloblastic anaemia\nOnly B12 β SACD + β Methylmalonic acid'),
]),
('B12', 'Cobalamin β Vitamin B12', [
('Active forms', 'Methylcobalamin (cytoplasm) Β· Adenosylcobalamin (mitochondria)'),
('Absorption', 'B12 + Intrinsic Factor (parietal cells) β terminal ILEUM\nCarried in blood by Transcobalamin II'),
('Functions', '1. Methylcobalamin: Homocysteine β Methionine (activates folate)\n2. Adenosylcobalamin: Methylmalonyl-CoA β Succinyl-CoA'),
('Deficiency', 'βΆ Megaloblastic anaemia\nβΆ SACD (subacute combined degeneration β dorsal + lateral columns)\nβΆ β Homocysteine Β· β Methylmalonic acid (specific marker)'),
('Pernicious anaemia', 'Autoimmune gastritis β no parietal cells β no IF β B12 malabsorption\nAnti-IF antibodies Β· Anti-parietal cell antibodies'),
('Sources', 'Only in ANIMAL products: meat, fish, eggs, dairy\nVegans must supplement'),
]),
('VIT C', 'Vitamin C β Ascorbic Acid', [
('Functions', '1. Collagen synthesis: hydroxylation of Pro & Lys (prolyl/lysyl hydroxylase)\n2. Antioxidant (regenerates Vit E)\n3. FeΒ³βΊ β FeΒ²βΊ (β non-haem iron absorption)\n4. Noradrenaline synthesis Β· Carnitine synthesis Β· Immune function'),
('Deficiency β SCURVY', 'βΆ Perifollicular haemorrhage\nβΆ Corkscrew / swan-neck hairs\nβΆ Bleeding gums Β· Loose teeth\nβΆ Poor wound healing Β· Haemarthrosis\nβΆ Subperiosteal haemorrhage (children)'),
('Sources', 'Citrus fruits Β· Kiwi Β· Berries Β· Bell peppers Β· Broccoli'),
('Toxicity', 'High doses β Oxalate kidney stones Β· GI upset Β· Rebound scurvy on withdrawal'),
]),
]
for label, name, rows in water_cards:
story += [flashcard(label, name, WATER_LIGHT, WATER_COLOR, rows), sp(0.3*cm)]
story.append(PageBreak())
# βββ COENZYME TABLE βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story += [banner('βοΈ COENZYME QUICK-REFERENCE TABLE', MED_BLUE), sp(0.3*cm)]
coh = [Paragraph(t, coenz_h_style) for t in ['Vitamin','Coenzyme','Key Reactions','Mnemonic']]
co_rows = [
coh,
['B1 Thiamine', 'TPP', 'Pyruvate DH Β· Ξ±-KG DH Β· Transketolase', 'The Pentose Path'],
['B2 Riboflavin', 'FAD Β· FMN', 'ETC Complex I & II Β· Ξ²-Oxidation', 'Flavin = Yellow'],
['B3 Niacin', 'NADβΊ Β· NADPβΊ', 'Glycolysis Β· TCA Β· FA synthesis', 'NAD needs Niacin'],
['B5 Pantothenate', 'CoA', 'Acetyl-CoA carrier Β· FA synthesis', 'CoA = Carrier of Acetyl'],
['B6 Pyridoxine', 'PLP', 'Transamination Β· ALA synthase Β· TrpβNiacin', 'PLP = amino acid worker'],
['B7 Biotin', 'Biocytin (COβ)', 'Pyruvate carboxylase Β· Acetyl-CoA carboxylase','Biotin Binds COβ'],
['B9 Folate', 'THF', 'Thymidylate synthesis Β· Purines Β· Met synth', 'THF Transfers carbons'],
['B12 Cobalamin', 'Methylcob. / Ado-cob.', 'Methionine synth Β· MMAβSuccinyl-CoA', 'B12 = Myelin protector'],
]
for i,r in enumerate(co_rows[1:], 1):
co_rows[i] = [Paragraph(str(c), coenz_b_style) for c in r]
cw = [3.2*cm, 3.2*cm, 6.0*cm, 4.6*cm]
co_t = Table(co_rows, colWidths=cw, repeatRows=1)
co_t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), MED_BLUE),
('BACKGROUND', (0,1), (-1,1), LIGHT_BLUE),
('BACKGROUND', (0,2), (-1,2), WHITE),
('BACKGROUND', (0,3), (-1,3), LIGHT_BLUE),
('BACKGROUND', (0,4), (-1,4), WHITE),
('BACKGROUND', (0,5), (-1,5), LIGHT_BLUE),
('BACKGROUND', (0,6), (-1,6), WHITE),
('BACKGROUND', (0,7), (-1,7), LIGHT_BLUE),
('BACKGROUND', (0,8), (-1,8), WHITE),
('GRID', (0,0), (-1,-1), 0.4, GRAY_MED),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('ROUNDEDCORNERS', [4]),
]))
story += [co_t, sp(0.5*cm)]
# βββ DEFICIENCY QUICK MAP βββββββββββββββββββββββββββββββββββββββββββββββββββββ
story += [banner('π©Ί DEFICIENCY β DISEASE QUICK MAP', colors.HexColor('#4a148c')), sp(0.3*cm)]
def_rows = [
[Paragraph(t, coenz_h_style) for t in ['Vitamin','Deficiency Disease','Classic Features']],
['A', 'Xerophthalmia / Night blindness', 'Bitot\'s spots Β· Keratomalacia Β· Toad skin'],
['D', 'Rickets (child) / Osteomalacia (adult)', 'Bow legs Β· Rachitic rosary Β· Bone pain'],
['E', 'Haemolytic anaemia (premature)', 'RBC haemolysis Β· Spinocerebellar ataxia'],
['K', 'Bleeding diathesis / HDN', 'β PT/INR Β· Haem. disease of newborn'],
['B1', 'Beriberi / Wernicke-Korsakoff', 'Wet: cardiomyopathy Β· Dry: neuropathy Β· WE triad'],
['B2', 'Ariboflavinosis', 'Angular stomatitis Β· Magenta tongue Β· Corneal vascularisation'],
['B3', 'Pellagra', '4 Ds: Dermatitis Β· Diarrhoea Β· Dementia Β· Death'],
['B5', 'Burning feet (rare)', 'Dermatitis Β· Alopecia Β· Adrenal insufficiency'],
['B6', 'Sideroblastic anaemia / neuropathy', 'Peripheral neuropathy Β· Convulsions Β· Cheilosis'],
['B7', 'Dermatitis / Alopecia', 'Avidin (raw egg white) binds biotin'],
['B9', 'Megaloblastic anaemia / NTD', 'Macrocytic RBCs Β· Neural tube defects in pregnancy'],
['B12', 'Megaloblastic anaemia + SACD', 'Cord demyelination Β· β Methylmalonic acid'],
['C', 'Scurvy', 'Corkscrew hairs Β· Perifollicular haemorrhage Β· Bleeding gums'],
]
for i, r in enumerate(def_rows[1:], 1):
def_rows[i] = [Paragraph(str(c), coenz_b_style) for c in r]
dw = [1.5*cm, 5.0*cm, 10.5*cm]
def_t = Table(def_rows, colWidths=dw, repeatRows=1)
def_t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#4a148c')),
*[('BACKGROUND', (0,i), (-1,i), LIGHT_BLUE if i%2==0 else WHITE) for i in range(1,14)],
('GRID', (0,0), (-1,-1), 0.4, GRAY_MED),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('ROUNDEDCORNERS', [4]),
]))
story += [def_t]
story.append(PageBreak())
# βββ EXAM Q&A SECTION βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story += [banner('π MOST REPEATED EXAM QUESTIONS & ANSWERS', EXAM_COLOR), sp(0.4*cm)]
qa_list = [
('1', 'What is the MOST ACTIVE form of Vitamin D?',
'1,25-Dihydroxycholecalciferol (Calcitriol) β made in kidney by 1Ξ±-hydroxylase\n(25-OH D3 = storage form; measured in blood tests)'),
('2', 'Carr-Price reaction detects which vitamin?',
'Vitamin A β gives blue-green colour with antimony trichloride'),
('3', 'Deficiency of which vitamin causes Night blindness?',
'Vitamin A β retinal needed for rhodopsin (visual pigment in rod cells)'),
('4', 'What is the coenzyme form of Thiamine (B1)?',
'TPP (Thiamine PyroPhosphate) β used in oxidative decarboxylation reactions'),
('5', 'Classic triad of Wernicke\'s encephalopathy?',
'Confusion + Ataxia + Ophthalmoplegia β B1 deficiency in alcoholics\nTreat urgently with IV thiamine BEFORE glucose'),
('6', 'Niacin is synthesised from which amino acid?',
'Tryptophan β 60 mg Trp = 1 mg Niacin (requires B6 + B2)'),
('7', 'Pellagra: causes and the 4 Ds?',
'Cause: Niacin/B3 deficiency (also INH therapy, carcinoid syndrome)\n4 Ds: Dermatitis (photosensitive, Casal\'s necklace) Β· Diarrhea Β· Dementia Β· Death'),
('8', 'Vitamin K is cofactor for which enzyme? Which factors are activated?',
'Ξ³-Glutamyl carboxylase β carboxylates factors II, VII, IX, X + Protein C, S\nWarfarin blocks Vit K epoxide reductase (VKOR)'),
('9', 'Vitamin B12 absorption requires what? Where is it absorbed?',
'Intrinsic Factor (IF) from gastric parietal cells\nAbsorbed at terminal ileum as B12-IF complex'),
('10', 'What is Pernicious Anaemia?',
'Autoimmune gastritis β destruction of parietal cells β no Intrinsic Factor\nβ B12 malabsorption β Megaloblastic anaemia + SACD\nMarkers: Anti-IF antibodies, Anti-parietal cell antibodies'),
('11', 'Biochemical marker SPECIFIC for B12 deficiency (not folate)?',
'β Methylmalonic acid (MMA) β because B12 is needed for MMA β Succinyl-CoA\nBoth B9 and B12 deficiency β β Homocysteine'),
('12', 'Folate vs B12 deficiency β key difference?',
'Both: Megaloblastic anaemia + β Homocysteine\nOnly B12: SACD (dorsal + lateral cord demyelination) + β MMA\nTreating B12 deficiency with folate alone can worsen neurological damage!'),
('13', 'Neural tube defects in pregnancy are prevented by?',
'Folic acid (B9) β 400 mcg/day periconceptionally\n(Anencephaly, Spina bifida, Encephalocele)'),
('14', 'Raw egg white causes which deficiency and why?',
'Biotin (B7) deficiency β Avidin in raw egg white binds biotin tightly\nCooked eggs: avidin denatured; biotin freely absorbed'),
('15', 'Which vitamin deficiency causes SACD (subacute combined degeneration)?',
'Vitamin B12 β dorsal columns (proprioception, vibration) +\nlateral corticospinal tracts (UMN signs) demyelinated'),
('16', 'Vitamin E deficiency in premature infants causes?',
'Haemolytic anaemia β oxidative damage to RBC membranes\n(tocopherol is the main lipid-soluble antioxidant in cell membranes)'),
('17', 'Vitamin C is required for synthesis of which protein?',
'Collagen β Vit C needed for hydroxylation of proline and lysine\n(prolyl hydroxylase & lysyl hydroxylase require ascorbic acid)'),
('18', 'Classic features of Scurvy?',
'Perifollicular haemorrhage Β· Corkscrew hairs Β· Bleeding gums Β· Loose teeth\nPoor wound healing Β· Haemarthrosis Β· Subperiosteal haemorrhage'),
('19', 'Which fat-soluble vitamin is teratogenic in excess?',
'Vitamin A (Retinol / Retinoic acid) β causes craniofacial, cardiac, CNS defects\nIsotretinoin (Accutane) is strictly contraindicated in pregnancy'),
('20', 'Haemorrhagic disease of the newborn β cause and prevention?',
'Cause: Vit K deficiency β sterile neonatal gut lacks bacteria to synthesise K2\nPrevention: IM Vitamin K 1 mg at birth'),
('21', 'Which drug causes B6 AND niacin deficiency?',
'Isoniazid (INH) β inhibits pyridoxal kinase β β PLP\nβ Trp cannot convert to niacin β give B6 + niacin prophylactically'),
('22', 'Methotrexate mechanism and antidote?',
'Blocks DHFR β Folate cannot be converted to THF β no DNA synthesis\nAntidote: Leucovorin (folinic acid) β bypasses DHFR block'),
('23', 'Which vitamins cause megaloblastic anaemia?',
'B9 (Folate) AND B12 (Cobalamin)\nBoth needed for thymidylate synthesis β DNA replication fails β large immature RBCs'),
('24', 'What is the active form of Vitamin B9 (folate)?',
'THF β TetraHydroFolate β one-carbon transfer reactions\nMTHFR converts 5,10-methylene-THF β 5-methyl-THF (common MTHFR polymorphism)'),
('25', 'Name the fat-soluble vitamin antioxidant and its deficiency features?',
'Vitamin E (Ξ±-Tocopherol) β protects membrane lipids from oxidation\nDeficiency: Haemolytic anaemia Β· Spinocerebellar ataxia Β· Neuropathy'),
]
for q_num, question, answer in qa_list:
story += [qa_card(q_num, question, answer), sp(0.2*cm)]
# βββ DRUG-VITAMIN TABLE βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
story.append(PageBreak())
story += [banner('π DRUGβVITAMIN INTERACTIONS', colors.HexColor('#b71c1c')), sp(0.3*cm)]
dv_head = [Paragraph(t, coenz_h_style) for t in ['Drug','Vitamin Affected','Mechanism & Clinical Effect']]
dv_rows = [
dv_head,
['Isoniazid (INH)', 'B6, Niacin', 'Inhibits pyridoxal kinase β β PLP β peripheral neuropathy, pellagra\nGive B6 + niacin prophylactically'],
['Methotrexate', 'B9 (Folate)', 'Blocks DHFR β no THF β megaloblastic anaemia\nRescue: Leucovorin (folinic acid)'],
['Trimethoprim', 'B9 (Folate)', 'Blocks bacterial DHFR (similar folate-depleting effect in humans)'],
['Warfarin', 'Vitamin K', 'Blocks VKOR β no Vit K recycling β β factors II, VII, IX, X\nAntidote: IV Vit K + FFP'],
['Cholestyramine / Orlistat', 'A, D, E, K', 'Impairs fat absorption β fat-soluble vitamin malabsorption'],
['Alcohol (chronic)', 'B1, B6, B9', 'Multiple mechanisms: poor intake, gut malabsorption, hepatic storage loss'],
['Phenytoin / Phenobarbital', 'B9, D', 'Induces CYP enzymes β accelerated catabolism of vitamins D and folate'],
['Pyrimethamine', 'B9 (Folate)', 'Antiprotozoal that blocks DHFR β give folinic acid concurrently'],
['PPIs (long-term)', 'B12', 'β Gastric acid β impaired B12 release from food protein'],
['Levodopa (L-DOPA)', 'B6', 'PLP accelerates levodopa metabolism β reduces therapeutic effect\n(avoid high-dose B6 if on levodopa without carbidopa)'],
]
for i, r in enumerate(dv_rows[1:], 1):
dv_rows[i] = [Paragraph(str(c), coenz_b_style) for c in r]
dv_t = Table(dv_rows, colWidths=[3.5*cm, 3.0*cm, 10.5*cm], repeatRows=1)
dv_t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#b71c1c')),
*[('BACKGROUND', (0,i), (-1,i), colors.HexColor('#ffebee') if i%2==0 else WHITE) for i in range(1,11)],
('GRID', (0,0), (-1,-1), 0.4, GRAY_MED),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'TOP'),
('ROUNDEDCORNERS', [4]),
]))
story += [dv_t]
# βββ BUILD βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
doc.build(story)
print(f"PDF created: {OUTPUT}")
PYEOF
show command