Flow chart ,diagram, short notes pdf
python3 -c " import pdfplumber with pdfplumber.open('/home/daytona/workspace/attachments/0cf6162f-1b99-4934-ba70-1d5150811d89/Excretion.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages[:5]): print(f'\n--- PAGE {i+1} ---') text = page.extract_text() if text: print(text[:2000]) "
python3 -c " from pypdf import PdfReader import base64, os reader = PdfReader('/home/daytona/workspace/attachments/0cf6162f-1b99-4934-ba70-1d5150811d89/Excretion.pdf') print(f'Pages: {len(reader.pages)}') # Try to extract images from first page page = reader.pages[0] print('Page keys:', page.keys()) print('Resources:', page.get('/Resources', {})) "
python3 -c " import subprocess, os os.makedirs('/home/daytona/workspace/excretion_pages', exist_ok=True) result = subprocess.run( ['pdftoppm', '-r', '150', '-jpeg', '/home/daytona/workspace/attachments/0cf6162f-1b99-4934-ba70-1d5150811d89/Excretion.pdf', '/home/daytona/workspace/excretion_pages/page'], capture_output=True, text=True ) print('stdout:', result.stdout) print('stderr:', result.stderr) print('return code:', result.returncode) import os files = sorted(os.listdir('/home/daytona/workspace/excretion_pages/')) print('Files:', files) "
python3 -c " # Use pytesseract for OCR on all pages import pytesseract from PIL import Image import os pages_dir = '/home/daytona/workspace/excretion_pages/' all_text = {} for i in range(1, 23): fname = f'page-{i:02d}.jpg' fpath = os.path.join(pages_dir, fname) try: img = Image.open(fpath) text = pytesseract.image_to_string(img) all_text[i] = text print(f'=== PAGE {i} ===') print(text[:500]) print() except Exception as e: print(f'Error on page {i}: {e}') "
python3 << 'PYEOF' import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.patches import FancyBboxPatch, FancyArrowPatch import numpy as np 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, Image as RLImage, Table, TableStyle, HRFlowable, PageBreak, KeepTogether) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY from reportlab.pdfgen import canvas from io import BytesIO os.makedirs('/home/daytona/workspace/excretion_output', exist_ok=True) # ============================================================ # HELPER: save matplotlib figure to BytesIO # ============================================================ def fig_to_rl_image(fig, width_cm=17): buf = BytesIO() fig.savefig(buf, format='png', dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) buf.seek(0) w = width_cm * cm from PIL import Image as PILImage img = PILImage.open(buf) ratio = img.height / img.width h = w * ratio buf.seek(0) return RLImage(buf, width=w, height=h) # ============================================================ # FIGURE 1: Types of Nitrogenous Waste - Flowchart # ============================================================ def make_fig1(): fig, ax = plt.subplots(figsize=(14, 7)) ax.set_xlim(0, 14) ax.set_ylim(0, 7) ax.axis('off') fig.patch.set_facecolor('#F0F8FF') ax.set_facecolor('#F0F8FF') title = ax.text(7, 6.5, 'Types of Nitrogenous Waste Products', ha='center', va='center', fontsize=15, fontweight='bold', color='#1a237e', bbox=dict(boxstyle='round,pad=0.5', facecolor='#bbdefb', edgecolor='#1a237e', lw=2)) # Three boxes data = [ (2, 3.5, 'AMMONIA\n(Ammonotelic)', '• Highly toxic\n• Max water needed\n• Least water loss\n• Aquatic animals\n (Bony fish, tadpoles)', '#ef9a9a', '#b71c1c'), (7, 3.5, 'UREA\n(Ureotelic)', '• Less toxic\n• Less water needed\n• Mammals, adult\n amphibians,\n marine fishes,\n terrestrial organisms', '#a5d6a7', '#1b5e20'), (12, 3.5, 'URIC ACID\n(Uricotelic)', '• Least toxic\n• Minimum water\n• Reptiles, birds,\n insects, land snails\n• Paste-like form', '#fff59d', '#f57f17'), ] for x, y, title_t, body, fc, ec in data: box = FancyBboxPatch((x-2.2, y-2.8), 4.4, 5.6, boxstyle='round,pad=0.2', facecolor=fc, edgecolor=ec, lw=2.5) ax.add_patch(box) ax.text(x, y+2.2, title_t, ha='center', va='center', fontsize=11, fontweight='bold', color=ec) ax.text(x, y-0.2, body, ha='center', va='center', fontsize=9, color='#212121', linespacing=1.6) # Arrow from top box to three ax.annotate('', xy=(2, 6.1), xytext=(7, 6.2), arrowprops=dict(arrowstyle='->', color='#1a237e', lw=1.5)) ax.annotate('', xy=(12, 6.1), xytext=(7, 6.2), arrowprops=dict(arrowstyle='->', color='#1a237e', lw=1.5)) plt.tight_layout(pad=0.5) return fig # ============================================================ # FIGURE 2: Kidney Structure & Nephron Flowchart # ============================================================ def make_fig2(): fig, ax = plt.subplots(figsize=(14, 9)) ax.set_xlim(0, 14) ax.set_ylim(0, 9) ax.axis('off') fig.patch.set_facecolor('#FFF8E1') ax.text(7, 8.6, 'Nephron – Urine Formation Process', ha='center', fontsize=14, fontweight='bold', color='#4a148c', bbox=dict(boxstyle='round,pad=0.4', facecolor='#e1bee7', edgecolor='#4a148c', lw=2)) steps = [ (7, 7.4, 'BLOOD ENTERS GLOMERULUS\n(Afferent arteriole → Glomerulus → Efferent arteriole)', '#ce93d8', '#6a1b9a'), (7, 6.0, 'ULTRA-FILTRATION\n(Bowman\'s Capsule – Filter: water, glucose, AA, urea, ions)\nGFR = 125 mL/min | ~180 L/day', '#80deea', '#006064'), (7, 4.7, 'SELECTIVE RE-ABSORPTION (PCT + Loop of Henle + DCT)\n• Actively: Na⁺, Glucose, Amino Acids\n• Passively: Urea, Water\n• 80–99% electrolytes & water reabsorbed', '#a5d6a7', '#1b5e20'), (7, 3.4, 'SECRETION (PCT & DCT)\n• H⁺, K⁺, NH₃, drugs secreted into filtrate\n• Maintains pH & ionic balance', '#ffcc80', '#e65100'), (7, 2.1, 'CONCENTRATION (Loop of Henle)\n• Countercurrent mechanism\n• Descending: permeable to water\n• Ascending: permeable to ions', '#f48fb1', '#880e4f'), (7, 0.8, 'URINE FORMATION & EXCRETION\n1–1.5 L/day | pH 6.0 | Light Yellow | Urea 25–30 g/day', '#bcaaa4', '#3e2723'), ] for x, y, label, fc, ec in steps: box = FancyBboxPatch((1.5, y-0.5), 11, 1.0, boxstyle='round,pad=0.15', facecolor=fc, edgecolor=ec, lw=2, alpha=0.9) ax.add_patch(box) ax.text(x, y, label, ha='center', va='center', fontsize=9, fontweight='bold', color='#212121') # Arrows between steps ys = [s[1] for s in steps] for i in range(len(ys)-1): ax.annotate('', xy=(7, ys[i+1]+0.5), xytext=(7, ys[i]-0.5), arrowprops=dict(arrowstyle='->', color='#4a148c', lw=2)) plt.tight_layout(pad=0.5) return fig # ============================================================ # FIGURE 3: Excretory Organs in Animal Kingdom # ============================================================ def make_fig3(): fig, ax = plt.subplots(figsize=(14, 9)) ax.set_xlim(0, 14) ax.set_ylim(0, 9) ax.axis('off') fig.patch.set_facecolor('#E8F5E9') ax.text(7, 8.6, 'Excretory Organs Across Animal Kingdom', ha='center', fontsize=14, fontweight='bold', color='#1b5e20', bbox=dict(boxstyle='round,pad=0.4', facecolor='#c8e6c9', edgecolor='#1b5e20', lw=2)) # Central node cx, cy = 7, 4.5 circle = plt.Circle((cx, cy), 0.6, color='#388e3c', zorder=5) ax.add_patch(circle) ax.text(cx, cy, 'EXCRETORY\nORGANS', ha='center', va='center', fontsize=8, fontweight='bold', color='white', zorder=6) groups = [ (1.5, 7.8, 'PLATYHELMINTHES\nFlame cells / Protonephridia', '#ef9a9a', '#c62828'), (5.0, 7.8, 'ANNELIDS\nNephridia', '#80cbc4', '#004d40'), (8.5, 7.8, 'ARTHROPODS\nInsects: Malpighian tubules\nArachnida: Coxal glands', '#ffe082', '#e65100'), (12.0, 7.8, 'MOLLUSCA\nOrgan of Bojanus\nKeber\'s organ', '#ce93d8', '#6a1b9a'), (1.5, 1.2, 'ASCHELMINTHES\nRenette cells', '#ffccbc', '#bf360c'), (5.0, 1.2, 'ECHINODERMA\nAbsent\n(diffusion)', '#b0bec5', '#263238'), (8.5, 1.2, 'UROCHORDATA\nNephrocytes', '#81d4fa', '#01579b'), (12.0, 1.2, 'VERTEBRATA\nKidney', '#c5e1a5', '#33691e'), ] for gx, gy, label, fc, ec in groups: box = FancyBboxPatch((gx-1.8, gy-0.9), 3.6, 1.8, boxstyle='round,pad=0.2', facecolor=fc, edgecolor=ec, lw=1.8, alpha=0.9) ax.add_patch(box) ax.text(gx, gy, label, ha='center', va='center', fontsize=8.5, fontweight='bold', color='#212121') # Line to center ax.annotate('', xy=(cx + 0.6*(gx-cx)/np.hypot(gx-cx, gy-cy), cy + 0.6*(gy-cy)/np.hypot(gx-cx, gy-cy)), xytext=(gx, gy), arrowprops=dict(arrowstyle='->', color='#388e3c', lw=1.5)) plt.tight_layout(pad=0.5) return fig # ============================================================ # FIGURE 4: Hormonal Regulation (RAAS) Flowchart # ============================================================ def make_fig4(): fig, ax = plt.subplots(figsize=(12, 9)) ax.set_xlim(0, 12) ax.set_ylim(0, 9) ax.axis('off') fig.patch.set_facecolor('#FFF3E0') ax.text(6, 8.6, 'Hormonal Regulation of Kidney Function', ha='center', fontsize=14, fontweight='bold', color='#e65100', bbox=dict(boxstyle='round,pad=0.4', facecolor='#ffe0b2', edgecolor='#e65100', lw=2)) # RAAS pathway raas = [ (6, 7.5, 'Low BP / Low Blood Volume\nor Low Na⁺ detected', '#ffccbc', '#bf360c'), (6, 6.2, 'JGA releases RENIN', '#ffe082', '#f57f17'), (6, 5.0, 'Renin → Angiotensin I\n(Angiotensinogen → Angiotensin I)', '#fff9c4', '#f9a825'), (6, 3.8, 'ACE converts to\nAngiotensin II', '#c8e6c9', '#2e7d32'), (6, 2.6, 'Angiotensin II:\n• Stimulates Aldosterone release\n• Constricts blood vessels ↑ BP', '#b3e5fc', '#01579b'), (6, 1.4, 'Aldosterone → Na⁺ & H₂O retention\n→ ↑ Blood Volume → ↑ BP', '#e1bee7', '#6a1b9a'), ] for x, y, label, fc, ec in raas: box = FancyBboxPatch((2.0, y-0.45), 8.0, 0.9, boxstyle='round,pad=0.15', facecolor=fc, edgecolor=ec, lw=2) ax.add_patch(box) ax.text(x, y, label, ha='center', va='center', fontsize=9, fontweight='bold', color='#212121') ys = [r[1] for r in raas] for i in range(len(ys)-1): ax.annotate('', xy=(6, ys[i+1]+0.45), xytext=(6, ys[i]-0.45), arrowprops=dict(arrowstyle='->', color='#e65100', lw=2)) # ADH side note ax.text(0.5, 4.5, 'ADH\n(Anti-Diuretic\nHormone):\n↑ water\nreabsorption\nin DCT &\nCollecting\nDuct', ha='center', va='center', fontsize=8.5, color='#01579b', bbox=dict(boxstyle='round,pad=0.4', facecolor='#e3f2fd', edgecolor='#01579b', lw=1.5)) ax.annotate('', xy=(2, 3.8), xytext=(1.5, 4.2), arrowprops=dict(arrowstyle='->', color='#01579b', lw=1.5)) # ANF side note ax.text(11.5, 4.5, 'ANF\n(Atrial Natri-\nuretic Factor):\n↓ BP\n↓ Na⁺ reabs.\nOppose RAAS', ha='center', va='center', fontsize=8.5, color='#880e4f', bbox=dict(boxstyle='round,pad=0.4', facecolor='#fce4ec', edgecolor='#880e4f', lw=1.5)) ax.annotate('', xy=(10, 3.8), xytext=(10.5, 4.2), arrowprops=dict(arrowstyle='->', color='#880e4f', lw=1.5)) plt.tight_layout(pad=0.5) return fig # ============================================================ # FIGURE 5: Kidney Disorders Summary # ============================================================ def make_fig5(): fig, ax = plt.subplots(figsize=(13, 6)) ax.set_xlim(0, 13) ax.set_ylim(0, 6) ax.axis('off') fig.patch.set_facecolor('#FCE4EC') ax.text(6.5, 5.7, 'Kidney Disorders', ha='center', fontsize=14, fontweight='bold', color='#880e4f', bbox=dict(boxstyle='round,pad=0.4', facecolor='#f8bbd0', edgecolor='#880e4f', lw=2)) disorders = [ (2.2, 3.0, 'GLOMERULONEPHRITIS', 'Inflammation of\nglomeruli of kidney\nCause: immune reaction', '#ef9a9a', '#c62828'), (5.5, 3.0, 'RENAL CALCULI\n(Kidney Stones)', 'Crystallised salts\n(oxalates) deposited\nin renal pelvis', '#ffe082', '#e65100'), (8.8, 3.0, 'UREMIA', 'Excess urea in blood\n(>40 mg/100mL)\nTreated by dialysis', '#80cbc4', '#004d40'), (12.0, 3.0, 'GLYCOSURIA', 'Glucose in urine\nDue to Diabetes\nMellitus', '#ce93d8', '#6a1b9a'), ] for x, y, title_d, body, fc, ec in disorders: box = FancyBboxPatch((x-1.7, y-1.5), 3.4, 3.0, boxstyle='round,pad=0.2', facecolor=fc, edgecolor=ec, lw=2, alpha=0.9) ax.add_patch(box) ax.text(x, y+0.9, title_d, ha='center', va='center', fontsize=9, fontweight='bold', color=ec) ax.text(x, y-0.3, body, ha='center', va='center', fontsize=8.5, color='#212121', linespacing=1.5) # Dialysis note ax.text(6.5, 0.5, '⚕ Dialysis = Artificial method to remove nitrogenous wastes from blood when kidneys fail (Uremia)', ha='center', va='center', fontsize=9, style='italic', color='#4a148c', bbox=dict(boxstyle='round,pad=0.3', facecolor='#e8eaf6', edgecolor='#4a148c', lw=1.5)) plt.tight_layout(pad=0.5) return fig # ============================================================ # BUILD PDF # ============================================================ print("Generating figures...") f1 = make_fig1() f2 = make_fig2() f3 = make_fig3() f4 = make_fig4() f5 = make_fig5() print("Figures done. Building PDF...") output_path = '/home/daytona/workspace/excretion_output/Excretion_Notes_Diagrams.pdf' doc = SimpleDocTemplate( output_path, pagesize=A4, rightMargin=1.5*cm, leftMargin=1.5*cm, topMargin=1.5*cm, bottomMargin=1.5*cm ) styles = getSampleStyleSheet() title_style = ParagraphStyle('TitleStyle', parent=styles['Title'], fontSize=20, textColor=colors.HexColor('#1a237e'), spaceAfter=6, alignment=TA_CENTER, fontName='Helvetica-Bold') heading1 = ParagraphStyle('H1', parent=styles['Heading1'], fontSize=13, textColor=colors.HexColor('#4a148c'), spaceBefore=10, spaceAfter=4, fontName='Helvetica-Bold', borderPad=4, backColor=colors.HexColor('#e8eaf6'), borderRadius=4, borderWidth=1, borderColor=colors.HexColor('#4a148c')) body = ParagraphStyle('Body', parent=styles['Normal'], fontSize=10, leading=15, spaceAfter=3, fontName='Helvetica', textColor=colors.HexColor('#212121')) bullet_style = ParagraphStyle('Bullet', parent=styles['Normal'], fontSize=10, leading=15, leftIndent=15, spaceAfter=2, fontName='Helvetica', textColor=colors.HexColor('#212121')) small_bold = ParagraphStyle('SmallBold', parent=styles['Normal'], fontSize=9.5, leading=13, fontName='Helvetica-Bold', textColor=colors.HexColor('#1b5e20')) story = [] # ---- COVER ---- story.append(Spacer(1, 1.5*cm)) story.append(Paragraph('EXCRETION IN ORGANISMS', title_style)) story.append(Paragraph('Flowcharts • Diagrams • Short Notes', ParagraphStyle( 'Sub', parent=styles['Normal'], fontSize=13, alignment=TA_CENTER, textColor=colors.HexColor('#6a1b9a'), spaceAfter=4, fontName='Helvetica'))) story.append(HRFlowable(width='100%', thickness=2, color=colors.HexColor('#1a237e'), spaceAfter=10)) # Intro note story.append(Paragraph( 'This study sheet covers: Types of excretion | Animal excretory organs | ' 'Nephron structure & urine formation | Hormonal regulation | Kidney disorders | Urine composition.', ParagraphStyle('Intro', parent=styles['Normal'], fontSize=10.5, alignment=TA_JUSTIFY, textColor=colors.HexColor('#37474f'), fontName='Helvetica', backColor=colors.HexColor('#e3f2fd'), borderPad=8, borderRadius=4, spaceAfter=10))) # ---- SECTION 1: SHORT NOTES ---- story.append(Paragraph('1. Types of Nitrogenous Excretion', heading1)) tbl_data = [ [Paragraph('<b>Feature</b>', body), Paragraph('<b>Ammonotelic</b>', body), Paragraph('<b>Ureotelic</b>', body), Paragraph('<b>Uricotelic</b>', body)], [Paragraph('Waste Product', body), Paragraph('Ammonia', body), Paragraph('Urea', body), Paragraph('Uric Acid', body)], [Paragraph('Toxicity', body), Paragraph('Highly toxic', body), Paragraph('Less toxic', body), Paragraph('Least toxic', body)], [Paragraph('Water needed', body), Paragraph('Maximum', body), Paragraph('Less', body), Paragraph('Minimum', body)], [Paragraph('Examples', body), Paragraph('Bony fish, Aquatic insects, Tadpoles, Amphib. (aq.)', body), Paragraph('Mammals, Frogs (adult), Marine bony fish', body), Paragraph('Reptiles, Birds, Insects, Land snails', body)], ] tbl = Table(tbl_data, colWidths=[3.2*cm, 4.5*cm, 4.5*cm, 4.5*cm]) tbl.setStyle(TableStyle([ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#1a237e')), ('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('#e8eaf6'), colors.HexColor('#ffffff')]), ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#9e9e9e')), ('ALIGN', (0, 0), (-1, -1), 'CENTER'), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4), ('ROUNDEDCORNERS', [4, 4, 4, 4]), ])) story.append(tbl) story.append(Spacer(1, 0.3*cm)) # Figure 1 story.append(fig_to_rl_image(f1, 17)) plt.close(f1) story.append(Spacer(1, 0.4*cm)) story.append(PageBreak()) # ---- SECTION 2: Kidney ---- story.append(Paragraph('2. The Human Kidney – Key Facts', heading1)) kidney_facts = [ ('<b>Weight:</b> 120–170 g | <b>Size:</b> 10–12 cm long, 5–7 cm wide, 2–3 cm thick', body), ('<b>Blood supply:</b> Renal artery (oxygenated) → Renal vein (deoxygenated)', body), ('<b>Nephron:</b> Structural & functional unit of the kidney (~1 million per kidney)', body), ('<b>Parts of Nephron:</b> Bowman\'s capsule → PCT → Loop of Henle → DCT → Collecting duct', body), ('<b>GFR:</b> 125 mL/min (~180 L/day filtered; only ~1–1.5 L excreted as urine)', body), ('<b>JGA (Juxtaglomerular Apparatus):</b> Regulates GFR; releases Erythropoietin & Renin', body), ] for text, st in kidney_facts: story.append(Paragraph('• ' + text, bullet_style)) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph('3. Urine Formation – Flowchart', heading1)) story.append(fig_to_rl_image(f2, 17)) plt.close(f2) story.append(PageBreak()) # ---- SECTION 3: Reabsorption Details ---- story.append(Paragraph('4. Reabsorption – Section-wise Summary', heading1)) reabs_data = [ [Paragraph('<b>Segment</b>', body), Paragraph('<b>What is Reabsorbed</b>', body)], [Paragraph('PCT (Proximal Convoluted Tubule)', body), Paragraph('Na⁺, Glucose, Amino acids (active); Water, Urea (passive) – ~65% of filtrate', body)], [Paragraph('Descending Loop of Henle', body), Paragraph('Water (permeable); Impermeable to salts', body)], [Paragraph('Ascending Loop of Henle', body), Paragraph('Na⁺, Cl⁻, K⁺ (impermeable to water)', body)], [Paragraph('DCT (Distal Convoluted Tubule)', body), Paragraph('Na⁺ (Aldosterone-controlled), HCO₃⁻ ; Conditional water reabsorption (ADH)', body)], [Paragraph('Collecting Duct', body), Paragraph('Water (ADH-controlled); urea recycling; Na⁺/K⁺ balance', body)], ] rtbl = Table(reabs_data, colWidths=[5.5*cm, 11*cm]) rtbl.setStyle(TableStyle([ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#388e3c')), ('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('#e8f5e9'), colors.HexColor('#ffffff')]), ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#9e9e9e')), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4), ])) story.append(rtbl) story.append(Spacer(1, 0.4*cm)) story.append(Paragraph('5. Excretory Organs in Animal Kingdom', heading1)) story.append(fig_to_rl_image(f3, 17)) plt.close(f3) story.append(PageBreak()) # ---- SECTION 4: Hormonal Regulation ---- story.append(Paragraph('6. Hormonal Regulation of Kidney', heading1)) story.append(fig_to_rl_image(f4, 15)) plt.close(f4) story.append(Spacer(1, 0.3*cm)) # Quick hormone table story.append(Paragraph('Hormones at a Glance:', small_bold)) horm_data = [ [Paragraph('<b>Hormone</b>', body), Paragraph('<b>Source</b>', body), Paragraph('<b>Action on Kidney</b>', body)], [Paragraph('ADH (Vasopressin)', body), Paragraph('Posterior Pituitary', body), Paragraph('↑ Water reabsorption in DCT & Collecting duct', body)], [Paragraph('Aldosterone', body), Paragraph('Adrenal Cortex', body), Paragraph('↑ Na⁺ & water reabsorption; ↑ K⁺ excretion', body)], [Paragraph('Renin', body), Paragraph('JGA (Kidney)', body), Paragraph('Activates RAAS → ↑ Aldosterone → ↑ BP', body)], [Paragraph('ANF (ANP)', body), Paragraph('Atrial walls of Heart', body), Paragraph('↓ Na⁺ reabsorption; ↓ BP; Opposes RAAS', body)], [Paragraph('PTH', body), Paragraph('Parathyroid gland', body), Paragraph('↑ Ca²⁺ reabsorption; ↓ Phosphate reabsorption', body)], ] htbl = Table(horm_data, colWidths=[4.5*cm, 4.5*cm, 7.5*cm]) htbl.setStyle(TableStyle([ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#e65100')), ('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('#fff3e0'), colors.HexColor('#ffffff')]), ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#9e9e9e')), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4), ])) story.append(htbl) story.append(PageBreak()) # ---- SECTION 5: Urine Composition & Disorders ---- story.append(Paragraph('7. Normal Urine Composition', heading1)) urine_data = [ [Paragraph('<b>Property</b>', body), Paragraph('<b>Value</b>', body)], [Paragraph('Volume per day', body), Paragraph('1 – 1.5 Litres', body)], [Paragraph('pH', body), Paragraph('6.0 (slightly acidic)', body)], [Paragraph('Colour', body), Paragraph('Light Yellow (due to Urochrome)', body)], [Paragraph('Urea per day', body), Paragraph('25 – 30 g', body)], [Paragraph('Other solutes', body), Paragraph('Creatinine, Uric acid, Salts (NaCl, K⁺, phosphates)', body)], [Paragraph('Specific gravity', body), Paragraph('1.003 – 1.030', body)], ] utbl = Table(urine_data, colWidths=[5.5*cm, 11*cm]) utbl.setStyle(TableStyle([ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#1565c0')), ('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('#e3f2fd'), colors.HexColor('#ffffff')]), ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#9e9e9e')), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4), ])) story.append(utbl) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph('Abnormal constituents of Urine (Diagnostically important):', small_bold)) abn_data = [ [Paragraph('<b>Substance</b>', body), Paragraph('<b>Condition</b>', body), Paragraph('<b>Cause</b>', body)], [Paragraph('Glucose (Glycosuria)', body), Paragraph('Diabetes Mellitus', body), Paragraph('Insulin deficiency → high blood glucose exceeds renal threshold', body)], [Paragraph('Ketone bodies (Ketonuria)', body), Paragraph('Diabetes / Starvation', body), Paragraph('Excess fat catabolism; acetoacetate, β-hydroxybutyrate', body)], [Paragraph('Proteins (Proteinuria)', body), Paragraph('Glomerulonephritis', body), Paragraph('Damaged glomerular membrane → protein leaks into filtrate', body)], [Paragraph('Blood (Haematuria)', body), Paragraph('Kidney stones / infection', body), Paragraph('Damage to glomerulus or urinary tract', body)], [Paragraph('Urea (Uremia – in blood)', body), Paragraph('Renal failure', body), Paragraph('Kidney cannot filter → urea accumulates in blood', body)], ] atbl = Table(abn_data, colWidths=[4.5*cm, 4.5*cm, 7.5*cm]) atbl.setStyle(TableStyle([ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#880e4f')), ('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('#fce4ec'), colors.HexColor('#ffffff')]), ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#9e9e9e')), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4), ])) story.append(atbl) story.append(Spacer(1, 0.3*cm)) story.append(Paragraph('8. Kidney Disorders – Flowchart', heading1)) story.append(fig_to_rl_image(f5, 17)) plt.close(f5) story.append(Spacer(1, 0.4*cm)) # ---- QUICK REVISION BOX ---- story.append(Paragraph('9. Quick Revision – Key Points', heading1)) revision = [ '1 nephron filters ~125 mL/min → GFR = 125 mL/min; Total filtration = ~180 L/day', 'Urine output = 1–1.5 L/day (99% of filtrate is reabsorbed)', 'PCT reabsorbs: glucose, AA, Na⁺, ~65% water (obligatory)', 'Loop of Henle: countercurrent mechanism; creates concentration gradient in medulla', 'DCT + Collecting duct: conditional (facultative) reabsorption; regulated by ADH & Aldosterone', 'Dialysis (artificial kidney) is used in Uremia / chronic renal failure', 'Malpighian tubules: main excretory organ of insects (Arthropoda)', 'Flame cells = excretory organs of flatworms (Platyhelminthes)', 'Organ of Bojanus = excretory organ of Mollusca', 'Ammonotelic = aquatic; Ureotelic = terrestrial mammals; Uricotelic = birds/reptiles/insects', ] for pt in revision: story.append(Paragraph('✔ ' + pt, bullet_style)) story.append(Spacer(1, 0.5*cm)) story.append(HRFlowable(width='100%', thickness=1.5, color=colors.HexColor('#1a237e'))) story.append(Paragraph('End of Notes – Excretion in Organisms', ParagraphStyle( 'Footer', parent=styles['Normal'], fontSize=9, alignment=TA_CENTER, textColor=colors.HexColor('#757575'), fontName='Helvetica', spaceBefore=6))) print("Building document...") doc.build(story) print(f"PDF saved to: {output_path}") import os size = os.path.getsize(output_path) print(f"File size: {size/1024:.1f} KB") PYEOF
Excretion Notes Diagrams
PDF Document · PDF
| # | Content |
|---|---|
| 1 | Types of Nitrogenous Excretion - colour-coded comparison table (Ammonia / Urea / Uric Acid) + flowchart diagram |
| 2 | Nephron & Urine Formation Flowchart - step-by-step from glomerular filtration to urine output |
| 3 | Reabsorption Table - PCT, Loop of Henle, DCT, Collecting duct |
| 4 | Excretory Organs Across Animal Kingdom - spider diagram (Platyhelminthes → Vertebrata) |
| 5 | RAAS Hormonal Regulation Flowchart - Renin → Angiotensin → Aldosterone + ADH & ANF side notes |
| 6 | Hormone Summary Table - ADH, Aldosterone, Renin, ANF, PTH |
| 7 | Urine Composition + Abnormal Constituents (Glycosuria, Ketonuria, Proteinuria, etc.) |
| 8 | Kidney Disorders - diagram (Glomerulonephritis, Renal Calculi, Uremia, Glycosuria) |
| 9 | Quick Revision - 10 Key Points checklist |