I have a seminar Tommorow on the topic lipid profile can you give me the pdf of it

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Running Command

mkdir -p /home/daytona/workspace/lipid-profile-seminar && ls /home/daytona/workspace/lipid-profile-seminar/

Writing File

~/lipid-profile-seminar/generate_pdf.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, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import ListFlowable, ListItem

OUTPUT = "/home/daytona/workspace/lipid-profile-seminar/Lipid_Profile_Seminar.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=2*cm, leftMargin=2*cm,
    topMargin=2.5*cm, bottomMargin=2.5*cm,
    title="Lipid Profile - Seminar Notes",
    author="Orris Medical Library"
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle(
    'CustomTitle',
    parent=styles['Title'],
    fontSize=26,
    textColor=colors.HexColor('#1a3a5c'),
    spaceAfter=6,
    alignment=TA_CENTER,
    fontName='Helvetica-Bold'
)
subtitle_style = ParagraphStyle(
    'Subtitle',
    parent=styles['Normal'],
    fontSize=12,
    textColor=colors.HexColor('#4a6fa5'),
    spaceAfter=4,
    alignment=TA_CENTER,
    fontName='Helvetica'
)
h1_style = ParagraphStyle(
    'H1',
    parent=styles['Heading1'],
    fontSize=16,
    textColor=colors.white,
    fontName='Helvetica-Bold',
    spaceBefore=18,
    spaceAfter=8,
    backColor=colors.HexColor('#1a3a5c'),
    leftIndent=-12,
    rightIndent=-12,
    borderPad=6
)
h2_style = ParagraphStyle(
    'H2',
    parent=styles['Heading2'],
    fontSize=13,
    textColor=colors.HexColor('#1a3a5c'),
    fontName='Helvetica-Bold',
    spaceBefore=12,
    spaceAfter=4,
    borderPad=2
)
body_style = ParagraphStyle(
    'Body',
    parent=styles['Normal'],
    fontSize=10.5,
    leading=15,
    spaceAfter=8,
    alignment=TA_JUSTIFY,
    fontName='Helvetica'
)
bullet_style = ParagraphStyle(
    'Bullet',
    parent=styles['Normal'],
    fontSize=10.5,
    leading=15,
    leftIndent=18,
    spaceAfter=4,
    fontName='Helvetica'
)
note_style = ParagraphStyle(
    'Note',
    parent=styles['Normal'],
    fontSize=9.5,
    leading=13,
    backColor=colors.HexColor('#eaf2ff'),
    borderColor=colors.HexColor('#4a6fa5'),
    borderWidth=1,
    borderPad=6,
    spaceAfter=8,
    fontName='Helvetica-Oblique'
)
table_header_style = ParagraphStyle(
    'TableHeader',
    parent=styles['Normal'],
    fontSize=10,
    fontName='Helvetica-Bold',
    textColor=colors.white,
    alignment=TA_CENTER
)

story = []

# ---- TITLE PAGE ----
story.append(Spacer(1, 1.5*cm))
story.append(Paragraph("LIPID PROFILE", title_style))
story.append(Paragraph("A Comprehensive Seminar Guide", subtitle_style))
story.append(Spacer(1, 0.3*cm))
story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a3a5c')))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("Sources: Textbook of Family Medicine 9e | Fuster & Hurst's The Heart 15e | Fischer's Mastery of Surgery 8e", subtitle_style))
story.append(Paragraph("Prepared for Seminar | June 24, 2026", subtitle_style))
story.append(Spacer(1, 1*cm))

# ---- SECTION 1: INTRODUCTION ----
story.append(Paragraph("1. Introduction & Overview", h1_style))
story.append(Paragraph(
    "Lipid levels are routinely measured to evaluate cardiovascular risk. Plasma lipids travel as "
    "lipoproteins - macromolecular complexes of lipid and protein. There are four major classes "
    "of lipoproteins, each with distinct composition, metabolism, and clinical significance.",
    body_style
))
story.append(Paragraph("The Four Major Lipoprotein Classes:", h2_style))

lp_data = [
    [Paragraph('<b>Lipoprotein</b>', table_header_style),
     Paragraph('<b>Density</b>', table_header_style),
     Paragraph('<b>Primary Lipid</b>', table_header_style),
     Paragraph('<b>Key Apolipoprotein</b>', table_header_style),
     Paragraph('<b>Clinical Role</b>', table_header_style)],
    ['Chylomicrons', 'Lowest (<0.95)', 'Triglycerides (85-90%)', 'ApoB-48, ApoE, ApoC', 'Dietary fat transport (intestine → blood)'],
    ['VLDL', '0.95-1.006', 'Triglycerides (55-65%)', 'ApoB-100, ApoE, ApoC', 'Endogenous TG transport (liver → periphery)'],
    ['LDL', '1.019-1.063', 'Cholesterol (45-50%)', 'ApoB-100', 'Cholesterol delivery to tissues; atherogenic'],
    ['HDL', '1.063-1.210', 'Protein & Phospholipid', 'ApoA-I, ApoA-II', 'Reverse cholesterol transport; cardioprotective'],
]
lp_table = Table(lp_data, colWidths=[3.2*cm, 2.6*cm, 3.5*cm, 3.5*cm, 4.2*cm])
lp_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 9.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 5),
]))
story.append(lp_table)
story.append(Spacer(1, 0.4*cm))
story.append(Paragraph(
    "Note: Approximately 60-70% of plasma cholesterol is carried as LDL-C. HDL-C accounts for "
    "20-30% of total cholesterol. All atherogenic lipoproteins (LDL, IDL, VLDL, Lp(a)) carry one "
    "molecule of ApoB-100, making ApoB a useful surrogate marker for total atherogenic particle burden.",
    note_style
))

# ---- SECTION 2: STANDARD LIPID PROFILE ----
story.append(Paragraph("2. Standard Lipid Profile", h1_style))
story.append(Paragraph(
    "The standard lipid profile, as recommended by the NCEP ATP III, consists of direct measurement "
    "of total cholesterol, HDL-C, and triglycerides, with a calculated LDL-C - obtained after a "
    "<b>9-hour fast</b>. A standard lipid profile includes: plasma cholesterol, LDL-C, HDL-C, and "
    "plasma triglycerides.",
    body_style
))

story.append(Paragraph("Components of the Standard Lipid Panel:", h2_style))

comp_data = [
    [Paragraph('<b>Component</b>', table_header_style),
     Paragraph('<b>How Measured</b>', table_header_style),
     Paragraph('<b>Normal Range</b>', table_header_style),
     Paragraph('<b>Clinical Significance</b>', table_header_style)],
    ['Total Cholesterol (TC)', 'Direct enzymatic assay', '< 200 mg/dL (desirable)', 'Sum of all cholesterol fractions'],
    ['LDL Cholesterol', 'Calculated (Friedewald) or direct', '< 100 mg/dL (optimal)', 'Primary atherogenic fraction; main treatment target'],
    ['HDL Cholesterol', 'Direct precipitation assay', '> 40 mg/dL (M), > 50 mg/dL (F)', 'Cardioprotective; inverse relationship with CAD risk'],
    ['Triglycerides (TG)', 'Direct enzymatic assay', '< 150 mg/dL (normal)', 'Reflects VLDL & remnant lipoproteins; risk for pancreatitis at >500'],
    ['Non-HDL Cholesterol', 'Calculated: TC - HDL', '< 130 mg/dL (optimal)', 'Includes all atherogenic lipoproteins (LDL + VLDL + IDL + Lp(a))'],
    ['VLDL Cholesterol', 'Estimated as TG/5', '2-30 mg/dL', 'Indirect estimate; invalid when TG > 400 mg/dL'],
]
comp_table = Table(comp_data, colWidths=[3.8*cm, 3.8*cm, 3.8*cm, 5.6*cm])
comp_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 9.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 5),
]))
story.append(comp_table)
story.append(Spacer(1, 0.4*cm))

# ---- SECTION 3: FRIEDEWALD FORMULA ----
story.append(Paragraph("3. Friedewald Formula for LDL Calculation", h1_style))
story.append(Paragraph(
    "The Friedewald formula is the standard equation used to calculate LDL-C from a fasting lipid panel:",
    body_style
))

formula_style = ParagraphStyle(
    'Formula',
    parent=styles['Normal'],
    fontSize=13,
    fontName='Helvetica-Bold',
    alignment=TA_CENTER,
    textColor=colors.HexColor('#1a3a5c'),
    spaceBefore=10,
    spaceAfter=10,
    backColor=colors.HexColor('#eaf2ff'),
    borderPad=10
)
story.append(Paragraph("LDL-C = Total Cholesterol - HDL-C - (Triglycerides / 5)", formula_style))
story.append(Spacer(1, 0.3*cm))

story.append(Paragraph("<b>Limitations - Friedewald Formula is INVALID when:</b>", h2_style))
invalid_items = [
    "Chylomicrons are present in the sample (non-fasting state with chylomicronemia)",
    "Triglycerides > 400 mg/dL (leads to <b>underestimation</b> of LDL-C)",
    "Dysbetalipoproteinemia (Type III hyperlipidemia) is present",
    "Hypertriglyceridemia is present (non-LDL particles like IDL are included in the calculation)",
]
for item in invalid_items:
    story.append(Paragraph(f"• {item}", bullet_style))

story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "In these cases, <b>direct LDL measurement</b> (more costly but more accurate) should be used. "
    "Nonfasting total cholesterol and HDL measurements give reliable assessment of CHD risk without "
    "the need to measure triglycerides.",
    note_style
))

# ---- SECTION 4: REFERENCE RANGES ----
story.append(Paragraph("4. Reference Ranges & Risk Classification (NCEP ATP III)", h1_style))

atp_data = [
    [Paragraph('<b>Parameter</b>', table_header_style),
     Paragraph('<b>Category</b>', table_header_style),
     Paragraph('<b>Value (mg/dL)</b>', table_header_style),
     Paragraph('<b>Classification</b>', table_header_style)],
    # Total Cholesterol
    ['Total Cholesterol', 'Desirable', '< 200', 'Low risk'],
    ['', 'Borderline High', '200-239', 'Moderate risk'],
    ['', 'High', '≥ 240', 'High risk'],
    # LDL
    ['LDL-C', 'Optimal', '< 100', 'Target for high-risk pts'],
    ['', 'Near Optimal', '100-129', 'Acceptable'],
    ['', 'Borderline High', '130-159', 'Monitor closely'],
    ['', 'High', '160-189', 'Drug therapy often needed'],
    ['', 'Very High', '≥ 190', 'Aggressive treatment'],
    # HDL
    ['HDL-C', 'Low (Risk Factor)', '< 40', 'Independent CV risk factor'],
    ['', 'Normal', '40-59', 'Average protection'],
    ['', 'High (Protective)', '≥ 60', 'Negative risk factor'],
    # TG
    ['Triglycerides', 'Normal', '< 150', 'No increased risk'],
    ['', 'Borderline High', '150-199', 'Mild concern'],
    ['', 'High', '200-499', 'Increased cardiovascular risk'],
    ['', 'Very High', '≥ 500', 'Risk of acute pancreatitis'],
]

atp_table = Table(atp_data, colWidths=[3.8*cm, 3.8*cm, 3.8*cm, 5.6*cm])
atp_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 9.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 5),
    ('SPAN', (0,1), (0,3)),   # TC span
    ('SPAN', (0,4), (0,8)),   # LDL span
    ('SPAN', (0,9), (0,11)),  # HDL span
    ('SPAN', (0,12), (0,15)), # TG span
]))
story.append(atp_table)

# ---- SECTION 5: PHYSIOLOGIC & ANALYTIC VARIATION ----
story.append(PageBreak())
story.append(Paragraph("5. Sources of Variation in Lipid Measurements", h1_style))
story.append(Paragraph(
    "Multiple factors can alter lipid test results. Clinicians must interpret lipid panels in the "
    "context of these pre-analytical and physiological variables:",
    body_style
))

variation_items = [
    ("<b>Fasting state:</b> Failure to fast elevates triglycerides and leads to underestimation of LDL-C. "
     "Total cholesterol and HDL-C are NOT significantly different in fasting vs postprandial state."),
    ("<b>Diet:</b> Dietary changes appear in lipid measurements in ~1-2 weeks. Patients should maintain a "
     "stable diet for <b>3 weeks</b> before testing."),
    ("<b>Time of day:</b> Morning specimens preferred - triglycerides have diurnal variation (lowest in morning, "
     "highest in afternoon)."),
    ("<b>Acute illness/surgery:</b> Recent illness, surgery, MI, stroke, or cardiac catheterization can lower "
     "lipid measurements for several weeks. For major illness, wait 2-3 months before measurement."),
    ("<b>Myocardial Infarction:</b> Cholesterol decreases 24 hours after MI and remains depressed for up to 12 weeks."),
    ("<b>Posture:</b> Lipid values can be up to 10% higher in the upright vs supine position due to fluid shifts."),
    ("<b>Pregnancy:</b> Lipid levels increase significantly during pregnancy; do not measure during pregnancy."),
]
for item in variation_items:
    story.append(Paragraph(f"• {item}", bullet_style))

# ---- SECTION 6: DRUGS AFFECTING LIPIDS ----
story.append(Paragraph("6. Effects of Drugs on Lipid Values", h1_style))
story.append(Paragraph(
    "Many commonly used medications can significantly alter lipid fractions. This is important both "
    "for interpretation of lipid panels and for understanding iatrogenic dyslipidemia:",
    body_style
))

drug_data = [
    [Paragraph('<b>Drug</b>', table_header_style),
     Paragraph('<b>Total Chol</b>', table_header_style),
     Paragraph('<b>LDL-C</b>', table_header_style),
     Paragraph('<b>HDL-C</b>', table_header_style),
     Paragraph('<b>Triglycerides</b>', table_header_style)],
    ['Thiazide diuretics', '↑', '↑', '—', '↑'],
    ['Beta-blockers', '—', '—', '↓', '↑'],
    ['Alpha-blockers', '↓', '↓', '↑', '↓'],
    ['ACE inhibitors', '—', '—', '—', '—'],
    ['Calcium-channel blockers', '—', '—', '—', '—'],
    ['Unopposed estrogens', '↓', '↓', '↑', '↑'],
    ['Unopposed progestogens', '—', '↑', '↓', '↓'],
    ['Tamoxifen', '↓', '↓', '—', '↑'],
    ['Raloxifene', '↓', '↓', '—', '—'],
    ['Isotretinoin', '↑', '↑', '↓', '↑'],
    ['Protease inhibitors (HIV)', '↑', '—', '—', '↑'],
]
drug_table = Table(drug_data, colWidths=[5*cm, 2.8*cm, 2.8*cm, 2.8*cm, 3.6*cm])
drug_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 10),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('ALIGN', (1,0), (-1,-1), 'CENTER'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 6),
]))
story.append(drug_table)
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "Source: Adapted from Mantel-Tecewisse AK et al. Drug-induced lipid changes: a review of the "
    "unintended effects of some commonly used drugs on serum lipid levels. Drug Saf 2001;24(6):443-456.",
    note_style
))

# ---- SECTION 7: SECONDARY CAUSES OF DYSLIPIDEMIA ----
story.append(Paragraph("7. Secondary Causes of Dyslipidemia", h1_style))

sec_data = [
    [Paragraph('<b>Condition / Cause</b>', table_header_style),
     Paragraph('<b>Lipid Effect</b>', table_header_style)],
    ['Hypothyroidism', 'Elevated LDL-C, elevated TG'],
    ['Diabetes mellitus (Type 2)', 'Elevated TG, low HDL-C, elevated small dense LDL'],
    ['Chronic kidney disease (CKD)', 'Elevated TG-rich lipoproteins (VLDL), low HDL-C; high TG; normal or low TC'],
    ['Nephrotic syndrome', 'Elevated TC, elevated LDL-C, elevated TG, low HDL-C'],
    ['Obesity', 'Elevated TG, low HDL-C, elevated LDL-C'],
    ['Alcohol excess', 'Elevated TG (can cause severe hypertriglyceridemia)'],
    ['Obstructive liver disease', 'Elevated TC (abnormal lipoprotein X)'],
    ['Cushing syndrome', 'Elevated TC, elevated TG'],
    ['Anorexia nervosa', 'Elevated TC, elevated LDL-C'],
    ['Pregnancy', 'Elevated TC, elevated TG, elevated HDL-C'],
]
sec_table = Table(sec_data, colWidths=[7*cm, 10*cm])
sec_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 10),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 6),
]))
story.append(sec_table)

# ---- SECTION 8: LIPOPROTEIN METABOLISM ----
story.append(PageBreak())
story.append(Paragraph("8. Lipoprotein Metabolism", h1_style))
story.append(Paragraph(
    "Understanding lipoprotein metabolism helps explain how dyslipidemia develops and is targeted by therapy.",
    body_style
))
story.append(Paragraph("Exogenous (Dietary) Pathway:", h2_style))
story.append(Paragraph(
    "After ingestion of a fatty meal, dietary triglycerides and cholesterol are packaged into "
    "<b>chylomicrons</b> by intestinal enterocytes. These are secreted into intestinal lymphatics "
    "(lacteals) and enter the blood via the thoracic duct. In the capillaries of muscle and adipose "
    "tissue, <b>lipoprotein lipase (LPL)</b> hydrolyzes the triglycerides, releasing free fatty acids "
    "for cellular use. The resulting <b>chylomicron remnants</b> (enriched in cholesterol) are taken up "
    "by the liver via ApoE/LDL-receptor-related protein (LRP) receptors.",
    body_style
))
story.append(Paragraph("Endogenous Pathway:", h2_style))
story.append(Paragraph(
    "The liver packages endogenous triglycerides and cholesterol into <b>VLDL</b> (ApoB-100 containing) "
    "and secretes them into the bloodstream. LPL progressively hydrolyzes VLDL triglycerides, "
    "converting VLDL → IDL → LDL. LDL (the remnant of VLDL catabolism) is the primary carrier of "
    "cholesterol to peripheral tissues via the <b>LDL receptor (LDLR)</b>, which recognizes ApoB-100. "
    "When LDL receptors are downregulated (high cellular cholesterol), LDL accumulates in plasma.",
    body_style
))
story.append(Paragraph("Reverse Cholesterol Transport (HDL Pathway):", h2_style))
story.append(Paragraph(
    "HDL particles, synthesized in the liver and intestine, acquire cholesterol from peripheral tissues "
    "via <b>ABCA1</b> and <b>SR-BI</b> transporters. The enzyme <b>LCAT</b> (lecithin-cholesterol "
    "acyltransferase) esterifies the cholesterol on HDL. Cholesterol ester transfer protein (CETP) "
    "transfers cholesterol esters from HDL to VLDL and LDL in exchange for triglycerides. HDL "
    "ultimately delivers cholesterol back to the liver for bile synthesis or excretion - this process "
    "is cardioprotective and is the basis for HDL's role as the 'good cholesterol'.",
    body_style
))

# ---- SECTION 9: CARDIOVASCULAR RISK ----
story.append(Paragraph("9. Lipids and Cardiovascular Risk", h1_style))
story.append(Paragraph(
    "Lipid profiling is fundamentally used as a cardiovascular risk stratification tool.",
    body_style
))

risk_points = [
    ("<b>LDL-C and CHD:</b> There is a direct, causal association between elevated LDL-C and coronary "
     "heart disease (CHD). The risk is continuous with no definite threshold."),
    ("<b>HDL-C and CHD:</b> There is a strong independent inverse relationship between HDL-C and CHD. "
     "For every 1 mg/dL decrease in HDL-C, the risk of CAD increases by <b>2-3%</b>."),
    ("<b>Triglycerides:</b> When plasma TG exceeds 440 mg/dL vs <88 mg/dL, risk is approximately "
     "5-fold for MI, 3-fold for ischemic stroke, and 10-fold for acute pancreatitis."),
    ("<b>Remnant Cholesterol (Remnant-C):</b> Calculated as TC - HDL-C - LDL-C. Represents cholesterol "
     "in TG-rich lipoprotein remnants (VLDL + IDL + chylomicron remnants). Increasingly recognized as "
     "an independent ASCVD risk marker."),
    ("<b>Non-HDL Cholesterol:</b> Captures all atherogenic lipoproteins. US, European, and Canadian "
     "guidelines all recommend measuring non-HDL-C alongside LDL-C."),
    ("<b>ApoB:</b> One ApoB per atherogenic particle - reflects total particle number. Considered "
     "superior to LDL-C in some studies for predicting ASCVD risk."),
    ("<b>Lp(a):</b> Shows modest correlation with stroke and CHD risk but routine screening in "
     "asymptomatic individuals is not currently recommended (AHA 2010 guidelines)."),
]
for point in risk_points:
    story.append(Paragraph(f"• {point}", bullet_style))

# ---- SECTION 10: FASTING vs NONFASTING ----
story.append(Paragraph("10. Fasting vs Nonfasting Lipid Profiles", h1_style))

fn_data = [
    [Paragraph('<b>Parameter</b>', table_header_style),
     Paragraph('<b>Fasting (9h fast)</b>', table_header_style),
     Paragraph('<b>Nonfasting</b>', table_header_style)],
    ['Total Cholesterol', 'Standard', 'Reliable (not significantly different)'],
    ['HDL-C', 'Standard', 'Reliable (not significantly different)'],
    ['Triglycerides', 'Required for accuracy', 'Higher by ~26 mg/dL (0.3 mmol/L)'],
    ['LDL-C (calculated)', 'Standard (Friedewald)', 'Unreliable - TG affects calculation'],
    ['Remnant Cholesterol', 'Baseline measurement', 'Higher by ~8 mg/dL (0.2 mmol/L) postprandially'],
    ['Clinical Use', 'Required for full panel incl. TG & LDL', 'Adequate for TC and HDL risk screening'],
]
fn_table = Table(fn_data, colWidths=[4.5*cm, 5.5*cm, 7*cm])
fn_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 10),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 6),
]))
story.append(fn_table)
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "The AHA 2010 guidelines recommend against routine measurement of lipoprotein subfractions, "
    "particle size, and density in asymptomatic adults for cardiovascular risk assessment, as these "
    "do not significantly improve predictive capacity over the standard lipid panel.",
    note_style
))

# ---- SECTION 11: SCREENING RECOMMENDATIONS ----
story.append(PageBreak())
story.append(Paragraph("11. Screening Recommendations", h1_style))
story.append(Paragraph(
    "The NCEP ATP III recommended lipid screening as a tool to promote cardiovascular disease risk "
    "reduction. Key screening guidelines:",
    body_style
))
screen_items = [
    "<b>Adults ≥ 20 years:</b> Fasting lipid panel every 5 years (NCEP ATP III)",
    "<b>Men ≥ 35 years</b> and <b>women ≥ 45 years:</b> Screen for lipid disorders (USPSTF)",
    "<b>Any age</b> with cardiovascular risk factors (diabetes, hypertension, smoking, family history): Screen earlier",
    "<b>Acute illness:</b> Postpone testing - triglycerides increase and LDL decreases in inflammatory states",
    "<b>Repeat testing:</b> If baseline values are borderline, repeat within 1-8 weeks (2 measurements averaged)",
    "<b>Children:</b> Screen if family history of premature CVD or familial hypercholesterolemia (after age 2)",
]
for item in screen_items:
    story.append(Paragraph(f"• {item}", bullet_style))

# ---- SECTION 12: DYSLIPIDEMIA CLASSIFICATION ----
story.append(Paragraph("12. Classification of Dyslipidemias (Fredrickson/WHO Classification)", h1_style))

fred_data = [
    [Paragraph('<b>Type</b>', table_header_style),
     Paragraph('<b>Common Name</b>', table_header_style),
     Paragraph('<b>Elevated Lipoprotein</b>', table_header_style),
     Paragraph('<b>Lipid Elevation</b>', table_header_style),
     Paragraph('<b>CVD Risk</b>', table_header_style)],
    ['Type I', 'Familial hyperchylomicronemia', 'Chylomicrons', 'TG ↑↑↑', 'Low (pancreatitis risk)'],
    ['Type IIa', 'Familial hypercholesterolemia', 'LDL', 'TC ↑↑, LDL ↑↑', 'Very High'],
    ['Type IIb', 'Combined hyperlipidemia', 'LDL + VLDL', 'TC ↑, TG ↑, LDL ↑', 'Very High'],
    ['Type III', 'Dysbetalipoproteinemia', 'IDL (remnants)', 'TC ↑, TG ↑', 'High'],
    ['Type IV', 'Familial hypertriglyceridemia', 'VLDL', 'TG ↑↑', 'Moderate'],
    ['Type V', 'Mixed hyperlipidemia', 'VLDL + Chylomicrons', 'TC ↑, TG ↑↑↑', 'Moderate (pancreatitis risk)'],
]
fred_table = Table(fred_data, colWidths=[2*cm, 4.5*cm, 3.5*cm, 3.8*cm, 3.2*cm])
fred_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 9.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 5),
]))
story.append(fred_table)

# ---- SECTION 13: TREATMENT ----
story.append(Paragraph("13. Treatment of Dyslipidemia", h1_style))
story.append(Paragraph("Therapeutic Lifestyle Changes (TLC) - First Line:", h2_style))
tlc_items = [
    "Reduce dietary saturated fat to <7% of total calories",
    "Reduce dietary cholesterol to <200 mg/day",
    "Increase soluble fiber (10-25 g/day) - reduces LDL by 5-10%",
    "Use plant stanols/sterols (2 g/day) - reduces LDL by 6-15%",
    "Weight reduction - reduces LDL, TG; raises HDL",
    "Increase aerobic physical activity (30+ min most days) - primarily raises HDL",
    "Reduce alcohol to lower triglycerides",
]
for item in tlc_items:
    story.append(Paragraph(f"• {item}", bullet_style))

story.append(Paragraph("Pharmacological Therapy:", h2_style))
rx_data = [
    [Paragraph('<b>Drug Class</b>', table_header_style),
     Paragraph('<b>Mechanism</b>', table_header_style),
     Paragraph('<b>Effect on Lipids</b>', table_header_style),
     Paragraph('<b>Primary Use</b>', table_header_style)],
    ['Statins (HMG-CoA reductase inhibitors)', 'Inhibit hepatic cholesterol synthesis → upregulate LDL receptors', 'LDL ↓ 25-50%, TG ↓, HDL ↑ slightly', 'First-line for elevated LDL-C; CVD prevention'],
    ['Ezetimibe', 'Blocks intestinal cholesterol absorption (NPC1L1)', 'LDL ↓ 15-20%', 'Adjunct to statins or statin-intolerance'],
    ['PCSK9 Inhibitors (evolocumab, alirocumab)', 'Inhibit PCSK9 → more LDL receptors recycled', 'LDL ↓ 50-60%', 'Familial hypercholesterolemia; high CV risk'],
    ['Fibrates (gemfibrozil, fenofibrate)', 'PPAR-α agonists → ↑ LPL activity', 'TG ↓ 30-50%, HDL ↑ 10-15%', 'Hypertriglyceridemia; low HDL'],
    ['Niacin (Nicotinic acid)', 'Inhibits hepatic VLDL secretion', 'TG ↓, LDL ↓, HDL ↑ 15-35%', 'Broad spectrum; low HDL (limited use now)'],
    ['Bile acid sequestrants (cholestyramine)', 'Interrupt enterohepatic circulation of bile acids', 'LDL ↓ 10-30%', 'Adjunct therapy; safe in pregnancy'],
    ['Omega-3 fatty acids', 'Reduce hepatic TG synthesis', 'TG ↓ 20-50% at high doses', 'Severe hypertriglyceridemia (≥500 mg/dL)'],
]
rx_table = Table(rx_data, colWidths=[4.2*cm, 4.5*cm, 3.5*cm, 4.8*cm])
rx_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a3a5c')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 9),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
    ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0b8c8')),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 5),
]))
story.append(rx_table)

# ---- SECTION 14: QUICK SUMMARY ----
story.append(PageBreak())
story.append(Paragraph("14. Quick Review - Key Points for Seminar", h1_style))

summary_points = [
    "Lipid profile = Total Cholesterol + HDL-C + Triglycerides (direct) + LDL-C (calculated)",
    "Friedewald: LDL = TC - HDL - TG/5 (invalid if TG > 400, chylomicrons present, or Type III hyperlipidemia)",
    "LDL-C is the primary atherogenic fraction and main treatment target",
    "HDL-C is cardioprotective: every 1 mg/dL fall in HDL → 2-3% rise in CAD risk",
    "All atherogenic lipoproteins carry ApoB-100 (one molecule per particle)",
    "9-hour fast required for accurate TG and calculated LDL; TC and HDL reliable nonfasting",
    "Triglycerides lowest in morning, highest in afternoon (diurnal variation)",
    "Acute illness/MI falsely lowers lipids - wait 2-3 months after major illness",
    "Non-HDL-C = TC - HDL-C: captures all atherogenic particles; increasingly recommended alongside LDL-C",
    "Remnant-C = TC - HDL-C - LDL-C: represents TG-rich lipoprotein cholesterol",
    "First-line treatment is always Therapeutic Lifestyle Changes (TLC)",
    "Statins are first-line pharmacotherapy for elevated LDL-C and CV risk reduction",
    "Fibrates are preferred for hypertriglyceridemia and low HDL",
    "PCSK9 inhibitors achieve up to 60% LDL reduction for familial hypercholesterolemia",
    "Type III hyperlipidemia (dysbetalipoproteinemia) invalidates the Friedewald formula and is treated with fibrates",
]

for i, point in enumerate(summary_points, 1):
    story.append(Paragraph(f"<b>{i}.</b> {point}", bullet_style))

story.append(Spacer(1, 0.5*cm))
story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#b0b8c8')))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "References: Textbook of Family Medicine, 9th Edition (Rakel) | Fuster & Hurst's The Heart, "
    "15th Edition | Fischer's Mastery of Surgery, 8th Edition | Tietz Textbook of Laboratory Medicine, "
    "7th Edition | NCEP ATP III Guidelines | AHA 2010 Cholesterol Guidelines",
    ParagraphStyle('Ref', parent=styles['Normal'], fontSize=8.5, textColor=colors.grey, fontName='Helvetica-Oblique', alignment=TA_CENTER)
))

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

cd /home/daytona/workspace/lipid-profile-seminar && python generate_pdf.py

Running Command

ls -lh /home/daytona/workspace/lipid-profile-seminar/Lipid_Profile_Seminar.pdf

Your seminar PDF is ready! Download it here:

Lipid Profile Seminar

PDF Document · PDF


Here's what the PDF covers across 4 pages with color-coded tables and structured sections:
SectionContent
1. Introduction & Overview4 lipoprotein classes with density, lipid content, apolipoproteins
2. Standard Lipid ProfileAll 6 components, how measured, normal ranges
3. Friedewald FormulaLDL calculation + 3 conditions where it is INVALID
4. Reference RangesFull NCEP ATP III classification for TC, LDL, HDL, TG
5. Sources of VariationFasting, diet, time of day, illness, MI effect on lipids
6. Drug Effects on LipidsTable of 11 drug classes (thiazides, beta-blockers, estrogens, etc.)
7. Secondary Causes10 conditions causing dyslipidemia with lipid effects
8. Lipoprotein MetabolismExogenous, endogenous, and reverse cholesterol transport pathways
9. CV RiskLDL, HDL, TG, Remnant-C, ApoB, Lp(a) risk associations
10. Fasting vs NonfastingWhen each is reliable/required
11. Screening GuidelinesATP III, USPSTF, age-based recommendations
12. Fredrickson ClassificationTypes I-V with lipid pattern and CVD risk
13. TreatmentTLC lifestyle changes + 7 drug classes with mechanism and use
14. Quick Review15 key exam-ready bullet points
Sources: Textbook of Family Medicine 9e, Fuster & Hurst's The Heart 15e, Fischer's Mastery of Surgery 8e, and NCEP ATP III/AHA guidelines. Good luck with your seminar tomorrow!
This is a shared conversation. Sign in to Orris to start your own chat.