Take reference from guyton

Asking for Preferences

Parkinson's disease

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Loading Image
Reading File
I now have all the content needed from Guyton. Let me compile the complete answer:

Parkinson Disease

Guyton and Hall Textbook of Medical Physiology, Chapter 57

Definition and Alternate Name

Parkinson disease, also known as paralysis agitans, results from widespread degeneration of the pars compacta of the substantia nigra - the portion that sends dopamine-secreting nerve fibers to the caudate nucleus and putamen (the striatum).

Epidemiology

  • More than 10 million people worldwide are affected
  • Men are 1.5 times more likely than women to develop it
  • Etiology is uncertain; a combination of genetic and environmental factors (including toxins such as pesticides) is believed to be involved

Basal Ganglia Circuit - Background

To understand Parkinson disease, Guyton first explains the key neurotransmitters in the basal ganglia system (Fig. 57.14):
PathwayNeurotransmitterDirection
Substantia nigra → Caudate nucleus & PutamenDopamine (inhibitory)Nigrostriatal
Caudate nucleus & Putamen → Globus pallidus & Substantia nigraGABA (inhibitory)Striatopallidal
Cortex → Caudate nucleus & PutamenAcetylcholineCorticostriatal
Brain stem → Basal gangliaNorepinephrine, serotonin, enkephalinMultiple
Glutamate pathways (not shown in Fig. 57.14) provide the major excitatory signals that balance these inhibitory systems.
Key principle: Dopamine acts as an inhibitory stabilizer. GABA-mediated feedback loops make the basal ganglia circuits predominantly negative feedback loops, lending stability to motor control.

The Basal Ganglia Circuitry (Fig. 57.10)

Basal ganglia-corticospinal circuitry showing connections from motor cortex, thalamus, subthalamus, substantia nigra, cerebellum to muscles - Guyton Fig. 57.10
Figure 57.10 from Guyton: Relationship of the basal ganglia circuitry to the corticospinal-cerebellar system for movement control.

Motor Features (Clinical Presentation)

Guyton describes 5 cardinal motor features:
  1. Rigidity - of much of the musculature of the body
  2. Resting tremor - involuntary, at a fixed rate of 3 to 6 cycles/sec, even when the person is at rest (different from cerebellar tremor which occurs only during intentional movement)
  3. Akinesia - serious difficulty initiating movement (often more distressing than rigidity or tremor)
  4. Postural instability - impaired postural reflexes leading to poor balance and falls
  5. Other motor symptoms - dysphagia, speech disorders, gait disturbances, fatigue

Nonmotor Features

  • Sleep disturbances
  • Depression and anxiety
  • Autonomic dysfunction
  • Cognitive impairment (in advanced stages)

Pathophysiology (Guyton's Explanation)

Why Rigidity Occurs

"Destruction of the dopaminergic neurons in the substantia nigra may allow the caudate nucleus and putamen to become overly active and cause continuous output of excitatory signals to the corticospinal motor control system. These signals could overly excite many of the muscles of the body, thus leading to rigidity."
Loss of dopamine (inhibitory) → Striatum becomes overactive → Excessive excitatory output to corticospinal system → Muscle rigidity

Why Tremor Occurs

"Some of the feedback circuits might easily oscillate because of high feedback gains after loss of their inhibition, leading to the tremor of Parkinson disease."
Loss of dopamine-mediated damping → Feedback circuit oscillation → Resting tremor (3-6 Hz)
This tremor differs from cerebellar tremor in that it occurs continuously during waking hours (involuntary), whereas cerebellar tremor occurs only during intentional movements.

Why Akinesia Occurs

"Dopamine secretion in the limbic system, especially in the nucleus accumbens, is often decreased, along with its decrease in the basal ganglia. It has been suggested that this decrease might reduce the psychic drive for motor activity and contribute to akinesia."
Reduced dopamine in nucleus accumbens (limbic system) → Reduced psychic drive → Akinesia. Movements, when they do occur, are stiff and staccato rather than smooth.

Treatment (Guyton's Coverage)

1. L-Dopa (Levodopa)

  • Ameliorates motor disturbances, especially rigidity and akinesia
  • Little effect on nonmotor symptoms
  • Mechanism: L-dopa is converted into dopamine in the brain, restoring the inhibition-excitation balance in the caudate nucleus and putamen
  • Why not use dopamine directly? Dopamine cannot cross the blood-brain barrier; L-dopa's slightly different chemical structure allows it to pass through

2. Monoamine Oxidase (MAO) Inhibitors

  • Inhibit MAO, the enzyme responsible for destroying dopamine after release
  • Released dopamine persists longer in basal ganglia tissues
  • Added benefit: help slow the destruction of dopaminergic neurons in the substantia nigra
  • Guyton notes: L-dopa + MAO inhibitor combination provides better results than either alone

3. Fetal Dopamine Cell Transplantation

  • Fetal dopamine-secreting brain cells transplanted into the caudate nuclei and putamen
  • Used with some short-term success
  • Guyton comments: "If persistence of dopamine secretion by these cells could be achieved, perhaps this treatment would become the therapy of the future."

Summary Table

FeatureDetail
Primary lesionPars compacta of substantia nigra
Key deficitLoss of dopamine in caudate nucleus & putamen
Dopamine roleInhibitory stabilizer
Result of lossStriatum overactive → excitatory overflow
Classic triadRigidity, resting tremor (3-6 Hz), akinesia
Tremor typeResting (not intention)
Akinesia causeDecreased limbic dopamine (nucleus accumbens)
First-line treatmentL-Dopa (crosses BBB, converted to dopamine)

Source: Guyton and Hall Textbook of Medical Physiology, Chapter 57 - Cerebellum and Basal Ganglia, pp. 712-713

Please convert into PDF along with good diagrams and a good note

Reading File
Running Command

mkdir -p /tmp/workspace/parkinsons-pdf && ls /tmp/workspace/parkinsons-pdf/

Running Command

cd /tmp/workspace/parkinsons-pdf && wget -q "https://cdn.orris.care/cdss_images/9e213038b76efe526d4db092d48b030fa2dbcf19bbd69e583a8b35704512ad2e.png" -O basal_ganglia_circuit.png && wget -q "https://cdn.orris.care/cdss_images/5f77a0e08c3e0fb45af88ab025eb3ba0ce01bc647c9f5225a610d6202a09062a.png" -O basal_ganglia_anatomy.png && ls -lh *.png

Running Command

cd /tmp/workspace/parkinsons-pdf && python3 -c " import urllib.request urllib.request.urlretrieve('https://cdn.orris.care/cdss_images/9e213038b76efe526d4db092d48b030fa2dbcf19bbd69e583a8b35704512ad2e.png', 'basal_ganglia_circuit.png') urllib.request.urlretrieve('https://cdn.orris.care/cdss_images/5f77a0e08c3e0fb45af88ab025eb3ba0ce01bc647c9f5225a610d6202a09062a.png', 'basal_ganglia_anatomy.png') print('Downloaded successfully') import os for f in os.listdir('.'): print(f, os.path.getsize(f)) "

Writing File

~/parkinsons-pdf/generate_pdf.py

"""
Parkinson's Disease - PDF Generator
Based on Guyton and Hall Textbook of Medical Physiology, Chapter 57
"""

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_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    Image, HRFlowable, KeepTogether, PageBreak
)
from reportlab.platypus.flowables import Flowable
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Arrow, Circle, Polygon
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Group
from reportlab.lib.colors import HexColor
import os

# ─── Color Palette ────────────────────────────────────────────────────────────
DEEP_NAVY    = HexColor('#1A2B4A')
ACCENT_BLUE  = HexColor('#2E5FA3')
LIGHT_BLUE   = HexColor('#D6E4F7')
MEDIUM_BLUE  = HexColor('#4A7DC4')
ACCENT_RED   = HexColor('#C0392B')
LIGHT_RED    = HexColor('#FDECEA')
ACCENT_GREEN = HexColor('#1E8449')
LIGHT_GREEN  = HexColor('#D5F5E3')
ACCENT_ORANGE= HexColor('#D35400')
LIGHT_ORANGE = HexColor('#FDEBD0')
LIGHT_PURPLE = HexColor('#EBE2F5')
ACCENT_PURPLE= HexColor('#7D3C98')
GRAY_BG      = HexColor('#F4F6F8')
GRAY_BORDER  = HexColor('#BDC3C7')
TEXT_DARK    = HexColor('#1C2833')
WHITE        = colors.white
GOLD         = HexColor('#D4AC0D')
LIGHT_GOLD   = HexColor('#FEF9E7')

PAGE_W, PAGE_H = A4
MARGIN = 2.2 * cm

# ─── Document Setup ───────────────────────────────────────────────────────────
OUTPUT = '/tmp/workspace/parkinsons-pdf/Parkinsons_Disease_Guyton.pdf'

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=MARGIN, rightMargin=MARGIN,
    topMargin=2.5*cm, bottomMargin=2.5*cm,
    title="Parkinson Disease – Guyton & Hall",
    author="Guyton and Hall Textbook of Medical Physiology"
)

CONTENT_W = PAGE_W - 2 * MARGIN

# ─── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

title_style = S('MyTitle',
    fontName='Helvetica-Bold', fontSize=26, leading=32,
    textColor=WHITE, alignment=TA_CENTER, spaceAfter=4)

subtitle_style = S('MySubtitle',
    fontName='Helvetica', fontSize=12, leading=16,
    textColor=HexColor('#AED6F1'), alignment=TA_CENTER, spaceAfter=2)

source_style = S('Source',
    fontName='Helvetica-Oblique', fontSize=9, leading=12,
    textColor=HexColor('#85C1E9'), alignment=TA_CENTER)

h1_style = S('H1',
    fontName='Helvetica-Bold', fontSize=15, leading=20,
    textColor=WHITE, spaceAfter=2, spaceBefore=4,
    borderPad=6, backColor=ACCENT_BLUE)

h2_style = S('H2',
    fontName='Helvetica-Bold', fontSize=12, leading=16,
    textColor=DEEP_NAVY, spaceAfter=4, spaceBefore=8,
    borderPad=4)

body_style = S('Body',
    fontName='Helvetica', fontSize=10, leading=15,
    textColor=TEXT_DARK, alignment=TA_JUSTIFY, spaceAfter=4)

body_bold = S('BodyBold',
    fontName='Helvetica-Bold', fontSize=10, leading=15,
    textColor=TEXT_DARK, spaceAfter=4)

bullet_style = S('Bullet',
    fontName='Helvetica', fontSize=10, leading=15,
    textColor=TEXT_DARK, leftIndent=16, bulletIndent=4,
    spaceAfter=3)

caption_style = S('Caption',
    fontName='Helvetica-Oblique', fontSize=8.5, leading=12,
    textColor=HexColor('#555555'), alignment=TA_CENTER, spaceAfter=4)

note_style = S('Note',
    fontName='Helvetica', fontSize=9.5, leading=14,
    textColor=HexColor('#4A235A'), alignment=TA_JUSTIFY)

quote_style = S('Quote',
    fontName='Helvetica-Oblique', fontSize=9.5, leading=14,
    textColor=HexColor('#2C3E50'), alignment=TA_JUSTIFY,
    leftIndent=12, rightIndent=12)

table_header = S('TH',
    fontName='Helvetica-Bold', fontSize=9.5, leading=13,
    textColor=WHITE, alignment=TA_CENTER)

table_cell = S('TC',
    fontName='Helvetica', fontSize=9, leading=13,
    textColor=TEXT_DARK, alignment=TA_LEFT)

table_cell_c = S('TCC',
    fontName='Helvetica', fontSize=9, leading=13,
    textColor=TEXT_DARK, alignment=TA_CENTER)

# ─── Header/Footer ───────────────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    # Header bar
    canvas.setFillColor(DEEP_NAVY)
    canvas.rect(0, PAGE_H - 1.4*cm, PAGE_W, 1.4*cm, fill=1, stroke=0)
    canvas.setFillColor(WHITE)
    canvas.setFont('Helvetica-Bold', 9)
    canvas.drawString(MARGIN, PAGE_H - 0.85*cm, "Parkinson Disease")
    canvas.setFont('Helvetica', 8)
    canvas.drawRightString(PAGE_W - MARGIN, PAGE_H - 0.85*cm,
                           "Guyton & Hall — Chapter 57")
    # Footer
    canvas.setFillColor(DEEP_NAVY)
    canvas.rect(0, 0, PAGE_W, 1.1*cm, fill=1, stroke=0)
    canvas.setFillColor(WHITE)
    canvas.setFont('Helvetica', 8)
    canvas.drawCentredString(PAGE_W/2, 0.38*cm,
                             f"Page {doc.page}  |  Guyton & Hall Textbook of Medical Physiology")
    canvas.restoreState()

def on_first_page(canvas, doc):
    # Gradient-like title background
    canvas.setFillColor(DEEP_NAVY)
    canvas.rect(0, PAGE_H - 8.5*cm, PAGE_W, 8.5*cm, fill=1, stroke=0)
    canvas.setFillColor(ACCENT_BLUE)
    canvas.rect(0, PAGE_H - 8.5*cm, PAGE_W, 0.5*cm, fill=1, stroke=0)
    # Gold accent line
    canvas.setFillColor(GOLD)
    canvas.rect(0, PAGE_H - 5*cm, PAGE_W, 0.18*cm, fill=1, stroke=0)
    on_page(canvas, doc)

# ─── Custom Flowable: Colored Section Header ─────────────────────────────────
class SectionHeader(Flowable):
    def __init__(self, text, bg=ACCENT_BLUE, fg=WHITE, width=None, height=0.75*cm):
        super().__init__()
        self.text = text
        self.bg = bg
        self.fg = fg
        self._width = width
        self._height = height

    def wrap(self, available_w, available_h):
        self.width = self._width or available_w
        return self.width, self._height

    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.roundRect(0, 0, self.width, self._height, 4, fill=1, stroke=0)
        c.setFillColor(self.fg)
        c.setFont('Helvetica-Bold', 12)
        c.drawString(10, (self._height - 12) / 2 + 2, self.text)


class InfoBox(Flowable):
    """Colored callout box."""
    def __init__(self, lines, bg=LIGHT_BLUE, border=ACCENT_BLUE,
                 title=None, width=None, icon='●'):
        super().__init__()
        self.lines = lines
        self.bg = bg
        self.border = border
        self.title = title
        self._width = width
        self.icon = icon

    def wrap(self, available_w, available_h):
        self.width = self._width or available_w
        n = len(self.lines)
        title_h = 18 if self.title else 0
        self.height = title_h + n * 16 + 16
        return self.width, self.height

    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.setStrokeColor(self.border)
        c.setLineWidth(1.2)
        c.roundRect(0, 0, self.width, self.height, 5, fill=1, stroke=1)
        # left accent bar
        c.setFillColor(self.border)
        c.rect(0, 0, 4, self.height, fill=1, stroke=0)
        y = self.height - 12
        if self.title:
            c.setFillColor(self.border)
            c.setFont('Helvetica-Bold', 10)
            c.drawString(12, y, f"{self.icon}  {self.title}")
            y -= 18
        c.setFillColor(TEXT_DARK)
        c.setFont('Helvetica', 9)
        for line in self.lines:
            c.drawString(14, y, line)
            y -= 15


# ─── Pathophysiology Flow Diagram ────────────────────────────────────────────
def make_patho_diagram():
    d = Drawing(CONTENT_W, 6.8*cm)
    W = float(CONTENT_W)
    H = 6.8 * 28.35  # convert cm to points

    boxes = [
        ("Degeneration of\nSubstantia Nigra\n(pars compacta)", ACCENT_RED),
        ("↓ Dopamine in\nCaudate Nucleus\n& Putamen", HexColor('#E74C3C')),
        ("Striatum\nOveractivity", HexColor('#D35400')),
        ("Excessive\nExcitatory Output\nto Corticospinal", HexColor('#8E44AD')),
        ("RIGIDITY\nTREMOR\nAKINESIA", DEEP_NAVY),
    ]

    n = len(boxes)
    bw = (W - 20) / n - 6
    bh = 2.6 * 28.35
    y0 = (H - bh) / 2

    for i, (txt, col) in enumerate(boxes):
        x = 10 + i * (bw + 6)
        # box
        d.add(Rect(x, y0, bw, bh, fillColor=col, strokeColor=WHITE,
                   strokeWidth=1.5, rx=6, ry=6))
        # text
        lines = txt.split('\n')
        line_h = 13
        total_h = len(lines) * line_h
        ty = y0 + bh/2 + total_h/2 - line_h + 2
        for ln in lines:
            s = String(x + bw/2, ty, ln,
                       fontName='Helvetica-Bold' if i == n-1 else 'Helvetica',
                       fontSize=8.5, fillColor=WHITE, textAnchor='middle')
            d.add(s)
            ty -= line_h
        # arrow
        if i < n - 1:
            ax = x + bw + 1
            ay = y0 + bh/2
            d.add(Line(ax, ay, ax + 4, ay, strokeColor=GRAY_BORDER, strokeWidth=1.5))
            # arrowhead
            d.add(Polygon([ax+4, ay, ax+1, ay+4, ax+1, ay-4],
                          fillColor=GRAY_BORDER, strokeColor=GRAY_BORDER))

    return d


# ─── Dopamine Pathway Diagram ─────────────────────────────────────────────────
def make_dopamine_diagram():
    d = Drawing(CONTENT_W, 5.5*cm)
    W = float(CONTENT_W)
    H = 5.5 * 28.35

    # Left side: Substantia Nigra
    sn_x, sn_y, sn_w, sn_h = 20, H*0.35, 120, 55
    d.add(Rect(sn_x, sn_y, sn_w, sn_h, fillColor=HexColor('#1A5276'),
               strokeColor=WHITE, strokeWidth=1, rx=6, ry=6))
    d.add(String(sn_x + sn_w/2, sn_y + sn_h/2 + 5,
                 "Substantia Nigra", fontName='Helvetica-Bold', fontSize=8,
                 fillColor=WHITE, textAnchor='middle'))
    d.add(String(sn_x + sn_w/2, sn_y + sn_h/2 - 8,
                 "(pars compacta)", fontName='Helvetica-Oblique', fontSize=7,
                 fillColor=HexColor('#AED6F1'), textAnchor='middle'))

    # Middle: Striatum (Caudate + Putamen)
    st_x, st_y, st_w, st_h = W/2 - 70, H*0.35, 140, 55
    d.add(Rect(st_x, st_y, st_w, st_h, fillColor=HexColor('#117A65'),
               strokeColor=WHITE, strokeWidth=1, rx=6, ry=6))
    d.add(String(st_x + st_w/2, st_y + st_h/2 + 5,
                 "Caudate Nucleus &", fontName='Helvetica-Bold', fontSize=8,
                 fillColor=WHITE, textAnchor='middle'))
    d.add(String(st_x + st_w/2, st_y + st_h/2 - 8,
                 "Putamen (Striatum)", fontName='Helvetica', fontSize=7.5,
                 fillColor=HexColor('#A9DFBF'), textAnchor='middle'))

    # Right: Motor Output
    mo_x, mo_y, mo_w, mo_h = W - 140, H*0.35, 120, 55
    d.add(Rect(mo_x, mo_y, mo_w, mo_h, fillColor=ACCENT_PURPLE,
               strokeColor=WHITE, strokeWidth=1, rx=6, ry=6))
    d.add(String(mo_x + mo_w/2, mo_y + mo_h/2 + 5,
                 "Corticospinal", fontName='Helvetica-Bold', fontSize=8,
                 fillColor=WHITE, textAnchor='middle'))
    d.add(String(mo_x + mo_w/2, mo_y + mo_h/2 - 8,
                 "Motor System", fontName='Helvetica', fontSize=7.5,
                 fillColor=HexColor('#D2B4DE'), textAnchor='middle'))

    # Arrow: SN -> Striatum (Dopamine - inhibitory, normally suppresses)
    ax1 = sn_x + sn_w
    ay1 = sn_y + sn_h/2
    ax2 = st_x
    ay2 = st_y + st_h/2
    d.add(Line(ax1, ay1, ax2, ay2, strokeColor=HexColor('#2ECC71'), strokeWidth=2))
    d.add(String((ax1+ax2)/2, ay1 + 10, "Dopamine (inhibitory)",
                 fontName='Helvetica', fontSize=7.5,
                 fillColor=HexColor('#1E8449'), textAnchor='middle'))

    # Arrow: Striatum -> Motor (normally balanced; in PD = overactive)
    ax3 = st_x + st_w
    ay3 = st_y + st_h/2
    ax4 = mo_x
    ay4 = mo_y + mo_h/2
    d.add(Line(ax3, ay3, ax4, ay4, strokeColor=ACCENT_RED, strokeWidth=2))
    d.add(String((ax3+ax4)/2, ay3 + 10, "Excitatory output",
                 fontName='Helvetica', fontSize=7.5,
                 fillColor=ACCENT_RED, textAnchor='middle'))

    # Label: In PD - no dopamine
    d.add(Rect(sn_x, H*0.04, sn_w, 28, fillColor=LIGHT_RED,
               strokeColor=ACCENT_RED, strokeWidth=0.8, rx=4, ry=4))
    d.add(String(sn_x + sn_w/2, H*0.04 + 16,
                 "In PD: DEGENERATED", fontName='Helvetica-Bold', fontSize=7,
                 fillColor=ACCENT_RED, textAnchor='middle'))
    d.add(String(sn_x + sn_w/2, H*0.04 + 5,
                 "→ No dopamine release", fontName='Helvetica', fontSize=7,
                 fillColor=ACCENT_RED, textAnchor='middle'))

    d.add(Rect(st_x, H*0.04, st_w, 28, fillColor=LIGHT_ORANGE,
               strokeColor=ACCENT_ORANGE, strokeWidth=0.8, rx=4, ry=4))
    d.add(String(st_x + st_w/2, H*0.04 + 16,
                 "In PD: OVERACTIVE", fontName='Helvetica-Bold', fontSize=7,
                 fillColor=ACCENT_ORANGE, textAnchor='middle'))
    d.add(String(st_x + st_w/2, H*0.04 + 5,
                 "→ Excessive excitation", fontName='Helvetica', fontSize=7,
                 fillColor=ACCENT_ORANGE, textAnchor='middle'))

    d.add(Rect(mo_x, H*0.04, mo_w, 28, fillColor=LIGHT_PURPLE,
               strokeColor=ACCENT_PURPLE, strokeWidth=0.8, rx=4, ry=4))
    d.add(String(mo_x + mo_w/2, H*0.04 + 16,
                 "In PD: OVER-EXCITED", fontName='Helvetica-Bold', fontSize=7,
                 fillColor=ACCENT_PURPLE, textAnchor='middle'))
    d.add(String(mo_x + mo_w/2, H*0.04 + 5,
                 "→ Rigidity & Tremor", fontName='Helvetica', fontSize=7,
                 fillColor=ACCENT_PURPLE, textAnchor='middle'))

    return d


# ─── Treatment Comparison Diagram ────────────────────────────────────────────
def make_treatment_diagram():
    d = Drawing(CONTENT_W, 4.5*cm)
    W = float(CONTENT_W)
    H = 4.5 * 28.35

    treatments = [
        ("L-Dopa\n(Levodopa)", "Crosses BBB\nConverted → Dopamine\nRestores inhibition",
         HexColor('#1A5276'), HexColor('#D6EAF8')),
        ("MAO\nInhibitors", "Prevent dopamine\ndegradation\nExtend dopamine action",
         HexColor('#145A32'), HexColor('#D5F5E3')),
        ("Fetal Cell\nTransplant", "Dopamine-secreting\ncells into striatum\nShort-term success",
         HexColor('#6E2F7C'), HexColor('#EDE0F5')),
    ]

    n = len(treatments)
    bw = (W - 30) / n - 8
    bh = H * 0.62
    y0 = (H - bh) / 2 - 5

    for i, (title, detail, dark, light) in enumerate(treatments):
        x = 15 + i * (bw + 8)
        # shadow
        d.add(Rect(x+3, y0-3, bw, bh, fillColor=GRAY_BORDER, strokeColor=None, rx=6, ry=6))
        # card
        d.add(Rect(x, y0, bw, bh, fillColor=light, strokeColor=dark,
                   strokeWidth=1.2, rx=6, ry=6))
        # header strip
        d.add(Rect(x, y0 + bh - 30, bw, 30, fillColor=dark,
                   strokeColor=dark, rx=6, ry=6))
        # fix bottom of header strip
        d.add(Rect(x, y0 + bh - 30, bw, 10, fillColor=dark, strokeColor=None))

        lines = title.split('\n')
        ty = y0 + bh - 10
        for ln in lines:
            d.add(String(x + bw/2, ty, ln, fontName='Helvetica-Bold', fontSize=9,
                         fillColor=WHITE, textAnchor='middle'))
            ty -= 12

        detail_lines = detail.split('\n')
        dy = y0 + bh - 42
        for dl in detail_lines:
            d.add(String(x + bw/2, dy, dl, fontName='Helvetica', fontSize=8,
                         fillColor=TEXT_DARK, textAnchor='middle'))
            dy -= 14

    return d


# ─── Build Story ──────────────────────────────────────────────────────────────
story = []

# ── COVER PAGE TITLE AREA ──
story.append(Spacer(1, 4.5*cm))  # space for the dark header band

title_p = Paragraph("PARKINSON DISEASE", title_style)
subtitle_p = Paragraph("Pathophysiology, Clinical Features &amp; Management", subtitle_style)
source_p = Paragraph("Guyton and Hall Textbook of Medical Physiology · Chapter 57", source_style)

story.append(title_p)
story.append(Spacer(1, 0.3*cm))
story.append(subtitle_p)
story.append(Spacer(1, 0.25*cm))
story.append(source_p)
story.append(Spacer(1, 3.5*cm))

# ── OVERVIEW BOX on Cover ──
overview_data = [
    [Paragraph('<b>Also Known As</b>', table_cell), Paragraph('Paralysis Agitans', table_cell)],
    [Paragraph('<b>Primary Lesion</b>', table_cell), Paragraph('Pars compacta of Substantia Nigra', table_cell)],
    [Paragraph('<b>Key Deficit</b>', table_cell), Paragraph('↓ Dopamine in Caudate Nucleus &amp; Putamen', table_cell)],
    [Paragraph('<b>Prevalence</b>', table_cell), Paragraph('&gt;10 million worldwide; Men 1.5× more affected', table_cell)],
    [Paragraph('<b>Etiology</b>', table_cell), Paragraph('Genetic + Environmental (toxins, pesticides)', table_cell)],
]
overview_table = Table(overview_data, colWidths=[5*cm, CONTENT_W - 5*cm])
overview_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), GRAY_BG),
    ('BACKGROUND', (0,0), (0,-1), LIGHT_BLUE),
    ('TEXTCOLOR', (0,0), (0,-1), DEEP_NAVY),
    ('BOX', (0,0), (-1,-1), 1.5, ACCENT_BLUE),
    ('INNERGRID', (0,0), (-1,-1), 0.5, GRAY_BORDER),
    ('ROWBACKGROUNDS', (0,0), (-1,-1), [GRAY_BG, WHITE]),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 8),
]))
story.append(overview_table)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════
# PAGE 2: Basal Ganglia Anatomy & Neurotransmitters
# ═══════════════════════════════════════════════════════
story.append(Spacer(1, 0.3*cm))
story.append(SectionHeader("  BASAL GANGLIA — Anatomy & Neurotransmitter Pathways"))
story.append(Spacer(1, 0.3*cm))

story.append(Paragraph(
    "The basal ganglia are a group of deep brain nuclei (caudate nucleus, putamen, globus pallidus, "
    "subthalamus, and substantia nigra) that work with the corticospinal system to control complex "
    "patterns of voluntary motor activity. Understanding their circuitry is essential to grasp "
    "how Parkinson disease disrupts normal movement.",
    body_style))
story.append(Spacer(1, 0.2*cm))

# Two column layout: anatomy diagram + neurotransmitter text
anat_img_path = '/tmp/workspace/parkinsons-pdf/basal_ganglia_anatomy.png'
circuit_img_path = '/tmp/workspace/parkinsons-pdf/basal_ganglia_circuit.png'

anat_img = Image(anat_img_path, width=7.5*cm, height=8*cm, kind='proportional')
circuit_img = Image(circuit_img_path, width=7.5*cm, height=8*cm, kind='proportional')

nt_text = [
    Paragraph("<b>Key Neurotransmitter Pathways (Fig. 57.14)</b>", h2_style),
    Paragraph("1. <b>Dopamine</b> — Substantia nigra → Caudate nucleus &amp; Putamen (inhibitory)", bullet_style),
    Paragraph("2. <b>GABA</b> — Caudate &amp; Putamen → Globus pallidus &amp; Substantia nigra (inhibitory)", bullet_style),
    Paragraph("3. <b>Acetylcholine</b> — Cortex → Caudate nucleus &amp; Putamen (excitatory)", bullet_style),
    Paragraph("4. <b>Glutamate</b> — Multiple excitatory pathways balancing inhibitory signals", bullet_style),
    Spacer(1, 0.2*cm),
    Paragraph(
        "GABA and dopamine both act as <b>inhibitory stabilizers</b>, making the "
        "basal ganglia feedback loops predominantly <b>negative feedback</b> — "
        "lending stability to motor control.",
        body_style),
]

img_table = Table(
    [[anat_img, circuit_img]],
    colWidths=[CONTENT_W/2, CONTENT_W/2]
)
img_table.setStyle(TableStyle([
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ALIGN', (0,0), (-1,-1), 'CENTER'),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
]))
story.append(img_table)
story.append(Paragraph(
    "<i>Left: Anatomical relations of basal ganglia to cerebral cortex and thalamus (Fig. 57.9)  |  "
    "Right: Basal ganglia circuitry and relationship to corticospinal-cerebellar system (Fig. 57.10) — Guyton &amp; Hall</i>",
    caption_style))
story.append(Spacer(1, 0.3*cm))
for fl in nt_text:
    story.append(fl)

# ═══════════════════════════════════════════════════════
# PAGE 3: Definition, Epidemiology, Clinical Features
# ═══════════════════════════════════════════════════════
story.append(PageBreak())
story.append(Spacer(1, 0.3*cm))
story.append(SectionHeader("  DEFINITION & EPIDEMIOLOGY"))
story.append(Spacer(1, 0.3*cm))

story.append(Paragraph(
    "<b>Parkinson disease</b> (also called <i>paralysis agitans</i>) results from widespread degeneration "
    "of the <b>pars compacta of the substantia nigra</b> — the region that sends "
    "dopamine-secreting nerve fibers to the caudate nucleus and putamen.",
    body_style))
story.append(Spacer(1, 0.15*cm))

epi_data = [
    [Paragraph('<b>Statistic</b>', table_header), Paragraph('<b>Value</b>', table_header)],
    [Paragraph('Global Prevalence', table_cell), Paragraph('>10 million people', table_cell)],
    [Paragraph('Sex Ratio', table_cell), Paragraph('Men affected 1.5× more than women', table_cell)],
    [Paragraph('Etiology', table_cell), Paragraph('Genetic + Environmental factors (toxins, pesticides)', table_cell)],
    [Paragraph('Typical Onset', table_cell), Paragraph('Gradual; more common after age 60', table_cell)],
]
epi_table = Table(epi_data, colWidths=[5.5*cm, CONTENT_W - 5.5*cm])
epi_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), ACCENT_BLUE),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('BACKGROUND', (0,1), (-1,-1), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [GRAY_BG, WHITE]),
    ('BOX', (0,0), (-1,-1), 1.2, ACCENT_BLUE),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 8),
]))
story.append(epi_table)
story.append(Spacer(1, 0.4*cm))

# Clinical Features
story.append(SectionHeader("  CLINICAL FEATURES — Motor Symptoms", bg=HexColor('#922B21'), fg=WHITE))
story.append(Spacer(1, 0.3*cm))

motor_data = [
    [Paragraph('<b>#</b>', table_header),
     Paragraph('<b>Feature</b>', table_header),
     Paragraph('<b>Description (Guyton)</b>', table_header)],
    [Paragraph('1', table_cell_c),
     Paragraph('<b>Rigidity</b>', table_cell),
     Paragraph('Rigidity of much of the musculature of the body', table_cell)],
    [Paragraph('2', table_cell_c),
     Paragraph('<b>Resting Tremor</b>', table_cell),
     Paragraph('Involuntary, fixed rate of <b>3 to 6 cycles/sec</b>; present even at rest '
               '(unlike cerebellar tremor which occurs only with intentional movement)', table_cell)],
    [Paragraph('3', table_cell_c),
     Paragraph('<b>Akinesia</b>', table_cell),
     Paragraph('Serious difficulty initiating movement; patient must exert highest concentration '
               'for even simple movements; movements are stiff and staccato when they do occur', table_cell)],
    [Paragraph('4', table_cell_c),
     Paragraph('<b>Postural Instability</b>', table_cell),
     Paragraph('Impaired postural reflexes → poor balance and falls', table_cell)],
    [Paragraph('5', table_cell_c),
     Paragraph('<b>Other Motor</b>', table_cell),
     Paragraph('Dysphagia (impaired swallowing), speech disorders, gait disturbances, fatigue', table_cell)],
]
motor_table = Table(motor_data, colWidths=[1.2*cm, 4*cm, CONTENT_W - 5.2*cm])
motor_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), HexColor('#922B21')),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_RED, WHITE]),
    ('BOX', (0,0), (-1,-1), 1.2, HexColor('#922B21')),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 6),
    ('ALIGN', (0,0), (0,-1), 'CENTER'),
]))
story.append(motor_table)
story.append(Spacer(1, 0.4*cm))

# Nonmotor features
story.append(SectionHeader("  NONMOTOR FEATURES", bg=HexColor('#6C3483'), fg=WHITE))
story.append(Spacer(1, 0.25*cm))
nonmotor = [
    "Sleep disturbances",
    "Depression and anxiety",
    "Autonomic dysfunction",
    "Cognitive impairment (in advanced stages)"
]
nm_data = [[Paragraph(f"● {f}", bullet_style) for f in nonmotor[:2]],
           [Paragraph(f"● {f}", bullet_style) for f in nonmotor[2:]]]
nm_table = Table(nm_data, colWidths=[CONTENT_W/2, CONTENT_W/2])
nm_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_PURPLE),
    ('BOX', (0,0), (-1,-1), 1, ACCENT_PURPLE),
    ('INNERGRID', (0,0), (-1,-1), 0.3, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 8),
]))
story.append(nm_table)


# ═══════════════════════════════════════════════════════
# PAGE 4: Pathophysiology with Flow Diagram
# ═══════════════════════════════════════════════════════
story.append(PageBreak())
story.append(Spacer(1, 0.3*cm))
story.append(SectionHeader("  PATHOPHYSIOLOGY — Mechanism of Motor Defects"))
story.append(Spacer(1, 0.35*cm))

story.append(Paragraph(
    "According to Guyton, the key pathophysiological sequence in Parkinson disease follows a "
    "logical cascade from neuronal loss to clinical symptoms:",
    body_style))
story.append(Spacer(1, 0.25*cm))
story.append(make_patho_diagram())
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "<i>Figure: Pathophysiology cascade from substantia nigra degeneration to motor defects in Parkinson disease</i>",
    caption_style))
story.append(Spacer(1, 0.35*cm))

story.append(SectionHeader("  DOPAMINE PATHWAY — Normal vs. Parkinson Disease", bg=HexColor('#117A65')))
story.append(Spacer(1, 0.3*cm))
story.append(make_dopamine_diagram())
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "<i>Figure: Dopamine pathway from substantia nigra to striatum and corticospinal system. "
    "In PD, dopamine is lost → striatum becomes overactive → excessive excitatory output → rigidity &amp; tremor</i>",
    caption_style))
story.append(Spacer(1, 0.35*cm))

# Mechanism detail boxes
story.append(SectionHeader("  MECHANISM OF EACH SYMPTOM (from Guyton)"))
story.append(Spacer(1, 0.25*cm))

mech_data = [
    [Paragraph('<b>Symptom</b>', table_header),
     Paragraph('<b>Guyton\'s Mechanism</b>', table_header)],
    [Paragraph('<b>Rigidity</b>', table_cell),
     Paragraph(
         '"Destruction of dopaminergic neurons in the substantia nigra may allow the caudate nucleus '
         'and putamen to become <b>overly active</b> and cause continuous output of excitatory signals '
         'to the corticospinal motor control system. These signals could <b>overly excite many of '
         'the muscles</b> of the body, thus leading to rigidity."',
         quote_style)],
    [Paragraph('<b>Tremor\n(3–6 Hz)</b>', table_cell),
     Paragraph(
         '"Some of the feedback circuits might easily <b>oscillate</b> because of high feedback gains '
         'after loss of their inhibition, leading to the tremor of Parkinson disease." This tremor differs '
         'from cerebellar tremor — it occurs continuously during all waking hours (involuntary), not just '
         'during intentional movements.',
         quote_style)],
    [Paragraph('<b>Akinesia</b>', table_cell),
     Paragraph(
         'Dopamine secretion in the <b>limbic system</b>, especially in the <b>nucleus accumbens</b>, '
         'is often decreased alongside the decrease in the basal ganglia. This is suggested to '
         '<b>reduce the psychic drive for motor activity</b>. The mental effort required to initiate '
         'movement can be at the limit of the patient\'s willpower.',
         quote_style)],
]
mech_table = Table(mech_data, colWidths=[3.5*cm, CONTENT_W - 3.5*cm])
mech_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), ACCENT_BLUE),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_BLUE, GRAY_BG]),
    ('BOX', (0,0), (-1,-1), 1.2, ACCENT_BLUE),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
    ('LEFTPADDING', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (0,-1), 'CENTER'),
]))
story.append(mech_table)


# ═══════════════════════════════════════════════════════
# PAGE 5: Treatment
# ═══════════════════════════════════════════════════════
story.append(PageBreak())
story.append(Spacer(1, 0.3*cm))
story.append(SectionHeader("  TREATMENT OF PARKINSON DISEASE (Guyton)"))
story.append(Spacer(1, 0.35*cm))
story.append(make_treatment_diagram())
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "<i>Figure: Three main treatment strategies described by Guyton — L-Dopa, MAO Inhibitors, and Fetal Cell Transplantation</i>",
    caption_style))
story.append(Spacer(1, 0.35*cm))

# Treatment detail table
tx_data = [
    [Paragraph('<b>Treatment</b>', table_header),
     Paragraph('<b>Mechanism</b>', table_header),
     Paragraph('<b>Notes (Guyton)</b>', table_header)],
    [Paragraph('<b>L-Dopa\n(Levodopa)</b>', table_cell),
     Paragraph('Converted to <b>dopamine</b> in the brain; restores inhibition-excitation balance '
               'in caudate &amp; putamen', table_cell),
     Paragraph('Ameliorates <b>rigidity and akinesia</b>; little effect on nonmotor symptoms. '
               'Dopamine itself cannot cross the <b>blood-brain barrier</b> — L-dopa\'s slightly '
               'different structure allows it to pass through.', table_cell)],
    [Paragraph('<b>MAO\nInhibitors</b>', table_cell),
     Paragraph('Inhibit <b>monoamine oxidase</b>, the enzyme that destroys dopamine after release → '
               'dopamine persists longer in basal ganglia', table_cell),
     Paragraph('Also helps <b>slow destruction</b> of dopaminergic neurons in substantia nigra. '
               '<b>Combination with L-dopa</b> provides better results than either alone.', table_cell)],
    [Paragraph('<b>Fetal\nCell\nTransplant</b>', table_cell),
     Paragraph('Fetal dopamine-secreting brain cells transplanted into <b>caudate nuclei and '
               'putamen</b>', table_cell),
     Paragraph('Used with some <b>short-term success</b>. Guyton: "If persistence of dopamine '
               'secretion by these cells could be achieved, perhaps this treatment would become '
               'the therapy of the future."', table_cell)],
]
tx_table = Table(tx_data, colWidths=[3*cm, 6*cm, CONTENT_W - 9*cm])
tx_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), ACCENT_GREEN),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_GREEN, WHITE]),
    ('BOX', (0,0), (-1,-1), 1.2, ACCENT_GREEN),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING', (0,0), (-1,-1), 7),
    ('BOTTOMPADDING', (0,0), (-1,-1), 7),
    ('LEFTPADDING', (0,0), (-1,-1), 7),
    ('ALIGN', (0,0), (0,-1), 'CENTER'),
]))
story.append(tx_table)
story.append(Spacer(1, 0.4*cm))

# Comparison: Parkinson tremor vs Cerebellar tremor
story.append(SectionHeader("  PARKINSON TREMOR vs. CEREBELLAR TREMOR", bg=HexColor('#784212')))
story.append(Spacer(1, 0.25*cm))
comp_data = [
    [Paragraph('<b>Feature</b>', table_header),
     Paragraph('<b>Parkinson Tremor</b>', table_header),
     Paragraph('<b>Cerebellar Tremor</b>', table_header)],
    [Paragraph('Type', table_cell_c),
     Paragraph('Resting tremor', table_cell),
     Paragraph('Intention tremor', table_cell)],
    [Paragraph('When occurs', table_cell_c),
     Paragraph('All waking hours (involuntary)', table_cell),
     Paragraph('Only during intentional movements', table_cell)],
    [Paragraph('Rate', table_cell_c),
     Paragraph('3 to 6 cycles/sec (fixed)', table_cell),
     Paragraph('Variable', table_cell)],
    [Paragraph('Cause', table_cell_c),
     Paragraph('Loss of dopaminergic inhibition → feedback circuit oscillation', table_cell),
     Paragraph('Cerebellar damage → loss of movement fine-tuning', table_cell)],
]
comp_table = Table(comp_data, colWidths=[3.5*cm, (CONTENT_W-3.5*cm)/2, (CONTENT_W-3.5*cm)/2])
comp_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), HexColor('#784212')),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_ORANGE, WHITE]),
    ('BOX', (0,0), (-1,-1), 1.2, HexColor('#784212')),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 7),
    ('ALIGN', (0,0), (0,-1), 'CENTER'),
]))
story.append(comp_table)


# ═══════════════════════════════════════════════════════
# PAGE 6: Quick Review Table + Important Note
# ═══════════════════════════════════════════════════════
story.append(PageBreak())
story.append(Spacer(1, 0.3*cm))
story.append(SectionHeader("  QUICK REVIEW — SUMMARY TABLE"))
story.append(Spacer(1, 0.3*cm))

summary_data = [
    [Paragraph('<b>Feature</b>', table_header), Paragraph('<b>Detail</b>', table_header)],
    [Paragraph('Other name', table_cell), Paragraph('Paralysis agitans', table_cell)],
    [Paragraph('Primary lesion', table_cell), Paragraph('Pars compacta of substantia nigra', table_cell)],
    [Paragraph('Key neurotransmitter lost', table_cell), Paragraph('Dopamine (inhibitory)', table_cell)],
    [Paragraph('Target area of dopamine deficiency', table_cell), Paragraph('Caudate nucleus and putamen (striatum)', table_cell)],
    [Paragraph('Effect of dopamine loss', table_cell), Paragraph('Striatum overactive → excessive excitatory signals to corticospinal system', table_cell)],
    [Paragraph('Cardinal motor triad', table_cell), Paragraph('Rigidity | Resting tremor (3–6 Hz) | Akinesia', table_cell)],
    [Paragraph('Postural symptom', table_cell), Paragraph('Postural instability, poor balance, falls', table_cell)],
    [Paragraph('Tremor type', table_cell), Paragraph('Resting (involuntary) — NOT intention tremor', table_cell)],
    [Paragraph('Akinesia mechanism', table_cell), Paragraph('Decreased dopamine in nucleus accumbens (limbic) → reduced psychic drive', table_cell)],
    [Paragraph('Nonmotor features', table_cell), Paragraph('Sleep disturbance, depression, autonomic dysfunction, cognitive impairment (late)', table_cell)],
    [Paragraph('First-line treatment', table_cell), Paragraph('L-Dopa — crosses BBB, converted to dopamine in brain', table_cell)],
    [Paragraph('Second treatment', table_cell), Paragraph('MAO inhibitors — prevent dopamine breakdown; slow neuronal loss', table_cell)],
    [Paragraph('Experimental treatment', table_cell), Paragraph('Fetal dopamine cell transplantation — short-term success', table_cell)],
    [Paragraph('Best treatment combo', table_cell), Paragraph('L-Dopa + MAO inhibitor together', table_cell)],
]
summary_table = Table(summary_data, colWidths=[6*cm, CONTENT_W - 6*cm])
summary_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), DEEP_NAVY),
    ('TEXTCOLOR', (0,0), (-1,0), WHITE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [GRAY_BG, WHITE]),
    ('BOX', (0,0), (-1,-1), 1.5, DEEP_NAVY),
    ('INNERGRID', (0,0), (-1,-1), 0.4, GRAY_BORDER),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING', (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING', (0,0), (-1,-1), 8),
    ('BACKGROUND', (0,1), (0,-1), LIGHT_BLUE),
]))
story.append(summary_table)
story.append(Spacer(1, 0.5*cm))


# ── IMPORTANT NOTE BOX ──
story.append(SectionHeader("  IMPORTANT NOTE FOR STUDENTS", bg=GOLD, fg=DEEP_NAVY))
story.append(Spacer(1, 0.25*cm))

note_bg_table = Table([[
    Paragraph(
        "<b>Key Concept 1 — Dopamine is INHIBITORY:</b> "
        "Dopamine normally inhibits the striatum. Its loss does NOT mean the striatum stops working — "
        "it means the striatum is <b>released from inhibition</b> and becomes overactive. "
        "This overactivity drives excitatory signals downstream, causing rigidity and tremor.",
        note_style),
]], colWidths=[CONTENT_W])
note_bg_table.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_GOLD),
    ('BOX', (0,0), (-1,-1), 1.5, GOLD),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(note_bg_table)
story.append(Spacer(1, 0.2*cm))

note_bg_table2 = Table([[
    Paragraph(
        "<b>Key Concept 2 — Akinesia vs. Paralysis:</b> "
        "Akinesia is NOT paralysis. The patient CAN move, but initiating movement requires "
        "extreme mental effort. Guyton states the mental anguish required 'is often at the "
        "limit of the patient\'s willpower.' This is partly due to decreased dopamine in the "
        "<b>nucleus accumbens</b> (limbic system), reducing psychic drive.",
        note_style),
]], colWidths=[CONTENT_W])
note_bg_table2.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_GOLD),
    ('BOX', (0,0), (-1,-1), 1.5, GOLD),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(note_bg_table2)
story.append(Spacer(1, 0.2*cm))

note_bg_table3 = Table([[
    Paragraph(
        "<b>Key Concept 3 — Why L-Dopa and not Dopamine?</b> "
        "Dopamine cannot cross the blood-brain barrier (BBB). L-Dopa has a slightly different "
        "chemical structure that allows it to pass through the BBB, after which it is converted "
        "to dopamine in the brain by DOPA decarboxylase.",
        note_style),
]], colWidths=[CONTENT_W])
note_bg_table3.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_GOLD),
    ('BOX', (0,0), (-1,-1), 1.5, GOLD),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(note_bg_table3)
story.append(Spacer(1, 0.2*cm))

note_bg_table4 = Table([[
    Paragraph(
        "<b>Key Concept 4 — Resting Tremor Mechanism:</b> "
        "The tremor in Parkinson disease is caused by <b>oscillation of feedback circuits</b> "
        "due to high feedback gain after loss of dopaminergic inhibition. Unlike cerebellar tremor "
        "(intention-type, only during movement), Parkinson tremor is <b>continuous</b> during "
        "all waking hours — even at rest.",
        note_style),
]], colWidths=[CONTENT_W])
note_bg_table4.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_GOLD),
    ('BOX', (0,0), (-1,-1), 1.5, GOLD),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(note_bg_table4)
story.append(Spacer(1, 0.2*cm))

note_bg_table5 = Table([[
    Paragraph(
        "<b>Schizophrenia Connection (Guyton, Chapter 59):</b> "
        "Schizophrenic-like symptoms develop in some Parkinson patients treated with L-dopa "
        "(which releases dopamine in the brain). This supports the dopamine hypothesis of "
        "schizophrenia — where <b>excess dopamine</b> in certain brain regions may contribute "
        "to psychotic symptoms. This is why antipsychotics (dopamine blockers) can cause "
        "Parkinson-like side effects.",
        note_style),
]], colWidths=[CONTENT_W])
note_bg_table5.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), LIGHT_PURPLE),
    ('BOX', (0,0), (-1,-1), 1.5, ACCENT_PURPLE),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
    ('TOPPADDING', (0,0), (-1,-1), 8),
    ('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(note_bg_table5)
story.append(Spacer(1, 0.3*cm))

story.append(Paragraph(
    "<i>Source: Guyton and Hall Textbook of Medical Physiology · Chapter 57 · pp. 712–713</i>",
    caption_style))

# ─── Build PDF ────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=on_first_page, onLaterPages=on_page)
print(f"PDF created: {OUTPUT}")
import os
print(f"File size: {os.path.getsize(OUTPUT):,} bytes")
Running Command

cd /tmp/workspace/parkinsons-pdf && python3 generate_pdf.py

Editing File

~/parkinsons-pdf/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/parkinsons-pdf/generate_pdf.py'
Running Command

cd /tmp/workspace/parkinsons-pdf && python3 generate_pdf.py

Your PDF is ready! Here's the download link:

Parkinsons Disease Guyton

PDF Document · PDF


What's inside the PDF (6 pages):
PageContent
1 - CoverTitle banner with dark navy design + overview quick-facts table
2 - AnatomyBoth Guyton diagrams (Fig. 57.9 and Fig. 57.10) side by side + neurotransmitter pathway list
3 - Clinical FeaturesEpidemiology table, motor symptoms table (5 cardinal features), nonmotor features
4 - PathophysiologyColor-coded cascade flow diagram + dopamine pathway diagram (Normal vs PD) + mechanism of each symptom with direct Guyton quotes
5 - TreatmentTreatment comparison diagram + detailed treatment table + Parkinson tremor vs Cerebellar tremor comparison
6 - Review + NotesFull summary table + 5 important student notes (gold boxes) covering key concepts: dopamine as inhibitory, akinesia vs paralysis, why L-dopa not dopamine, resting tremor mechanism, and the schizophrenia-dopamine connection
This is a shared conversation. Sign in to Orris to start your own chat.