attachment
attachment
attachment
attachment
attachment
attachment

Make a notes out of it

analyse_media
analyse_media
analyse_media
Here are clean, organized notes from all three pages:

Chapter 6 - Popliteal Fossa

"The popliteal artery is auscultated for measuring the blood pressure in the lower limb."

Introduction

  • Popliteal fossa = Latin: hamstring of knee
  • Shallow, diamond-shaped depression at the back of the knee joint
  • Best felt when knee is semiflexed
  • Corresponds to the cubital fossa of the forearm

Surface Landmarks

#StructureKey Feature
1Lateral & medial condyles of femur & tibiaFelt on sides and front of knee
2Head of fibulaBony prominence below posterolateral aspect of lateral condyle of tibia
3Common peroneal nervePalpated against posterolateral neck of fibula, medial to biceps femoris tendon, finger moved upward
4Fibular collateral ligamentRounded cord just above fibular head in flexed knee
5Hamstrings (knee flexed against resistance)Semitendinosus (rounded, superficial) over semimembranosus (flat); biceps femoris laterally; groove anteriorly bounded by adductor magnus medially and iliotibial tract laterally
6Popliteal artery pulseFelt in middle of fossa by deep pressure
7Gastrocnemius headsTwo rounded cushions in lower fossa, merge into calf inferiorly

Location

  • Diamond-shaped depression behind the knee joint
  • Between lower part of femur and upper part of tibia

Boundaries

SideStructure
SuperolaterallyBiceps femoris
SuperomediallySemitendinosus + semimembranosus + gracilis + sartorius + adductor magnus
InferolaterallyLateral head of gastrocnemius + plantaris
InferomediallyMedial head of gastrocnemius

Roof

Formed by the superficial fascia (deep fascia) over the popliteal fossa.
The roof contains:
  • (a) Small saphenous vein
  • (b) Three cutaneous nerves:
    • Branches and terminal part of the posterior cutaneous nerve of the thigh
    • Posterior division of the medial cutaneous nerve of thigh
    • Peroneal or sural communicating nerve

Floor

Formed from above downwards by:
  • (a) Popliteal surface of the femur
  • (b) Capsule of the knee joint + oblique popliteal ligament
  • (c) Popliteus muscle covered by its fascia

Contents (8 structures)

  1. Popliteal artery and its branches
  2. Popliteal vein and its tributaries
  3. Tibial nerve and its branches
  4. Common peroneal nerve and its branches
  5. Posterior cutaneous nerve of the thigh
  6. Genicular branch of the obturator nerve
  7. Popliteal lymph nodes
  8. Fat - surrounds and supports all above structures

Arrangement of Neurovascular Structures

The popliteal vessels and tibial nerve cross the fossa vertically, arranged one over the other:
  • Tibial nerve = most superficial
  • Popliteal vein = deep to tibial nerve
  • Popliteal artery = deepest of all (artery crossed posteriorly by vein and nerve)

Relative positions (medial to lateral / front to back):

LevelArrangement
Upper fossaMedial to lateral: A, V, N (Artery, Vein, Nerve)
Middle fossaBehind to forwards: N, V, A (Nerve, Vein, Artery)
Lower fossaMedial to lateral: N, V, A (Nerve, Vein, Artery)
Mnemonic: AVN (upper) → NVA (lower)
  • Common peroneal nerve crosses the fossa obliquely from superior angle to lateral angle, along the medial border of biceps femoris - lies in the same superficial plane as the tibial nerve.

Popliteal Artery

Beginning, Course & Termination

  • Continuation of the femoral artery
  • Begins at the opening in the adductor magnus (hiatus) - junction of middle one-third with lower one-third of thigh
  • Runs downwards and slightly laterally to reach the lower border of popliteus
  • Terminates at the lower border of popliteus by dividing into:
    • Anterior tibial artery
    • Posterior tibial artery

Relations

  • Popliteal artery is the deepest structure in the popliteal fossa

Source: Human Anatomy - Lower Limb, Abdomen and Pelvis, Chapter 6, pp. 87-89

Generate a quick reference PDF with diagrams and key labels

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace/popliteal-fossa

Running Command

mkdir -p /home/daytona/workspace/popliteal-fossa && ls /home/daytona/workspace/

Writing File

~/popliteal-fossa/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Flowable
import math

# ─── Color palette ────────────────────────────────────────────────────────────
MAROON    = colors.HexColor("#7B1C2A")
DARK_RED  = colors.HexColor("#A0293A")
LIGHT_RED = colors.HexColor("#F5E6E8")
GOLD      = colors.HexColor("#C8960C")
LIGHT_GOLD= colors.HexColor("#FFF8E7")
CREAM     = colors.HexColor("#FDFAF5")
DARK_GRAY = colors.HexColor("#2C2C2C")
MED_GRAY  = colors.HexColor("#5A5A5A")
LIGHT_GRAY= colors.HexColor("#F0F0F0")
BLUE_GRAY = colors.HexColor("#4A6FA5")
TEAL      = colors.HexColor("#2E7D8C")

W, H = A4

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

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

TITLE_STYLE = sty("MainTitle",
    fontName="Helvetica-Bold", fontSize=26, textColor=MAROON,
    alignment=TA_CENTER, spaceAfter=4)

SUBTITLE_STYLE = sty("SubTitle",
    fontName="Helvetica", fontSize=11, textColor=MED_GRAY,
    alignment=TA_CENTER, spaceAfter=12)

H1 = sty("H1",
    fontName="Helvetica-Bold", fontSize=13, textColor=colors.white,
    alignment=TA_LEFT, spaceBefore=8, spaceAfter=4,
    backColor=MAROON, leftIndent=-6, borderPad=4)

H2 = sty("H2",
    fontName="Helvetica-Bold", fontSize=11, textColor=DARK_RED,
    spaceBefore=8, spaceAfter=3, borderPadding=(0,0,2,0))

BODY = sty("Body",
    fontName="Helvetica", fontSize=9.5, textColor=DARK_GRAY,
    leading=14, spaceAfter=3, alignment=TA_JUSTIFY)

BULLET = sty("Bullet",
    fontName="Helvetica", fontSize=9.5, textColor=DARK_GRAY,
    leading=14, leftIndent=14, spaceAfter=2, bulletIndent=4)

SMALL = sty("Small",
    fontName="Helvetica-Oblique", fontSize=8.5, textColor=MED_GRAY,
    alignment=TA_CENTER, spaceAfter=4)

CAPTION = sty("Caption",
    fontName="Helvetica-Bold", fontSize=8, textColor=TEAL,
    alignment=TA_CENTER)

NOTE = sty("Note",
    fontName="Helvetica-Oblique", fontSize=9, textColor=MAROON,
    alignment=TA_CENTER, spaceBefore=4, spaceAfter=4)

# ─── Custom Flowables ─────────────────────────────────────────────────────────

class SectionHeader(Flowable):
    """Colored banner section header."""
    def __init__(self, text, color=MAROON, width=None):
        Flowable.__init__(self)
        self.text = text
        self.color = color
        self.width = width or (W - 4*cm)
        self.height = 22

    def draw(self):
        c = self.canv
        c.setFillColor(self.color)
        c.roundRect(0, 0, self.width, self.height, 4, fill=1, stroke=0)
        c.setFillColor(colors.white)
        c.setFont("Helvetica-Bold", 11)
        c.drawString(10, 6, self.text.upper())


class DiamondDiagram(Flowable):
    """SVG-like diamond shape showing popliteal fossa boundaries."""
    def __init__(self, w=380, h=340):
        Flowable.__init__(self)
        self.width = w
        self.height = h

    def draw(self):
        c = self.canv
        cx, cy = self.width / 2, self.height / 2

        # Shadow
        c.setFillColor(colors.HexColor("#CCCCCC"))
        c.setStrokeColor(colors.HexColor("#CCCCCC"))
        pts_shadow = [
            (cx+3, cy+110), (cx+90+3, cy-20), (cx+3, cy-110), (cx-90+3, cy-20)
        ]
        path = c.beginPath()
        path.moveTo(*pts_shadow[0])
        for pt in pts_shadow[1:]:
            path.lineTo(*pt)
        path.close()
        c.drawPath(path, fill=1, stroke=0)

        # Diamond body
        c.setFillColor(LIGHT_RED)
        c.setStrokeColor(MAROON)
        c.setLineWidth(2)
        pts = [
            (cx, cy + 110),   # top
            (cx + 90, cy - 20), # right
            (cx, cy - 110),   # bottom
            (cx - 90, cy - 20)  # left
        ]
        path = c.beginPath()
        path.moveTo(*pts[0])
        for pt in pts[1:]:
            path.lineTo(*pt)
        path.close()
        c.drawPath(path, fill=1, stroke=1)

        # Corner dots
        for pt in pts:
            c.setFillColor(MAROON)
            c.circle(pt[0], pt[1], 5, fill=1, stroke=0)

        # Center label
        c.setFillColor(MAROON)
        c.setFont("Helvetica-Bold", 11)
        c.drawCentredString(cx, cy + 2, "POPLITEAL")
        c.drawCentredString(cx, cy - 12, "FOSSA")

        # ── Corner boundary labels ──
        label_style = [("Helvetica-Bold", 9, DARK_RED)]

        def draw_label(x, y, lines, anchor="c"):
            c.setFont("Helvetica-Bold", 8.5)
            c.setFillColor(DARK_RED)
            line_h = 11
            total = len(lines) * line_h
            start_y = y + total / 2
            for i, line in enumerate(lines):
                yy = start_y - i * line_h
                if anchor == "l":
                    c.drawString(x, yy, line)
                elif anchor == "r":
                    c.drawRightString(x, yy, line)
                else:
                    c.drawCentredString(x, yy, line)

        # Top (Superolaterally)
        draw_label(cx, cy + 128, ["SUPEROLATERALLY", "Biceps Femoris"])

        # Right (Inferolaterally)
        draw_label(cx + 115, cy - 24, ["INFEROLATERALLY", "Lat. head Gastrocnemius", "+ Plantaris"], anchor="l")

        # Bottom (Inferomedially)
        draw_label(cx, cy - 128, ["INFEROMEDIALLY", "Med. head Gastrocnemius"])

        # Left (Superomedially)
        draw_label(cx - 115, cy - 24, ["SUPEROMEDIALLY", "Semitendinosus", "Semimembranosus", "Gracilis + Sartorius"], anchor="r")

        # Axis arrows (vertical dashed line)
        c.setStrokeColor(TEAL)
        c.setLineWidth(1)
        c.setDash(4, 3)
        c.line(cx, cy + 100, cx, cy - 100)
        c.setDash()

        # Small arrow tips
        c.setFillColor(TEAL)
        c.setFont("Helvetica", 8)
        c.drawCentredString(cx + 16, cy + 86, "Superior")
        c.drawCentredString(cx + 16, cy - 96, "Inferior")


class NVADiagram(Flowable):
    """Diagram showing nerve/vein/artery arrangement at 3 levels."""
    def __init__(self, w=370, h=300):
        Flowable.__init__(self)
        self.width = w
        self.height = h

    def draw(self):
        c = self.canv
        margin_l = 40
        margin_r = 40
        top_y = self.height - 30

        # Title
        c.setFont("Helvetica-Bold", 10)
        c.setFillColor(MAROON)
        c.drawCentredString(self.width / 2, top_y + 10, "Neurovascular Arrangement in Popliteal Fossa")

        levels = [
            {
                "label": "UPPER FOSSA",
                "sublabel": "(Medial → Lateral)",
                "items": [("A", "Artery", colors.HexColor("#C0392B")),
                           ("V", "Vein", colors.HexColor("#2980B9")),
                           ("N", "Nerve", colors.HexColor("#27AE60"))],
                "y": top_y - 30
            },
            {
                "label": "MIDDLE FOSSA",
                "sublabel": "(Back → Front)",
                "items": [("N", "Nerve", colors.HexColor("#27AE60")),
                           ("V", "Vein", colors.HexColor("#2980B9")),
                           ("A", "Artery", colors.HexColor("#C0392B"))],
                "y": top_y - 115
            },
            {
                "label": "LOWER FOSSA",
                "sublabel": "(Medial → Lateral)",
                "items": [("N", "Nerve", colors.HexColor("#27AE60")),
                           ("V", "Vein", colors.HexColor("#2980B9")),
                           ("A", "Artery", colors.HexColor("#C0392B"))],
                "y": top_y - 200
            }
        ]

        box_w = 54
        box_h = 44
        spacing = 62
        start_x = margin_l + 90

        for level in levels:
            y = level["y"]

            # Level label
            c.setFont("Helvetica-Bold", 9)
            c.setFillColor(DARK_GRAY)
            c.drawString(margin_l, y + 28, level["label"])
            c.setFont("Helvetica-Oblique", 7.5)
            c.setFillColor(MED_GRAY)
            c.drawString(margin_l, y + 16, level["sublabel"])

            # Horizontal arrow
            arrow_x1 = start_x - 8
            arrow_x2 = start_x + 3 * spacing
            c.setStrokeColor(LIGHT_GRAY)
            c.setLineWidth(1)
            c.line(arrow_x1, y + box_h / 2, arrow_x2, y + box_h / 2)

            for i, (letter, name, col) in enumerate(level["items"]):
                bx = start_x + i * spacing
                by = y

                # Box
                c.setFillColor(col)
                c.setStrokeColor(colors.white)
                c.setLineWidth(1.5)
                c.roundRect(bx, by, box_w, box_h, 6, fill=1, stroke=1)

                # Letter
                c.setFillColor(colors.white)
                c.setFont("Helvetica-Bold", 18)
                c.drawCentredString(bx + box_w / 2, by + box_h / 2 + 1, letter)

                # Name below box
                c.setFillColor(DARK_GRAY)
                c.setFont("Helvetica", 7.5)
                c.drawCentredString(bx + box_w / 2, by - 9, name)

            # Connector line between levels
            if level != levels[-1]:
                next_y = level["y"] - 85
                c.setStrokeColor(LIGHT_GRAY)
                c.setDash(3, 3)
                c.setLineWidth(0.5)
                c.line(self.width / 2, y - 2, self.width / 2, next_y + box_h + 2)
                c.setDash()

        # Mnemonic box
        c.setFillColor(LIGHT_GOLD)
        c.setStrokeColor(GOLD)
        c.setLineWidth(1.5)
        c.roundRect(self.width - margin_r - 95, 6, 92, 52, 6, fill=1, stroke=1)
        c.setFillColor(GOLD)
        c.setFont("Helvetica-Bold", 8)
        c.drawCentredString(self.width - margin_r - 49, 46, "MNEMONIC")
        c.setFont("Helvetica-Bold", 10)
        c.setFillColor(DARK_GRAY)
        c.drawCentredString(self.width - margin_r - 49, 32, "Upper: A-V-N")
        c.drawCentredString(self.width - margin_r - 49, 19, "Lower: N-V-A")


class FloorRoofDiagram(Flowable):
    """Simple schematic cross-section showing roof and floor."""
    def __init__(self, w=370, h=180):
        Flowable.__init__(self)
        self.width = w
        self.height = h

    def draw(self):
        c = self.canv
        cx = self.width / 2

        # Roof bar
        roof_y = self.height - 40
        c.setFillColor(colors.HexColor("#E8D5B7"))
        c.setStrokeColor(colors.HexColor("#8B6914"))
        c.setLineWidth(1.5)
        c.rect(60, roof_y, self.width - 120, 22, fill=1, stroke=1)
        c.setFillColor(colors.HexColor("#5D4037"))
        c.setFont("Helvetica-Bold", 9)
        c.drawCentredString(cx, roof_y + 8, "ROOF  –  Superficial (Deep) Fascia")

        # Fossa space
        fossa_top = roof_y
        fossa_bot = 80
        c.setFillColor(LIGHT_RED)
        c.setStrokeColor(MAROON)
        c.setLineWidth(1)
        c.rect(60, fossa_bot, self.width - 120, fossa_top - fossa_bot, fill=1, stroke=1)

        # Content labels inside
        c.setFillColor(DARK_GRAY)
        c.setFont("Helvetica", 8)
        contents = [
            "N  –  Tibial Nerve (most superficial)",
            "V  –  Popliteal Vein",
            "A  –  Popliteal Artery (deepest)",
            "+ Common Peroneal N., Lymph Nodes, Fat"
        ]
        for i, txt in enumerate(contents):
            c.drawCentredString(cx, fossa_top - 18 - i * 14, txt)

        # Floor bar
        c.setFillColor(colors.HexColor("#D7E8F0"))
        c.setStrokeColor(colors.HexColor("#1A5276"))
        c.setLineWidth(1.5)
        c.rect(60, fossa_bot - 44, self.width - 120, 42, fill=1, stroke=1)
        c.setFillColor(colors.HexColor("#1A5276"))
        c.setFont("Helvetica-Bold", 8.5)
        c.drawCentredString(cx, fossa_bot - 10, "FLOOR")
        c.setFont("Helvetica", 8)
        c.setFillColor(DARK_GRAY)
        c.drawCentredString(cx, fossa_bot - 24, "Femur (popliteal surface)  |  Capsule + Oblique popliteal lig.  |  Popliteus muscle")

        # Arrows
        c.setStrokeColor(MAROON)
        c.setFillColor(MAROON)
        c.setLineWidth(1)
        c.drawString(4, roof_y + 6, "Superficial")
        c.drawString(4, fossa_bot - 26, "Deep")


# ─── Build document ──────────────────────────────────────────────────────────

OUTPUT = "/home/daytona/workspace/popliteal-fossa/Popliteal_Fossa_Quick_Reference.pdf"
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2.2*cm, rightMargin=2.2*cm,
    topMargin=2*cm, bottomMargin=2*cm,
    title="Popliteal Fossa – Quick Reference",
    author="Anatomy Notes"
)

story = []

# ── Cover / Header ────────────────────────────────────────────────────────────
story.append(Spacer(1, 6))
story.append(Paragraph("POPLITEAL FOSSA", TITLE_STYLE))
story.append(Paragraph("Chapter 6 – Quick Reference Notes", SUBTITLE_STYLE))
story.append(Paragraph(
    "<i>\"The popliteal artery is auscultated for measuring the blood pressure in the lower limb.\"</i>",
    NOTE))
story.append(HRFlowable(width="100%", thickness=2, color=MAROON, spaceAfter=10))

# ── Introduction ──────────────────────────────────────────────────────────────
story.append(SectionHeader("Introduction & Location"))
story.append(Spacer(1, 6))

intro_data = [
    ["Definition", "Shallow diamond-shaped depression at the back of the knee joint (best felt in semiflexion)"],
    ["Latin meaning", "Hamstring of knee"],
    ["Forearm analogy", "Corresponds to the cubital fossa"],
    ["Location", "Behind the knee joint, between lower femur and upper tibia"],
]
t = Table(intro_data, colWidths=[4.2*cm, 12*cm])
t.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (0, -1), LIGHT_RED),
    ("BACKGROUND",    (1, 0), (1, -1), CREAM),
    ("FONTNAME",      (0, 0), (0, -1), "Helvetica-Bold"),
    ("FONTSIZE",      (0, 0), (-1, -1), 9),
    ("TEXTCOLOR",     (0, 0), (0, -1), MAROON),
    ("TEXTCOLOR",     (1, 0), (1, -1), DARK_GRAY),
    ("VALIGN",        (0, 0), (-1, -1), "MIDDLE"),
    ("ROWBACKGROUNDS",(0, 0), (-1, -1), [LIGHT_RED + colors.HexColor("#00000000"), CREAM]),
    ("GRID",          (0, 0), (-1, -1), 0.5, colors.HexColor("#DDDDDD")),
    ("LEFTPADDING",   (0, 0), (-1, -1), 8),
    ("RIGHTPADDING",  (0, 0), (-1, -1), 8),
    ("TOPPADDING",    (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
    ("ROUNDEDCORNERS",(0, 0), (-1, -1), [4, 4, 4, 4]),
]))
story.append(t)
story.append(Spacer(1, 10))

# ── Boundaries Diagram ────────────────────────────────────────────────────────
story.append(SectionHeader("Boundaries  (Diamond Shape)"))
story.append(Spacer(1, 8))
story.append(DiamondDiagram(w=400, h=330))
story.append(Paragraph("Fig 1. Boundaries of the popliteal fossa (diamond shape viewed from posterior)", SMALL))
story.append(Spacer(1, 6))

# Boundaries table
bound_data = [
    ["Side", "Structures"],
    ["Superolaterally", "Biceps femoris"],
    ["Superomedially", "Semitendinosus, Semimembranosus, Gracilis, Sartorius, Adductor magnus"],
    ["Inferolaterally", "Lateral head of gastrocnemius + Plantaris"],
    ["Inferomedially", "Medial head of gastrocnemius"],
]
t2 = Table(bound_data, colWidths=[5*cm, 11.2*cm])
t2.setStyle(TableStyle([
    ("BACKGROUND",   (0, 0), (-1, 0), MAROON),
    ("TEXTCOLOR",    (0, 0), (-1, 0), colors.white),
    ("FONTNAME",     (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE",     (0, 0), (-1, -1), 9),
    ("ROWBACKGROUNDS",(0, 1), (-1, -1), [CREAM, LIGHT_RED]),
    ("FONTNAME",     (0, 1), (0, -1), "Helvetica-Bold"),
    ("TEXTCOLOR",    (0, 1), (0, -1), DARK_RED),
    ("GRID",         (0, 0), (-1, -1), 0.5, colors.HexColor("#DDDDDD")),
    ("LEFTPADDING",  (0, 0), (-1, -1), 8),
    ("RIGHTPADDING", (0, 0), (-1, -1), 8),
    ("TOPPADDING",   (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING",(0, 0), (-1, -1), 5),
    ("VALIGN",       (0, 0), (-1, -1), "MIDDLE"),
]))
story.append(t2)
story.append(Spacer(1, 12))

# ── Roof & Floor ──────────────────────────────────────────────────────────────
story.append(SectionHeader("Roof, Floor & Contents"))
story.append(Spacer(1, 8))
story.append(FloorRoofDiagram(w=440, h=190))
story.append(Paragraph("Fig 2. Cross-section schematic – Roof, contents, and floor of popliteal fossa", SMALL))
story.append(Spacer(1, 6))

# Roof detail
story.append(Paragraph("Roof Details", H2))
roof_data = [
    ["Small saphenous vein"],
    ["Posterior cutaneous nerve of thigh (branches + terminal part)"],
    ["Posterior division of medial cutaneous nerve of thigh"],
    ["Peroneal (sural) communicating nerve"],
]
for row in roof_data:
    story.append(Paragraph(u"\u2022  " + row[0], BULLET))

story.append(Spacer(1, 6))
story.append(Paragraph("Floor Details (top to bottom)", H2))
floor_data = [
    ("a", "Popliteal surface of the femur"),
    ("b", "Capsule of knee joint + oblique popliteal ligament"),
    ("c", "Popliteus muscle covered by fascia"),
]
for letter, txt in floor_data:
    story.append(Paragraph(f"<b>({letter})</b>  {txt}", BULLET))

story.append(Spacer(1, 10))

# ── Contents ──────────────────────────────────────────────────────────────────
story.append(SectionHeader("Contents of the Popliteal Fossa"))
story.append(Spacer(1, 6))
contents_data = [
    ["#", "Structure", "Note"],
    ["1", "Popliteal artery + branches", "Deepest structure; continuation of femoral artery"],
    ["2", "Popliteal vein + tributaries", "Anterior to tibial nerve"],
    ["3", "Tibial nerve + branches", "Most superficial of the three"],
    ["4", "Common peroneal nerve + branches", "Oblique path: superior angle → lateral angle"],
    ["5", "Posterior cutaneous nerve of thigh", "Sensory to posterior skin"],
    ["6", "Genicular branch of obturator nerve", "Small articular branch"],
    ["7", "Popliteal lymph nodes", "Drain the deep leg and knee"],
    ["8", "Fat", "Surrounds and supports all above structures"],
]
t3 = Table(contents_data, colWidths=[0.8*cm, 6*cm, 9.4*cm])
t3.setStyle(TableStyle([
    ("BACKGROUND",   (0, 0), (-1, 0), TEAL),
    ("TEXTCOLOR",    (0, 0), (-1, 0), colors.white),
    ("FONTNAME",     (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE",     (0, 0), (-1, -1), 8.5),
    ("ROWBACKGROUNDS",(0, 1), (-1, -1), [CREAM, colors.HexColor("#EAF4F6")]),
    ("FONTNAME",     (0, 1), (1, -1), "Helvetica-Bold"),
    ("TEXTCOLOR",    (0, 1), (0, -1), TEAL),
    ("TEXTCOLOR",    (1, 1), (1, -1), DARK_GRAY),
    ("TEXTCOLOR",    (2, 1), (2, -1), MED_GRAY),
    ("GRID",         (0, 0), (-1, -1), 0.4, colors.HexColor("#CCCCCC")),
    ("LEFTPADDING",  (0, 0), (-1, -1), 6),
    ("RIGHTPADDING", (0, 0), (-1, -1), 6),
    ("TOPPADDING",   (0, 0), (-1, -1), 4),
    ("BOTTOMPADDING",(0, 0), (-1, -1), 4),
    ("VALIGN",       (0, 0), (-1, -1), "MIDDLE"),
    ("ALIGN",        (0, 0), (0, -1), "CENTER"),
]))
story.append(t3)
story.append(Spacer(1, 10))

# ── NVA Arrangement ──────────────────────────────────────────────────────────
story.append(SectionHeader("Neurovascular Arrangement"))
story.append(Spacer(1, 8))
story.append(NVADiagram(w=450, h=310))
story.append(Paragraph("Fig 3. Arrangement of nerve (N), vein (V), and artery (A) at three levels in the popliteal fossa", SMALL))
story.append(Spacer(1, 8))

# Key rule note
note_data = [["Key Rule: Tibial nerve is most superficial; popliteal artery is deepest.\nArtery is crossed posteriorly by vein and then nerve."]]
t_note = Table(note_data, colWidths=[16.2*cm])
t_note.setStyle(TableStyle([
    ("BACKGROUND",   (0, 0), (-1, -1), LIGHT_GOLD),
    ("TEXTCOLOR",    (0, 0), (-1, -1), DARK_GRAY),
    ("FONTNAME",     (0, 0), (-1, -1), "Helvetica-BoldOblique"),
    ("FONTSIZE",     (0, 0), (-1, -1), 9),
    ("BOX",          (0, 0), (-1, -1), 1.5, GOLD),
    ("LEFTPADDING",  (0, 0), (-1, -1), 10),
    ("TOPPADDING",   (0, 0), (-1, -1), 6),
    ("BOTTOMPADDING",(0, 0), (-1, -1), 6),
]))
story.append(t_note)
story.append(Spacer(1, 10))

# ── Popliteal Artery ──────────────────────────────────────────────────────────
story.append(SectionHeader("Popliteal Artery"))
story.append(Spacer(1, 6))

art_data = [
    ["Property", "Detail"],
    ["Origin", "Continuation of the femoral artery"],
    ["Beginning", "Opening of adductor magnus (hiatus) – junction of middle 1/3 and lower 1/3 of thigh"],
    ["Course", "Downwards and slightly laterally through the fossa"],
    ["Termination", "Lower border of popliteus – divides into anterior and posterior tibial arteries"],
    ["Position", "Deepest structure in popliteal fossa (deepest to vein and nerve)"],
]
t4 = Table(art_data, colWidths=[4.5*cm, 11.7*cm])
t4.setStyle(TableStyle([
    ("BACKGROUND",   (0, 0), (-1, 0), DARK_RED),
    ("TEXTCOLOR",    (0, 0), (-1, 0), colors.white),
    ("FONTNAME",     (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE",     (0, 0), (-1, -1), 9),
    ("ROWBACKGROUNDS",(0, 1), (-1, -1), [CREAM, LIGHT_RED]),
    ("FONTNAME",     (0, 1), (0, -1), "Helvetica-Bold"),
    ("TEXTCOLOR",    (0, 1), (0, -1), DARK_RED),
    ("GRID",         (0, 0), (-1, -1), 0.4, colors.HexColor("#DDDDDD")),
    ("LEFTPADDING",  (0, 0), (-1, -1), 8),
    ("RIGHTPADDING", (0, 0), (-1, -1), 8),
    ("TOPPADDING",   (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING",(0, 0), (-1, -1), 5),
    ("VALIGN",       (0, 0), (-1, -1), "MIDDLE"),
]))
story.append(t4)
story.append(Spacer(1, 10))

# ── Surface Landmarks ────────────────────────────────────────────────────────
story.append(SectionHeader("Surface Landmarks"))
story.append(Spacer(1, 6))

landmarks = [
    ("1", "Lateral & medial condyles", "Femur and tibia – felt on sides and front of knee"),
    ("2", "Head of fibula", "Bony prominence below posterolateral aspect of lateral condyle of tibia"),
    ("3", "Common peroneal nerve", "Palpated against posterolateral neck of fibula, medial to biceps femoris tendon"),
    ("4", "Fibular collateral ligament", "Rounded cord just above head of fibula in flexed knee"),
    ("5", "Hamstrings", "Semitendinosus (rounded, superficial) over flat semimembranosus; biceps femoris laterally"),
    ("6", "Popliteal artery pulse", "Deep pressure in middle of fossa"),
    ("7", "Gastrocnemius heads", "Two rounded cushions in lower fossa, merge into calf inferiorly"),
]
lm_data = [["#", "Landmark", "How to Identify"]] + [[n, b, d] for n, b, d in landmarks]
t5 = Table(lm_data, colWidths=[0.7*cm, 5.5*cm, 10*cm])
t5.setStyle(TableStyle([
    ("BACKGROUND",   (0, 0), (-1, 0), BLUE_GRAY),
    ("TEXTCOLOR",    (0, 0), (-1, 0), colors.white),
    ("FONTNAME",     (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE",     (0, 0), (-1, -1), 8.5),
    ("ROWBACKGROUNDS",(0, 1), (-1, -1), [CREAM, colors.HexColor("#EEF2FF")]),
    ("FONTNAME",     (0, 1), (1, -1), "Helvetica-Bold"),
    ("TEXTCOLOR",    (0, 1), (0, -1), BLUE_GRAY),
    ("TEXTCOLOR",    (1, 1), (1, -1), DARK_GRAY),
    ("TEXTCOLOR",    (2, 1), (2, -1), MED_GRAY),
    ("GRID",         (0, 0), (-1, -1), 0.4, colors.HexColor("#CCCCCC")),
    ("LEFTPADDING",  (0, 0), (-1, -1), 6),
    ("RIGHTPADDING", (0, 0), (-1, -1), 6),
    ("TOPPADDING",   (0, 0), (-1, -1), 4),
    ("BOTTOMPADDING",(0, 0), (-1, -1), 4),
    ("VALIGN",       (0, 0), (-1, -1), "MIDDLE"),
    ("ALIGN",        (0, 0), (0, -1), "CENTER"),
]))
story.append(t5)
story.append(Spacer(1, 12))

# ── Footer ───────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=1, color=MAROON, spaceAfter=6))
story.append(Paragraph(
    "Source: Human Anatomy – Lower Limb, Abdomen and Pelvis, Chapter 6, pp. 87–89  |  Quick Reference Notes",
    SMALL))

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

cd /home/daytona/workspace/popliteal-fossa && python generate_pdf.py 2>&1

Editing File

~/popliteal-fossa/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/popliteal-fossa/generate_pdf.py'
Running Command

cd /home/daytona/workspace/popliteal-fossa && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/popliteal-fossa/Popliteal_Fossa_Quick_Reference.pdf

Your quick reference PDF is ready! Here's what's inside:
Included diagrams & sections:
  • Diamond boundary diagram - labeled with all 4 sides (superolaterally, superomedially, inferolaterally, inferomedially) and their muscle structures
  • Roof-Floor cross-section schematic - shows the superficial fascia as the roof, N/V/A arrangement inside, and the 3-layer floor
  • NVA arrangement diagram - color-coded boxes (red = artery, blue = vein, green = nerve) showing how the arrangement changes at upper, middle, and lower levels of the fossa
  • Full tables for boundaries, contents (8 structures), popliteal artery details, and surface landmarks

Popliteal Fossa Quick Reference

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.