I need a highly detailed and well-researched medical report on Heart Blockage (Coronary Artery Disease). The required length for this research is a full 4 to 5 pages (approx 1,500 - 2,000 words).Pathophysiology, Symptoms, prevention ,Diagnosis, Treatment
"coronary artery disease" AND "pathophysiology"

Can you convert this whole information about CAD. In pdf
ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace/cad-…
mkdir -p /home/daytona/workspace/cad-report && python3 -c "import reportlab; pri…
~/cad-report/generate_cad_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, HRFlowable,
Table, TableStyle, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Image as RLImage
import urllib.request
import os
OUTPUT = "/home/daytona/workspace/cad-report/CAD_Medical_Report.pdf"
# ── Download the atherosclerosis diagram ──────────────────────────────────────
IMG_URL = "https://cdn.orris.care/cdss_images/74ab1878991d7b8fa8e1ff3ba3306c2a1ac640a261189d32ac918eeec422dddc.png"
IMG_PATH = "/home/daytona/workspace/cad-report/atherosclerosis_diagram.png"
if not os.path.exists(IMG_PATH):
urllib.request.urlretrieve(IMG_URL, IMG_PATH)
# ── Page setup ────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2.2*cm,
leftMargin=2.2*cm,
topMargin=2.5*cm,
bottomMargin=2.5*cm,
title="Heart Blockage (Coronary Artery Disease) - Medical Report",
author="Orris Medical AI",
)
# ── Colour palette ────────────────────────────────────────────────────────────
DARK_RED = colors.HexColor("#8B1A1A")
MED_RED = colors.HexColor("#C0392B")
LIGHT_GREY = colors.HexColor("#F5F5F5")
BORDER_GREY= colors.HexColor("#CCCCCC")
TEXT_BLACK = colors.HexColor("#1A1A1A")
SUBTITLE_GREY = colors.HexColor("#555555")
# ── Styles ────────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()
styles = {
"title": ParagraphStyle(
"title", parent=base["Normal"],
fontSize=26, fontName="Helvetica-Bold",
textColor=DARK_RED, alignment=TA_CENTER, spaceAfter=4,
),
"subtitle": ParagraphStyle(
"subtitle", parent=base["Normal"],
fontSize=13, fontName="Helvetica",
textColor=SUBTITLE_GREY, alignment=TA_CENTER, spaceAfter=6,
),
"meta": ParagraphStyle(
"meta", parent=base["Normal"],
fontSize=9, fontName="Helvetica",
textColor=SUBTITLE_GREY, alignment=TA_CENTER, spaceAfter=2,
),
"h1": ParagraphStyle(
"h1", parent=base["Normal"],
fontSize=14, fontName="Helvetica-Bold",
textColor=colors.white, spaceBefore=10, spaceAfter=4,
leftIndent=0,
),
"h2": ParagraphStyle(
"h2", parent=base["Normal"],
fontSize=11.5, fontName="Helvetica-Bold",
textColor=MED_RED, spaceBefore=8, spaceAfter=3,
),
"h3": ParagraphStyle(
"h3", parent=base["Normal"],
fontSize=10.5, fontName="Helvetica-BoldOblique",
textColor=DARK_RED, spaceBefore=5, spaceAfter=2,
),
"body": ParagraphStyle(
"body", parent=base["Normal"],
fontSize=10, fontName="Helvetica",
textColor=TEXT_BLACK, leading=15, spaceAfter=5,
alignment=TA_JUSTIFY,
),
"bullet": ParagraphStyle(
"bullet", parent=base["Normal"],
fontSize=10, fontName="Helvetica",
textColor=TEXT_BLACK, leading=14, spaceAfter=3,
leftIndent=16, bulletIndent=6, alignment=TA_JUSTIFY,
),
"caption": ParagraphStyle(
"caption", parent=base["Normal"],
fontSize=8.5, fontName="Helvetica-Oblique",
textColor=SUBTITLE_GREY, alignment=TA_CENTER, spaceAfter=4,
),
"ref": ParagraphStyle(
"ref", parent=base["Normal"],
fontSize=8.5, fontName="Helvetica",
textColor=SUBTITLE_GREY, leading=12, spaceAfter=2,
),
"source_label": ParagraphStyle(
"source_label", parent=base["Normal"],
fontSize=9, fontName="Helvetica-Bold",
textColor=DARK_RED, spaceAfter=3,
),
}
# ── Helper: coloured section header band ─────────────────────────────────────
def section_header(text):
data = [[Paragraph(text, styles["h1"])]]
t = Table(data, colWidths=[doc.width])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_RED),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING",(0,0), (-1,-1), 6),
("ROWBACKGROUNDS",(0,0),(-1,-1),[DARK_RED]),
]))
return t
def bullet(text):
return Paragraph(f"• {text}", styles["bullet"])
def body(text):
return Paragraph(text, styles["body"])
def h2(text):
return Paragraph(text, styles["h2"])
def h3(text):
return Paragraph(text, styles["h3"])
def spacer(h=6):
return Spacer(1, h)
def hr():
return HRFlowable(width="100%", thickness=0.5, color=BORDER_GREY, spaceAfter=4, spaceBefore=4)
# ── Build story ───────────────────────────────────────────────────────────────
story = []
# ── TITLE BLOCK ──────────────────────────────────────────────────────────────
title_data = [[
Paragraph("HEART BLOCKAGE", styles["title"]),
], [
Paragraph("Coronary Artery Disease (CAD)", styles["subtitle"]),
], [
Paragraph("Comprehensive Medical Research Report", styles["meta"]),
], [
Paragraph("Pathophysiology | Symptoms | Prevention | Diagnosis | Treatment", styles["meta"]),
], [
Paragraph("Prepared by Orris Medical AI · Sources: Robbins Pathology · Fuster's Heart Disease · Harrison's Medicine · Schwartz's Surgery · Lippincott Biochemistry", styles["meta"]),
]]
title_table = Table(title_data, colWidths=[doc.width])
title_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_GREY),
("LEFTPADDING", (0,0), (-1,-1), 16),
("RIGHTPADDING", (0,0), (-1,-1), 16),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING",(0,0), (-1,-1), 5),
("BOX", (0,0), (-1,-1), 1.5, DARK_RED),
("LINEBELOW", (0,1), (-1,1), 0.8, MED_RED),
]))
story.append(title_table)
story.append(spacer(14))
# ── 1. OVERVIEW ───────────────────────────────────────────────────────────────
story.append(section_header("1. OVERVIEW AND EPIDEMIOLOGY"))
story.append(spacer(6))
story.append(body(
"Coronary artery disease (CAD), commonly referred to as \"heart blockage,\" is the leading cause of death worldwide "
"and a primary driver of cardiovascular morbidity. It results from the progressive narrowing or obstruction of the coronary "
"arteries — the vessels supplying oxygenated blood to the heart muscle — most commonly due to the buildup of atherosclerotic "
"plaque within the arterial wall. CAD may manifest as stable angina, acute coronary syndromes (unstable angina and myocardial "
"infarction), ischemic heart failure, life-threatening arrhythmias, or sudden cardiac death."
))
story.append(body(
"Since its peak mortality in 1968, modern prevention and treatment strategies — including risk factor modification, "
"revascularization, aspirin, statins, and beta-blockers — have reduced CAD mortality by approximately 74%, "
"though the disease remains the number-one global killer."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery, 11th ed.</i>", styles["caption"]))
story.append(spacer(6))
# ── 2. PATHOPHYSIOLOGY ────────────────────────────────────────────────────────
story.append(section_header("2. PATHOPHYSIOLOGY"))
story.append(spacer(6))
story.append(body(
"The central mechanism underlying CAD is <b>atherosclerosis</b>, a chronic inflammatory process of the arterial wall that begins "
"early in life and progresses silently over decades. The pathogenesis is best understood through the "
"<b>response-to-injury hypothesis</b>."
))
story.append(h2("Step 1: Endothelial Injury and Dysfunction"))
story.append(body(
"The process begins with endothelial cell (EC) dysfunction triggered by mechanical, chemical, or inflammatory insults. "
"The three most important causes are <b>hemodynamic turbulence</b> (particularly at vessel bifurcations and bends where "
"flow is nonlaminar), <b>hypercholesterolemia</b>, and <b>systemic inflammation</b>. Additional triggers include cigarette "
"smoke toxins, hypertriglyceridemia, elevated homocysteine, and pro-inflammatory cytokines. "
"Laminar flow normally activates atheroprotective transcription factors such as Krüppel-like factor-2 (KLF2); turbulent flow "
"suppresses these, making bifurcation sites \"atheroprone.\""
))
story.append(Paragraph("<i>Source: Robbins Pathologic Basis of Disease, p. 468</i>", styles["caption"]))
story.append(h2("Step 2: Lipid Accumulation and Foam Cell Formation"))
story.append(body(
"Endothelial dysfunction increases vascular permeability, allowing low-density lipoprotein (LDL) cholesterol to infiltrate "
"the subendothelial intima. In the presence of oxidative stress, LDL is oxidized (oxLDL). Circulating monocytes, attracted "
"by adhesion molecules expressed on dysfunctional endothelium, migrate into the intima and differentiate into macrophages. "
"These macrophages engulf oxLDL via scavenger receptors, becoming engorged with cholesterol esters and transforming into "
"<b>foam cells</b> — the hallmark of early atherosclerotic lesions. Foam cell accumulation produces the earliest lesion, "
"the <b>fatty streak</b>."
))
story.append(Paragraph("<i>Source: Lippincott's Illustrated Reviews: Biochemistry, 8th ed.</i>", styles["caption"]))
# Insert the atherosclerosis diagram
if os.path.exists(IMG_PATH):
story.append(spacer(6))
img = RLImage(IMG_PATH, width=7*cm, height=12*cm)
img.hAlign = "CENTER"
data = [[img]]
img_table = Table(data, colWidths=[doc.width])
img_table.setStyle(TableStyle([
("ALIGN", (0,0), (-1,-1), "CENTER"),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
]))
story.append(img_table)
story.append(Paragraph(
"Fig. 1 — Evolution of arterial wall changes in atherosclerosis: from healthy endothelium (1) through "
"endothelial dysfunction, monocyte adhesion (2), macrophage activation and fatty streak (3-4), to mature "
"fibrofatty atheroma with foam cells and lipid debris (5). "
"<i>Source: Robbins Pathologic Basis of Disease, Fig. 11.8</i>",
styles["caption"]
))
story.append(spacer(6))
story.append(h2("Step 3: Plaque Formation and the Inflammasome"))
story.append(body(
"As the lesion matures, several amplifying processes converge:"
))
for pt in [
"<b>Inflammasome activation:</b> Cholesterol crystals and oxLDL activate the NLRP3 inflammasome within macrophages, "
"triggering caspase-1 to cleave pro-IL-1β into its active form. IL-1β potentiates endothelial activation, recruits more "
"inflammatory cells, and drives smooth muscle cell (SMC) proliferation.",
"<b>Smooth muscle cell (SMC) migration:</b> Vascular SMCs from the medial layer migrate into the intima in response to PDGF "
"and other cytokines. They proliferate and synthesize extracellular matrix (ECM) proteins — particularly collagen and "
"proteoglycans — converting the fatty streak into a fibrous atheroma.",
"<b>Necrotic core formation:</b> Macrophages and SMCs undergo cell death; lipid debris and extracellular cholesterol "
"accumulate to form a necrotic, lipid-rich core.",
"<b>Fibrous cap:</b> A fibrous cap of collagen and SMCs overlies the necrotic core. Thick caps are \"stable\"; thin, "
"inflamed caps are vulnerable to rupture.",
]:
story.append(bullet(pt))
story.append(Paragraph("<i>Source: Fuster and Hurst's The Heart, 15th ed.</i>", styles["caption"]))
story.append(h2("Step 4: Plaque Rupture and Acute Thrombosis"))
story.append(body(
"The most feared complication of atherosclerosis is <b>plaque rupture</b>. Activated macrophages at the cap shoulder region "
"secrete matrix metalloproteinases (MMPs) that degrade collagen, thinning the fibrous cap. Rupture exposes the "
"prothrombotic necrotic core to circulating blood, triggering platelet aggregation and coagulation cascade activation — "
"forming a thrombus that can partially or completely occlude the artery, precipitating unstable angina or acute myocardial "
"infarction. The degree of luminal obstruction, the speed of occlusion, and collateral circulation determine clinical outcome."
))
story.append(Paragraph("<i>Source: Fuster and Hurst's The Heart, 15th ed., Figure 14-3</i>", styles["caption"]))
story.append(spacer(6))
# ── RISK FACTORS ──────────────────────────────────────────────────────────────
story.append(h2("Risk Factors"))
story.append(body(
"CAD risk factors are classified as <b>non-modifiable</b> (advanced age, male sex, and family history/genetic "
"predisposition) and <b>modifiable</b> (cigarette smoking, hypertension, dyslipidemia with elevated LDL and low HDL, "
"type 2 diabetes mellitus, obesity, physical inactivity, metabolic syndrome, and chronic kidney disease). "
"Due to increased public awareness and aggressive management, several of these risk factors — except obesity and glucose "
"intolerance — have been declining in many populations."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery, 11th ed.</i>", styles["caption"]))
story.append(spacer(4))
# ── 3. SYMPTOMS ───────────────────────────────────────────────────────────────
story.append(section_header("3. CLINICAL SYMPTOMS"))
story.append(spacer(6))
story.append(body(
"CAD produces a <b>spectrum of presentations</b> determined by the severity and speed of arterial obstruction:"
))
story.append(h2("Stable Angina Pectoris"))
story.append(body(
"The classic symptom is <b>substernal chest discomfort</b> — often described as pressure, squeezing, tightness, or "
"heaviness — provoked by physical exertion or emotional stress and relieved within minutes by rest or sublingual "
"nitroglycerin. Pain may radiate to the left arm, jaw, neck, shoulder, or epigastrium. Anginal pain results from "
"ischemia-induced release of adenosine, bradykinin, and other mediators that stimulate local nerve endings."
))
story.append(Paragraph("<i>Source: Robbins Pathologic Basis of Disease</i>", styles["caption"]))
story.append(h2("Atypical and Silent Presentations"))
story.append(body(
"A significant proportion of patients — particularly <b>diabetics, women, and the elderly</b> — present with "
"anginal equivalents rather than classic chest pain: dyspnea on exertion, unexplained fatigue, diaphoresis, nausea, "
"or epigastric discomfort. \"Silent ischemia\" (electrocardiographic evidence of ischemia without symptoms) is common "
"in these populations."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery</i>", styles["caption"]))
story.append(h2("Acute Coronary Syndrome (ACS)"))
story.append(body(
"When plaque ruptures abruptly, patients may present with <b>unstable angina</b> (chest pain at rest or with minimal "
"exertion, not fully relieved by nitroglycerin) or <b>acute myocardial infarction (AMI)</b>, characterized by prolonged "
"ischemia causing cardiomyocyte necrosis. AMI may be complicated by cardiogenic shock, ventricular septal defect, "
"acute mitral regurgitation, or cardiac free wall rupture."
))
story.append(h2("Heart Failure"))
story.append(body(
"Repeated ischemic insults or a large infarction impair ventricular systolic function, triggering neurohormonal activation "
"(renin-angiotensin-aldosterone system, sympathetic nervous system), adverse cardiac remodeling, and progressive "
"<b>ischemic heart failure</b>. Patients present with exertional dyspnea, orthopnea, paroxysmal nocturnal dyspnea, "
"fatigue, and peripheral edema."
))
story.append(h2("Arrhythmias and Sudden Cardiac Death"))
story.append(body(
"Ischemic injury disrupts the myocardial electrical conduction system, predisposing to ventricular tachycardia, "
"ventricular fibrillation, and sudden cardiac death. New-onset arrhythmias in a patient with cardiac risk factors should "
"always prompt investigation for underlying CAD."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery, 11th ed.</i>", styles["caption"]))
story.append(spacer(6))
# ── 4. PREVENTION ─────────────────────────────────────────────────────────────
story.append(section_header("4. PREVENTION"))
story.append(spacer(6))
story.append(body(
"Prevention is the most cost-effective strategy in CAD management and is divided into <b>primary prevention</b> "
"(preventing disease onset) and <b>secondary prevention</b> (preventing recurrence in those already diagnosed)."
))
story.append(h2("Lifestyle Modification"))
for pt in [
"<b>Smoking cessation</b> — eliminating tobacco exposure is the single most impactful intervention.",
"<b>Regular aerobic exercise</b> — at least 150 minutes per week of moderate-intensity activity reduces cardiovascular risk directly and by controlling obesity, hypertension, and insulin resistance.",
"<b>Heart-healthy diet</b> — Mediterranean-style diet (rich in fruits, vegetables, whole grains, legumes, nuts, olive oil, and fish; low in saturated and trans fats) reduces LDL and systemic inflammation.",
"<b>Weight management</b> — BMI target below 25 kg/m².",
]:
story.append(bullet(pt))
story.append(h2("Pharmacological Prevention (AHA/ACC Class I Recommendations)"))
for pt in [
"<b>Blood pressure control:</b> below 140/90 mmHg (below 130/80 mmHg in diabetics or CKD patients).",
"<b>LDL cholesterol:</b> below 100 mg/dL (below 70 mg/dL for very high-risk patients) using statin therapy (HMG-CoA reductase inhibitors).",
"<b>Antiplatelet therapy:</b> low-dose aspirin in all patients without contraindications.",
"<b>Beta-blockers:</b> in all patients with LV dysfunction or following MI/ACS/revascularization.",
"<b>RAAS blockade</b> (ACE inhibitors or ARBs) in patients with hypertension, LV dysfunction, diabetes, or CKD.",
"<b>Glycemic control:</b> HbA1c target below 7% in diabetics.",
]:
story.append(bullet(pt))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery; Textbook of Family Medicine, 9th ed.</i>", styles["caption"]))
story.append(spacer(6))
# ── 5. DIAGNOSIS ──────────────────────────────────────────────────────────────
story.append(section_header("5. DIAGNOSIS"))
story.append(spacer(6))
story.append(body(
"A thorough history (character, location, radiation, duration, and precipitants of chest discomfort) and physical "
"examination form the cornerstone of evaluation. The <b>TIMI risk score</b> aids in stratifying patients with suspected ACS."
))
story.append(h2("Electrocardiography (ECG)"))
story.append(body(
"The resting 12-lead ECG may reveal ST-segment changes, T-wave inversions, Q waves (evidence of prior infarction), or "
"new left bundle branch block. During <b>exercise stress testing</b> (treadmill ECG), 1 mm of horizontal or downsloping "
"ST-segment depression is the standard threshold for ischemia; sensitivity is approximately 50% and specificity approximately "
"90% for obstructive CAD, making it useful as a screening tool in low-to-intermediate risk patients."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery</i>", styles["caption"]))
story.append(h2("Cardiac Biomarkers"))
story.append(body(
"Cardiac <b>troponins</b> (troponin I and T) are the biomarkers of choice for detecting myocardial necrosis. "
"High-sensitivity troponin assays detect injury within 1-3 hours of symptom onset. CK-MB and myoglobin are older "
"adjunct markers."
))
story.append(h2("Non-Invasive Imaging"))
for pt in [
"<b>Stress echocardiography:</b> Pharmacologic stress (dobutamine or dipyridamole) with echocardiographic imaging detects wall-motion abnormalities indicating reversible ischemia — more sensitive than exercise ECG.",
"<b>Nuclear perfusion imaging (SPECT/PET):</b> Technetium-99m or thallium-201 agents reveal perfusion defects under stress vs. rest, identifying viable but ischemic myocardium.",
"<b>Coronary CT angiography (CCTA):</b> High-resolution ECG-gated CT imaging of the coronary arteries; excellent negative predictive value and non-invasive. Recommended for intermediate-risk patients. Reclassifies diagnosis in about 27% of patients at 6-week assessment.",
"<b>Cardiac MRI:</b> Useful for assessing myocardial viability, perfusion, and scar tissue.",
]:
story.append(bullet(pt))
story.append(h2("Invasive Coronary Angiography"))
story.append(body(
"<b>Conventional coronary angiography</b> (cardiac catheterization) remains the gold standard diagnostic tool. It directly "
"visualizes coronary anatomy, quantifies the degree of stenosis, and guides revascularization planning. "
"<b>Fractional Flow Reserve (FFR)</b> measurement during catheterization provides the functional significance of a stenosis "
"beyond anatomical severity."
))
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery; Textbook of Clinical Echocardiography</i>", styles["caption"]))
story.append(spacer(6))
# ── 6. TREATMENT ──────────────────────────────────────────────────────────────
story.append(section_header("6. TREATMENT"))
story.append(spacer(6))
story.append(body(
"CAD management integrates <b>medical therapy</b>, <b>percutaneous interventions</b>, and <b>surgical revascularization</b> "
"— selected based on symptom burden, coronary anatomy, LV function, and comorbidities."
))
story.append(h2("1. Goal-Directed Medical Therapy"))
for pt in [
"<b>Antiplatelet agents:</b> Aspirin (75-100 mg/day) is the cornerstone; dual antiplatelet therapy with a P2Y12 inhibitor (clopidogrel, ticagrelor, or prasugrel) is added after ACS or stent placement for 6-12 months.",
"<b>Statins:</b> Reduce LDL and exert anti-inflammatory, plaque-stabilizing effects. High-intensity statin therapy (atorvastatin 40-80 mg, rosuvastatin 20-40 mg) is standard after ACS.",
"<b>Beta-blockers:</b> Reduce myocardial oxygen demand, heart rate, and blood pressure; decrease mortality post-MI.",
"<b>Nitrates:</b> Sublingual nitroglycerin for acute angina relief; long-acting nitrates for chronic angina.",
"<b>ACE inhibitors/ARBs:</b> Reduce afterload, prevent pathological remodeling, and improve survival in heart failure and post-MI.",
"<b>Ranolazine:</b> A late sodium channel inhibitor that reduces intracellular calcium overload and myocardial ischemia — used as add-on therapy for refractory angina (CARISA trial).",
]:
story.append(bullet(pt))
story.append(h2("2. Percutaneous Coronary Intervention (PCI)"))
story.append(body(
"PCI involves catheter-based coronary balloon angioplasty followed by <b>coronary stenting</b> (bare-metal or drug-eluting "
"stents). Drug-eluting stents (DES) release antiproliferative agents (paclitaxel, sirolimus, or everolimus) that inhibit "
"neointimal hyperplasia, dramatically reducing restenosis compared to bare metal stents. PCI is the treatment of choice for:"
))
for pt in [
"Single or two-vessel disease.",
"Acute STEMI — primary PCI within 90 minutes of first medical contact is the standard of care.",
"Patients with coronary anatomy unsuitable for surgical bypass.",
]:
story.append(bullet(pt))
story.append(h2("3. Coronary Artery Bypass Grafting (CABG)"))
story.append(body(
"CABG surgically bypasses obstructed coronary arteries using conduit vessels — typically the <b>left internal thoracic "
"artery (LITA)</b> to the left anterior descending artery (LAD), with additional saphenous vein grafts or radial artery "
"grafts to other vessels. LITA grafts have excellent long-term patency (>90% at 10 years)."
))
story.append(body(
"<b>ACC/AHA Class I indications for CABG include:</b>"
))
for pt in [
"Left main coronary artery disease.",
"Three-vessel CAD (with or without proximal LAD involvement).",
"Two-vessel disease with proximal LAD involvement.",
"Multivessel disease with diabetes mellitus (CABG preferred over PCI).",
]:
story.append(bullet(pt))
story.append(h2("Key Clinical Trial Evidence"))
# Evidence table
tbl_data = [
[Paragraph("<b>Trial</b>", styles["body"]),
Paragraph("<b>Year</b>", styles["body"]),
Paragraph("<b>Key Finding</b>", styles["body"])],
[Paragraph("SYNTAX Trial", styles["body"]),
Paragraph("2009/2013", styles["body"]),
Paragraph("In complex multivessel/left-main CAD, CABG had lower MACCE at 5 years (26.9% vs 37.3% for PCI)", styles["body"])],
[Paragraph("ASCERT Study", styles["body"]),
Paragraph("2012", styles["body"]),
Paragraph("In multivessel disease, CABG had significantly lower mortality than PCI at 4 years in patients >65 years", styles["body"])],
[Paragraph("NY State Study", styles["body"]),
Paragraph("2005", styles["body"]),
Paragraph("CABG associated with higher long-term survival than PCI in 59,314 patients with multivessel disease", styles["body"])],
[Paragraph("Stent or Surgery Trial", styles["body"]),
Paragraph("2008", styles["body"]),
Paragraph("Survival advantage with CABG over PCI persisted at 6 years in multivessel CAD", styles["body"])],
]
tbl = Table(tbl_data, colWidths=[3.5*cm, 2.2*cm, doc.width - 5.7*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_RED),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.white, LIGHT_GREY]),
("BOX", (0,0), (-1,-1), 0.8, BORDER_GREY),
("INNERGRID", (0,0), (-1,-1), 0.4, BORDER_GREY),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING",(0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(tbl)
story.append(Paragraph("<i>Source: Schwartz's Principles of Surgery, 11th ed.</i>", styles["caption"]))
story.append(spacer(4))
story.append(h2("4. Management of Acute MI"))
story.append(body(
"Immediate management of STEMI includes dual antiplatelet loading, anticoagulation (heparin or bivalirudin), and urgent "
"primary PCI. Fibrinolytic therapy (tPA, tenecteplase) is used when PCI is not available within 120 minutes. Post-MI care "
"includes beta-blocker, statin, ACE inhibitor, and antiplatelet therapy, combined with structured cardiac rehabilitation."
))
story.append(spacer(8))
# ── CONCLUSION ────────────────────────────────────────────────────────────────
story.append(section_header("7. CONCLUSION"))
story.append(spacer(6))
story.append(body(
"Coronary artery disease is a lifelong, progressive condition with a well-characterized pathophysiology rooted in "
"endothelial injury, chronic inflammation, and lipid-driven plaque formation. Its clinical manifestations range from "
"silent ischemia to fatal myocardial infarction. Early identification of risk factors, sustained lifestyle modification, "
"and individualized pharmacotherapy are the pillars of prevention. Timely diagnosis using both non-invasive imaging and "
"invasive angiography, combined with evidence-based revascularization through PCI or CABG, has transformed patient "
"outcomes over the past five decades. A multidisciplinary, patient-centered approach remains essential to reducing the "
"global burden of this disease."
))
story.append(spacer(10))
# ── REFERENCES ────────────────────────────────────────────────────────────────
story.append(hr())
story.append(Paragraph("REFERENCES & SOURCES", styles["source_label"]))
refs = [
"1. Robbins, Cotran & Kumar. Pathologic Basis of Disease, 10th ed. Elsevier. (Atherosclerosis pathophysiology, pp. 468-472)",
"2. Fuster & Hurst. The Heart, 15th ed. McGraw-Hill. (Atherogenesis, inflammasome, NLRP3, plaque rupture)",
"3. Schwartz. Principles of Surgery, 11th ed. McGraw-Hill. (Risk factors, clinical manifestations, diagnosis, CABG vs PCI)",
"4. Harrison's Principles of Internal Medicine, 22nd ed. (2025). McGraw-Hill. (Angina pectoris, stress testing)",
"5. Lippincott Illustrated Reviews: Biochemistry, 8th ed. (LDL metabolism, foam cell formation)",
"6. Textbook of Family Medicine, 9th ed. Elsevier. (AHA/ACC prevention guidelines, risk factor management)",
"7. Textbook of Clinical Echocardiography. Elsevier. (CCTA, coronary angiography diagnostic modalities)",
"8. SYNTAX Trial (2009, updated 2013). CABG vs PCI in complex CAD. JACC.",
"9. ASCERT Study (2012). ACC Foundation / STS database collaboration. N Engl J Med.",
"10. New York State Study (2005). CABG vs PCI in multivessel disease. N Engl J Med.",
"11. Stent or Surgery Trial (2008). International multicenter RCT. Lancet.",
"12. CARISA Trial. Ranolazine in stable angina. JAMA.",
]
for r in refs:
story.append(Paragraph(r, styles["ref"]))
story.append(spacer(8))
story.append(Paragraph(
"Report generated by Orris Medical AI · July 12, 2026 · For educational purposes only. Not a substitute for professional clinical judgment.",
styles["meta"]
))
# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
cd /home/daytona/workspace/cad-report && python3 generate_cad_pdf.py 2>&1
ls -lh /home/daytona/workspace/cad-report/CAD_Medical_Report.pdf
CAD Medical Report
PDF Document · PDF
Remove refrences and sources from pdf ok
~/cad-report/generate_cad_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/cad-report/generate_cad_pdf.py'
python3 << 'EOF' with open("/home/daytona/workspace/cad-report/generate_cad_pdf.…
cd /home/daytona/workspace/cad-report && python3 generate_cad_pdf.py 2>&1
ls -lh /home/daytona/workspace/cad-report/CAD_Medical_Report.pdf
CAD Medical Report
PDF Document · PDF
Refrences and source are remain showing in pdf just remove it
grep -n "ref\|source\|Source\|caption\|REFERENCE\|hr()\|source_label\|story.appe…
~/cad-report/generate_cad_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/cad-report/generate_cad_pdf.py'
python3 << 'EOF' with open("/home/daytona/workspace/cad-report/generate_cad_pdf.…
# Verify no source/reference lines remain grep -n "Source:\|REFERENCES\|source_l…
cd /home/daytona/workspace/cad-report && python3 generate_cad_pdf.py 2>&1
CAD Medical Report
PDF Document · PDF