Hello claude i got a internal medicine exam tomorrow and i haven't studied anything so I'll provide you the topics and the book can you make detailed short precise which covers whole topics and easy to understand notes in a doc file.make it in a way that any type of question can be understood and explain it in a stlye that you are teaching to a kid. Make a doc file with notes These are all the topics Kidney Congenital abnormalities( specially horseshoe kidney, posterioir urethral valve), renal physiology(but i will use easy and important subjects like filtration barrier anatomy, nephron transport physiology,afferent and efferent arteriols, renal tubular defects,RAAS system), Acid base physiology , acidosis, alkalosis. Patholgy- urine casts,nephritic and nephrotic syndromes(very important to remember differences, which symptoms they cause),kidney stones,urinary incontinence, acute cystitis,acutepyelonephritis, acute kidney injury, acute tubular necrosis,renal cell carvinoma,diuretics , ace inhibitiors/ARB.
mkdir -p /home/daytona/workspace/kidney-notes && ls /home/daytona/workspace/kidney-notes/
~/kidney-notes/create_notes.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageBreak, TableOfContents, UnderlineType
} = require('docx');
const fs = require('fs');
// Helper functions
function h1(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_1,
spacing: { before: 400, after: 200 },
pageBreakBefore: true,
});
}
function h2(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_2,
spacing: { before: 300, after: 150 },
});
}
function h3(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_3,
spacing: { before: 200, after: 100 },
});
}
function para(text, bold = false, color = '000000') {
return new Paragraph({
children: [new TextRun({ text, bold, color, size: 22 })],
spacing: { after: 100 },
});
}
function bullet(text, level = 0) {
return new Paragraph({
children: [new TextRun({ text, size: 22 })],
bullet: { level },
spacing: { after: 80 },
});
}
function boldBullet(label, text, level = 0) {
return new Paragraph({
children: [
new TextRun({ text: label + ': ', bold: true, size: 22 }),
new TextRun({ text, size: 22 }),
],
bullet: { level },
spacing: { after: 80 },
});
}
function keyPoint(text) {
return new Paragraph({
children: [new TextRun({ text: '⭐ ' + text, bold: true, color: 'C00000', size: 22 })],
spacing: { before: 100, after: 100 },
indent: { left: 360 },
});
}
function tip(text) {
return new Paragraph({
children: [new TextRun({ text: '💡 EXAM TIP: ' + text, bold: true, color: '2E75B6', size: 22 })],
spacing: { before: 100, after: 100 },
indent: { left: 360 },
});
}
function divider() {
return new Paragraph({ text: '─'.repeat(70), spacing: { before: 100, after: 100 } });
}
function makeTable(headers, rows, colWidths) {
const headerRow = new TableRow({
children: headers.map((h, i) =>
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: h, bold: true, color: 'FFFFFF', size: 20 })],
alignment: AlignmentType.CENTER,
})],
shading: { fill: '2E75B6', type: ShadingType.CLEAR, color: '2E75B6' },
width: colWidths ? { size: colWidths[i], type: WidthType.DXA } : undefined,
verticalAlign: VerticalAlign.CENTER,
})
),
tableHeader: true,
});
const dataRows = rows.map((row, ri) =>
new TableRow({
children: row.map((cell, ci) =>
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: cell, size: 20 })],
})],
shading: { fill: ri % 2 === 0 ? 'DEEAF1' : 'FFFFFF', type: ShadingType.CLEAR },
width: colWidths ? { size: colWidths[ci], type: WidthType.DXA } : undefined,
})
),
})
);
return new Table({
rows: [headerRow, ...dataRows],
width: { size: 9000, type: WidthType.DXA },
margins: { top: 80, bottom: 80, left: 120, right: 120 },
});
}
// Title Page
const titlePage = [
new Paragraph({
children: [new TextRun({ text: '', size: 48 })],
spacing: { before: 1200 },
}),
new Paragraph({
children: [new TextRun({ text: 'INTERNAL MEDICINE EXAM NOTES', bold: true, size: 48, color: '1F3864' })],
alignment: AlignmentType.CENTER,
spacing: { after: 200 },
}),
new Paragraph({
children: [new TextRun({ text: 'KIDNEY & RENAL SYSTEM', bold: true, size: 36, color: '2E75B6' })],
alignment: AlignmentType.CENTER,
spacing: { after: 400 },
}),
new Paragraph({
children: [new TextRun({ text: 'Quick Study Guide — Explained Like You\'re 10 Years Old', size: 26, color: '595959', italics: true })],
alignment: AlignmentType.CENTER,
spacing: { after: 200 },
}),
new Paragraph({
children: [new TextRun({ text: 'Covers: Congenital Anomalies | Renal Physiology | Acid-Base | Pathology | Pharmacology', size: 22, color: '595959' })],
alignment: AlignmentType.CENTER,
spacing: { after: 800 },
}),
new Paragraph({
children: [new TextRun({ text: 'June 2026', size: 22, color: '595959', italics: true })],
alignment: AlignmentType.CENTER,
}),
new Paragraph({ children: [new PageBreak()] }),
];
// ===== SECTION 1: CONGENITAL KIDNEY ABNORMALITIES =====
const section1 = [
h1('SECTION 1: CONGENITAL KIDNEY ABNORMALITIES'),
para('Think of the kidneys like two beans that form during fetal development. Sometimes they form in the wrong shape, wrong place, or with blockages. These are "congenital" = born with it.', false, '595959'),
h2('1.1 Horseshoe Kidney'),
para('WHAT IS IT? Imagine the two kidneys, instead of being separate, fuse together at their lower ends — forming a U-shape or horseshoe. The fused part is called the ISTHMUS.'),
keyPoint('Most common renal fusion anomaly — occurs in 1 in 400-500 people'),
h3('How It Happens (Embryology):'),
bullet('During fetal development, the kidneys ascend from the pelvis upward'),
bullet('Before they fully ascend, the lower poles fuse together'),
bullet('The fused kidney gets trapped under the INFERIOR MESENTERIC ARTERY (IMA) and cannot ascend fully'),
bullet('Result: horseshoe kidney sits lower than normal kidneys (lower lumbar level instead of T12-L1)'),
tip('IMA is what "traps" the horseshoe kidney during ascent — classic exam question!'),
h3('Clinical Features (What Problems Does It Cause?):'),
boldBullet('Hydronephrosis (most common complication)', 'The ureters cross anterior to the isthmus, causing kinking → urine backs up → swollen kidney'),
boldBullet('Recurrent UTIs', 'Poor urine drainage = bacteria love to grow there'),
boldBullet('Kidney Stones', 'Urine stasis → stone formation. Most common stone = calcium oxalate'),
boldBullet('Renal Cell Carcinoma', 'Higher risk (especially Wilms tumor in kids)'),
boldBullet('Vesicoureteral Reflux (VUR)', 'Urine flows backward from bladder to kidney'),
h3('What the Exam Loves to Ask:'),
keyPoint('Horseshoe kidney is associated with Turner Syndrome (45 XO)!'),
keyPoint('Rotation anomaly: renal pelvis faces anteriorly instead of medially'),
keyPoint('Most patients are ASYMPTOMATIC — found incidentally on imaging'),
bullet('Diagnosis: CT scan or ultrasound showing fused lower poles'),
bullet('Treatment: usually none unless complications; surgery if severe obstruction'),
divider(),
h2('1.2 Posterior Urethral Valve (PUV)'),
para('WHAT IS IT? Imagine the urethra (tube that drains urine from bladder) has a little flap/valve inside it that should NOT be there. This flap blocks urine from flowing out → causes everything upstream to blow up like a balloon.'),
keyPoint('ONLY occurs in MALES — most common cause of severe obstructive uropathy in male newborns'),
h3('Where is It?'),
bullet('In the posterior urethra (the part inside the prostate/pelvis)'),
bullet('The valve is made of mucosal folds at the level of the verumontanum'),
bullet('Type I PUV (most common) — folds extend anterolaterally from verumontanum'),
h3('What Happens Downstream (Pathophysiology):'),
para('Because urine cannot flow out properly, pressure builds up backward:'),
bullet('Bladder → becomes thick-walled and trabeculated (hypertrophied)'),
bullet('Ureters → dilate (hydroureter)'),
bullet('Kidneys → dilate (hydronephrosis) → permanent damage → renal dysplasia'),
bullet('In severe fetal cases → oligohydramnios (low amniotic fluid) → pulmonary hypoplasia (lungs don\'t develop) → Potter sequence'),
keyPoint('Potter sequence = oligohydramnios → flat face + limb deformities + pulmonary hypoplasia'),
h3('How It Presents:'),
boldBullet('Fetal/Neonatal', 'Bilateral hydronephrosis on prenatal ultrasound; oligohydramnios; poor urinary stream in newborn male'),
boldBullet('Infants', 'Failure to thrive, UTIs, palpable bladder'),
boldBullet('Older boys', 'Weak urinary stream, dribbling, UTIs, urinary incontinence'),
h3('Diagnosis & Treatment:'),
bullet('Diagnosis: VCUG (Voiding cystourethrogram) — GOLD STANDARD — shows posterior urethral dilation'),
bullet('Treatment: Endoscopic valve ablation (destroy the valve with a scope)'),
tip('VCUG is the diagnostic test of choice for PUV — remember this!'),
bullet('Long-term risk: chronic kidney disease even after treatment — up to 30-40% need dialysis/transplant'),
];
// ===== SECTION 2: RENAL PHYSIOLOGY =====
const section2 = [
h1('SECTION 2: RENAL PHYSIOLOGY'),
para('Think of the kidney as the world\'s best water filter + chemical factory. It filters blood, keeps what\'s useful, throws away what\'s not, and helps control blood pressure and acid levels.', false, '595959'),
h2('2.1 Filtration Barrier Anatomy'),
para('The glomerulus is a tiny ball of capillaries (blood vessels) in the kidney. Blood gets filtered through a 3-layer sandwich to produce urine.'),
h3('The 3 Layers of the Filtration Barrier (outside to inside):'),
new Paragraph({
children: [new TextRun({ text: 'Think of it as a fence with 3 gates:', bold: true, size: 22, color: '2E75B6' })],
spacing: { before: 100, after: 100 },
}),
makeTable(
['Layer', 'Structure', 'What It Does', 'Disease if Damaged'],
[
['1st Layer', 'Fenestrated Endothelium\n(cells with holes)', 'Lets water + small molecules through\nBlocks blood cells', 'HUS/TTP (endothelial damage)'],
['2nd Layer', 'Glomerular Basement\nMembrane (GBM)', 'Negatively charged → repels albumin\n(also negatively charged)', 'Goodpasture\'s (anti-GBM antibodies)'],
['3rd Layer', 'Podocytes with Slit\nDiaphragms (foot processes)', 'Final size filter\nMutations cause proteinuria', 'Minimal Change Disease\nFocal Segmental GS'],
],
[2000, 2200, 2600, 2200]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('GBM is the CHARGE barrier (repels proteins). Slit diaphragm is the SIZE barrier'),
keyPoint('Albumin is negative → repelled by negative GBM → stays in blood normally'),
tip('Loss of negative charge in GBM → nephrotic syndrome (protein leaks through)'),
h2('2.2 Nephron Transport Physiology'),
para('The nephron is like an assembly line. Different stations do different jobs:'),
makeTable(
['Segment', 'What\'s Reabsorbed', 'Transporters/Mechanism', 'Key Drug Target'],
[
['Proximal Convoluted Tubule (PCT)', 'Na+, glucose, amino acids, HCO3-, phosphate, uric acid, water (67% of all filtrate)', 'Na-glucose cotransporter (SGLT2), Na-H exchanger (NHE3)', 'SGLT2 inhibitors (gliflozins)'],
['Loop of Henle - Descending', 'Water only (NOT solutes)', 'Aquaporin channels', 'N/A'],
['Loop of Henle - Ascending (thick)', 'Na+, K+, Cl- (but NOT water!)', 'Na-K-2Cl cotransporter (NKCC2)', 'Loop diuretics (furosemide)'],
['Distal Convoluted Tubule (DCT)', 'Na+, Cl- (calcium reabsorbed here)', 'Na-Cl cotransporter (NCC)', 'Thiazide diuretics'],
['Collecting Duct', 'Na+ (in exchange for K+ or H+)\nWater (only if ADH present)', 'ENaC (aldosterone-dependent)', 'K+-sparing diuretics\nADH/Vasopressin'],
],
[2000, 2200, 2500, 2300]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('PCT reabsorbs 67% of everything — it\'s the hardest worker'),
keyPoint('Thick ascending LOH = "diluting segment" — creates the concentration gradient'),
tip('Furosemide acts on thick ascending LOH (NKCC2) → most powerful diuretic'),
h2('2.3 Afferent and Efferent Arterioles'),
para('Think of the kidney as a water park. The afferent arteriole is the pipe bringing water IN; the efferent arteriole is the pipe going OUT. The pressure between them determines how much water (urine) gets filtered.'),
makeTable(
['Arteriole', 'Location', 'Effect of Constriction', 'Effect of Dilation'],
[
['Afferent\n(incoming)', 'Before the glomerulus\n(brings blood IN)', 'Decreases GFR\n(less blood enters filter)', 'Increases GFR\n(more blood enters filter)'],
['Efferent\n(outgoing)', 'After the glomerulus\n(blood exits)', 'Increases GFR (blood backed up in filter) but decreases renal blood flow', 'Decreases GFR'],
],
[1500, 2500, 2500, 2500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
boldBullet('Angiotensin II', 'Constricts EFFERENT arteriole → maintains GFR when blood pressure is low → that\'s why ACE inhibitors can drop GFR!'),
boldBullet('Prostaglandins (NSAIDs block these)', 'Dilate AFFERENT arteriole → NSAIDs can cause acute kidney injury by removing this protection'),
keyPoint('ACE inhibitors + NSAIDs together = double danger to kidneys!'),
keyPoint('ACE inhibitors preferentially dilate the efferent arteriole → reduces intraglomerular pressure → protective in diabetic nephropathy'),
h2('2.4 Renal Tubular Defects'),
para('These are genetic conditions where the "transport machinery" in the tubule is broken. Like a factory where one machine is missing.'),
makeTable(
['Condition', 'Defect', 'What\'s Lost in Urine', 'Key Feature'],
[
['Fanconi Syndrome', 'Generalized PCT dysfunction\n(all transporters fail)', 'Glucose, amino acids, phosphate, uric acid, HCO3-, K+, Na+', 'Glycosuria with NORMAL blood glucose\nCauses rickets'],
['Bartter Syndrome', 'NKCC2 defect (LOH)', 'Na+, K+, Cl-', 'Like chronic furosemide use\nHypokalemia + metabolic alkalosis'],
['Gitelman Syndrome', 'NCC defect (DCT)', 'Na+, Cl-, Mg2+', 'Like chronic thiazide use\nHypomagnesemia + hypokalemia'],
['Liddle Syndrome', 'Overactive ENaC (CD)\n(gain of function)', 'Excess Na+ reabsorbed', 'Hypertension + hypokalemia\nLow renin, low aldosterone'],
['RTA Type I (Distal)', 'Collecting duct can\'t secrete H+', 'Can\'t acidify urine', 'pH >5.5 even with acidosis\nNephrocalcinosis + kidney stones'],
['RTA Type II (Proximal)', 'PCT can\'t reabsorb HCO3-', 'HCO3- lost in urine', 'pH varies\nAssociated with Fanconi'],
['RTA Type IV', 'Hypoaldosteronism', 'K+ retained (hyperkalemia)', 'Hyperkalemia + metabolic acidosis\nSeen in diabetes, ACE inhibitors'],
],
[1800, 2000, 2000, 3200]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
tip('Bartter = NKCC2 (furosemide target). Gitelman = NCC (thiazide target). Liddle = ENaC overactive'),
keyPoint('Fanconi syndrome = everything leaks from PCT — classic cause: Wilson disease, multiple myeloma, tenofovir (HIV drug)'),
h2('2.5 RAAS System (Renin-Angiotensin-Aldosterone System)'),
para('Think of RAAS as the blood pressure rescue team. When blood pressure drops or salt levels fall, RAAS kicks in to raise pressure back up.'),
h3('The Chain Reaction:'),
bullet('STEP 1: Low BP / low blood volume / low Na+ detected by juxtaglomerular cells (JGA)'),
bullet('STEP 2: JGA releases RENIN into blood'),
bullet('STEP 3: Renin converts ANGIOTENSINOGEN (liver) → ANGIOTENSIN I'),
bullet('STEP 4: ACE (in lung endothelium) converts Angiotensin I → ANGIOTENSIN II'),
bullet('STEP 5: Angiotensin II does 4 things:'),
bullet('Constricts blood vessels (raises BP)', 1),
bullet('Constricts efferent arteriole (maintains GFR)', 1),
bullet('Stimulates aldosterone release from adrenal gland', 1),
bullet('Stimulates ADH (vasopressin) release + thirst', 1),
bullet('STEP 6: ALDOSTERONE → acts on collecting duct → more Na+ reabsorbed, more K+ excreted → increases blood volume → raises BP'),
h3('Drugs That Block RAAS:'),
boldBullet('ACE Inhibitors (e.g., lisinopril, enalapril)', 'Block conversion of Ang I → Ang II. Side effect: DRY COUGH (bradykinin accumulation), angioedema'),
boldBullet('ARBs (e.g., losartan, valsartan)', 'Block Ang II receptor (AT1). No cough. Used if patient can\'t tolerate ACEi'),
boldBullet('Aliskiren', 'Direct renin inhibitor (least common)'),
keyPoint('ACEi/ARBs are FIRST-LINE for diabetic nephropathy and heart failure with CKD'),
tip('Never combine ACEi + ARB — double RAAS blockade → severe hyperkalemia and AKI'),
];
// ===== SECTION 3: ACID-BASE =====
const section3 = [
h1('SECTION 3: ACID-BASE PHYSIOLOGY, ACIDOSIS & ALKALOSIS'),
para('Think of your blood pH like a swimming pool. It has to stay in a perfect range (7.35-7.45). Too acidic (< 7.35) = acidosis. Too basic (>7.45) = alkalosis. The body uses 3 systems to keep it balanced.', false, '595959'),
h2('3.1 Buffer Systems'),
boldBullet('Bicarbonate Buffer (most important!)', 'CO2 + H2O ↔ H2CO3 ↔ H+ + HCO3-'),
boldBullet('Respiratory system', 'Controls CO2 (fast response, minutes)'),
boldBullet('Kidneys', 'Controls HCO3- (slow response, hours-days)'),
h2('3.2 The ABG Cheat Sheet'),
makeTable(
['Parameter', 'Normal', 'Acidosis', 'Alkalosis'],
[
['pH', '7.35-7.45', '< 7.35', '> 7.45'],
['PaCO2 (respiratory)', '35-45 mmHg', '> 45 (respiratory acidosis)', '< 35 (respiratory alkalosis)'],
['HCO3- (metabolic)', '22-26 mEq/L', '< 22 (metabolic acidosis)', '> 26 (metabolic alkalosis)'],
],
[2000, 2000, 2500, 2500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('ROME: Respiratory Opposite, Metabolic Equal — pH and PCO2 go opposite in respiratory; pH and HCO3 go same in metabolic'),
h2('3.3 The 4 Types — Simple Summary Table'),
makeTable(
['Type', 'pH', 'Primary Change', 'Common Causes', 'Compensation'],
[
['Metabolic Acidosis', 'LOW', 'HCO3- LOW', 'Diabetic ketoacidosis (DKA), lactic acidosis, renal failure, diarrhea, RTA', 'LUNGS breathe faster (Kussmaul breathing) → blows off CO2 → lowers CO2'],
['Metabolic Alkalosis', 'HIGH', 'HCO3- HIGH', 'Vomiting (lose HCl), loop/thiazide diuretics, hyperaldosteronism, antacid overuse', 'LUNGS breathe slower → retain CO2 → raises CO2'],
['Respiratory Acidosis', 'LOW', 'CO2 HIGH', 'Hypoventilation: COPD, pneumonia, opioids, sleep apnea, neuromuscular disease', 'KIDNEYS retain more HCO3- (takes 3-5 days)'],
['Respiratory Alkalosis', 'HIGH', 'CO2 LOW', 'Hyperventilation: anxiety, pain, PE, high altitude, mechanical ventilation, fever', 'KIDNEYS excrete more HCO3-'],
],
[1600, 600, 1200, 2400, 2200]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
h2('3.4 Anion Gap — Super Important for Metabolic Acidosis!'),
para('Anion Gap (AG) = Na+ - (Cl- + HCO3-)'),
para('Normal AG = 8-12 mEq/L (some say 10-12)'),
makeTable(
['High Anion Gap Acidosis (AG > 12)', 'Normal Anion Gap Acidosis (AG normal = hyperchloremic)'],
[
['Mnemonic: MUDPILES\nM - Methanol\nU - Uremia (renal failure)\nD - Diabetic ketoacidosis\nP - Propylene glycol / Paracetamol\nI - Isoniazid / Iron\nL - Lactic acidosis\nE - Ethylene glycol\nS - Salicylates (aspirin OD)', 'Mnemonic: HARD\nH - Hyperchloremia\nA - Addison\'s disease\nR - RTA (renal tubular acidosis)\nD - Diarrhea (loses HCO3-)\n\nAlso: Saline infusion (dilutional)'],
],
[4500, 4500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('Diarrhea = Normal AG acidosis (loses HCO3-). Vomiting = Metabolic ALKALOSIS (loses HCl)'),
tip('Osmolal gap > 10 + high AG acidosis = methanol or ethylene glycol poisoning'),
h2('3.5 Compensation Rules (MUST KNOW)'),
makeTable(
['Disorder', 'Expected Compensation Formula'],
[
['Metabolic Acidosis', 'Expected PCO2 = 1.5 x HCO3- + 8 (± 2) [Winter\'s formula]'],
['Metabolic Alkalosis', 'Expected PCO2 = 0.7 x HCO3- + 21 (± 2)'],
['Respiratory Acidosis (acute)', 'HCO3- rises 1 mEq/L per 10 mmHg rise in CO2'],
['Respiratory Acidosis (chronic)', 'HCO3- rises 3.5 mEq/L per 10 mmHg rise in CO2'],
['Respiratory Alkalosis (acute)', 'HCO3- falls 2 mEq/L per 10 mmHg fall in CO2'],
['Respiratory Alkalosis (chronic)', 'HCO3- falls 5 mEq/L per 10 mmHg fall in CO2'],
],
[3000, 6000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
tip('If measured value ≠ expected compensation → MIXED disorder is present'),
];
// ===== SECTION 4: PATHOLOGY =====
const section4 = [
h1('SECTION 4: RENAL PATHOLOGY'),
h2('4.1 Urine Casts — The Kidney\'s "Black Box"'),
para('Casts form in the collecting tubules when proteins or cells get "molded" into the shape of the tubule. Think of them as evidence left at the crime scene! Each type tells you where the problem is.'),
makeTable(
['Cast Type', 'What\'s In It', 'What It Means', 'Classic Disease'],
[
['Hyaline casts', 'Just protein (Tamm-Horsfall protein)', 'NORMAL — can occur with dehydration or exercise', 'Normal finding'],
['RBC casts (Red Blood Cell)', 'Red blood cells stuck together', 'GLOMERULONEPHRITIS — bleeding in glomerulus\n= blood leaking through filter', 'Nephritic syndrome, IgA nephropathy, RPGN'],
['WBC casts (White Blood Cell)', 'White blood cells', 'PYELONEPHRITIS or interstitial nephritis\n= infection/inflammation in kidney tissue', 'Acute pyelonephritis'],
['Granular casts ("muddy brown")', 'Cell debris / dirty looking', 'ACUTE TUBULAR NECROSIS (ATN)\n= dead tubule cells breaking down', 'ATN — most important finding!'],
['Waxy casts', 'Highly refractile, smooth', 'CHRONIC KIDNEY DISEASE\n= kidney burned out', 'CKD, end-stage renal disease'],
['Fatty casts\n(oval fat bodies)', 'Fat droplets\n(Maltese cross under polarized light)', 'NEPHROTIC SYNDROME\n= massive protein loss + fat in urine', 'Minimal change, membranous, FSGS'],
['Broad/renal failure casts', 'Very wide, any material', 'End-stage kidney failure\n= tubules dilated from chronic damage', 'CKD, ESRD'],
],
[1400, 1600, 2600, 2400]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('RBC casts = GLOMERULONEPHRITIS (nephritic). Fatty casts = NEPHROTIC'),
keyPoint('"Muddy brown" granular casts = ATN — bread and butter exam question'),
tip('Waxy casts = kidney is failing chronically. Hyaline = don\'t panic, it\'s normal!'),
h2('4.2 NEPHRITIC vs NEPHROTIC Syndrome — THE BIG COMPARISON'),
para('This is the MOST IMPORTANT table in nephrology. Memorize it cold!'),
makeTable(
['Feature', 'NEPHRITIC Syndrome', 'NEPHROTIC Syndrome'],
[
['Mental image', '"Nephri-FIGHT" — angry, blood everywhere', '"Nephro-SPILL" — leaking like a broken dam'],
['Proteinuria', 'MILD (< 3.5 g/day)', 'MASSIVE (> 3.5 g/day) ★'],
['Hematuria', 'YES — red/brown "cola-colored" urine ★', 'NO (or minimal)'],
['Blood pressure', 'HIGH (hypertension) ★', 'Normal or slightly low'],
['Edema', 'Mild-moderate (periorbital)', 'MASSIVE (periorbital, anasarca, ascites) ★'],
['Oliguria', 'YES (reduced urine output)', 'No'],
['Serum albumin', 'Normal or slightly low', 'VERY LOW (hypoalbuminemia) ★'],
['Serum cholesterol', 'Normal', 'HIGH (hyperlipidemia) ★'],
['Urine findings', 'RBC casts, dysmorphic RBCs', 'Fatty casts, oval fat bodies, "Maltese cross"'],
['Complement (C3)', 'Often LOW (complement consumed)', 'Usually normal'],
['Mechanism', 'Inflammation → glomerulus bleeds', 'Podocyte/GBM damage → protein leaks'],
],
[2000, 3300, 3700]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 200 } }),
h3('NEPHRITIC Causes (Inflamed/Angry Glomerulus):'),
makeTable(
['Disease', 'Key Feature', 'Immunofluorescence', 'Electron Microscopy', 'Age Group'],
[
['IgA Nephropathy (Berger\'s)', 'Hematuria after URI/GI infection (24-48 hrs later). Most common GN worldwide', 'IgA deposits in mesangium', 'Mesangial deposits', 'Young adults'],
['Post-Streptococcal GN (PSGN)', 'Hematuria 2-3 WEEKS after strep throat or skin infection. Low C3. "Lumpy-bumpy" pattern', 'Granular IgG + C3 deposits (subepithelial)', '"Humps" on subepithelial side', 'Children 5-15'],
['Goodpasture\'s Syndrome', 'Anti-GBM antibodies. Pulmonary hemorrhage + nephritis. Young men smokers', 'Linear IgG along GBM ("train track" pattern)', 'GBM destruction', 'Young males'],
['RPGN (Crescentic GN)', 'Rapid progressive GN — most severe! Crescents (parietal cells) filling Bowman\'s space. 3 types by IF', 'Type I = linear (Goodpasture), Type II = granular, Type III = pauci-immune (ANCA)', 'Fibrin in crescents', 'Variable'],
['Lupus Nephritis', 'SLE patient + nephritis. "Full house" IF (IgG, IgA, IgM, C3, C1q)', '"Full house" pattern — all immunoglobulins', 'Subendothelial + mesangial + subepithelial deposits', 'Women 20-40'],
['Alport Syndrome', 'Hereditary. X-linked mutation in type IV collagen (COL4A3/A4/A5). Hematuria + sensorineural deafness + ocular problems', 'Normal or thin/split GBM', 'Basket-weave thinning of GBM', 'Males > females'],
],
[1800, 2000, 1600, 1600, 1000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 200 } }),
h3('NEPHROTIC Causes (Leaky Glomerulus):'),
makeTable(
['Disease', 'Key Feature', 'Light Microscopy', 'Electron Microscopy', 'Treatment'],
[
['Minimal Change Disease (MCD)', 'Most common nephrotic in CHILDREN. Normal on LM! Idiopathic or post-URI, NSAIDs, Hodgkin lymphoma. Responds to steroids rapidly', 'NORMAL glomerulus (hence "minimal change")', 'Effacement/fusion of podocyte foot processes', 'Steroids (excellent response)'],
['Focal Segmental GS (FSGS)', 'Most common nephrotic in ADULTS (Black patients). Focal (some glomeruli) + segmental (part of glomerulus). HIV, heroin, obesity, sickle cell', 'Focal sclerosis of segments', 'Foot process effacement', 'Steroids, but often resistant. May progress to CKD'],
['Membranous Nephropathy', 'Most common in WHITE ADULTS. Associated: HBV, malaria, SLE, penicillamine, gold, captopril. "Spike and dome" appearance', '"Spike and dome" pattern — GBM thickened', 'Subepithelial deposits (humps on epithelial side)', 'ACEi/ARBs ± steroids; spontaneous remission possible'],
['Diabetic Nephropathy', 'Most common cause of nephrotic worldwide! Kimmelstiel-Wilson nodules. Microalbuminuria → macroalbuminuria → ESRD', 'Nodular glomerulosclerosis\n(Kimmelstiel-Wilson nodules)', 'GBM thickening', 'Strict glucose control, ACEi/ARBs'],
['Amyloidosis', 'Systemic disease with amyloid protein depositing in kidneys. AL amyloid (myeloma) or AA amyloid (chronic inflammation)', 'Congo red stain → apple-green birefringence under polarized light', 'Fibrils', 'Treat underlying cause'],
],
[1400, 2200, 1600, 1600, 1200]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('Children + nephrotic + responds to steroids = MINIMAL CHANGE DISEASE'),
keyPoint('Kimmelstiel-Wilson nodules = DIABETIC nephropathy'),
keyPoint('Congo red + apple green birefringence = AMYLOIDOSIS'),
keyPoint('Linear IF = Goodpasture\'s. Granular IF = PSGN. Full house = LUPUS'),
tip('"Spike and dome" on EM = Membranous nephropathy. Foot process fusion = MCD or FSGS'),
];
// ===== SECTION 5: KIDNEY STONES =====
const section5 = [
h1('SECTION 5: KIDNEY STONES (NEPHROLITHIASIS)'),
para('Kidney stones form when waste products in urine crystallize. Think of it like sugar crystallizing at the bottom of an oversaturated tea cup. They cause excruciating COLICKY (comes and goes) pain radiating from flank to groin ("loin to groin").', false, '595959'),
makeTable(
['Stone Type', '% of All Stones', 'Cause / Risk Factor', 'X-ray', 'Key Association', 'Treatment/Prevention'],
[
['Calcium Oxalate\n(most common)', '~80%\n(oxalate alone or with phosphate)', 'Hypercalciuria, hyperoxaluria, low urine volume. Crohn\'s disease (fat malabsorption → more oxalate absorbed)', 'RADIOPAQUE\n(white on X-ray)', 'Crohn\'s disease, hyperparathyroidism, Vitamin D excess', 'Increase fluids, thiazides (reduce Ca excretion), low-oxalate diet'],
['Struvite\n(magnesium ammonium phosphate)', '~10-15%', 'UREASE-PRODUCING BACTERIA:\nProteus, Klebsiella, Pseudomonas, Staph saprophyticus (women)', 'Radiopaque\n"Staghorn calculi" filling renal pelvis!', 'Recurrent UTIs. STAGHORN CALCULUS', 'Treat infection, surgery for staghorn stones'],
['Uric Acid', '~5-10%', 'Gout, high purine diet, hyperuricemia, dehydration. Low urine pH (acidic)', 'RADIOLUCENT\n(NOT seen on X-ray)', 'Gout, Lesch-Nyhan syndrome, myeloproliferative disorders (tumor lysis)', 'Alkalize urine (potassium citrate), allopurinol, increase fluids'],
['Cystine', 'Rare (~1%)', 'Cystinuria — autosomal recessive defect in PCT transporter for COLA amino acids\n(Cystine, Ornithine, Lysine, Arginine)', 'Faintly radiopaque\n"Ground glass" appearance', 'Young patients + recurrent stones + hexagonal crystals in urine', 'Alkalize urine, D-penicillamine, high fluid intake'],
],
[1200, 900, 2000, 1000, 1600, 2300]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('Struvite = STAGHORN calculi = always think INFECTION (Proteus)'),
keyPoint('Uric acid = RADIOLUCENT — only stone invisible on plain X-ray! Seen on CT/ultrasound'),
keyPoint('Cystine = hexagonal crystals in urine + young patient + recurrent stones'),
tip('Most common stone overall = CALCIUM OXALATE. Most common in women = STRUVITE (from UTIs)'),
h3('Clinical Presentation & Management:'),
boldBullet('Pain', 'Sudden, severe, colicky flank pain radiating to groin — "loin to groin"'),
boldBullet('Hematuria', 'Blood in urine (painless can suggest tumor)'),
boldBullet('Nausea/vomiting', 'Common'),
boldBullet('Diagnosis', 'Non-contrast CT KUB = gold standard (catches all stones including uric acid)'),
boldBullet('Small stones (<5mm)', 'Pass spontaneously with fluids + pain control (tamsulosin helps ureter relax)'),
boldBullet('Larger stones/obstruction', 'Lithotripsy (ESWL) or ureteroscopy'),
];
// ===== SECTION 6: UTI/PYELONEPHRITIS/CYSTITIS =====
const section6 = [
h1('SECTION 6: URINARY TRACT INFECTIONS'),
h2('6.1 Urinary Incontinence'),
para('Incontinence = involuntary loss of urine. There are different types — each with a different cause and treatment:'),
makeTable(
['Type', 'Mechanism', 'Trigger', 'Key Feature', 'Treatment'],
[
['Stress Incontinence', 'Weak pelvic floor/urethral sphincter', 'Coughing, sneezing, laughing, exercise', 'Most common in women, post-partum, obese', 'Kegel exercises, pessary, surgery'],
['Urge Incontinence\n("Overactive bladder")', 'Detrusor (bladder muscle) overactivity', 'Sudden urge to urinate, can\'t hold it', 'Urgency + frequency + nocturia', 'Anticholinergics (oxybutynin), mirabegron'],
['Overflow Incontinence', 'Bladder can\'t empty → overfills', 'Continuous dribbling, no urge', 'BPH (men), neurogenic bladder (diabetics, MS, spinal injury)', 'Treat BPH (tamsulosin), catheter'],
['Functional Incontinence', 'Physical/cognitive impairment prevents getting to toilet in time', 'Confusion, immobility', 'Elderly patients', 'Scheduled toileting, treat underlying'],
],
[1400, 2000, 1800, 2000, 1800]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('Stress = exertion trigger (cough/sneeze). Urge = "can\'t hold it." Overflow = constant dribbling (BPH/neuro)'),
h2('6.2 Acute Cystitis'),
para('Cystitis = bladder infection. Very common in women (short urethra). Think of it as bacteria climbing up a short ladder into the bladder.'),
boldBullet('Most common organism', 'E. coli (80%). Then Staphylococcus saprophyticus (in young sexually active women — remember this for exams!), Klebsiella, Proteus'),
boldBullet('Risk factors', 'Female sex, sexual activity ("honeymoon cystitis"), pregnancy, catheter, DM, urinary obstruction'),
h3('Symptoms (Lower Tract — ONLY bladder/urethra, NO fever):'),
bullet('Dysuria (painful urination) — "burning"'),
bullet('Frequency and urgency'),
bullet('Suprapubic pain/tenderness'),
bullet('Hematuria (gross or microscopic)'),
bullet('NO fever, NO flank pain, NO systemic symptoms (distinguishes from pyelonephritis!)'),
h3('Diagnosis:'),
bullet('Urinalysis: pyuria (WBCs in urine), bacteriuria, positive leukocyte esterase + nitrite test'),
bullet('Urine culture: >100,000 CFU/mL = significant bacteriuria'),
boldBullet('Treatment', 'Trimethoprim-sulfamethoxazole (TMP-SMX) or nitrofurantoin — 3-7 days. Fluoroquinolones (ciprofloxacin) for complicated cases'),
keyPoint('Nitrite positive on UA = gram-negative bacteria (E. coli, Klebsiella, Proteus — they convert nitrate to nitrite)'),
tip('Staph saprophyticus in young women + sexually active = classic exam scenario'),
h2('6.3 Acute Pyelonephritis'),
para('Pyelonephritis = kidney infection (UPPER tract). Same bacteria as cystitis but they climbed all the way up to the kidney. This is much more serious — it\'s a SYSTEMIC illness.'),
h3('Key Differences from Cystitis:'),
makeTable(
['Feature', 'Cystitis', 'Pyelonephritis'],
[
['Location', 'Bladder only', 'Kidney + renal pelvis'],
['Fever', 'NO', 'YES (> 38°C) ★'],
['Flank pain', 'NO', 'YES (costovertebral angle tenderness) ★'],
['Nausea/vomiting', 'Minimal', 'Common'],
['WBC casts in urine', 'NO', 'YES ★ — pathognomonic!'],
['Severity', 'Mild — outpatient', 'Can be severe — may need hospitalization'],
],
[2000, 2500, 2500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('WBC casts in urine = pyelonephritis (or interstitial nephritis) — classic exam answer'),
boldBullet('Organism', 'E. coli most common. Occasionally Klebsiella, Proteus, Staph aureus (hematogenous spread)'),
boldBullet('Diagnosis', 'Urine culture + blood culture if septic. CT: striated nephrograms (striped pattern)'),
boldBullet('Treatment', 'Fluoroquinolones (ciprofloxacin) or aminoglycosides (severe). IV antibiotics if hospitalized. Duration: 7-14 days'),
boldBullet('Complications', 'Perinephric abscess, emphysematous pyelonephritis (gas in kidney — diabetics!), urosepsis'),
tip('Emphysematous pyelonephritis = gas-forming organisms in kidney of diabetic = surgical emergency!'),
];
// ===== SECTION 7: AKI AND ATN =====
const section7 = [
h1('SECTION 7: ACUTE KIDNEY INJURY (AKI) & ACUTE TUBULAR NECROSIS (ATN)'),
h2('7.1 Acute Kidney Injury (AKI)'),
para('AKI = sudden loss of kidney function happening over HOURS TO DAYS. Think of it like your kidney suddenly going on strike. Creatinine rises, urine output drops.', false, '595959'),
para('DEFINITION (KDIGO): Rise in creatinine ≥ 0.3 mg/dL within 48 hours, OR ≥ 1.5x baseline within 7 days, OR urine output < 0.5 mL/kg/hr for > 6 hours'),
h3('The 3 Types of AKI — The Holy Trinity:'),
makeTable(
['Type', 'Cause (Mechanism)', 'Urine Findings', 'FENa', 'BUN:Cr Ratio', 'Treatment'],
[
['PRE-RENAL\n(most common ~60%)', 'Not enough blood reaching the kidney\n→ Hypovolemia, heart failure, sepsis, hemorrhage, dehydration, over-diuresis', 'Concentrated urine (high osmolality)\nHyaline casts\nSodium <20 mEq/L', 'LOW (<1%)\n(kidneys desperately hold onto Na)', '>20:1\n(BUN rises more)', 'Fix the underlying cause!\nFluid resuscitation, stop offending drugs'],
['INTRINSIC/RENAL\n(~35%)', 'Damage to kidney tissue itself\n→ ATN (most common), glomerulonephritis, AIN (drugs), vascular\n→ Ischemia or nephrotoxins', '"Muddy brown" granular casts\nRenal tubular cells\nSodium >40 mEq/L', 'HIGH (>2%)\n(damaged tubules can\'t reabsorb Na)', '<20:1', 'Remove cause (stop nephrotoxin), supportive care, dialysis if severe'],
['POST-RENAL\n(~5-10%)', 'Obstruction downstream of kidney\n→ BPH, kidney stones, tumor, bladder outlet obstruction', 'Variable\nMay have normal casts', 'Variable', 'Variable', 'Relieve obstruction! (catheter, ureteral stent, nephrostomy tube)'],
],
[1200, 2200, 1600, 1000, 1000, 2000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('FENa (Fractional Excretion of Sodium) = (UNa x PCr) / (PNa x UCr) x 100'),
keyPoint('FENa < 1% = Pre-renal (kidneys conserving Na). FENa > 2% = Intrinsic (tubules damaged, can\'t conserve Na)'),
tip('FENa is NOT reliable if patient is on diuretics — use FEUrea instead'),
h2('7.2 Acute Tubular Necrosis (ATN)'),
para('ATN = the most common cause of INTRINSIC AKI. The tubular cells (especially PCT and thick ascending LOH) die from either lack of oxygen (ischemic ATN) or poison (nephrotoxic ATN).'),
makeTable(
['Type', 'Common Causes', 'Mechanism', 'Key Finding'],
[
['Ischemic ATN', 'Prolonged pre-renal → hypotension/shock → surgery\n(Think: shock, sepsis, major surgery, burns)', 'Reduced blood flow → tubular cell hypoxia → cell death → tubular necrosis', '"Muddy brown" granular casts\nRenal tubular epithelial cells in urine'],
['Nephrotoxic ATN', 'Aminoglycosides (gentamicin), Cisplatin, contrast dye, myoglobin (rhabdomyolysis), hemoglobin, NSAIDs chronic use, heavy metals (mercury, lead)', 'Direct toxic injury to tubular cells (PCT most vulnerable)', 'Specific toxin: e.g., myoglobinuria (brown urine, + dipstick for blood, negative for RBCs on microscopy) = rhabdomyolysis'],
],
[1400, 2500, 2500, 2600]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
h3('Phases of ATN (Classic Exam Question!):'),
boldBullet('Phase 1 - Initiation', 'Injury occurs (hours to days). BUN/Cr rising, urine output falling'),
boldBullet('Phase 2 - Maintenance (oliguric phase)', 'Oliguria (< 400 mL/day). Days to weeks. Most dangerous — risk of hyperkalemia, fluid overload, uremia'),
boldBullet('Phase 3 - Recovery (polyuric phase)', 'Tubules regenerate → massive diuresis (urine output increases dramatically). Risk of hypokalemia and hyponatremia now!'),
keyPoint('Rhabdomyolysis → myoglobin clogs tubules → ATN. Key: brown urine + elevated CK + POSITIVE urine dipstick for blood but NO RBCs on microscopy'),
keyPoint('Aminoglycosides: nephrotoxicity is trough-dependent; ototoxicity is also a side effect'),
tip('Prevention of contrast-induced ATN: pre-hydrate with IV saline, use iso-osmolar contrast, give N-acetylcysteine in high-risk patients'),
];
// ===== SECTION 8: RENAL CELL CARCINOMA =====
const section8 = [
h1('SECTION 8: RENAL CELL CARCINOMA (RCC)'),
para('RCC = most common kidney cancer in adults. Originates from the proximal tubular epithelium. Think of it as the PCT cells going rogue.', false, '595959'),
h2('8.1 Key Facts:'),
boldBullet('Peak age', '50-70 years. Male > Female (2:1)'),
boldBullet('Most common type', 'Clear cell RCC (~75%) — VHL gene mutation (chromosome 3p)'),
boldBullet('Risk factors', 'Smoking (most important modifiable RF!), obesity, hypertension, von Hippel-Lindau disease, dialysis patients, tuberous sclerosis, acquired cystic disease'),
h2('8.2 Classic Triad (only in ~10%!):'),
bullet('Hematuria (painless! — most common presenting symptom)'),
bullet('Flank pain'),
bullet('Palpable flank mass'),
keyPoint('"Classic triad" = advanced disease. Painless hematuria alone is the most common early sign'),
h2('8.3 Paraneoplastic Syndromes (RCC is the king of paraneoplastic syndromes!):'),
makeTable(
['Paraneoplastic Feature', 'Substance Produced', 'Clinical Effect'],
[
['Polycythemia', 'Ectopic EPO (erythropoietin)', 'High RBC count, plethora, hypertension'],
['Hypercalcemia', 'PTHrP (parathyroid hormone-related peptide)', 'Bones, stones, groans, psychic moans'],
['Hypertension', 'Renin secretion', 'Refractory hypertension'],
['Cushing\'s syndrome', 'Ectopic ACTH', 'Moon face, buffalo hump, striae'],
['Stauffer syndrome', 'IL-6 (liver dysfunction without metastasis)', 'Elevated LFTs, hepatomegaly — REVERSES with tumor removal'],
],
[2000, 2500, 4500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('Stauffer syndrome = reversible hepatic dysfunction due to RCC paraneoplastic = classic USMLE trap'),
h2('8.4 Diagnosis & Treatment:'),
boldBullet('Gold standard imaging', 'CT scan abdomen with contrast ("classic" = hypervascular tumor)'),
boldBullet('Most common site of mets', 'Lungs (cannonball lesions), bone, liver, brain, adrenals — "Lungs, Bones, Liver, Brain, Adrenals"'),
boldBullet('Right-sided RCC', 'Can invade IVC (inferior vena cava) → left-sided varicocele if tumor blocks left gonadal vein drainage'),
boldBullet('Left-sided RCC', 'Can cause left testicular varicocele directly (left gonadal vein drains into left renal vein)'),
boldBullet('Treatment', 'Surgical nephrectomy (localized). Sunitinib, sorafenib (TKIs) for metastatic disease. RCC is RESISTANT to chemo and radiation!'),
tip('New varicocele in adult male that does NOT drain with lying down = suspect left RCC blocking left renal vein'),
];
// ===== SECTION 9: DIURETICS =====
const section9 = [
h1('SECTION 9: DIURETICS'),
para('Diuretics = drugs that make you pee more (increase urine output). They work by blocking different Na+ transporters along the nephron. Remember: DIURETICS WORK WHERE THEIR TARGET IS IN THE NEPHRON.', false, '595959'),
makeTable(
['Class', 'Drug Examples', 'Site of Action', 'Mechanism', 'Side Effects', 'Clinical Uses'],
[
['Carbonic Anhydrase Inhibitors', 'Acetazolamide', 'PCT', 'Blocks carbonic anhydrase → less HCO3- reabsorption → bicarbonaturia', 'Metabolic acidosis, hypokalemia, renal stones (Ca phosphate — alkaline urine)', 'Glaucoma, altitude sickness, metabolic alkalosis'],
['Loop Diuretics\n(Most POWERFUL!)', 'Furosemide (lasix)\nBumetanide\nTorsemide\nEthacrynic acid', 'Thick ascending LOH', 'Blocks NKCC2 → Na, K, Cl, Mg, Ca all wasted', 'Hypokalemia ★, metabolic alkalosis ★, ototoxicity (dose-dependent), hyperuricemia (gout!), hypomagnesemia, hypocalcemia (unlike thiazides)', 'Pulmonary edema, heart failure, hypertension, hypercalcemia'],
['Thiazides', 'Hydrochlorothiazide (HCTZ)\nChlorothiazide\nMetolazone', 'DCT', 'Blocks NCC → Na, Cl, K wasted; Ca RETAINED (unlike loop!)', 'Hypokalemia ★, metabolic alkalosis ★, hyperuricemia (gout!), hyponatremia, HYPERGLYCEMIA, hyperlipidemia, HYPERCALCEMIA', 'Hypertension (1st line), osteoporosis (Ca retaining), kidney stones (Ca oxalate prevention), diabetes insipidus (paradoxically)'],
['K+-sparing Diuretics', 'Spironolactone\nEplerenone', 'Collecting duct', 'Block aldosterone receptor → Na excreted, K+ RETAINED', 'HYPERKALEMIA ★, gynecomastia (spironolactone), metabolic acidosis', 'Heart failure (reduces mortality!), hyperaldosteronism, avoid in renal failure'],
['K+-sparing Diuretics (ENaC blockers)', 'Amiloride\nTriamterene', 'Collecting duct', 'Block ENaC (epithelial Na channel) directly', 'HYPERKALEMIA ★, metabolic acidosis', 'Used with loop/thiazides to prevent hypokalemia; Liddle syndrome'],
['Osmotic Diuretics', 'Mannitol', 'PCT + LOH', 'Filtered but not reabsorbed → draws water into tubule lumen osmotically', 'Initial fluid overload (can worsen pulmonary edema!), dehydration, hypernatremia', 'Cerebral edema (reduce ICP), acute glaucoma, rhabdomyolysis (force diuresis)'],
],
[1200, 1300, 900, 1700, 1700, 1700]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 200 } }),
keyPoint('Loop diuretics = HYPOCALCEMIA (Ca wasted). Thiazides = HYPERCALCEMIA (Ca retained). This is a classic exam reversal trap!'),
keyPoint('ALL diuretics except K+-sparing cause HYPOKALEMIA and METABOLIC ALKALOSIS'),
keyPoint('Ethacrynic acid = only loop diuretic safe in SULFA ALLERGY (furosemide is sulfa-based)'),
tip('Spironolactone gynecomastia → switch to eplerenone (more selective, no anti-androgen effects)'),
tip('"Loop diuretics for loop" = treats hypercalcemia. Thiazides for nephrogenic DI and osteoporosis'),
];
// ===== SECTION 10: ACE INHIBITORS / ARBs =====
const section10 = [
h1('SECTION 10: ACE INHIBITORS & ARBs'),
h2('10.1 ACE Inhibitors (ACEi)'),
para('ACE (Angiotensin Converting Enzyme) converts Angiotensin I → Angiotensin II. Block this enzyme = less Ang II = blood vessels relax + less aldosterone = lower blood pressure.'),
makeTable(
['Drug', 'Notes'],
[
['Lisinopril', 'Most commonly prescribed ACEi. Once daily. Does NOT require hepatic activation (already active)'],
['Enalapril', 'Prodrug — activated in liver to enalaprilat'],
['Captopril', 'Short-acting. Contains sulfhydryl group → unique side effects (taste disturbance, neutropenia, membranous nephropathy)'],
['Ramipril', 'Proven mortality benefit in heart failure and high-risk CV patients (HOPE trial)'],
['Benazepril, Fosinopril, Perindopril', 'Various other ACEi, all similar class effects'],
],
[2000, 7000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
h3('Mechanism of Action:'),
bullet('Blocks conversion of Ang I → Ang II (in lungs)'),
bullet('Also prevents breakdown of BRADYKININ → bradykinin accumulates'),
bullet('Bradykinin causes: vasodilation + DRY COUGH + angioedema'),
h3('Major Clinical Uses:'),
boldBullet('Hypertension', 'First-line, especially with CKD, diabetes, or heart failure'),
boldBullet('Diabetic nephropathy', 'Reduces proteinuria by dilating efferent arteriole → reduces intraglomerular pressure'),
boldBullet('Heart failure (HFrEF)', 'Reduces mortality — ESSENTIAL part of therapy'),
boldBullet('Post-MI', 'Reduces remodeling, improves survival'),
boldBullet('CKD with proteinuria', 'Slows progression regardless of etiology'),
h3('Side Effects (MUST KNOW!):'),
makeTable(
['Side Effect', 'Mechanism', 'Management'],
[
['DRY COUGH ★\n(most common reason to stop)', 'Bradykinin accumulation (ACE normally degrades bradykinin)', 'Switch to ARB (ARBs do NOT cause cough — bradykinin not affected)'],
['ANGIOEDEMA ★\n(potentially life-threatening)', 'Bradykinin-mediated. Can occur years after starting drug!', 'STOP drug immediately. Airway management. Icatibant (bradykinin receptor blocker) or FFP. Switch to ARB (angioedema can still occur but much less common)'],
['Hyperkalemia', 'Less aldosterone → less K+ excreted', 'Monitor K+. Avoid K+ supplements, K+-sparing diuretics'],
['Rise in creatinine (initial)', 'Efferent dilation → less filtration pressure\n(acceptable rise < 30% from baseline)', 'Expected and acceptable. Only stop if > 30-40% rise or bilateral RAS suspected'],
['Teratogenicity ★\n(Category D/X in pregnancy)', 'Ang II important for fetal renal development. Causes fetal renal dysplasia + oligohydramnios', 'ABSOLUTELY CONTRAINDICATED in pregnancy!'],
['Hypotension\n("first-dose effect")', 'Especially in volume-depleted or high-renin states', 'Start low, go slow. Give at night'],
],
[2000, 3000, 3000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 200 } }),
h2('10.2 ARBs (Angiotensin Receptor Blockers)'),
para('ARBs block the AT1 receptor for Angiotensin II. Same benefits as ACEi but WITHOUT the cough (bradykinin is not affected).'),
makeTable(
['Drug', 'Notes'],
[
['Losartan', 'First ARB. Also lowers uric acid (unique among ARBs — useful in gout patients with HTN)'],
['Valsartan', 'Used in heart failure (Entresto = sacubitril/valsartan — newest HF drug)'],
['Olmesartan', 'Highly potent. Rare: sprue-like enteropathy (diarrhea/malabsorption) — unique side effect'],
['Irbesartan, Candesartan, Telmisartan', 'All similar class effects'],
],
[2000, 7000]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
makeTable(
['Feature', 'ACEi', 'ARB'],
[
['Mechanism', 'Block ACE enzyme → less Ang II production', 'Block AT1 receptor → Ang II can\'t act'],
['Bradykinin', 'Increases (ACE degrades bradykinin)', 'Normal (not affected)'],
['Dry cough', 'YES (10-15% of patients)', 'NO (major advantage)'],
['Angioedema', 'Yes (~0.1-0.5%)', 'Very rare but possible'],
['Hyperkalemia', 'Yes', 'Yes'],
['Pregnancy', 'CONTRAINDICATED', 'CONTRAINDICATED'],
['Use if cough on ACEi', 'N/A', 'YES — first choice switch'],
],
[2500, 3000, 3500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 150 } }),
keyPoint('NEVER combine ACEi + ARB (dual blockade) — ONTARGET trial showed no benefit + more harm (AKI, hyperkalemia)'),
keyPoint('Sacubitril/Valsartan (Entresto) = ARB + neprilysin inhibitor = first-in-class for HFrEF, reduces mortality'),
tip('Losartan lowers uric acid = good for hypertensive patient with gout'),
h2('10.3 Contraindications to ACEi/ARBs:'),
boldBullet('Bilateral renal artery stenosis (RAS)', 'Both sides → kidneys completely dependent on Ang II efferent constriction to maintain GFR → ACEi/ARBs → acute renal failure (creatinine shoots up)'),
boldBullet('Pregnancy', 'Causes fetal renal agenesis/dysplasia'),
boldBullet('Hyperkalemia (K+ > 5.5)', 'Will worsen it'),
boldBullet('History of ACEi-induced angioedema', 'Avoid ARBs if angioedema was severe (cross-sensitivity)'),
keyPoint('Bilateral RAS + ACEi = acute kidney injury (dramatic creatinine rise = diagnostic clue)'),
];
// ===== QUICK REFERENCE / CHEAT SHEET =====
const cheatSheet = [
h1('QUICK REFERENCE CHEAT SHEET'),
h2('Nephrology in 60 Seconds'),
makeTable(
['Topic', 'Key Point to Remember'],
[
['Horseshoe kidney', 'Fused at lower poles. Trapped by IMA. Turner syndrome. Hydronephrosis + stones + UTIs most common complications'],
['PUV', 'MALES ONLY. Posterior urethra. VCUG diagnosis. Can cause oligohydramnios + Potter sequence'],
['Filtration barrier', '3 layers: Fenestrated endothelium → GBM (charge barrier) → Podocytes/slit diaphragm (size barrier)'],
['RAAS', 'Low BP → Renin → Ang I → (ACE in lungs) → Ang II → Vasoconstriction + Aldosterone → Na retention + K loss'],
['Bartter vs Gitelman', 'Bartter = NKCC2 defect (LOH = furosemide-like). Gitelman = NCC defect (DCT = thiazide-like). Both: hypokalemia + metabolic alkalosis'],
['RTA Type I', 'Can\'t acidify below pH 5.5 → nephrocalcinosis, stones'],
['RTA Type IV', 'Hypoaldosteronism → HYPERKALEMIA + acidosis. Seen with DM, ACEi use'],
['Metabolic acidosis', 'HCO3- low, pH low. Compensation: lungs blow off CO2 (Kussmaul breathing). MUDPILES (high AG) vs HARD (normal AG)'],
['Metabolic alkalosis', 'HCO3- high, pH high. Vomiting/loop diuretics. Compensation: breathe slower'],
['RBC casts', 'Glomerulonephritis = NEPHRITIC'],
['Muddy brown casts', 'ATN = intrinsic AKI'],
['Fatty casts/Maltese cross', 'NEPHROTIC syndrome'],
['WBC casts', 'Pyelonephritis or interstitial nephritis'],
['MCD', 'Kids + nephrotic + steroid-responsive + foot process effacement on EM + NORMAL on LM'],
['FSGS', 'Adults (esp. Black) + nephrotic + focal sclerosis. HIV, heroin'],
['Membranous nephropathy', 'White adults + spike and dome on EM + subepithelial deposits. HBV, SLE'],
['PSGN', '2-3 weeks post-strep + low C3 + subepithelial humps + kids'],
['Goodpasture\'s', 'Linear IgG IF + pulmonary hemorrhage + young male smoker'],
['IgA nephropathy', 'Hematuria within 24-48 hrs of URI. IgA in mesangium'],
['Kidney stones', 'Calcium oxalate (most common, radiopaque). Uric acid (radiolucent, gout). Struvite (staghorn, infection). Cystine (hexagonal, young)'],
['AKI Pre-renal', 'FENa <1%, BUN:Cr >20:1. Hyaline casts. Fix volume depletion'],
['AKI Intrinsic/ATN', 'FENa >2%, BUN:Cr <20:1. Muddy brown casts. Stop nephrotoxin'],
['RCC', 'Painless hematuria + flank mass. VHL gene. Paraneoplastics: polycythemia, hypercalcemia, Stauffer syndrome'],
['Loop diuretics', 'NKCC2. Hypokalemia + HYPOCALCEMIA. Most potent. Use in pulmonary edema, hypercalcemia'],
['Thiazides', 'NCC. Hypokalemia + HYPERCALCEMIA. Use in HTN, osteoporosis, nephrogenic DI'],
['K+-sparing diuretics', 'ENaC/Aldosterone. HYPERKALEMIA. Spironolactone: gynecomastia. Reduce HF mortality'],
['ACEi side effect', 'DRY COUGH (bradykinin). ANGIOEDEMA. Hyperkalemia. Avoid in pregnancy + bilateral RAS'],
['ACEi vs ARB', 'ARB: NO cough. Both: hyperkalemia, avoid pregnancy. NEVER combine'],
],
[2500, 6500]
),
new Paragraph({ children: [new TextRun({ text: '' })], spacing: { after: 300 } }),
new Paragraph({
children: [new TextRun({ text: '🍀 GOOD LUCK ON YOUR EXAM! You\'ve got this! 🍀', bold: true, size: 28, color: '2E75B6' })],
alignment: AlignmentType.CENTER,
spacing: { before: 400, after: 200 },
}),
];
// Assemble the document
const doc = new Document({
creator: 'Orris Medical Notes',
title: 'Internal Medicine Kidney Notes',
description: 'Comprehensive kidney/renal notes for internal medicine exam',
styles: {
default: {
document: {
run: { font: 'Calibri', size: 22 },
},
},
paragraphStyles: [
{
id: 'Heading1',
name: 'Heading 1',
basedOn: 'Normal',
run: { size: 32, bold: true, color: '1F3864', font: 'Calibri' },
paragraph: { spacing: { before: 400, after: 200 } },
},
{
id: 'Heading2',
name: 'Heading 2',
basedOn: 'Normal',
run: { size: 26, bold: true, color: '2E75B6', font: 'Calibri' },
paragraph: { spacing: { before: 300, after: 150 } },
},
{
id: 'Heading3',
name: 'Heading 3',
basedOn: 'Normal',
run: { size: 24, bold: true, color: '595959', font: 'Calibri' },
paragraph: { spacing: { before: 200, after: 100 } },
},
],
},
sections: [
{
children: [
...titlePage,
...section1,
...section2,
...section3,
...section4,
...section5,
...section6,
...section7,
...section8,
...section9,
...section10,
...cheatSheet,
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync('/home/daytona/workspace/kidney-notes/Kidney_Internal_Medicine_Notes.docx', buffer);
console.log('Document created successfully!');
}).catch(err => {
console.error('Error creating document:', err);
process.exit(1);
});
cd /home/daytona/workspace/kidney-notes && node create_notes.js 2>&1
python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/kidney-notes/Kidney_Internal_Medicine_Notes.docx 2>&1
cd /home/daytona/workspace/kidney-notes && python3 -c "import zipfile; z = zipfile.ZipFile('Kidney_Internal_Medicine_Notes.docx'); print('Valid ZIP/DOCX. Files inside:'); print('\n'.join(z.namelist()[:10]))" 2>&1 && ls -lh Kidney_Internal_Medicine_Notes.docx
Kidney Internal Medicine Notes
Word Document · DOCX
Make a quick PDF study guide covering everything
~/kidney-notes/create_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.colors import HexColor, white, black
import os
# ── Colors ────────────────────────────────────────────────────────────────────
NAVY = HexColor('#1F3864')
BLUE = HexColor('#2E75B6')
LTBLUE = HexColor('#DEEAF1')
RED = HexColor('#C00000')
ORANGE = HexColor('#ED7D31')
GREEN = HexColor('#375623')
LTGREEN = HexColor('#E2EFDA')
YELLOW = HexColor('#FFF2CC')
LTGRAY = HexColor('#F2F2F2')
MIDGRAY = HexColor('#595959')
DARKRED = HexColor('#7B0000')
TEAL = HexColor('#00B0F0')
W, H = A4
# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
TITLE = S('title', fontName='Helvetica-Bold', fontSize=28, textColor=NAVY,
alignment=TA_CENTER, spaceAfter=6)
SUBTITLE = S('subtitle', fontName='Helvetica', fontSize=13, textColor=BLUE,
alignment=TA_CENTER, spaceAfter=4)
COVER_SB = S('cover_sb', fontName='Helvetica-Oblique', fontSize=10, textColor=MIDGRAY,
alignment=TA_CENTER, spaceAfter=2)
H1 = S('h1', fontName='Helvetica-Bold', fontSize=14, textColor=white,
backColor=NAVY, borderPad=6, spaceAfter=8, spaceBefore=14,
leftIndent=-8, rightIndent=-8, leading=18)
H2 = S('h2', fontName='Helvetica-Bold', fontSize=11, textColor=NAVY,
spaceAfter=4, spaceBefore=10, leading=14)
H3 = S('h3', fontName='Helvetica-Bold', fontSize=10, textColor=BLUE,
spaceAfter=3, spaceBefore=6, leading=12)
BODY = S('body', fontName='Helvetica', fontSize=9, textColor=black,
spaceAfter=3, leading=13)
BOLD_BODY = S('bold_body', fontName='Helvetica-Bold', fontSize=9, textColor=black,
spaceAfter=3, leading=13)
SMALL = S('small', fontName='Helvetica', fontSize=8, textColor=MIDGRAY,
spaceAfter=2, leading=11)
BULLET = S('bullet', fontName='Helvetica', fontSize=9, textColor=black,
spaceAfter=2, leftIndent=14, firstLineIndent=-10, leading=12,
bulletText='•')
BULLET2 = S('bullet2', fontName='Helvetica', fontSize=8.5, textColor=MIDGRAY,
spaceAfter=2, leftIndent=24, firstLineIndent=-10, leading=11,
bulletText='‣')
KEYPOINT = S('keypoint', fontName='Helvetica-Bold', fontSize=9, textColor=RED,
spaceAfter=3, leftIndent=10, leading=12,
backColor=YELLOW, borderPad=4)
EXAMTIP = S('examtip', fontName='Helvetica-Bold', fontSize=9, textColor=BLUE,
spaceAfter=3, leftIndent=10, leading=12,
backColor=LTBLUE, borderPad=4)
# ── Helper builders ───────────────────────────────────────────────────────────
def h1(text):
return Paragraph(f' {text}', H1)
def h2(text):
return Paragraph(text, H2)
def h3(text):
return Paragraph(text, H3)
def p(text):
return Paragraph(text, BODY)
def bp(text):
return Paragraph(text, BOLD_BODY)
def bul(text, level=0):
s = BULLET if level == 0 else BULLET2
return Paragraph(text, s)
def kp(text):
return Paragraph(f'⭐ {text}', KEYPOINT)
def tip(text):
return Paragraph(f'💡 EXAM TIP: {text}', EXAMTIP)
def sp(n=4):
return Spacer(1, n)
def hr():
return HRFlowable(width='100%', thickness=0.5, color=BLUE, spaceAfter=4, spaceBefore=4)
def tbl(headers, rows, col_widths=None, stripe=True):
"""Build a styled table."""
data = [headers] + rows
if col_widths is None:
n = len(headers)
col_widths = [(W - 3*cm) / n] * n
style = [
# Header
('BACKGROUND', (0,0), (-1,0), BLUE),
('TEXTCOLOR', (0,0), (-1,0), white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 8),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'TOP'),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 7.5),
('GRID', (0,0), (-1,-1), 0.3, HexColor('#AAAAAA')),
('ROWBACKGROUNDS', (0,1), (-1,-1), [LTBLUE, white] if stripe else [white]),
('LEFTPADDING', (0,0), (-1,-1), 4),
('RIGHTPADDING', (0,0), (-1,-1), 4),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING',(0,0), (-1,-1), 3),
('WORDWRAP', (0,0), (-1,-1), True),
]
# Convert plain strings to Paragraphs for wrapping
cell_style = ParagraphStyle('cell', fontName='Helvetica', fontSize=7.5, leading=10,
wordWrap='LTR', spaceAfter=0)
hdr_style = ParagraphStyle('hdr', fontName='Helvetica-Bold', fontSize=8, leading=10,
textColor=white, wordWrap='LTR', spaceAfter=0)
fmt_data = []
for ri, row in enumerate(data):
fmt_row = []
for ci, cell in enumerate(row):
s = hdr_style if ri == 0 else cell_style
fmt_row.append(Paragraph(str(cell), s))
fmt_data.append(fmt_row)
t = Table(fmt_data, colWidths=col_widths, repeatRows=1)
t.setStyle(TableStyle(style))
return t
def comparison_tbl(header_left, header_right, left_col, right_col, rows_data):
"""Two-column comparison table."""
headers = [header_left, header_right]
rows = [[l, r] for l, r in rows_data]
w = (W - 3*cm) / 2
return tbl(headers, rows, [w, w])
# ── Page decorators ───────────────────────────────────────────────────────────
def on_page(canvas, doc):
canvas.saveState()
# Header bar
canvas.setFillColor(NAVY)
canvas.rect(0, H - 1.2*cm, W, 1.2*cm, fill=1, stroke=0)
canvas.setFont('Helvetica-Bold', 8)
canvas.setFillColor(white)
canvas.drawString(1*cm, H - 0.8*cm, 'INTERNAL MEDICINE: KIDNEY QUICK STUDY GUIDE')
canvas.drawRightString(W - 1*cm, H - 0.8*cm, 'Exam Prep 2026')
# Footer
canvas.setFillColor(LTBLUE)
canvas.rect(0, 0, W, 0.8*cm, fill=1, stroke=0)
canvas.setFont('Helvetica', 7)
canvas.setFillColor(NAVY)
canvas.drawCentredString(W/2, 0.25*cm, f'Page {doc.page} | Explained Simply — Study Smart!')
canvas.restoreState()
def on_cover(canvas, doc):
canvas.saveState()
canvas.setFillColor(NAVY)
canvas.rect(0, H - 3*cm, W, 3*cm, fill=1, stroke=0)
canvas.setFillColor(BLUE)
canvas.rect(0, 0, W, 1.5*cm, fill=1, stroke=0)
canvas.setFont('Helvetica-Oblique', 8)
canvas.setFillColor(white)
canvas.drawCentredString(W/2, 0.5*cm, 'Made with ❤ for your exam | Good luck!')
canvas.restoreState()
# ── Document ──────────────────────────────────────────────────────────────────
output_path = '/home/daytona/workspace/kidney-notes/Kidney_Study_Guide.pdf'
doc = SimpleDocTemplate(
output_path,
pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=1.8*cm, bottomMargin=1.5*cm,
title='Kidney Internal Medicine Study Guide',
author='Orris',
)
story = []
# ═══════════════════════════════════════════════════════════════════
# COVER PAGE
# ═══════════════════════════════════════════════════════════════════
story += [
Spacer(1, 4*cm),
Paragraph('INTERNAL MEDICINE', TITLE),
Paragraph('KIDNEY & RENAL SYSTEM', S('big', fontName='Helvetica-Bold',
fontSize=22, textColor=BLUE, alignment=TA_CENTER, spaceAfter=8)),
Spacer(1, 0.5*cm),
Paragraph('Quick Study Guide', S('qs', fontName='Helvetica-BoldOblique',
fontSize=16, textColor=ORANGE, alignment=TA_CENTER, spaceAfter=6)),
Spacer(1, 0.3*cm),
Paragraph('Explained like you\'re 10 years old — because the best way to understand medicine is simply.',
COVER_SB),
Spacer(1, 1*cm),
tbl(
['TOPICS COVERED'],
[['• Congenital Anomalies (Horseshoe Kidney, PUV)'],
['• Renal Physiology (Filtration Barrier, Nephron Transport, RAAS, Arterioles)'],
['• Renal Tubular Defects (Fanconi, Bartter, Gitelman, Liddle, RTA)'],
['• Acid-Base Physiology (Acidosis, Alkalosis, Anion Gap, Compensation)'],
['• Urine Casts | Nephritic vs Nephrotic Syndromes'],
['• Kidney Stones | Urinary Incontinence | Cystitis | Pyelonephritis'],
['• Acute Kidney Injury (AKI) | Acute Tubular Necrosis (ATN)'],
['• Renal Cell Carcinoma | Diuretics | ACE Inhibitors / ARBs'],
],
[W - 3*cm],
),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 1 — CONGENITAL KIDNEY ABNORMALITIES
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 1 — CONGENITAL KIDNEY ABNORMALITIES'),
sp(),
h2('1.1 Horseshoe Kidney'),
p('<b>What is it?</b> Two kidneys fuse at their LOWER POLES forming a U-shape. The fused bridge is called the <b>ISTHMUS</b>. Think of it as the kidneys holding hands at the bottom.'),
kp('Most common renal fusion anomaly — 1 in 400-500 people'),
sp(),
h3('Why does it happen? (Embryology)'),
bul('Kidneys normally start in the pelvis and ASCEND upward during fetal development'),
bul('Before they fully separate, the lower poles fuse together'),
bul('The fused mass gets TRAPPED under the <b>Inferior Mesenteric Artery (IMA)</b> → cannot ascend fully'),
bul('Final position: lower than normal (lower lumbar, NOT T12-L1)'),
bul('Rotation anomaly: renal pelves face ANTERIORLY instead of medially'),
tip('IMA traps the horseshoe kidney = the #1 exam fact about this topic'),
sp(),
tbl(
['Complication', 'Why It Happens', 'Key Notes'],
[
['Hydronephrosis\n(most common)', 'Ureters cross ANTERIOR to isthmus → kinking → urine backs up', 'Most common complication'],
['Recurrent UTIs', 'Poor drainage → bacteria grow', 'Especially E. coli'],
['Kidney Stones', 'Urine stasis → crystal formation', 'Mostly calcium oxalate'],
['Wilms Tumor / RCC', 'Higher malignancy risk', 'Especially Wilms in kids'],
['VUR', 'Vesicoureteral reflux', 'Urine flows backward to kidney'],
],
[4.5*cm, 7*cm, 4.5*cm],
),
sp(6),
kp('Horseshoe kidney is associated with TURNER SYNDROME (45 XO) — classic exam link!'),
kp('Most patients are ASYMPTOMATIC — found incidentally on CT/ultrasound'),
p('<b>Diagnosis:</b> CT or ultrasound showing fused lower poles. <b>Treatment:</b> None if asymptomatic; surgery for severe obstruction.'),
sp(8),
h2('1.2 Posterior Urethral Valve (PUV)'),
p('<b>What is it?</b> An abnormal mucosal fold INSIDE the posterior urethra that acts like a one-way flap valve. It partially blocks urine from flowing OUT of the bladder. Everything upstream gets stretched like a balloon.'),
kp('ONLY IN MALES — most common cause of severe obstructive uropathy in newborn males'),
sp(),
h3('The Domino Effect (Pathophysiology):'),
bul('<b>PUV blocks urine outflow</b> → bladder works harder → thick-walled/trabeculated bladder'),
bul('<b>Bladder</b> backs up → <b>ureters</b> dilate (hydroureter)'),
bul('<b>Ureters</b> back up → <b>kidneys</b> dilate (hydronephrosis) → renal dysplasia'),
bul('<b>Severe fetal cases</b> → oligohydramnios → Potter sequence'),
sp(),
tbl(
['Feature', 'Detail'],
[
['Potter Sequence', 'Oligohydramnios → flat face + limb deformities + PULMONARY HYPOPLASIA (lungs don\'t develop — fatal if severe)'],
['Presentation in fetus/newborn', 'Bilateral hydronephrosis on prenatal US; oligohydramnios; poor/dribbling urinary stream in male infant'],
['Presentation in older boys', 'Weak stream, UTIs, urinary incontinence, failure to thrive'],
['Gold standard diagnosis', 'VCUG (Voiding Cystourethrogram) → shows dilated posterior urethra'],
['Treatment', 'Endoscopic valve ablation (destroy the valve with a scope)'],
['Long-term risk', '30-40% develop CKD requiring dialysis/transplant even after treatment'],
],
[4*cm, 12*cm],
),
tip('VCUG = diagnostic gold standard for PUV. If you see "VCUG" in the stem, think PUV'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 2 — RENAL PHYSIOLOGY
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 2 — RENAL PHYSIOLOGY'),
sp(),
h2('2.1 Filtration Barrier Anatomy'),
p('The glomerulus filters blood through a <b>3-layer sandwich</b>. Each layer is a "gate" that keeps different things out of the urine:'),
sp(),
tbl(
['Layer', 'Structure', 'What It Blocks', 'Disease if Damaged'],
[
['1st (innermost)', 'Fenestrated endothelium\n(cells with pores/holes)', 'Blood cells (RBCs, WBCs, platelets)', 'HUS/TTP — endothelial damage'],
['2nd (middle)', 'Glomerular Basement Membrane (GBM)\n— negatively charged!', 'Proteins (like albumin — also negative, so repelled). CHARGE BARRIER', 'Goodpasture\'s (anti-GBM Ab)\nDiabetic nephropathy (GBM thickening)'],
['3rd (outermost)', 'Podocytes with Slit Diaphragms\n(foot processes interdigitate)', 'Larger molecules by SIZE. SIZE BARRIER', 'Minimal Change Disease (effacement of foot processes)\nFSGS'],
],
[2.5*cm, 5*cm, 5*cm, 5*cm],
),
sp(4),
kp('GBM = CHARGE barrier (repels albumin). Slit diaphragm = SIZE barrier'),
kp('Albumin is negatively charged → repelled by negative GBM → stays in blood normally'),
tip('Loss of negative charge in GBM → nephrotic syndrome (proteinuria). Loss of foot processes → also nephrotic'),
sp(8),
h2('2.2 Nephron Transport Physiology'),
p('The nephron is like an assembly line — each segment specializes in reabsorbing specific substances:'),
sp(),
tbl(
['Segment', 'Reabsorbs', 'Transporter', 'Drug Target'],
[
['PCT\n(Proximal Convoluted Tubule)', '67% of ALL filtrate: Na+, glucose, amino acids, HCO3-, phosphate, uric acid + water', 'SGLT2 (glucose), NHE3 (Na/H exchanger)', 'SGLT2 inhibitors (gliflozins: empagliflozin)'],
['Descending Loop of Henle', 'WATER ONLY (not solutes)', 'Aquaporin channels', 'N/A'],
['Ascending LOH (thick)', 'Na+, K+, 2Cl- — but NOT water!\n(creates concentration gradient)', 'NKCC2 cotransporter', 'Loop diuretics\n(furosemide, bumetanide)'],
['DCT\n(Distal Convoluted Tubule)', 'Na+, Cl-\nCalcium reabsorbed here!', 'NCC cotransporter', 'Thiazide diuretics\n(HCTZ, chlorothiazide)'],
['Collecting Duct', 'Na+ (→ K+ or H+ out)\nWater (only if ADH present)', 'ENaC (aldosterone-dependent)\nAquaporin-2 (ADH-dependent)', 'K+-sparing diuretics\n(spironolactone, amiloride)'],
],
[3.5*cm, 4.5*cm, 4.5*cm, 4.5*cm],
),
sp(4),
kp('PCT reabsorbs 67% of everything — the hardest-working segment'),
kp('Thick ascending LOH = "diluting segment" — creates medullary concentration gradient'),
tip('Furosemide blocks NKCC2 → most powerful diuretic. Thiazides block NCC → moderate'),
sp(8),
h2('2.3 Afferent and Efferent Arterioles'),
p('Think of the glomerulus as a water balloon. The <b>afferent arteriole</b> fills it (incoming), the <b>efferent arteriole</b> drains it (outgoing). Pressure between them = GFR (filtration rate).'),
sp(),
tbl(
['Arteriole', 'If CONSTRICTED → GFR', 'If DILATED → GFR', 'What Controls It?'],
[
['Afferent (incoming,\nbefore glomerulus)', '↓ GFR (less blood in)', '↑ GFR (more blood in)', 'Prostaglandins (dilate)\nNSAIDs block prostaglandins → constrict afferent → ↓GFR'],
['Efferent (outgoing,\nafter glomerulus)', '↑ GFR (blood dams up inside)', '↓ GFR (blood drains faster)', 'Angiotensin II (constricts)\nACE inhibitors block Ang II → dilate efferent → ↓GFR'],
],
[4*cm, 4*cm, 4*cm, 6*cm],
),
sp(4),
kp('Angiotensin II constricts EFFERENT → maintains GFR when BP is low'),
kp('ACEi/ARBs dilate efferent → reduce intraglomerular pressure → protective in diabetic nephropathy'),
kp('NSAIDs + ACEi together = double attack on GFR → dangerous in elderly/CKD'),
sp(8),
h2('2.4 Renal Tubular Defects'),
tbl(
['Condition', 'Defect', 'Lost in Urine', 'Key Clue'],
[
['Fanconi Syndrome', 'ALL PCT transporters fail', 'Glucose, amino acids, phosphate, HCO3-, uric acid, K+', 'Glycosuria with NORMAL blood glucose → rickets\nCauses: Wilson, myeloma, tenofovir'],
['Bartter Syndrome', 'NKCC2 defect (LOH)', 'Na+, K+, Cl-', 'Like being on furosemide 24/7\nHypokalemia + metabolic alkalosis + polyuria'],
['Gitelman Syndrome', 'NCC defect (DCT)', 'Na+, Cl-, Mg2+', 'Like being on thiazide 24/7\nHypomagnesemia + hypokalemia + alkalosis'],
['Liddle Syndrome', 'ENaC overactive (CD)\n→ gain of function mutation', 'Excess Na+ reabsorbed', 'HTN + hypokalemia\nLow renin + LOW aldosterone (autonomous)'],
['RTA Type I (Distal)', 'Collecting duct can\'t secrete H+', 'H+ retained', 'Urine pH >5.5 EVEN in acidosis\nNephrocalcinosis + kidney stones'],
['RTA Type II (Proximal)', 'PCT can\'t reabsorb HCO3-', 'HCO3- in urine', 'Variable urine pH\nAssociated with Fanconi syndrome'],
['RTA Type IV', 'Hypoaldosteronism', 'K+ NOT excreted (hyperkalemia)', 'HYPERKALEMIA + metabolic acidosis\nDiabetes, CKD, ACE inhibitors'],
],
[3.5*cm, 3.5*cm, 3.5*cm, 6.5*cm],
),
sp(4),
tip('Bartter = NKCC2 (furosemide target). Gitelman = NCC (thiazide target). Both: hypokalemia + alkalosis'),
kp('RTA Type IV is the ONLY RTA with HYPERKALEMIA (the rest have hypokalemia or normal K+)'),
sp(8),
h2('2.5 The RAAS System (Renin-Angiotensin-Aldosterone)'),
p('<b>Think of RAAS as the kidney\'s emergency blood pressure rescue team:</b>'),
bul('⬇ BP or ⬇ Na+ or ⬇ blood volume → <b>Juxtaglomerular cells (JGA)</b> detect it'),
bul('JGA releases <b>RENIN</b>'),
bul('Renin acts on <b>angiotensinogen</b> (from liver) → <b>Angiotensin I</b>'),
bul('<b>ACE</b> (in lung) converts Ang I → <b>Angiotensin II</b>'),
bul('Ang II does 4 things: (1) vasoconstriction → ↑BP, (2) constricts efferent arteriole, (3) stimulates ALDOSTERONE from adrenal cortex, (4) stimulates ADH + thirst'),
bul('<b>Aldosterone</b> → collecting duct → Na+ in, K+ out → ↑ blood volume → ↑BP'),
sp(4),
tbl(
['Drug Class', 'Examples', 'Where It Blocks', 'Side Effects'],
[
['ACE Inhibitors (ACEi)', 'Lisinopril, enalapril, ramipril', 'Blocks ACE → less Ang II\nBradykinin accumulates!', 'DRY COUGH, ANGIOEDEMA (bradykinin)\nHyperkalemia, teratogenic'],
['ARBs', 'Losartan, valsartan, olmesartan', 'Blocks AT1 receptor\nBradykinin NOT affected', 'NO cough! Hyperkalemia, teratogenic\nAngioedema very rare'],
['Aliskiren', 'Aliskiren', 'Blocks Renin directly', 'Rare — not first-line'],
],
[3.5*cm, 4*cm, 5*cm, 5*cm],
),
kp('ACEi cause cough because bradykinin accumulates → switch to ARB if cough'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 3 — ACID-BASE
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 3 — ACID-BASE PHYSIOLOGY, ACIDOSIS & ALKALOSIS'),
p('<b>Blood pH must stay 7.35–7.45.</b> Below 7.35 = ACIDOSIS. Above 7.45 = ALKALOSIS. Two organs control this: LUNGS (fast, controls CO2) and KIDNEYS (slow, controls HCO3-).'),
sp(),
tbl(
['Parameter', 'Normal Range', 'Acidosis', 'Alkalosis'],
[
['pH', '7.35 – 7.45', '< 7.35', '> 7.45'],
['PaCO2 (respiratory)', '35 – 45 mmHg', '> 45 mmHg (resp. acidosis)', '< 35 mmHg (resp. alkalosis)'],
['HCO3- (metabolic)', '22 – 26 mEq/L', '< 22 mEq/L (met. acidosis)', '> 26 mEq/L (met. alkalosis)'],
],
[4*cm, 4*cm, 5*cm, 5*cm],
),
sp(4),
kp('ROME: Respiratory Opposite (pH↓ + PCO2↑), Metabolic Equal (pH↓ + HCO3-↓)'),
sp(6),
h2('The 4 Acid-Base Disorders'),
tbl(
['Disorder', 'pH', 'Primary Change', 'Common Causes', 'Compensation'],
[
['Metabolic\nAcidosis', 'LOW', 'HCO3- LOW', 'DKA, lactic acidosis, renal failure, diarrhea, RTA, ingestions (methanol, salicylates)', 'LUNGS: breathe faster → blow off CO2 (Kussmaul breathing)\nWinter\'s formula: PCO2 = 1.5×HCO3- + 8 (±2)'],
['Metabolic\nAlkalosis', 'HIGH', 'HCO3- HIGH', 'Vomiting (lose HCl), loop/thiazide diuretics, hyperaldosteronism, antacids', 'LUNGS: breathe slower → retain CO2\nExpected PCO2 = 0.7×HCO3- + 21'],
['Respiratory\nAcidosis', 'LOW', 'CO2 HIGH', 'Hypoventilation: COPD, opioids, obesity hypoventilation, pneumonia, sleep apnea, NMD', 'KIDNEYS: retain HCO3-\nAcute: +1 mEq/L HCO3- per 10↑CO2\nChronic: +3.5 mEq/L per 10↑CO2'],
['Respiratory\nAlkalosis', 'HIGH', 'CO2 LOW', 'Hyperventilation: anxiety, pain, PE, high altitude, pregnancy, fever, mechanical ventilation', 'KIDNEYS: excrete HCO3-\nAcute: -2 mEq/L HCO3- per 10↓CO2\nChronic: -5 mEq/L per 10↓CO2'],
],
[2.5*cm, 1.5*cm, 2*cm, 5*cm, 6*cm],
),
sp(6),
h2('Anion Gap — Critical for Metabolic Acidosis!'),
bp('Anion Gap (AG) = Na+ − (Cl- + HCO3-) Normal = 8–12 mEq/L'),
sp(),
tbl(
['High AG Acidosis (AG > 12) — mnemonic: MUDPILES', 'Normal AG Acidosis (Hyperchloremic) — mnemonic: HARD'],
[['M – Methanol\nU – Uremia (renal failure)\nD – DKA (diabetic ketoacidosis)\nP – Propylene glycol / Paracetamol (acetaminophen)\nI – Isoniazid / Iron\nL – Lactic acidosis\nE – Ethylene glycol\nS – Salicylates (aspirin OD)',
'H – Hyperchloremia (saline infusion)\nA – Addison\'s disease\nR – RTA (renal tubular acidosis types I & II)\nD – Diarrhea (bicarbonate loss)\n\n(Easy memory: anything that LOSES HCO3- or adds Cl-)']],
[9*cm, 9*cm],
),
sp(4),
kp('Diarrhea → NORMAL AG acidosis (HCO3- loss). Vomiting → metabolic ALKALOSIS (HCl loss)'),
tip('Osmolal gap >10 + high AG acidosis → Methanol or Ethylene glycol poisoning'),
tip('If measured compensation ≠ expected → MIXED acid-base disorder is present'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 4 — URINE CASTS
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 4 — URINE CASTS (The Kidney\'s Clues)'),
p('Casts form when proteins or cells get "molded" in the shape of the renal tubule. They\'re like footprints left at the scene of the crime — each type tells you exactly what\'s wrong.'),
sp(),
tbl(
['Cast Type', 'Contents', 'Meaning', 'Disease'],
[
['Hyaline casts', 'Tamm-Horsfall protein only', 'NORMAL — dehydration, exercise', 'Normal, not worrying'],
['RBC casts ⭐', 'Red blood cells', 'GLOMERULONEPHRITIS\nBlood leaking from glomerulus', 'Nephritic syndrome, IgA nephropathy, RPGN'],
['"Muddy brown"\ngranular casts ⭐', 'Cellular debris', 'ACUTE TUBULAR NECROSIS (ATN)\nDead tubule cells breaking apart', 'ATN — KEY FINDING for diagnosis'],
['WBC casts ⭐', 'White blood cells', 'PYELONEPHRITIS or interstitial nephritis\nInflammation in kidney tissue', 'Acute pyelonephritis, AIN'],
['Fatty casts ⭐\n(oval fat bodies)', 'Fat droplets\n(Maltese cross pattern under polarized light)', 'NEPHROTIC SYNDROME\nMassive protein + fat leaking', 'MCD, FSGS, Membranous nephropathy'],
['Waxy casts', 'Highly refractile material', 'CHRONIC KIDNEY DISEASE\nBurned-out, dilated tubules', 'CKD, end-stage renal disease'],
['Broad/renal failure casts', 'Any material — very wide', 'SEVERE CKD — tubules abnormally dilated', 'ESRD, near end-stage'],
],
[3.5*cm, 3.5*cm, 4.5*cm, 5.5*cm],
),
sp(4),
kp('RBC casts = Nephritic syndrome. Fatty casts = Nephrotic syndrome. This distinction is on every exam!'),
kp('"Muddy brown" granular casts = ATN. WBC casts = Pyelonephritis. Hyaline = normal.'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 5 — NEPHRITIC vs NEPHROTIC
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 5 — NEPHRITIC vs NEPHROTIC SYNDROME'),
p('This is the MOST TESTED comparison in nephrology. Learn it cold. Use the mental images: <b>Nephritic = angry/inflamed (blood everywhere). Nephrotic = leaky/spilling (protein everywhere).</b>'),
sp(),
tbl(
['Feature', 'NEPHRITIC Syndrome', 'NEPHROTIC Syndrome'],
[
['Mental image', '🔴 "Nephri-FIGHT" — angry glomerulus, inflamed, bleeding', '💧 "Nephro-SPILL" — leaky dam, protein flooding out'],
['Proteinuria', 'MILD (<3.5 g/day)', 'MASSIVE (>3.5 g/day) ⭐'],
['Hematuria', 'YES — cola/brown-colored urine ⭐', 'NO (or trace)'],
['Blood pressure', 'HIGH (HTN) ⭐ — Na/fluid retention', 'Normal or low'],
['Edema', 'Mild (periorbital)', 'MASSIVE — periorbital, ascites, anasarca ⭐'],
['Serum albumin', 'Normal or mildly low', 'VERY LOW (hypoalbuminemia) ⭐'],
['Cholesterol', 'Normal', 'HIGH (hyperlipidemia) ⭐'],
['Urine microscopy', 'RBC casts, dysmorphic RBCs', 'Fatty casts, oval fat bodies, Maltese cross'],
['Complement C3', 'Often LOW (consumed by inflammation)', 'Usually NORMAL'],
['Mechanism', 'Inflammation → glomerulus bleeds', 'GBM/podocyte damage → protein leaks'],
],
[4*cm, 7*cm, 7*cm],
),
sp(8),
h2('Nephritic Syndrome — Causes'),
tbl(
['Disease', 'Key Feature', 'Immunofluorescence', 'EM Finding', 'Age'],
[
['IgA Nephropathy\n(Berger\'s) ⭐', 'Gross hematuria 24-48 hrs AFTER URI/GI illness. Most common GN worldwide.', 'IgA in mesangium', 'Mesangial deposits', 'Young adults'],
['Post-Strep GN\n(PSGN) ⭐', 'Hematuria 2-3 WEEKS after strep throat. Low C3. "Lumpy-bumpy" pattern.', 'Granular IgG + C3\n(subepithelial)', '"Humps" (subepithelial)', 'Kids 5-15 yrs'],
['Goodpasture\'s Syndrome', 'Anti-GBM antibodies. Pulmonary hemorrhage + nephritis. Young male SMOKERS.', 'Linear IgG\n(train tracks) ⭐', 'GBM destruction', 'Young males'],
['RPGN (Crescentic GN)', 'MOST SEVERE. Rapidly progressive. Crescents in Bowman\'s space.', 'Type I=linear, Type II=granular, Type III=pauci-immune (ANCA)', 'Fibrin crescents', 'Variable'],
['Lupus Nephritis', 'SLE + nephritis. "Full house" pattern.', '"Full house" (IgG, IgA, IgM, C3, C1q) ⭐', 'Subendothelial + subepithelial deposits', 'Women 20-40'],
['Alport Syndrome', 'X-linked COL4A3/4/5 mutation. Hematuria + sensorineural deafness + ocular problems.', 'Thin/split GBM', 'Basket-weave GBM ⭐', 'Males > females'],
],
[3.5*cm, 4.5*cm, 3.5*cm, 3.5*cm, 2*cm],
),
sp(6),
kp('IgA nephropathy: hematuria DURING or 24-48 hrs after infection. PSGN: 2-3 WEEKS after infection. Different timing!'),
kp('Linear IF = Goodpasture\'s. Granular IF = PSGN. Full house = Lupus. Pauci-immune = ANCA vasculitis'),
sp(8),
h2('Nephrotic Syndrome — Causes'),
tbl(
['Disease', 'Key Feature', 'Light Microscopy', 'Electron Microscopy', 'Treatment'],
[
['Minimal Change Disease (MCD) ⭐', 'Most common nephrotic in CHILDREN. Post-viral, NSAIDs, Hodgkin lymphoma.', 'NORMAL! (hence "minimal change")', 'Foot process EFFACEMENT/fusion ⭐', 'STEROIDS (excellent response)'],
['FSGS ⭐', 'Most common nephrotic in BLACK ADULTS. HIV, heroin, obesity, sickle cell.', 'Focal (some glomeruli) + segmental (part of glomerulus) sclerosis', 'Foot process effacement', 'Steroids (often resistant). Can progress to CKD'],
['Membranous Nephropathy ⭐', 'Most common in WHITE ADULTS. HBV, malaria, SLE, penicillamine, gold.', '"Spike and dome" — GBM thickened ⭐', 'Subepithelial deposits ("humps on outside")', 'ACEi/ARBs ± steroids'],
['Diabetic Nephropathy ⭐', 'Most common nephrotic WORLDWIDE. Microalbuminuria → ESRD.', 'Nodular glomerulosclerosis\n(Kimmelstiel-Wilson nodules) ⭐', 'GBM thickening', 'Glucose control + ACEi/ARBs'],
['Amyloidosis', 'Myeloma (AL amyloid) or chronic inflammation (AA amyloid)', 'Congo red → apple-green birefringence under polarized light ⭐', 'Fibrils (amyloid fibers)', 'Treat underlying cause'],
],
[3.5*cm, 4.5*cm, 3*cm, 3*cm, 3*cm],
),
sp(4),
kp('Children + nephrotic + steroids work = MINIMAL CHANGE DISEASE (always)'),
kp('Kimmelstiel-Wilson nodules = DIABETIC nephropathy — classic histology question'),
kp('Congo red + apple-green birefringence = AMYLOIDOSIS — never forget this'),
tip('"Spike and dome" on EM = Membranous. Foot process fusion on EM = MCD or FSGS'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 6 — KIDNEY STONES
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 6 — KIDNEY STONES (NEPHROLITHIASIS)'),
p('<b>Classic presentation:</b> Sudden, severe, COLICKY flank pain radiating to groin ("loin to groin"), nausea/vomiting, hematuria. Pain comes and goes (colicky) because ureter is squeezing against the stone.'),
sp(),
tbl(
['Stone Type', '%', 'Cause / Risk Factor', 'X-ray?', 'Classic Association', 'Treatment'],
[
['Calcium Oxalate\n(most common) ⭐', '~80%', 'Hypercalciuria, hyperoxaluria, low urine volume, Crohn\'s disease (fat malabsorption)', 'RADIOPAQUE (white)', 'Crohn\'s disease, hyperparathyroidism, Vit D excess', 'Fluids, thiazides, low-oxalate diet'],
['Struvite\n(Magnesium-\nammonium-phosphate)', '~10-15%', 'UREASE-producing bacteria: Proteus, Klebsiella, Pseudomonas, Staph saprophyticus', 'Radiopaque\nSTAGHORN shape ⭐', 'Recurrent UTIs\nSTAGHORN calculus fills renal pelvis', 'Treat infection first, then surgery/lithotripsy'],
['Uric Acid', '~5-10%', 'Gout, high purine diet, dehydration, low urine pH (acidic)', 'RADIOLUCENT ⭐\n(invisible on plain X-ray!)', 'Gout, Lesch-Nyhan, tumor lysis syndrome, myeloproliferative disorders', 'Alkalize urine (K-citrate), allopurinol, fluids'],
['Cystine', '~1%', 'CYSTINURIA — autosomal recessive PCT defect (COLA amino acids: Cystine, Ornithine, Lysine, Arginine)', 'Faintly radiopaque\n(ground glass)', 'Young patient + recurrent stones + HEXAGONAL CRYSTALS in urine ⭐', 'Alkalize urine, D-penicillamine, high fluids'],
],
[2.5*cm, 1*cm, 4*cm, 2*cm, 3.5*cm, 4*cm],
),
sp(4),
kp('Struvite = STAGHORN calculi = ALWAYS think INFECTION (especially Proteus mirabilis)'),
kp('Uric acid = ONLY stone INVISIBLE on plain X-ray (radiolucent) — seen on CT or ultrasound'),
kp('Cystine = hexagonal crystals + young patient + family history of kidney stones'),
tip('Non-contrast CT KUB = gold standard diagnosis (shows ALL stone types including uric acid)'),
tip('Stones <5mm: pass spontaneously with fluids + pain control (tamsulosin relaxes ureter)'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 7 — URINARY INCONTINENCE / CYSTITIS / PYELONEPHRITIS
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 7 — URINARY INCONTINENCE, CYSTITIS & PYELONEPHRITIS'),
sp(),
h2('7.1 Urinary Incontinence'),
tbl(
['Type', 'Mechanism', 'Trigger', 'Key Patient', 'Treatment'],
[
['Stress', 'Weak pelvic floor / urethral sphincter', 'Coughing, sneezing, laughing, exercise', 'Women, post-partum, obese', 'Kegel exercises, pessary, surgery'],
['Urge\n(Overactive Bladder)', 'Detrusor muscle overactivity', 'Sudden urge, can\'t hold it (urgency + frequency + nocturia)', 'Elderly, neurological conditions', 'Oxybutynin (anticholinergic), mirabegron (β3 agonist)'],
['Overflow', 'Bladder can\'t empty → overfills → spills', 'Continuous dribbling, no urge', 'BPH (men), neurogenic bladder (DM, MS, spinal injury)', 'Treat BPH (tamsulosin, finasteride), catheterization'],
['Functional', 'Physical or cognitive inability to reach toilet', 'Confusion, mobility issues', 'Elderly patients, dementia', 'Scheduled toileting, treat underlying condition'],
],
[2.5*cm, 4*cm, 4*cm, 3*cm, 4*cm],
),
sp(4),
kp('Stress = exertion (cough/sneeze). Urge = can\'t hold it. Overflow = constant dribbling (BPH/neuro)'),
sp(8),
h2('7.2 Acute Cystitis (Bladder Infection)'),
p('Bladder-only infection. Think bacteria climbing up the short female urethra into the bladder. <b>NO systemic symptoms, NO fever, NO flank pain.</b>'),
bul('<b>Most common organism:</b> E. coli (80%). Staphylococcus saprophyticus in young sexually active women ⭐'),
bul('<b>Symptoms:</b> Dysuria (burning), frequency, urgency, suprapubic pain, hematuria'),
bul('<b>Diagnosis:</b> Urinalysis — pyuria + bacteriuria + positive leukocyte esterase + positive nitrite. Urine culture: >100,000 CFU/mL'),
bul('<b>Treatment:</b> TMP-SMX or nitrofurantoin for 3-7 days. Fluoroquinolones for complicated cases'),
kp('Staph saprophyticus = classic cystitis organism in young women having sex ("honeymoon cystitis")'),
tip('Nitrite positive = gram-negative bacteria present (E. coli, Klebsiella, Proteus make nitrite from nitrate)'),
sp(8),
h2('7.3 Acute Pyelonephritis (Kidney Infection)'),
p('UPPER tract infection — bacteria reach the kidney. This is a SYSTEMIC illness — much more serious than cystitis.'),
sp(),
tbl(
['Feature', 'Cystitis (Lower)', 'Pyelonephritis (Upper)'],
[
['Location', 'Bladder / urethra only', 'Kidney + renal pelvis (upper tract)'],
['Fever', 'NO', 'YES (>38°C) — HALLMARK ⭐'],
['Flank pain / CVA tenderness', 'NO', 'YES — costovertebral angle tenderness ⭐'],
['Nausea/vomiting', 'Minimal', 'Common, can be severe'],
['WBC casts in urine', 'NO', 'YES ⭐ — pathognomonic for kidney involvement'],
['Systemic illness', 'NO', 'YES — can cause sepsis'],
['Treatment duration', '3-7 days oral antibiotics', '7-14 days; IV if hospitalized/septic'],
],
[5*cm, 5.5*cm, 6.5*cm],
),
sp(4),
kp('WBC CASTS in urine = kidney infection (pyelonephritis) or interstitial nephritis — key exam answer'),
bul('<b>Organisms:</b> E. coli most common. Klebsiella, Proteus. Staph aureus = hematogenous spread'),
bul('<b>Treatment:</b> Fluoroquinolones (ciprofloxacin) or aminoglycosides (severe). IV cephalosporins if hospitalized'),
bul('<b>Dangerous complications:</b> Perinephric abscess; emphysematous pyelonephritis (gas-forming organisms in DIABETIC → emergency!)'),
tip('Emphysematous pyelonephritis = gas in kidney = DIABETIC patient = SURGICAL EMERGENCY'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 8 — AKI & ATN
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 8 — ACUTE KIDNEY INJURY (AKI) & ACUTE TUBULAR NECROSIS (ATN)'),
p('<b>AKI</b> = sudden loss of kidney function over hours to days. <b>Definition:</b> Creatinine rise ≥0.3 mg/dL in 48h, OR ≥1.5x baseline in 7 days, OR urine output <0.5 mL/kg/hr for >6 hours.'),
sp(),
h2('8.1 The 3 Types of AKI'),
tbl(
['Type', 'Cause', 'BUN:Cr Ratio', 'FENa', 'Urine Findings', 'Treatment'],
[
['PRE-RENAL\n(~60%)\nMost common', 'Not enough blood reaching kidney:\nHypovolemia, heart failure, sepsis, bleeding, dehydration, NSAIDs, ACEi+dehydration', '>20:1\n(BUN rises more)', '<1%\n(kidneys desperately hold Na)', 'High urine osmolality\nHyaline casts\nUrine Na <20', 'FLUIDS! Fix underlying cause. Stop offending drugs'],
['INTRINSIC/RENAL\n(~35%)', 'Damage to kidney itself:\nATN (most common), glomerulonephritis, AIN (drugs: NSAIDs, antibiotics), vascular', '<20:1', '>2%\n(damaged tubules can\'t reabsorb Na)', '"Muddy brown" granular casts\nRTE cells\nUrine Na >40', 'Remove nephrotoxin, supportive, dialysis if severe'],
['POST-RENAL\n(~5-10%)', 'Obstruction downstream:\nBPH, stones, tumor, cervical cancer, bladder outlet obstruction', 'Variable', 'Variable', 'Variable\n(may dilute after relief)', 'RELIEVE OBSTRUCTION: catheter, stent, nephrostomy tube'],
],
[2.5*cm, 4.5*cm, 2*cm, 1.5*cm, 3.5*cm, 3*cm],
),
sp(4),
kp('FENa = (UNa × PCr) / (PNa × UCr) × 100. FENa <1% = Pre-renal. FENa >2% = Intrinsic/ATN'),
kp('FENa is unreliable on diuretics → use FEUrea instead'),
sp(8),
h2('8.2 Acute Tubular Necrosis (ATN)'),
p('Most common cause of INTRINSIC AKI. Tubular cells die from: (1) <b>Ischemia</b> (lack of oxygen) or (2) <b>Nephrotoxins</b> (poisons).'),
sp(),
tbl(
['Type', 'Common Causes', 'Key Clue'],
[
['Ischemic ATN', 'Prolonged pre-renal state → shock, sepsis, major surgery, hemorrhage, burns\n(Pre-renal ignored too long = ATN)', '"Muddy brown" granular casts in urine + FENa >2%'],
['Nephrotoxic ATN', 'Aminoglycosides (gentamicin), Cisplatin, contrast dye, Myoglobin (rhabdomyolysis), Hemoglobin, NSAIDs chronic, Heavy metals', 'Specific toxin + rising creatinine 24-48 hrs after exposure\nRhabdomyolysis: brown urine, CK >1000, dipstick (+) for blood but NO RBCs on microscopy'],
],
[3*cm, 7*cm, 7*cm],
),
sp(4),
h3('3 Phases of ATN (Classic!):'),
bul('<b>Phase 1 - Initiation:</b> Injury happens. BUN/Cr start rising. Urine output falling.'),
bul('<b>Phase 2 - Maintenance (OLIGURIC phase):</b> <400 mL urine/day. Most dangerous — hyperkalemia, fluid overload, uremia. Days to weeks.'),
bul('<b>Phase 3 - Recovery (POLYURIC phase):</b> Tubules regenerate → massive urine output. Now risk of HYPOKALEMIA and dehydration!'),
sp(4),
kp('Rhabdomyolysis → myoglobin pigment clogs tubules → ATN. Brown urine + ↑CK + dipstick (+) for blood, 0 RBCs on microscopy'),
kp('Aminoglycosides: nephrotoxicity is TROUGH-dependent (check trough levels!). Also cause ototoxicity'),
tip('Prevention of contrast-induced ATN: IV saline hydration before procedure + iso-osmolar contrast + N-acetylcysteine in high-risk patients'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 9 — RENAL CELL CARCINOMA
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 9 — RENAL CELL CARCINOMA (RCC)'),
p('Most common kidney cancer in adults. Arises from <b>proximal tubular epithelium</b>. Most common type: <b>Clear cell RCC</b> (~75%) — associated with VHL gene mutation (chromosome 3p deletion).'),
sp(),
tbl(
['Feature', 'Detail'],
[
['Peak age', '50-70 years | Male > Female (2:1)'],
['Most common type', 'Clear cell RCC (~75%) — VHL gene (chr. 3p)'],
['Risk factors', 'Smoking (biggest modifiable RF!) ⭐, obesity, HTN, von Hippel-Lindau disease, dialysis, tuberous sclerosis, acquired cystic disease'],
['Classic triad (only ~10% of cases!)', 'Painless HEMATURIA + Flank pain + Palpable mass\n→ If all 3 present = likely advanced disease'],
['Most common symptom', 'Painless hematuria alone'],
['Imaging', 'CT abdomen with contrast: hypervascular mass with early enhancement'],
['Metastasis', 'Lungs (cannonball lesions), bone, liver, brain, adrenals — "LBLBA" — Lungs, Bones, Liver, Brain, Adrenals'],
['RCC + IVC invasion', 'Tumor can grow INTO inferior vena cava (IVC) — right-sided RCC → may affect left testicular vein → LEFT VARICOCELE'],
['Treatment', 'Surgery (nephrectomy) for localized. Sunitinib/sorafenib (TKIs) for metastatic. RCC is RESISTANT to chemo + radiation!'],
],
[4.5*cm, 12.5*cm],
),
sp(6),
h2('Paraneoplastic Syndromes — RCC is King of Paraneoplastics!'),
tbl(
['Syndrome', 'Substance', 'Effect', 'Exam Clue'],
[
['Polycythemia', 'Ectopic EPO', '↑ RBC count, hypertension', 'High hematocrit with no other cause'],
['Hypercalcemia', 'PTHrP', 'Bones, stones, groans, psychic moans', 'Ca2+ elevated, PTH low'],
['Hypertension', 'Ectopic renin', 'Refractory HTN', 'HTN not responding to usual meds'],
['Cushing\'s', 'Ectopic ACTH', 'Moon face, striae, hyperglycemia', 'Low-dose dexamethasone doesn\'t suppress'],
['Stauffer Syndrome ⭐', 'IL-6', 'Hepatic dysfunction WITHOUT liver metastasis\n(↑LFTs, hepatomegaly)', 'REVERSES after tumor removal — classic question!'],
],
[3*cm, 2.5*cm, 5*cm, 6.5*cm],
),
sp(4),
kp('Stauffer syndrome = reversible liver dysfunction from RCC (no mets!) = USMLE/board classic'),
kp('New left-sided varicocele in adult male that doesn\'t drain when lying down = suspect LEFT RCC (blocking left renal vein)'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 10 — DIURETICS
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 10 — DIURETICS'),
p('Diuretics increase urine output by blocking Na+ transporters at different levels of the nephron. <b>They work where their transporter is.</b>'),
sp(),
tbl(
['Class', 'Drugs', 'Site', 'Mechanism', 'Key Side Effects', 'Uses'],
[
['Carbonic Anhydrase\nInhibitors', 'Acetazolamide', 'PCT', 'Blocks CA → less HCO3- reabsorbed → bicarbonaturia', 'Metabolic ACIDOSIS (loses HCO3-)\nHypokalemia, Ca phosphate stones', 'Glaucoma, altitude sickness, met. alkalosis'],
['LOOP DIURETICS\n⭐ Most Powerful!', 'Furosemide\nBumetanide\nTorsemide\nEthacrynic acid*', 'Thick ascending LOH', 'Blocks NKCC2 → Na, K, Cl, Ca, Mg all lost', 'Hypokalemia ⭐\nMet. alkalosis ⭐\nOtotoxicity (dose-dependent) ⭐\nHyperuricemia (gout!)\nHYPOCALCEMIA', 'Pulmonary edema, CHF, HYPERCALCEMIA, hypertensive urgency'],
['THIAZIDES', 'Hydrochlorothiazide\nChlorothiazide\nMetolazone', 'DCT', 'Blocks NCC → Na, Cl, K lost; Ca RETAINED', 'Hypokalemia ⭐\nMet. alkalosis ⭐\nHyperuricemia (gout!)\nHYPERCALCEMIA ⭐\nHyperglycemia\nHyperlipidemia', 'HTN (1st line), osteoporosis, NEPHROGENIC DI (paradox), Ca oxalate stones prevention'],
['K+-sparing\n(Aldosterone antagonists)', 'Spironolactone\nEplerenone', 'Collecting duct', 'Block aldosterone receptor → Na out, K+ retained', 'HYPERKALEMIA ⭐\nGynecomastia (spironolactone)\nMet. acidosis', 'Heart failure (reduces mortality!), hyperaldosteronism, cirrhosis'],
['K+-sparing\n(ENaC blockers)', 'Amiloride\nTriamterene', 'Collecting duct', 'Block ENaC channel directly', 'HYPERKALEMIA ⭐\nMet. acidosis', 'Combo with loop/thiazides, Liddle syndrome'],
['Osmotic', 'Mannitol', 'PCT + LOH', 'Osmotically pulls water into tubule (not reabsorbed)', 'Initial fluid overload → risk in pulmonary edema!\nDehydration, hypernatremia', 'Cerebral edema (↓ICP), acute glaucoma, rhabdomyolysis'],
],
[2.5*cm, 2.5*cm, 1.5*cm, 3.5*cm, 3.5*cm, 4*cm],
),
sp(4),
kp('LOOP diuretics = HYPOCALCEMIA (Ca wasted in urine). THIAZIDES = HYPERCALCEMIA (Ca retained). Classic exam trap!'),
kp('ALL diuretics EXCEPT K+-sparing cause HYPOKALEMIA and METABOLIC ALKALOSIS'),
kp('Ethacrynic acid = only loop diuretic safe in SULFA ALLERGY (furosemide is a sulfonamide)'),
tip('Spironolactone causes gynecomastia (anti-androgenic) → switch to eplerenone (more selective)'),
tip('Thiazides PARADOXICALLY treat nephrogenic diabetes insipidus: volume depletion → PCT reabsorbs more → less urine'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# SECTION 11 — ACEi AND ARBs
# ═══════════════════════════════════════════════════════════════════
story += [
h1('SECTION 11 — ACE INHIBITORS & ARBs'),
sp(),
h2('11.1 ACE Inhibitors (ACEi)'),
p('Block ACE enzyme → less Angiotensin II produced → blood vessels relax + less aldosterone → lower BP. Also → bradykinin accumulates (ACE normally breaks down bradykinin).'),
sp(),
tbl(
['Drug', 'Notes'],
[
['Lisinopril', 'Most prescribed. Once daily. ALREADY active (no hepatic conversion needed)'],
['Enalapril', 'Prodrug — activated in liver to enalaprilat'],
['Captopril', 'Short-acting, has sulfhydryl group → unique: taste disturbance, neutropenia, membranous nephropathy'],
['Ramipril', 'HOPE trial: proven CV mortality benefit in high-risk patients'],
],
[4*cm, 13*cm],
),
sp(4),
h2('11.2 Side Effects of ACEi (CRITICAL)'),
tbl(
['Side Effect', 'Why It Happens', 'Management'],
[
['DRY COUGH ⭐\n(10-15% of patients)', 'Bradykinin accumulates (ACE normally degrades bradykinin → now it builds up)', 'SWITCH TO ARB — ARBs do not cause cough (bradykinin not affected)'],
['ANGIOEDEMA ⭐\n(life-threatening!)', 'Bradykinin-mediated swelling of lips, tongue, throat. Can occur years after starting drug!', 'STOP DRUG immediately. Airway management. Icatibant (bradykinin receptor blocker) or FFP. Can cautiously try ARB (much lower risk)'],
['Hyperkalemia', 'Less aldosterone → less K+ excreted', 'Monitor K+. Avoid K+ supplements and K+-sparing diuretics'],
['Rise in creatinine', 'Efferent dilation → less filtration pressure (acceptable <30% rise)', 'Expected and acceptable. STOP if >30-40% rise → bilateral RAS suspected'],
['TERATOGENICITY ⭐', 'Ang II needed for fetal renal development. Causes fetal renal dysplasia + oligohydramnios', 'ABSOLUTELY CONTRAINDICATED in PREGNANCY'],
],
[3.5*cm, 5.5*cm, 8*cm],
),
sp(6),
h2('11.3 ARBs vs ACEi — Side-by-Side'),
tbl(
['Feature', 'ACE Inhibitors', 'ARBs'],
[
['Mechanism', 'Block ACE enzyme → less Ang II produced', 'Block AT1 receptor → Ang II can\'t bind and act'],
['Bradykinin', 'Increases (ACE normally degrades bradykinin)', 'Normal (bradykinin not affected by ARBs)'],
['Dry cough', 'YES — 10-15% (bradykinin)', 'NO — major advantage over ACEi ⭐'],
['Angioedema', 'Yes (~0.1-0.5%)', 'Very rare, but possible (don\'t use after severe ACEi angioedema)'],
['Hyperkalemia', 'Yes', 'Yes'],
['Pregnancy', 'CONTRAINDICATED ⭐', 'CONTRAINDICATED ⭐'],
['First choice if cough on ACEi', 'N/A', 'YES ⭐'],
['Special feature', '—', 'Losartan lowers uric acid (good for gout + HTN)'],
],
[4*cm, 6.5*cm, 6.5*cm],
),
sp(4),
h2('11.4 Clinical Uses (Both ACEi and ARBs)'),
bul('<b>Hypertension</b> — first-line especially with CKD, DM, heart failure'),
bul('<b>Diabetic Nephropathy</b> — reduce proteinuria by dilating efferent → ↓intraglomerular pressure → slows CKD progression'),
bul('<b>Heart Failure (HFrEF)</b> — reduce mortality (essential therapy)'),
bul('<b>Post-MI</b> — prevent ventricular remodeling'),
bul('<b>CKD with proteinuria</b> — slow progression regardless of cause'),
sp(4),
h2('11.5 Contraindications to ACEi/ARBs'),
tbl(
['Contraindication', 'Why', 'What Happens if Ignored'],
[
['Bilateral renal artery stenosis (RAS)', 'Both kidneys depend on Ang II efferent constriction to maintain GFR', 'Efferent dilates → GFR drops → ACUTE KIDNEY INJURY → creatinine shoots up'],
['Pregnancy', 'Ang II needed for fetal kidney development', 'Fetal renal agenesis/dysplasia + oligohydramnios'],
['Hyperkalemia (K+ >5.5)', 'Will worsen potassium retention', 'Severe hyperkalemia → cardiac arrhythmia'],
['History of ACEi-induced angioedema (severe)', 'Cross-sensitivity with ARBs possible', 'Recurrent angioedema risk'],
],
[4*cm, 5.5*cm, 7.5*cm],
),
sp(4),
kp('Bilateral RAS + ACEi = dramatic creatinine rise = clue to diagnosis of bilateral RAS'),
kp('NEVER combine ACEi + ARB (ONTARGET trial: more harm than benefit — AKI + hyperkalemia)'),
tip('Sacubitril/Valsartan (Entresto) = ARB + neprilysin inhibitor: new standard for HFrEF, reduces mortality vs ACEi alone'),
PageBreak(),
]
# ═══════════════════════════════════════════════════════════════════
# FINAL CHEAT SHEET
# ═══════════════════════════════════════════════════════════════════
story += [
h1('FINAL CHEAT SHEET — Everything in One Page'),
tbl(
['Topic', 'The One Thing to Remember'],
[
['Horseshoe kidney', 'Fused lower poles. Trapped by IMA. Turner syndrome. Hydronephrosis #1 complication.'],
['Posterior Urethral Valve', 'Males ONLY. VCUG = diagnosis. Can → oligohydramnios → Potter sequence.'],
['Filtration barrier', '3 layers: Endothelium (cells) → GBM (charge barrier) → Podocytes/slit diaphragm (size barrier)'],
['RAAS', 'Low BP → Renin → Ang I → (ACE) → Ang II → vasoconstriction + aldosterone → Na retain, K lose'],
['Bartter vs Gitelman', 'Bartter = NKCC2 (like furosemide). Gitelman = NCC (like thiazide). Both: hypokalemia + alkalosis'],
['RTA Type I', 'Urine pH >5.5 even in acidosis. Nephrocalcinosis + stones.'],
['RTA Type IV', 'HYPERKALEMIA + acidosis. DM, CKD, ACEi use.'],
['Metabolic acidosis', 'HCO3- low. MUDPILES (high AG) vs HARD (normal AG). Lungs compensate (Kussmaul breathing)'],
['Metabolic alkalosis', 'HCO3- high. Vomiting, diuretics. Lungs breathe slower.'],
['RBC casts', '= GLOMERULONEPHRITIS (nephritic syndrome)'],
['Muddy brown casts', '= ATN (intrinsic AKI)'],
['Fatty casts / Maltese cross', '= NEPHROTIC syndrome'],
['WBC casts', '= Pyelonephritis or interstitial nephritis'],
['Nephritic vs Nephrotic', 'Nephritic: hematuria + HTN + mild proteinuria. Nephrotic: massive proteinuria + edema + hypoalbuminemia'],
['MCD', 'Kids + nephrotic + steroids work + NORMAL light microscopy + foot process fusion on EM'],
['FSGS', 'Black adults + nephrotic + focal sclerosis. HIV, heroin.'],
['Membranous nephropathy', 'White adults + spike and dome EM + HBV/SLE/drugs'],
['Diabetic nephropathy', 'Most common nephrotic worldwide. Kimmelstiel-Wilson nodules.'],
['IgA nephropathy', 'Hematuria 24-48h after URI (not weeks). IgA in mesangium.'],
['PSGN', '2-3 WEEKS after strep. Low C3. Subepithelial humps. Kids.'],
['Goodpasture\'s', 'Linear IF + pulmonary hemorrhage. Young male smoker.'],
['Uric acid stones', 'RADIOLUCENT. Gout. Alkalize urine.'],
['Struvite stones', 'STAGHORN. Urease-producing bugs (Proteus). Treat infection.'],
['Cystine stones', 'Hexagonal crystals. Young. AR mutation. COLA amino acids.'],
['Pre-renal AKI', 'FENa <1%, BUN:Cr >20:1. Hyaline casts. Give fluids.'],
['Intrinsic AKI / ATN', 'FENa >2%, BUN:Cr <20:1. Muddy brown casts. Stop nephrotoxin.'],
['ATN phases', 'Initiation → Oliguric (most dangerous) → Polyuric (hypokalemia risk)'],
['RCC', 'Painless hematuria. VHL gene. Paraneoplastics: polycythemia, hypercalcemia, Stauffer syndrome.'],
['Stauffer syndrome', 'Reversible liver dysfunction from RCC (no mets) — REVERSES after nephrectomy'],
['Loop diuretics', 'NKCC2. Hypokalemia + HYPOCALCEMIA. Most potent. Pulmonary edema, hypercalcemia.'],
['Thiazides', 'NCC. Hypokalemia + HYPERCALCEMIA. HTN, osteoporosis.'],
['K+-sparing diuretics', 'ENaC/aldosterone. HYPERKALEMIA. HF mortality reduction.'],
['ACEi cough', 'Bradykinin accumulation → dry cough → SWITCH TO ARB'],
['ACEi angioedema', 'Bradykinin-mediated → STOP DRUG → airway management'],
['ACEi contraindications', 'Pregnancy (fetal dysplasia), bilateral RAS (AKI), hyperkalemia'],
['Never combine', 'ACEi + ARB = double RAAS blockade = bad (AKI + hyperkalemia)'],
],
[5*cm, 12*cm],
),
sp(8),
Paragraph('🍀 GOOD LUCK ON YOUR EXAM TOMORROW! You\'ve studied smart — now go show them what you know! 🍀',
S('good_luck', fontName='Helvetica-Bold', fontSize=13, textColor=NAVY,
alignment=TA_CENTER, spaceAfter=4, spaceBefore=10)),
]
# Build
doc.build(story, onFirstPage=on_cover, onLaterPages=on_page)
print(f"PDF created: {output_path}")
print(f"File size: {os.path.getsize(output_path) / 1024:.1f} KB")
cd /home/daytona/workspace/kidney-notes && python3 create_pdf.py 2>&1
Kidney Study Guide
PDF Document · PDF
| Section | What's in it |
|---|---|
| 1 — Congenital Anomalies | Horseshoe kidney (IMA trap, Turner syndrome, complications table) + PUV (domino effect, Potter sequence, VCUG) |
| 2 — Renal Physiology | Filtration barrier 3-layer table, nephron transport per segment, afferent/efferent arterioles, tubular defects (Fanconi/Bartter/Gitelman/Liddle/RTA), full RAAS chain |
| 3 — Acid-Base | ABG values, all 4 disorders with causes + compensation, MUDPILES vs HARD anion gap mnemonics, Winter's formula |
| 4 — Urine Casts | Every cast type with meaning and disease association |
| 5 — Nephritic vs Nephrotic | Full comparison table + all nephritic causes (IF/EM per disease) + all nephrotic causes (LM/EM/treatment) |
| 6 — Kidney Stones | All 4 stone types with X-ray appearance, mnemonics, treatment |
| 7 — UTI/Cystitis/Pyelonephritis | Incontinence types table, cystitis vs pyelonephritis comparison, organisms, treatments |
| 8 — AKI & ATN | Pre/intrinsic/post-renal table with FENa, ATN phases, rhabdomyolysis pearl |
| 9 — Renal Cell Carcinoma | Classic triad, paraneoplastic syndromes (Stauffer!), varicocele clue |
| 10 — Diuretics | All 6 classes in one table — loop vs thiazide calcium trap highlighted |
| 11 — ACEi / ARBs | Side effects table, ACEi vs ARB comparison, contraindications |
| Final Cheat Sheet | Every single topic → one-line summary, perfect for last-minute review |
Generate detailed short notes on the following topic, provide summary, after summary provide a cheat sheet for quick revision and there are some questions in the file sort it out after the cheat sheet
cd /home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048 && python -m markitdown Lecture_4_Oncology_DH_26.pptx 2>&1 | head -300
cd /home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048 && python3 -c " from pptx import Presentation import sys def extract_pptx(path): prs = Presentation(path) for i, slide in enumerate(prs.slides): print(f'\n=== SLIDE {i+1} ===') for shape in slide.shapes: if hasattr(shape, 'text') and shape.text.strip(): print(shape.text.strip()) extract_pptx('Lecture_4_Oncology_DH_26.pptx') " 2>&1
cd /home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048 && python3 -c " import zipfile, os, re from xml.etree import ElementTree as ET def extract_pptx_text(pptx_path): ns = {'a': 'http://schemas.openxmlformats.org/drawingml/2006/main', 'p': 'http://schemas.openxmlformats.org/presentationml/2006/main', 'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'} with zipfile.ZipFile(pptx_path, 'r') as z: slide_files = sorted([f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')]) for slide_path in slide_files: slide_num = re.search(r'slide(\d+)', slide_path).group(1) print(f'\n=== SLIDE {slide_num} ===') with z.open(slide_path) as f: tree = ET.parse(f) root = tree.getroot() for sp in root.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}p'): texts = [] for r in sp.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}t'): if r.text: texts.append(r.text) line = ''.join(texts).strip() if line: print(line) print('====== LECTURE 4 ======') extract_pptx_text('Lecture_4_Oncology_DH_26.pptx') print() print('====== LECTURE 5 ======') extract_pptx_text('Lecture_5_Oncology_DH_26.pptx') " 2>&1
~/kidney-notes/create_oncology_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.colors import HexColor, white, black
import os
# ── Colors ────────────────────────────────────────────────────────
NAVY = HexColor('#1B2A4A')
TEAL = HexColor('#0E7C7B')
PURPLE = HexColor('#5C3D8F')
ORANGE = HexColor('#D4600A')
RED = HexColor('#B00020')
GREEN = HexColor('#1E6B3C')
LTGREEN = HexColor('#E9F5EE')
LTBLUE = HexColor('#E3EDF7')
LTPURP = HexColor('#EDE7F6')
LTORANGE= HexColor('#FFF3E0')
YELLOW = HexColor('#FFFDE7')
LTGRAY = HexColor('#F5F5F5')
MIDGRAY = HexColor('#555555')
DARKGREEN=HexColor('#145A32')
W, H = A4
# ── Styles ────────────────────────────────────────────────────────
def S(name, **kw):
return ParagraphStyle(name, **kw)
TITLE = S('T', fontName='Helvetica-Bold', fontSize=30, textColor=white,
alignment=TA_CENTER, spaceAfter=8)
SUBTITLE = S('ST', fontName='Helvetica-BoldOblique', fontSize=14, textColor=HexColor('#B3D9FF'),
alignment=TA_CENTER, spaceAfter=4)
COVER_SM = S('CS', fontName='Helvetica', fontSize=10, textColor=HexColor('#CCCCCC'),
alignment=TA_CENTER, spaceAfter=2)
H1 = S('h1', fontName='Helvetica-Bold', fontSize=13, textColor=white,
backColor=NAVY, borderPad=7, spaceAfter=8, spaceBefore=14, leading=17)
H2 = S('h2', fontName='Helvetica-Bold', fontSize=11, textColor=TEAL,
spaceAfter=5, spaceBefore=10, leading=14)
H3 = S('h3', fontName='Helvetica-Bold', fontSize=10, textColor=PURPLE,
spaceAfter=3, spaceBefore=7, leading=13)
H4 = S('h4', fontName='Helvetica-BoldOblique', fontSize=9.5, textColor=ORANGE,
spaceAfter=3, spaceBefore=5, leading=12)
BODY = S('body', fontName='Helvetica', fontSize=9, textColor=black,
spaceAfter=3, leading=13)
BBODY = S('bbody', fontName='Helvetica-Bold', fontSize=9, textColor=black,
spaceAfter=3, leading=13)
SMALL = S('small', fontName='Helvetica', fontSize=8, textColor=MIDGRAY,
spaceAfter=2, leading=11)
BUL = S('bul', fontName='Helvetica', fontSize=9, textColor=black,
leftIndent=14, firstLineIndent=-10, spaceAfter=2, leading=12, bulletText='•')
BUL2 = S('bul2', fontName='Helvetica', fontSize=8.5, textColor=MIDGRAY,
leftIndent=26, firstLineIndent=-10, spaceAfter=2, leading=11, bulletText='–')
KP = S('kp', fontName='Helvetica-Bold', fontSize=9, textColor=RED,
spaceAfter=4, leftIndent=8, leading=12,
backColor=YELLOW, borderPad=4)
TIP = S('tip', fontName='Helvetica-Bold', fontSize=9, textColor=TEAL,
spaceAfter=4, leftIndent=8, leading=12,
backColor=LTGREEN, borderPad=4)
QST = S('qst', fontName='Helvetica-Bold', fontSize=10, textColor=PURPLE,
spaceAfter=4, spaceBefore=8, leading=13)
ANS = S('ans', fontName='Helvetica', fontSize=9, textColor=black,
spaceAfter=6, leftIndent=14, leading=13,
backColor=LTPURP, borderPad=5)
# ── Helpers ───────────────────────────────────────────────────────
def h1(t): return Paragraph(f' {t}', H1)
def h2(t): return Paragraph(t, H2)
def h3(t): return Paragraph(t, H3)
def h4(t): return Paragraph(t, H4)
def p(t): return Paragraph(t, BODY)
def bp(t): return Paragraph(t, BBODY)
def bul(t, lv=0): return Paragraph(t, BUL if lv==0 else BUL2)
def kp(t): return Paragraph(f'⭐ {t}', KP)
def tip(t):return Paragraph(f'💡 {t}', TIP)
def sp(n=5):return Spacer(1, n)
def hr(): return HRFlowable(width='100%', thickness=0.5, color=TEAL, spaceAfter=4, spaceBefore=4)
def tbl(headers, rows, col_widths=None, hdr_color=None):
data = [headers] + rows
n = len(headers)
if col_widths is None:
col_widths = [(W - 3*cm) / n] * n
hc = hdr_color or TEAL
cell_s = ParagraphStyle('cs', fontName='Helvetica', fontSize=7.5, leading=10, spaceAfter=0)
hdr_s = ParagraphStyle('hs', fontName='Helvetica-Bold', fontSize=8, leading=10,
textColor=white, spaceAfter=0)
fmt = []
for ri, row in enumerate(data):
fmt.append([Paragraph(str(c), hdr_s if ri==0 else cell_s) for c in row])
t = Table(fmt, colWidths=col_widths, repeatRows=1)
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), hc),
('TEXTCOLOR', (0,0), (-1,0), white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'TOP'),
('ROWBACKGROUNDS',(0,1),(-1,-1),[LTBLUE, white]),
('GRID', (0,0), (-1,-1), 0.3, HexColor('#BBBBBB')),
('LEFTPADDING', (0,0), (-1,-1), 4),
('RIGHTPADDING',(0,0), (-1,-1), 4),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING',(0,0),(-1,-1), 3),
]))
return t
def q_block(num, question, answer):
return [
Paragraph(f'Q{num}. {question}', QST),
Paragraph(f'✅ {answer}', ANS),
sp(4),
]
# ── Page decorators ───────────────────────────────────────────────
def on_page(canvas, doc):
canvas.saveState()
canvas.setFillColor(NAVY)
canvas.rect(0, H - 1.2*cm, W, 1.2*cm, fill=1, stroke=0)
canvas.setFont('Helvetica-Bold', 8)
canvas.setFillColor(white)
canvas.drawString(1.2*cm, H - 0.8*cm, 'ONCOLOGY — GI CANCERS STUDY NOTES')
canvas.drawRightString(W - 1.2*cm, H - 0.8*cm, f'Lec 4 & 5 | Hakimian 2026')
canvas.setFillColor(LTBLUE)
canvas.rect(0, 0, W, 0.75*cm, fill=1, stroke=0)
canvas.setFont('Helvetica', 7)
canvas.setFillColor(NAVY)
canvas.drawCentredString(W/2, 0.22*cm, f'Page {doc.page} | Small Bowel Cancer & Gastric Cancer')
canvas.restoreState()
def on_cover(canvas, doc):
canvas.saveState()
canvas.setFillColor(NAVY)
canvas.rect(0, 0, W, H, fill=1, stroke=0)
# Teal accent bar
canvas.setFillColor(TEAL)
canvas.rect(0, H*0.38, W, 8, fill=1, stroke=0)
canvas.setFillColor(ORANGE)
canvas.rect(0, H*0.38 - 10, W, 4, fill=1, stroke=0)
# Footer
canvas.setFillColor(HexColor('#0A1628'))
canvas.rect(0, 0, W, 1.5*cm, fill=1, stroke=0)
canvas.setFont('Helvetica-Oblique', 8)
canvas.setFillColor(HexColor('#8899AA'))
canvas.drawCentredString(W/2, 0.5*cm, 'Daron Hakimian, M.Sc. Synthetic Biotechnology | June 2026')
canvas.restoreState()
# ── BUILD STORY ───────────────────────────────────────────────────
story = []
# ══════════════════════════════════════════════════════════════════
# COVER
# ══════════════════════════════════════════════════════════════════
story += [
Spacer(1, 5.5*cm),
Paragraph('ONCOLOGY', S('cv1', fontName='Helvetica-Bold', fontSize=11,
textColor=HexColor('#00BCD4'), alignment=TA_CENTER, spaceAfter=6,
characterSpacing=4)),
Paragraph('GI Cancers — Lectures 4 & 5', S('cv2', fontName='Helvetica-Bold', fontSize=26,
textColor=white, alignment=TA_CENTER, spaceAfter=10)),
Paragraph('Small Bowel Cancer (SBC) & Gastric Cancer (GC)', SUBTITLE),
Spacer(1, 0.8*cm),
Paragraph('Detailed Study Notes · Summary · Cheat Sheet · Practice Questions', COVER_SM),
Spacer(1, 1.5*cm),
tbl(['LECTURE 4 — Small Bowel Cancer', 'LECTURE 5 — Gastric Cancer'],
[['• SBC Epidemiology & Rarity\n• Anatomy & Tumor Types\n• Small Bowel Adenocarcinoma (SBA)\n• Neuroendocrine Tumors (NETs)\n• GI Stromal Tumors (GISTs)\n• Case Studies (5 cases)',
'• Gastric Cancer Epidemiology\n• Anatomy & Location subtypes\n• Proximal Gastric Cancer (PGC)\n• Distal Gastric Cancer (DGC)\n• Diffuse Type Cancer / CDH1 loss\n• CLDN18.2 new therapy / Case Studies']],
[9*cm, 9*cm], TEAL),
PageBreak(),
]
# ══════════════════════════════════════════════════════════════════
# LECTURE 4 — SMALL BOWEL CANCER
# ══════════════════════════════════════════════════════════════════
story += [
h1('LECTURE 4 — SMALL BOWEL CANCER (SBC)'),
sp(),
h2('1. Epidemiology & Why SBCs Are Rare'),
p('<b>Small bowel cancers represent only 3–5% of all gastrointestinal malignancies.</b> Despite the small bowel making up 75% of GI tract length and 90% of its mucosal surface, it is remarkably protected from cancer. Here is why:'),
sp(4),
tbl(
['Protective Factor', 'Explanation'],
[
['Rapid transit time', 'Contents move fast → less contact time with carcinogens'],
['Low bacterial load', 'Fewer bacteria compared to colon → less carcinogen production'],
['High IgA + lymphoid tissue', 'Strong local immune defense neutralizes threats early'],
['Liquid intestinal contents', 'Toxins diluted → reduced mucosal exposure'],
['Alkaline pH', 'Less DNA-damaging environment than acidic stomach or colon'],
],
[5*cm, 12*cm],
),
sp(4),
kp('Most prevalent in ages 60–70. These protective factors also delay diagnosis — symptoms appear late!'),
bul('<b>Late diagnosis</b> is a key challenge: no population-level screening program exists for SBC.'),
bul('<b>Position (duodenum/jejunum/ileum) matters less</b> than in CRC — molecular tumor profile is the key guide.'),
sp(8),
h2('2. Anatomy & Tumor Types Overview'),
p('The small bowel comprises duodenum, jejunum, and ileum. Unlike CRC, <b>tumor location is less important than molecular markers</b> because SBC is biologically heterogeneous.'),
sp(4),
tbl(
['Tumor Type', 'Key Characteristics'],
[
['Adenocarcinoma (SBA)', 'Most common malignant SBC. Gland-forming epithelial cancer. Found mostly in duodenum.'],
['Neuroendocrine Tumors (NETs) / Carcinoid', '2nd most common. Arise from enterochromaffin cells. Most common in ileum. Hormone-secreting.'],
['Lymphoma', 'Covered in separate lecture. Can arise from MALT tissue.'],
['GI Stromal Tumors (GISTs)', 'Arise from interstitial cells of Cajal. Most common in jejunum/ileum. Grow outward.'],
],
[4.5*cm, 12.5*cm],
),
sp(8),
h2('3. Small Bowel Adenocarcinoma (SBA)'),
h3('Location & Clinical Presentation'),
bul('<b>Primary location: Duodenum</b> (especially near the ampulla of Vater)'),
bul('Duodenal tumors detected EARLIER due to biliary symptoms (jaundice, obstruction of bile duct) and anatomical proximity'),
bul('Jejunal and ileal tumors detected LATER — present with anemia and obstruction'),
bul('<b>No population screening</b> → contributes strongly to late-stage presentation'),
sp(4),
h3('Molecular Drivers of SBA'),
p('SBA has a distinct molecular profile compared to colorectal adenocarcinoma (CRC):'),
sp(4),
tbl(
['Molecular Feature', 'SBA', 'CRC (comparison)', 'Clinical Relevance'],
[
['APC mutation', '30–40%', '70–80% (much higher)', 'SBA uses APC pathway less; different carcinogenesis'],
['MSI-H', 'Very frequent', 'Moderate', 'Strong Lynch syndrome association → check germline. MSI-H = PD-1 inhibitor candidate'],
['RAS mutation', 'Present', 'Present', 'Anti-EGFR not standard in SBA even in KRAS wild-type (unlike CRC)'],
['RAF mutation', 'More frequent than CRC', 'Less frequent', 'Potential RAF inhibitor target'],
['HER2 amplification', 'More frequent than CRC', 'Less frequent', 'HER2 blocker (trastuzumab/pertuzumab) potential'],
['Staging system', 'Same as CRC', '—', 'TNM staging used identically'],
],
[3*cm, 2.5*cm, 3*cm, 7.5*cm],
),
sp(4),
kp('SBA = MSI-H is very common → always check for Lynch syndrome! PD-1 inhibitors (pembrolizumab) indicated for MSI-H SBA.'),
kp('Anti-EGFR therapy is NOT standard in SBA even when KRAS wild-type — different from CRC!'),
tip('Clinical workflow for SBA: Gastroscopy/colonoscopy first (rule out CRC) → if negative, consider SBC → video capsule endoscopy or double-balloon enteroscopy → CT for staging → molecular profiling → treat by MSI/HER2/RAF status'),
sp(8),
h2('4. Neuroendocrine Tumors (NETs) / Carcinoid Tumors'),
h3('Overview'),
bul('Second most common type of SBC'),
bul('<b>Most commonly found in the ileum</b>'),
bul('Slow growing BUT biologically active → cause early metastases despite slow growth'),
bul('<b>Late-stage presentation:</b> 50% of patients already have liver metastases at diagnosis'),
bul('Usually <b>multifocal</b> — multiple tumors in the same region simultaneously'),
sp(4),
h3('Cell of Origin: Enterochromaffin Cells'),
bul('Arise from <b>enterochromaffin cells</b> in the mucosa — part of the diffuse neuroendocrine system'),
bul('Function: responsible for hormonal secretion (serotonin, tryptamine, chromogranin, etc.)'),
bul('These cells are normally "scattered" throughout the GI mucosa — hence multifocal tumors'),
sp(4),
h3('Hormonal Secretion & Consequences'),
p('<b>Main mediator: Serotonin (5-HT) and TGF-β</b>'),
tbl(
['Secreted Factor', 'Effect', 'Clinical Consequence'],
[
['Serotonin (5-HT)', 'Stimulates fibroblast growth → mesenteric fibrosis', 'Tissue scarring → bowel obstruction + ischemia (reduced blood flow due to scar tissue)'],
['TGF-β', 'Pro-fibrotic cytokine', 'Enhances mesenteric fibrosis'],
['Somatostatin receptors (increased expression)', 'Upregulated on tumor cells', 'Target for somatostatin analogues (octreotide, lanreotide) — main treatment!'],
],
[3.5*cm, 4*cm, 9.5*cm],
),
sp(4),
bul('<b>5-HIAA testing</b> (5-hydroxyindoleacetic acid, urine) = serotonin metabolite → elevated in NETs = key diagnostic test'),
sp(4),
h3('mTOR Signaling Pathway in NETs'),
bul('Loss/mutation of <b>PTEN, TSC1/2, or PI3K</b> → mTOR pathway stays constitutively ON'),
bul('Leads to uncontrolled cell growth and proliferation'),
bul('Target: <b>mTOR inhibitors</b> (everolimus) — used for advanced/metastatic NETs'),
sp(4),
h3('Molecular Markers for NET Diagnosis'),
tbl(
['Marker', 'Location/Biology', 'Clinical Use'],
[
['Chromogranin A', 'Stored in secretory vesicles of neuroendocrine cells', 'Elevated serum/urine level = confirms NET. Used for monitoring treatment response.'],
['Synaptophysin', 'Found in presynaptic vesicles of neurons and neuroendocrine cells', 'Elevated on immunohistochemistry = confirms NET origin'],
['Ki-67 proliferation index', 'Marker of cell division rate', 'LOW Ki-67 (<3%) = G1 NET (well-differentiated, slow). High Ki-67 = more aggressive NEC. Guides treatment.'],
['5-HIAA (urine)', 'Serotonin breakdown product', 'Elevated in functioning NETs. Used for diagnosis and monitoring.'],
['Somatostatin receptor status', 'SSTR2 most important', 'Positive → treat with somatostatin analogues; eligible for PRRT (peptide receptor radionuclide therapy)'],
],
[3.5*cm, 4.5*cm, 9*cm],
),
sp(4),
kp('Ki-67 LOW = G1 NET (slow, well-differentiated, good prognosis). Ki-67 HIGH = neuroendocrine CARCINOMA (aggressive).'),
kp('Chromogranin A + Synaptophysin = the two IHC markers that confirm NET diagnosis'),
tip('NET clinical workflow: suspect from symptoms (flushing, diarrhea, carcinoid syndrome) → urine 5-HIAA + serum Chromogranin A → CT/MRI for staging → somatostatin receptor scintigraphy (Ga-DOTATATE PET) → treat with SSA, mTOR inhibitors, or PRRT'),
sp(8),
h2('5. Gastrointestinal Stromal Tumors (GISTs)'),
h3('Overview'),
bul('1–2% of all GI neoplasms. Incidence: 10–15 cases per million people.'),
bul('<b>Most commonly found in jejunum and ileum</b> (though can occur anywhere in GI tract)'),
bul('Grow <b>outwardly</b> (exophytic) → do NOT obstruct the bowel lumen (unlike adenocarcinoma)'),
bul('Spread predominantly to <b>liver and peritoneal cavity</b> — NOT lymph nodes (important distinction!)'),
bul('Slow growing but <b>immortal</b> — apoptosis pathways are inhibited'),
bul('<b>Classical chemotherapy does NOT work</b> — requires targeted molecular therapy'),
sp(4),
h3('Cell of Origin: Interstitial Cells of Cajal (ICC)'),
bul('ICC are the <b>"pacemaker cells" of the gut</b> — regulate intestinal motility'),
bul('Slow-dividing cells normally → when they transform, GISTs grow slowly but persistently'),
bul('<b>DOG1 marker</b>: calcium-activated chloride channel — highly sensitive and specific IHC marker for GIST diagnosis'),
bul('<b>KIT (CD117)</b>: also a key marker — tyrosine kinase receptor, mutated in ~80% of GISTs'),
sp(4),
h3('Oncogenic Signaling Pathways in GISTs'),
tbl(
['Mutation', 'Frequency', 'Pathway', 'Treatment'],
[
['KIT exon 11 mutation', '~70% of GISTs', 'Constitutively active KIT receptor tyrosine kinase → cell growth', 'Imatinib (1st line) — standard of care'],
['KIT exon 9 mutation', '~10%', 'KIT activation', 'Imatinib higher dose OR sunitinib'],
['PDGFRA (most except D842V)', '~5-10%', 'PDGFRA constitutive activation', 'Imatinib responsive'],
['PDGFRA D842V mutation ⭐', '~5-8%', 'Constitutive activation of PDGFRA in ACTIVE pocket conformation', 'IMATINIB RESISTANT! → Avapritinib (fits active kinase pocket specifically)'],
['Wild-type (no KIT/PDGFRA)', '~10-15%', 'SDH, NF1, or other pathways', 'Sunitinib or regorafenib'],
],
[3.5*cm, 2*cm, 4*cm, 7.5*cm],
),
sp(4),
kp('PDGFRA D842V = imatinib-RESISTANT mutation → use Avapritinib (designed to fit the ACTIVE kinase pocket)'),
kp('Normal RTK inhibitors target the INACTIVE state of kinases. Avapritinib targets the ACTIVE state — key concept!'),
kp('GISTs: DOG1+ and KIT+ confirm diagnosis. PDGFRA D842V status determines if avapritinib is needed.'),
tip('GIST key facts for exams: No lymph node spread (unlike adenocarcinoma). No chemo. Liver/peritoneal mets. Exophytic growth → palpable mass WITHOUT obstruction.'),
PageBreak(),
]
# Case Studies Lecture 4
story += [
h1('LECTURE 4 — CASE STUDIES (Solved)'),
sp(),
h2('How to Approach SBC Cases — Diagnostic Logic'),
p('<b>Step 1:</b> Are Chromogranin A and 5-HIAA elevated? If YES → NET/carcinoid. If NO → proceed.'),
p('<b>Step 2:</b> Is DOG1+ and KIT+? If YES → GIST. Check PDGFRA D842V for treatment.'),
p('<b>Step 3:</b> If neither → think adenocarcinoma. Check MSI, HER2, RAS, BRAF.'),
p('<b>Step 4:</b> Obstruction present? Think adenocarcinoma or NET. Palpable mass without obstruction? Think GIST.'),
sp(6),
]
cases_l4 = [
('Case 1 — 62yo with abdominal pain, anemia, palpable mass',
'DOG1+, KIT+, PDGFRA D842V NEGATIVE. Normal Chromogranin A and 5-HIAA.',
'<b>Diagnosis: GIST (PDGFRA D842V negative)</b>\n→ Palpable mass + DOG1+ + KIT+ = GIST confirmed. D842V negative means the tumor is imatinib-SENSITIVE.\n→ <b>Treatment: Imatinib (standard first-line)</b>. No lymph node spread expected.'),
('Case 2 — 67yo with abdominal pain, weight loss, iron deficiency anemia, LIVER METS',
'MSI-H, BRAF-, RAS-, HER2-. Normal Chromogranin A and 5-HIAA.',
'<b>Diagnosis: Small Bowel Adenocarcinoma (SBA), MSI-H subtype</b>\n→ No NET markers (normal Chrom A / 5-HIAA). No GIST markers (no DOG1/KIT mentioned).\n→ MSI-H with liver mets = immunotherapy candidate.\n→ <b>Treatment: PD-1 checkpoint inhibitor (e.g., pembrolizumab)</b>. No anti-EGFR (not standard in SBA).'),
('Case 3 — 59yo with flushing, diarrhea, abdominal cramping, mild anemia',
'HIGH Chromogranin A and 5-HIAA. Ki-67 2%, somatostatin receptor positive, liver metastases.',
'<b>Diagnosis: NET (G1) with carcinoid syndrome and liver metastases</b>\n→ Classic carcinoid syndrome: flushing + diarrhea + abdominal cramping. High 5-HIAA confirms serotonin excess.\n→ Ki-67 2% = G1 (well-differentiated, slow growing). Somatostatin receptor positive = eligible for SSA therapy.\n→ <b>Treatment: Somatostatin analogues (octreotide/lanreotide) ± mTOR inhibitor (everolimus) ± PRRT</b>. Surgery for liver mets if feasible.'),
('Case 4 — 82yo with abdominal pain, anemia, palpable mass',
'DOG1+, KIT+, PDGFRA D842V POSITIVE. Normal Chromogranin A and 5-HIAA.',
'<b>Diagnosis: GIST (PDGFRA D842V positive)</b>\n→ Same presentation as Case 1 but D842V is POSITIVE.\n→ D842V = imatinib-RESISTANT mutation (fits active kinase pocket, not inactive).\n→ <b>Treatment: AVAPRITINIB (NOT imatinib!)</b> — specifically designed for active-pocket PDGFRA mutations.'),
('Case 5 — 66yo with abdominal pain, weight loss, iron deficiency anemia, liver mets',
'MSS, BRAF-, RAS-, HER2 POSITIVE. Normal Chromogranin A and 5-HIAA.',
'<b>Diagnosis: Small Bowel Adenocarcinoma (SBA), HER2-amplified</b>\n→ MSS (not MSI-H) → immunotherapy less likely to be effective.\n→ HER2+ = HER2-targeted therapy candidate.\n→ <b>Treatment: Chemotherapy + HER2-targeted therapy</b> (trastuzumab ± pertuzumab). Anti-EGFR NOT standard in SBA.'),
]
for title, findings, answer in cases_l4:
story += [
KeepTogether([
Paragraph(title, H3),
Paragraph(f'<b>Findings:</b> {findings}', BODY),
sp(3),
Paragraph('Answer:', H4),
Paragraph(answer.replace('\n', '<br/>'), ANS),
sp(6),
])
]
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# LECTURE 5 — GASTRIC CANCER
# ══════════════════════════════════════════════════════════════════
story += [
h1('LECTURE 5 — GASTRIC CANCER (GC)'),
sp(),
h2('1. Epidemiology'),
bul('Top 5 most common cancer worldwide'),
bul('<b>3rd leading cause of cancer-related deaths globally</b>'),
bul('Biologically heterogeneous — requires <b>biomarker-driven</b> treatment decisions'),
bul('Driven mainly by <b>bacterial (H. pylori)</b> and <b>viral (EBV)</b> infections'),
kp('Follow-up of H. pylori patients and EBV-associated disease should be standardized for early detection'),
sp(8),
h2('2. Anatomy — Location Determines Biology'),
tbl(
['Cancer Type', 'Location', 'Predominant Region', 'Driver Subtype'],
[
['Proximal Gastric Cancer (PGC)', 'Cardia / Gastroesophageal junction (GEJ)', 'Western countries (increasing!)', 'Chromosomal Instability (CIN) subtype'],
['Distal Gastric Cancer (DGC) — Corpus', 'Body of stomach', 'Eastern countries (decreasing with antibiotics)', 'MSI-H or EBV-associated'],
['Distal Gastric Cancer (DGC) — Antrum', 'Pyloric antrum (lower stomach)', 'Eastern countries', 'H. pylori-driven intestinal metaplasia'],
['Diffuse Type', 'Mostly corpus; can be anywhere', 'Both, but hereditary form globally', 'CDH1 (E-cadherin) loss driven'],
],
[3.5*cm, 3.5*cm, 3*cm, 7*cm],
),
sp(8),
h2('3. Proximal Gastric Cancer (PGC)'),
h3('Molecular Features'),
bul('<b>Chromosomal Instability (CIN) subtype</b> is most common in PGC'),
bul('<b>HER2 amplification</b> — key targetable mutation; trastuzumab ± chemotherapy is standard'),
bul('<b>TP53 mutation</b> — very common in CIN tumors'),
bul('<b>RTK pathway activation:</b> EGFR, VEGF, PDGFR — multiple targeted therapy opportunities'),
sp(4),
h3('Risk Factors for PGC (mainly Western risk factors)'),
bul('<b>Obesity</b> — increases gastroesophageal reflux → chronic injury'),
bul('<b>GERD (Gastroesophageal Reflux Disease)</b> — repeated acid exposure to GEJ'),
bul('<b>Barrett\'s metaplasia</b> — acid-resistant intestinal cells replace normal squamous cells at the esophageal junction → precancerous state → adenocarcinoma'),
bul('PGC incidence is <b>increasing in western countries</b> (linked to obesity epidemic)'),
sp(4),
h3('Metastatic Pattern of PGC'),
p('PGC spreads to two main nodal regions — each with distinct symptoms:'),
tbl(
['Metastatic Site', 'Imaging', 'Symptoms to Know'],
[
['Mediastinal lymph nodes', 'MRI/CT of Thorax', 'Dyspnea, wheezing, bronchitis-like symptoms, chest pain, dysphagia, facial/neck/arm swelling, distended neck veins, headache worse when lying down (SVC syndrome pattern)'],
['Paracardial lymph nodes', 'CT/MRI of Abdomen', 'Dysphagia, epigastric pain, heartburn/reflux/regurgitation, early satiety, bloating, nausea, vomiting, loss of appetite'],
],
[3.5*cm, 3*cm, 10.5*cm],
),
sp(4),
kp('Mediastinal mets → thoracic symptoms (breathing, SVC). Paracardial mets → upper GI symptoms (swallowing, satiety)'),
sp(8),
h2('4. Distal Gastric Cancer — Corpus (Body)'),
h3('MSI-H Subtype'),
bul('Defective Mismatch Repair (MMR) — either hereditary or through epigenetic methylation'),
bul('MSI-H tumors produce many <b>neoantigens</b> → high immune infiltration'),
bul('Target: <b>PD-1 inhibitors</b> (pembrolizumab) — approved for MSI-H gastric cancer'),
sp(4),
h3('EBV-Associated Gastric Cancer'),
bul('<b>9–10% of all gastric cancers</b> are EBV-associated'),
bul('EBV induces key driver mutations:'),
bul('<b>PIK3CA mutations</b> → activates PI3K-AKT pathway → promotes cell survival and proliferation', 1),
bul('<b>ARID1A mutations</b> → tumor suppressor gene involved in chromatin remodeling → loss promotes carcinogenesis', 1),
bul('<b>Viral antigens</b> → high immune cell infiltration → compensatory <b>PD-L1 OVEREXPRESSION</b>'),
bul('Consequence: PD-L1 overexpression means immune cells are "switched off" by the tumor'),
bul('<b>Treatment:</b> PD-1/PD-L1 inhibitors (nivolumab, pembrolizumab) especially effective in EBV+ PD-L1-high tumors'),
kp('EBV+ gastric cancer = high PD-L1 → excellent candidate for immunotherapy'),
sp(8),
h2('5. Distal Gastric Cancer — Antrum'),
bul('<b>Most common cancer associated with H. pylori</b>'),
bul('Incidence is <b>DECREASING</b> due to antibiotic eradication of H. pylori'),
bul('More prevalent in <b>eastern countries</b>'),
bul('Common presenting symptom: <b>obstruction and vomiting</b>'),
bul('Pathogenesis: H. pylori → chronic inflammation → intestinal metaplasia → dysplasia → adenocarcinoma'),
sp(4),
h3('Key Driver Mutations in Antral GC:'),
tbl(
['Gene', 'Role', 'Effect of Mutation'],
[
['APC', 'WNT pathway tumor suppressor', 'Loss → constitutive WNT signaling → uncontrolled growth'],
['TP53', 'Guardian of genome', 'Loss → no cell cycle arrest → accumulation of further mutations'],
['KRAS', 'RAS/MAPK pathway', 'Activating mutation → continuous proliferation signals'],
['SMAD4', 'TGF-β pathway mediator', 'Loss → TGF-β no longer acts as growth suppressor'],
['HER2', 'RTK (receptor tyrosine kinase)', 'Amplification → RTK pathway overactivation'],
['CDH1 (methylation)', 'E-cadherin gene — cell adhesion', 'Epigenetic silencing → E-cadherin loss → diffuse type features'],
],
[2.5*cm, 4*cm, 10.5*cm],
),
sp(8),
h2('6. Diffuse Type Gastric Cancer'),
h3('Overview'),
bul('Most prevalent in the <b>corpus</b>; can be induced through H. pylori in the antrum'),
bul('Phenotypes:'),
bul('<b>Signet-ring cell carcinoma</b> — mucin pushes nucleus to the side (like a signet ring)', 1),
bul('<b>Poorly cohesive carcinoma</b>', 1),
bul('<b>Mixed-type</b>', 1),
bul('<b>Harder to detect</b> (doesn\'t form a discrete mass) and spreads faster than intestinal type'),
sp(4),
h3('CDH1 (E-cadherin) Loss — Key Mechanism'),
p('<b>CDH1 encodes E-cadherin</b> — the "glue" that keeps epithelial cells stuck together. When lost:'),
tbl(
['Effect of CDH1 Loss', 'Consequence'],
[
['β-catenin released from cell membrane complex', 'Activates WNT/β-catenin signaling → increased proliferation'],
['Epithelial cell-cell adhesion disrupted', 'Cells detach from each other → diffuse spread pattern'],
['PI3K-AKT-mTOR pathway activated', 'Pro-survival signaling → cells survive even when detached (anoikis resistance)'],
['Peritoneal spread predominant', 'Diffuse type spreads to peritoneum > liver (unlike intestinal type)'],
['Faster metastasis but slower division than intestinal type', 'Paradox: spreads widely but cells divide slower'],
],
[5.5*cm, 11.5*cm],
),
sp(4),
bul('<b>Can be inherited (hereditary diffuse gastric cancer — HDGC)</b> — autosomal dominant CDH1 germline mutation → prophylactic gastrectomy considered'),
bul('<b>Can be epigenetically silenced</b> (CDH1 promoter methylation) — somatic, not inherited'),
kp('CDH1 germline mutation = hereditary diffuse gastric cancer → consider prophylactic total gastrectomy in carriers!'),
sp(8),
h2('7. CLDN18.2 — A New Targeted Therapy'),
p('<b>Claudin 18.2 (CLDN18.2)</b> is a tight junction membrane protein:'),
bul('Normally restricted to gastric mucosa but becomes exposed/overexpressed in gastric cancer'),
bul('Activates growth factor (GF) pathway and mTOR pathway when mutated/overexpressed'),
bul('<b>Frequently mutated in diffuse type gastric cancers</b>'),
bul('Targetable: <b>Zolbetuximab</b> (anti-CLDN18.2 antibody) — currently in Phase 3 clinical trials'),
bul('CLDN18.2+ patients who are HER2-negative may especially benefit'),
kp('CLDN18.2 = new targetable biomarker, especially for diffuse type GC. Phase 3 data emerging!'),
sp(8),
h2('8. Metastatic Patterns — Intestinal vs Diffuse'),
tbl(
['Type', 'Metastatic Spread Order', 'Key Notes'],
[
['Intestinal type\n(CIN, H. pylori-driven)', '1. Lymph nodes → 2. Liver → 3. Lungs', 'Follows typical GI cancer spread. Liver mets most common distant site.'],
['Diffuse type\n(CDH1 loss)', '1. Peritoneum → (2. Ovaries: Krukenberg tumor) → 3. Liver → 4. Lungs', 'Peritoneum FIRST! Ovarian met = Krukenberg tumor. Harder to detect, worse prognosis.'],
],
[3.5*cm, 5.5*cm, 8*cm],
),
sp(4),
kp('Diffuse type → peritoneal spread FIRST → Krukenberg tumor (ovarian metastasis) is a classic exam association'),
PageBreak(),
]
# Case Studies Lecture 5
story += [
h1('LECTURE 5 — CASE STUDIES (Solved)'),
sp(),
h2('How to Approach Gastric Cancer Cases'),
p('<b>Step 1:</b> Location — proximal (cardia/GEJ) or distal (body/antrum)?'),
p('<b>Step 2:</b> Check molecular panel: MSI status, HER2, PD-L1, CDH1, CLDN18.2, EBV.'),
p('<b>Step 3:</b> Match subtype:'),
bul('Proximal + HER2+ → CIN subtype → trastuzumab'),
bul('Corpus + MSI-H → PD-1 inhibitors'),
bul('Corpus + EBV+ + PD-L1 high → PD-1/PD-L1 inhibitors'),
bul('Antrum + H. pylori history → intestinal type → standard chemo ± HER2/VEGFR'),
bul('Diffuse + CDH1+ → hereditary diffuse GC or CDH1 loss-driven → consider CLDN18.2 status'),
sp(6),
]
cases_l5 = [
('Case 1 — 64yo male, chronic GERD, dysphagia, GEJ adenocarcinoma',
'MSS, HER2+, PD-L1 normal, CDH1-, CLDN18.2-, EBV-',
'<b>Diagnosis: Proximal Gastric Cancer (PGC) / GEJ adenocarcinoma, CIN subtype, HER2+</b>\n→ Location = GEJ (proximal). Chronic GERD + Barrett\'s metaplasia progression.\n→ MSS means no immunotherapy benefit. PD-L1 normal → PD-1 inhibitor less useful.\n→ HER2+ is the key actionable target.\n→ <b>Treatment: Chemotherapy (FLOT or FOLFOX) + Trastuzumab (HER2 blocker)</b>. Consider VEGFR inhibitor (ramucirumab) in metastatic setting.'),
('Case 2 — 74yo woman, anemia, gastric corpus adenocarcinoma',
'MSI-H, HER2-, PD-L1 elevated, CDH1-, CLDN18.2-, EBV-',
'<b>Diagnosis: Distal Gastric Cancer (DGC), corpus, MSI-H subtype</b>\n→ Corpus location. MSI-H = defective MMR → many neoantigens → immune infiltration → PD-L1 elevated.\n→ HER2 negative, so no trastuzumab.\n→ <b>Treatment: PD-1 checkpoint inhibitor (pembrolizumab) ± chemotherapy</b>. MSI-H gastric cancers respond very well to immunotherapy.'),
('Case 3 — 56yo, H. pylori gastritis, early satiety, weight loss, obstruction, distal antral adenocarcinoma',
'MSS, HER2+, PD-L1 normal, CDH1-, CLDN18.2-, EBV-',
'<b>Diagnosis: Distal Gastric Cancer (DGC), antrum, intestinal type, H. pylori-driven, HER2+</b>\n→ Classic H. pylori-driven antral cancer with obstruction. MSS = no immunotherapy benefit.\n→ HER2+ is the actionable biomarker.\n→ <b>Treatment: Chemotherapy + Trastuzumab (HER2 targeted)</b>. ± Ramucirumab (VEGFR2) for metastatic disease.'),
('Case 4 — 59yo male, weight loss, proximal corpus, lymphocyte-rich diffuse carcinoma',
'MSS, HER2-, PD-L1 HIGH, CDH1-, CLDN18.2+, EBV+',
'<b>Diagnosis: EBV-associated gastric cancer, diffuse type, CLDN18.2+</b>\n→ EBV+ drives PIK3CA and ARID1A mutations. Viral antigens → high immune infiltration → PD-L1 overexpression.\n→ MSS but EBV+ + PD-L1 HIGH = still good candidate for immunotherapy (PD-L1 expression is the key here).\n→ CLDN18.2+ = additional target (zolbetuximab).\n→ <b>Treatment: PD-1/PD-L1 inhibitors (nivolumab or pembrolizumab) ± CLDN18.2-targeted therapy (zolbetuximab)</b>'),
('Case 5 — 42yo woman, early satiety, diffuse type cancer, signet-ring cell carcinoma',
'MSS, HER2-, PD-L1 normal, CDH1+, CLDN18.2-, EBV-',
'<b>Diagnosis: Hereditary Diffuse Gastric Cancer (HDGC), CDH1 mutation positive</b>\n→ Young patient (42yo) with diffuse type signet-ring cancer + CDH1+ = classic hereditary diffuse gastric cancer.\n→ MSS, HER2-, PD-L1 normal = no standard targeted/immunotherapy agents available.\n→ CDH1 germline mutation → <b>genetic counseling for family members!</b> Prophylactic gastrectomy should be considered for CDH1+ carriers.\n→ <b>Treatment: Chemotherapy (limited efficacy). CLDN18.2 testing if not done. Genetic counseling mandatory.</b>'),
]
for title, findings, answer in cases_l5:
story += [
KeepTogether([
Paragraph(title, H3),
Paragraph(f'<b>Findings:</b> {findings}', BODY),
sp(3),
Paragraph('Answer:', H4),
Paragraph(answer.replace('\n', '<br/>'), ANS),
sp(6),
])
]
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# SUMMARY
# ══════════════════════════════════════════════════════════════════
story += [
h1('SUMMARY — Both Lectures'),
sp(),
h2('Lecture 4 Summary: Small Bowel Cancer (SBC)'),
p('Small bowel cancers are rare (3–5% of GI malignancies) because the small bowel has rapid transit, alkaline pH, high IgA, and diluted contents — all of which protect against carcinogenesis. They affect adults aged 60–70 most frequently and are diagnosed late due to the absence of a screening program.'),
sp(4),
p('Four main tumor types arise in the small bowel:'),
bul('<b>Adenocarcinoma (SBA):</b> Most common. Located primarily in the duodenum. MSI-H is very frequent (Lynch syndrome link) → PD-1 inhibitors. APC pathway less dominant than CRC. Anti-EGFR not standard. HER2 and RAF mutations more frequent than in CRC.'),
bul('<b>NETs/Carcinoid:</b> Second most common. Arise from enterochromaffin cells in the ileum. Secrete serotonin → carcinoid syndrome (flushing, diarrhea). Diagnosed via Chromogranin A + 5-HIAA. Ki-67 defines grade. Treated with somatostatin analogues, mTOR inhibitors (everolimus), PRRT. 50% already have liver mets at diagnosis.'),
bul('<b>GISTs:</b> Arise from interstitial cells of Cajal. Grow outward (no obstruction), spread to liver/peritoneum not lymph nodes. DOG1+ and KIT+ on IHC. PDGFRA D842V mutation = imatinib-resistant → use avapritinib. Classic chemo ineffective.'),
bul('<b>Lymphoma:</b> Covered separately.'),
sp(4),
p('<b>Diagnostic key rule:</b> If colonoscopy and gastroscopy are negative → think small bowel cancer. Obstruction suggests adenocarcinoma or NET. Palpable mass without obstruction suggests GIST. Always test Chromogranin A, 5-HIAA, DOG1, KIT, and molecular profile.'),
sp(8),
h2('Lecture 5 Summary: Gastric Cancer (GC)'),
p('Gastric cancer is the 3rd leading cause of cancer deaths worldwide. It is biologically heterogeneous and its management is increasingly biomarker-driven. Location within the stomach is the first key to understanding the subtype.'),
sp(4),
bul('<b>Proximal GC (cardia/GEJ):</b> CIN subtype, HER2 amplification, TP53 mutation, RTK pathway. Linked to obesity, GERD, Barrett\'s metaplasia. Increasing in the West. Metastasizes to mediastinal and paracardial lymph nodes → thoracic/upper GI symptoms.'),
bul('<b>Distal GC — Corpus:</b> MSI-H (MMR deficiency → PD-1 inhibitors) or EBV-associated (PIK3CA, ARID1A mutations + PD-L1 overexpression → immunotherapy). 9–10% of GC is EBV-driven.'),
bul('<b>Distal GC — Antrum:</b> H. pylori-driven intestinal metaplasia pathway. Most common mutations: APC, TP53, KRAS, SMAD4, HER2. Decreasing with antibiotic use. Obstruction is a key symptom.'),
bul('<b>Diffuse Type:</b> CDH1 (E-cadherin) loss → cells detach → peritoneal spread first (Krukenberg tumors in ovaries). Signet-ring cells. Hard to detect. Hereditary form (HDGC) in young patients. CLDN18.2 is an emerging target.'),
sp(4),
p('<b>New therapy highlight:</b> CLDN18.2 (claudin 18.2) — membrane protein overexpressed in diffuse type GC. Zolbetuximab (anti-CLDN18.2) in Phase 3 trials — important evolving standard of care.'),
p('<b>Metastatic pattern shortcut:</b> Intestinal type → lymph nodes → liver → lungs. Diffuse type → peritoneum → ovaries (Krukenberg) → liver → lungs.'),
PageBreak(),
]
# ══════════════════════════════════════════════════════════════════
# CHEAT SHEET
# ══════════════════════════════════════════════════════════════════
story += [
h1('CHEAT SHEET — Quick Revision'),
sp(),
h2('Small Bowel Cancer (SBC) Cheat Sheet'),
tbl(
['Topic', 'Key Point'],
[
['SBC Rarity', '3–5% of GI malignancies. Ages 60–70. No screening. Late diagnosis.'],
['Protective factors', 'Rapid transit, low bacteria, high IgA, liquid contents, alkaline pH'],
['SBA location', 'Duodenum most common (biliary symptoms = earlier detection)'],
['SBA vs CRC', 'SBA: less APC, more MSI-H, RAF, HER2. No anti-EGFR standard even in KRAS WT.'],
['SBA MSI-H', 'Strong Lynch syndrome link → PD-1 inhibitors (pembrolizumab)'],
['NETs origin', 'Enterochromaffin cells → ileum most common. Multifocal. Slow but early mets.'],
['NET symptoms', 'Flushing, diarrhea, abdominal cramping = carcinoid syndrome (serotonin excess)'],
['NET diagnosis', 'Chromogranin A + 5-HIAA (urine) elevated. Ki-67 for grading.'],
['NET treatment', 'Somatostatin analogues (octreotide) + mTOR inhibitor (everolimus) + PRRT if SSTR+'],
['Ki-67 in NETs', '<3% = G1 (well-diff, good prognosis). Higher = more aggressive NEC.'],
['GIST origin', 'Interstitial cells of Cajal (ICC) — gut pacemaker cells'],
['GIST markers', 'DOG1+ and KIT(CD117)+ on IHC — confirms diagnosis'],
['GIST spread', 'Liver + peritoneum (NOT lymph nodes). Exophytic growth (no obstruction).'],
['GIST treatment', 'Imatinib (1st line for KIT/PDGFRA-mutant). NO classic chemotherapy.'],
['PDGFRA D842V', 'Imatinib-RESISTANT. Treat with AVAPRITINIB (targets active kinase pocket)'],
['Diagnostic rule', 'Chrom A + 5-HIAA normal → not NET. DOG1+/KIT+ → GIST. Otherwise SBA.'],
['Obstruction present', 'Think adenocarcinoma or NET'],
['Palpable mass, no obstruction', 'Think GIST (exophytic)'],
],
[4.5*cm, 12.5*cm], TEAL
),
sp(8),
h2('Gastric Cancer (GC) Cheat Sheet'),
tbl(
['Topic', 'Key Point'],
[
['GC epidemiology', 'Top 5 cancer, 3rd cause of cancer death. Heterogeneous. Biomarker-driven.'],
['Proximal GC location', 'Cardia/GEJ. Western countries. Linked to obesity + GERD + Barrett\'s.'],
['Proximal GC subtype', 'CIN subtype. HER2+ (trastuzumab). TP53 mutation. RTK pathway.'],
['PGC mets symptoms', 'Mediastinal → respiratory/SVC symptoms. Paracardial → GI symptoms (dysphagia, satiety)'],
['Corpus GC', 'MSI-H (MMR defect → PD-1 inhibitors) OR EBV-associated'],
['EBV-GC', '9-10% of all GC. PIK3CA + ARID1A mutations. High PD-L1 → immunotherapy!'],
['EBV mechanism', 'Viral antigens → immune infiltration → compensatory PD-L1 overexpression'],
['Antral GC', 'H. pylori-driven. Intestinal metaplasia path. Obstruction = key symptom. Decreasing.'],
['Antral GC mutations', 'APC, TP53, KRAS, SMAD4, HER2, CDH1 methylation'],
['Diffuse type GC', 'CDH1 (E-cadherin) loss. Signet-ring cells. Poorly cohesive. Hard to detect.'],
['CDH1 loss effects', 'β-catenin released → WNT signaling. PI3K-AKT-mTOR ON. Anoikis resistance. Peritoneal spread.'],
['HDGC', 'Hereditary Diffuse GC = germline CDH1 mutation → prophylactic gastrectomy for carriers'],
['Diffuse mets', 'Peritoneum FIRST → Krukenberg tumor (ovarian mets) → liver → lungs'],
['Intestinal mets', 'Lymph nodes → liver → lungs'],
['CLDN18.2', 'New target in diffuse type GC. Zolbetuximab (Phase 3). GF + mTOR activation.'],
['HER2+ GC', 'Add trastuzumab to chemotherapy'],
['MSI-H GC', 'Add pembrolizumab/nivolumab (PD-1 inhibitors)'],
['EBV+ + PD-L1 high', 'PD-1/PD-L1 inhibitors very effective'],
['CDH1+ young patient', 'Think HDGC → genetic counseling + consider prophylactic gastrectomy'],
],
[4.5*cm, 12.5*cm], TEAL
),
PageBreak(),
]
# ══════════════════════════════════════════════════════════════════
# PRACTICE QUESTIONS (from slides)
# ══════════════════════════════════════════════════════════════════
story += [
h1('PRACTICE QUESTIONS & ANSWERS'),
sp(),
p('These questions are derived directly from the lecture recap slides (Lectures 4 and 5). Work through them before checking the answers.'),
sp(8),
h2('Lecture 4 Recap Questions'),
]
qs_l4 = [
('Why are Small Bowel Cancers (SBCs) so rare compared to other GI cancers?',
'The small bowel is protected by: (1) <b>Rapid transit time</b> — less carcinogen exposure; (2) <b>Low bacterial load</b> — less carcinogen production; (3) <b>High IgA and lymphoid tissue</b> — strong immune surveillance; (4) <b>Liquid intestinal contents</b> — toxins diluted; (5) <b>Alkaline pH</b> — less DNA-damaging environment. Despite making up 75% of GI length, these factors make SBC very rare.'),
('What predisposes a person to Small Bowel Cancers?',
'<b>SBA:</b> Crohn\'s disease, Lynch syndrome (MSI-H/MMR deficiency), celiac disease, familial adenomatous polyposis (FAP). <b>NETs:</b> MEN1 syndrome (multiple endocrine neoplasia). <b>GISTs:</b> Neurofibromatosis type 1 (NF1), SDH deficiency, familial GIST syndrome. <b>General SBC risk:</b> Male sex, age 60–70, prior abdominal radiation.'),
('Why does the molecular profile matter more than the position in SBC?',
'In colorectal cancer, position helps predict behavior (e.g., right-sided vs left-sided colon). But in SBC, tumors are <b>biologically heterogeneous</b> — an adenocarcinoma, NET, and GIST can all arise in the same segment of the ileum with completely different behaviors and treatments. The <b>molecular markers</b> (MSI, KIT, DOG1, Chromogranin A, 5-HIAA, Ki-67) determine tumor type, prognosis, and treatment — not location.'),
('Which types of cancers can emerge in the small bowel?',
'<b>Four main types:</b> (1) Adenocarcinoma (SBA) — most common, glandular origin; (2) Neuroendocrine Tumors (NETs/Carcinoid) — 2nd most common, from enterochromaffin cells; (3) Lymphoma — from MALT tissue (covered separately); (4) GI Stromal Tumors (GISTs) — from interstitial cells of Cajal.'),
('How do SBAs emerge and which pathway is dominant?',
'SBAs arise from glandular epithelial cells of the small bowel mucosa, primarily the duodenum. The <b>MSI/MMR deficiency pathway</b> is most dominant in SBA (unlike CRC where APC/WNT is dominant). APC mutations are present in only 30–40% of SBA vs 70–80% in CRC. MSI-H is very frequent in SBA, strongly associating with Lynch syndrome.'),
('Which cell type do NETs originate from and what is their function?',
'NETs originate from <b>enterochromaffin cells</b> — specialized cells scattered throughout the GI mucosa. These cells are part of the <b>diffuse neuroendocrine system</b>. Their function is <b>hormonal secretion</b> — they produce and release serotonin, chromogranin, and other neuroendocrine substances to regulate gut function. Their neuroendocrine nature makes tumors multifocal and hormonally active.'),
('Which molecular markers distinguish NETs and what is their significance?',
'<b>Chromogranin A</b>: stored in secretory vesicles — elevated serum/urine level confirms NET. <b>Synaptophysin</b>: found in synaptic vesicles — IHC-positive in NETs. <b>Ki-67 index</b>: grades the tumor — G1 (<3%) = slow, well-differentiated; G2 (3–20%); G3/NEC (>20%) = aggressive. <b>5-HIAA (urine)</b>: serotonin metabolite — elevated in functioning NETs = carcinoid syndrome. <b>Somatostatin receptor (SSTR)</b>: positive status = eligible for SSA treatment and PRRT.'),
('Which treatment do we propose for metastatic NETs?',
'<b>First-line:</b> Somatostatin analogues (octreotide LAR or lanreotide) — control symptoms and slow growth. <b>For progression:</b> mTOR inhibitor (everolimus). <b>If SSTR+:</b> PRRT (Peptide Receptor Radionuclide Therapy, e.g., Lu-177 DOTATATE) — delivers targeted radiation. <b>Liver-directed therapy:</b> Hepatic artery embolization/ablation if liver mets. <b>Surgery</b> when feasible. <b>Note:</b> Classic cytotoxic chemotherapy is largely ineffective for well-differentiated NETs.'),
('Which cell type do GISTs originate from and what is their function?',
'GISTs originate from <b>Interstitial Cells of Cajal (ICC)</b>. These are the <b>"pacemaker cells" of the gastrointestinal tract</b> — they generate and coordinate slow-wave electrical activity that controls smooth muscle contraction and intestinal motility (peristalsis). They are slow-dividing cells, which explains the slow but persistent growth of GISTs.'),
('Which molecular markers distinguish GISTs and what treatment is given?',
'<b>IHC markers:</b> DOG1 (calcium-activated chloride channel, very sensitive/specific) and KIT/CD117 (tyrosine kinase receptor). <b>Molecular testing:</b> KIT mutation (exon 11 most common → imatinib sensitive) and PDGFRA mutation (D842V = avapritinib required; others = imatinib sensitive). <b>Treatment:</b> Imatinib (1st line for most GISTs). Sunitinib (2nd line). Regorafenib (3rd line). For PDGFRA D842V: Avapritinib. NO classic chemotherapy.'),
('What do we give for constitutively active receptors (specifically PDGFRA D842V)?',
'<b>Avapritinib</b>. Standard TKIs (like imatinib) target kinase receptors in their <b>inactive</b> conformation. PDGFRA D842V mutation locks the receptor in its <b>active</b> conformation — imatinib cannot bind. Avapritinib was specifically designed to fit the <b>active kinase pocket</b>, making it effective where imatinib fails.'),
('Explain the general clinical workflow to detect SBC.',
'<b>Step 1:</b> Gastroscopy and colonoscopy — rule out upper and lower GI cancer first. <b>Step 2:</b> If negative but symptoms persist (anemia, obstruction, weight loss) → <b>think SBC</b>. <b>Step 3:</b> Video capsule endoscopy or double-balloon enteroscopy for direct visualization. <b>Step 4:</b> CT scan of chest/abdomen/pelvis for staging and metastases. <b>Step 5:</b> Biomarker testing: Chromogranin A + 5-HIAA (urine) for NETs. Biopsy + IHC: DOG1/KIT for GIST. Molecular: MSI, HER2, KRAS, BRAF for SBA. <b>Step 6:</b> Treat based on tumor type and biomarker profile.'),
]
for i, (q, a) in enumerate(qs_l4, 1):
story += q_block(i, q, a)
story += [
sp(6),
hr(),
h2('Lecture 5 Recap Questions'),
sp(4),
]
qs_l5 = [
('Why is gastric cancer still mainly driven by bacterial/viral infections and why should follow-up be standardized?',
'The majority of gastric cancers are driven by <b>H. pylori</b> (antral/intestinal type) and <b>Epstein-Barr Virus</b> (corpus, 9–10% of GC). These are <b>modifiable risk factors</b> — eradicating H. pylori with antibiotics has already reduced GC incidence. Standardized follow-up of patients with H. pylori gastritis, chronic atrophic gastritis, and intestinal metaplasia allows early detection of dysplasia before cancer develops, improving survival dramatically.'),
('What is the molecular basis of Proximal Gastric Cancer (cardia/GEJ) and what is the main risk factor?',
'<b>Molecular basis:</b> Chromosomal Instability (CIN) subtype — characterized by HER2 amplification, TP53 mutation, and RTK pathway overactivation (EGFR, VEGFR, PDGFR). <b>Main risk factors:</b> Obesity → GERD → Barrett\'s esophageal metaplasia → chronic acid injury at GEJ → adenocarcinoma. PGC is increasing in Western countries alongside the obesity epidemic. Barrett\'s metaplasia (acid-resistant intestinal cells replacing normal squamous cells at the esophageal junction) is the key precancerous lesion.'),
('Why does EBV-associated gastric cancer respond well to immunotherapy?',
'EBV infects gastric epithelial cells and induces <b>PIK3CA</b> and <b>ARID1A mutations</b>. Viral antigens on infected tumor cells trigger <b>high immune cell infiltration</b> — the immune system recognizes the tumor. In response, the tumor compensates by massively <b>overexpressing PD-L1</b>, which switches off infiltrating immune cells. PD-1/PD-L1 inhibitors (nivolumab, pembrolizumab) block this "off switch," reactivating the immune cells to kill the tumor. EBV+ cancers therefore respond particularly well.'),
('How does CDH1 (E-cadherin) loss lead to diffuse type gastric cancer and why is peritoneal spread predominant?',
'E-cadherin is the "molecular glue" keeping gastric epithelial cells attached to each other. When CDH1 is lost (by mutation or methylation): <b>β-catenin</b> is released from the cell membrane complex and activates WNT signaling → increased proliferation. <b>PI3K-AKT-mTOR pathway</b> is activated → cell survival even when detached (anoikis resistance). <b>Cell-cell adhesion</b> is disrupted → cells become single, non-cohesive units (signet-ring cells). These individual floating cells spread preferentially through the <b>peritoneal cavity</b> (rather than via lymphatics/blood) because the peritoneum provides a surface for implantation. This is why peritoneal spread (and Krukenberg ovarian metastases) is characteristic of diffuse type.'),
('What is CLDN18.2 and why is it clinically relevant?',
'Claudin 18.2 (CLDN18.2) is a tight junction membrane protein normally restricted to the gastric mucosa. In gastric cancer (especially diffuse type), it becomes <b>overexpressed/exposed</b> and activates growth factor pathways and mTOR signaling. Crucially, it is <b>frequently mutated/overexpressed specifically in diffuse type gastric cancers</b> and is essentially absent from other normal tissues — making it an ideal tumor-specific target. <b>Zolbetuximab</b> (anti-CLDN18.2 monoclonal antibody) is currently in <b>Phase 3 clinical trials</b> and represents a new standard of care candidate for CLDN18.2+/HER2- gastric cancer.'),
('Explain the difference in metastatic spread between intestinal and diffuse type gastric cancers.',
'<b>Intestinal type</b> (CIN subtype, H. pylori-driven): Follows classic GI cancer lymphovascular spread — <b>1. Regional lymph nodes → 2. Liver (most common distant site) → 3. Lungs</b>. Discrete tumor mass, contained growth. <b>Diffuse type</b> (CDH1 loss, signet-ring cells): Cells are non-cohesive and spread individually via the peritoneum — <b>1. Peritoneum (FIRST and predominant) → 2. Ovaries (Krukenberg tumor = classic metastatic pattern) → 3. Liver → 4. Lungs</b>. Peritoneal carcinomatosis is a hallmark of advanced diffuse GC and carries a poor prognosis.'),
]
for i, (q, a) in enumerate(qs_l5, len(qs_l4)+1):
story += q_block(i, q, a)
story += [
sp(6),
hr(),
h2('Case-Based Questions (Recap Slides)'),
sp(4),
]
story += q_block(
len(qs_l4)+len(qs_l5)+1,
'Lecture 4, Recap 4 (also Lecture 5, Recap 7): A 71yo woman, weight loss, abdominal discomfort, anemia. No family history of CRC. Tumor in descending colon. Liver mets. MSS, BRAF-, RAS+. What is the treatment plan? (RECAP QUESTION FOR CRC)',
'<b>Diagnosis: CRC (colorectal cancer), RAS-mutant, MSS</b><br/>→ Descending colon = left-sided CRC.<br/>→ RAS+ = <b>anti-EGFR therapy is CONTRAINDICATED</b> (cetuximab/panitumumab do not work in RAS-mutant tumors).<br/>→ MSS = no immunotherapy benefit.<br/>→ BRAF- = not a BRAF V600E case.<br/>→ <b>Treatment: FOLFOX or FOLFIRI + Bevacizumab (anti-VEGF) for metastatic disease</b>. No anti-EGFR.'
)
story += q_block(
len(qs_l4)+len(qs_l5)+2,
'Lecture 5, Recap 3 (Pathway question): What pathway is involved when PTEN/TSC1-2/PI3K is mutated in NETs, and what is the treatment?',
'<b>The mTOR signaling pathway.</b><br/>→ Normally, PTEN acts as a brake on the PI3K pathway. TSC1/2 acts as a brake on mTOR. When PTEN or TSC1/2 are lost/mutated, or PI3K is activated → <b>mTOR pathway stays constitutively ON</b> → uncontrolled cell growth and proliferation.<br/>→ <b>Treatment: mTOR inhibitor — Everolimus</b> (approved for advanced pancreatic NETs and other progressive NETs).'
)
story += q_block(
len(qs_l4)+len(qs_l5)+3,
'Lecture 4 & 5 Case 82yo male: DOG1+, KIT+, PDGFRA D842V+. What is the diagnosis and treatment?',
'<b>Diagnosis: GIST with PDGFRA D842V mutation</b><br/>→ DOG1+ and KIT+ confirm GIST origin (Interstitial cells of Cajal).<br/>→ PDGFRA D842V = the specific mutation that locks the receptor in its <b>active conformation</b>.<br/>→ Standard imatinib targets the inactive kinase conformation → <b>imatinib does NOT work here!</b><br/>→ <b>Treatment: AVAPRITINIB</b> — specifically designed to fit and inhibit the active kinase pocket of PDGFRA D842V-mutant GIST.<br/>→ Note: This is the same case in both lectures (age 82, same findings) — consistent answer expected.'
)
# Final page
story += [
PageBreak(),
Spacer(1, 6*cm),
Paragraph('END OF NOTES', S('end', fontName='Helvetica-Bold', fontSize=18,
textColor=NAVY, alignment=TA_CENTER, spaceAfter=10)),
Paragraph('Lectures 4 & 5 — Oncology: GI Cancers (SBC & Gastric Cancer)',
S('end2', fontName='Helvetica-Oblique', fontSize=11,
textColor=MIDGRAY, alignment=TA_CENTER, spaceAfter=6)),
Paragraph('Daron Hakimian, M.Sc. Synthetic Biotechnology | 2026',
S('end3', fontName='Helvetica', fontSize=9,
textColor=MIDGRAY, alignment=TA_CENTER)),
]
# Build
output = '/home/daytona/workspace/kidney-notes/Oncology_GI_Cancers_Notes.pdf'
doc = SimpleDocTemplate(
output, pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=1.8*cm, bottomMargin=1.5*cm,
title='Oncology GI Cancers Notes — Lectures 4 & 5',
author='Orris',
)
doc.build(story, onFirstPage=on_cover, onLaterPages=on_page)
print(f"PDF created: {output}")
print(f"Size: {os.path.getsize(output)/1024:.1f} KB")
cd /home/daytona/workspace/kidney-notes && python3 create_oncology_pdf.py 2>&1
Oncology GI Cancers Notes
PDF Document · PDF
| Section | Content |
|---|---|
| SBC Epidemiology | Why SBC is rare — 5 protective mechanisms explained, why diagnosis is late |
| SBA | Duodenal location, molecular drivers table (vs CRC), why no anti-EGFR, MSI-H → Lynch → pembrolizumab |
| NETs | Enterochromaffin cell origin, serotonin secretion → carcinoid syndrome, mesenteric fibrosis chain, mTOR pathway, Chromogranin A / 5-HIAA / Ki-67 markers, treatment |
| GISTs | Cajal cell origin, DOG1/KIT markers, exophytic growth/no lymph nodes, imatinib vs avapritinib for D842V, why chemo fails |
| Gastric Cancer | Location-driven subtypes (proximal/corpus/antrum/diffuse), CIN, MSI-H, EBV mechanism, H. pylori pathway, CDH1 loss cascade, CLDN18.2 new therapy |
Generate detailed short notes on the following topic, provide summary, after summary provide a cheat sheet for quick revision and there are some questions in the file sort it out after the cheat sheet
Generate detailed short notes on the following topic, provide summary, after summary provide a cheat sheet for quick revision and there are some questions in the file sort it out after the cheat sheet
cd /home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048 && python3 -c " import zipfile, re from xml.etree import ElementTree as ET def extract_pptx_text(pptx_path): with zipfile.ZipFile(pptx_path, 'r') as z: slide_files = sorted([f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')], key=lambda x: int(re.search(r'slide(\d+)', x).group(1))) for slide_path in slide_files: slide_num = re.search(r'slide(\d+)', slide_path).group(1) print(f'\n=== SLIDE {slide_num} ===') with z.open(slide_path) as f: tree = ET.parse(f) root = tree.getroot() for sp in root.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}p'): texts = [] for r in sp.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}t'): if r.text: texts.append(r.text) line = ''.join(texts).strip() if line: print(line) print('====== LECTURE 8 ======') extract_pptx_text('Lecture_8_Oncology_DH_26.pptx') print() print('====== LECTURE 9 ======') extract_pptx_text('Lecture_9_Oncology_DH_26.pptx') " 2>&1
Generate detailed short notes on the following topic, provide summary, after summary provide a cheat sheet for quick revision and there are some questions in the file sort it out after the cheat sheet
Generate
Generate detailed short notes on the following topic, provide summary, after summary provide a cheat sheet for quick revision and there are some questions in the file sort it out after the cheat sheet
Explain it in short and detailed manner easy to remember
python3 -c " from pypdf import PdfReader reader = PdfReader('/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Pharmacology_Exam_Notes.pdf') print(f'Pages: {len(reader.pages)}') # Extract all text for i, page in enumerate(reader.pages): print(f'\n=== PAGE {i+1} ===') print(page.extract_text()) " 2>&1
Hello claude i got a internal medicine exam tomorrow and i haven't studied anything so I'll provide you the topics and the book can you make detailed short precise which covers whole topics and easy to understand notes in a doc file.make it in a way that any type of question can be understood and explain it in a stlye that you are teaching to a kid. Make a doc file with notes ill provide notes again so wait untill i say
All the topics consist of cardiologic disease, pulmonary disease, gastrointestinal disease , renal disease , neurological disease
Just go on
python3 -c " from pypdf import PdfReader import os files = [ '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (27).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (28).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (33).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (34).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (42).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (43).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (44).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (63).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (64).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (65).pdf', ] for f in files: name = os.path.basename(f) print(f'\n\n========== FILE: {name} ==========') try: r = PdfReader(f) print(f'Pages: {len(r.pages)}') for i, page in enumerate(r.pages): txt = page.extract_text() if txt and txt.strip(): print(f'--- Page {i+1} ---') print(txt[:3000]) except Exception as e: print(f'ERROR: {e}') " 2>&1 | head -600
python3 -c " from pypdf import PdfReader import os files = [ '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (33).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (34).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (42).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (43).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (44).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (63).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (64).pdf', '/home/daytona/workspace/attachments/616f2f28-7a69-4373-8b26-ace33f7e6048/Новый документ (65).pdf', ] for f in files: name = os.path.basename(f) print(f'\n\n========== FILE: {name} ==========') try: r = PdfReader(f) print(f'Pages: {len(r.pages)}') for i, page in enumerate(r.pages): txt = page.extract_text() if txt and txt.strip(): print(f'--- Page {i+1} ---') print(txt) except Exception as e: print(f'ERROR: {e}') " 2>&1
ls /home/daytona/workspace/kidney-notes/ 2>/dev/null && echo "exists" || mkdir -p /home/daytona/workspace/internal-medicine-notes && echo "created"
Generate the internet disease notes in a doc file
Generate