make me flow charts of this in easy way
cd /home/daytona/workspace/attachments/8692d9bb-2a5d-45b8-a1ff-cf8b771a70fe/ && python3 -c " import pdfplumber with pdfplumber.open('Blood Supply of Bone.pdf') as pdf: print(f'Pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'--- PAGE {i+1} ---') text = page.extract_text() print(text) print() "
cd /home/daytona/workspace/attachments/8692d9bb-2a5d-45b8-a1ff-cf8b771a70fe/ && python3 -c " import pytesseract from pdf2image import convert_from_path import sys pages = convert_from_path('Blood Supply of Bone.pdf', dpi=200) print(f'Total pages: {len(pages)}') full_text = '' for i, page in enumerate(pages): text = pytesseract.image_to_string(page) print(f'--- PAGE {i+1} ---') print(text[:500]) print() full_text += f'\n--- PAGE {i+1} ---\n' + text " 2>&1 | head -200
cd /home/daytona/workspace/attachments/8692d9bb-2a5d-45b8-a1ff-cf8b771a70fe/ && python3 -c " import pytesseract from pdf2image import convert_from_path pages = convert_from_path('Blood Supply of Bone.pdf', dpi=200) full_text = '' for i, page in enumerate(pages): text = pytesseract.image_to_string(page) full_text += f'\n--- PAGE {i+1} ---\n' + text print(full_text) " 2>&1
mkdir -p /home/daytona/workspace/blood-supply-flowcharts
~/blood-supply-flowcharts/make_flowcharts.py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
import matplotlib.patheffects as pe
import numpy as np
# ── shared helpers ──────────────────────────────────────────────────────────────
def box(ax, x, y, w, h, text, facecolor, edgecolor, fontsize=10,
style="round,pad=0.1", bold=False, text_color="white"):
rect = FancyBboxPatch((x - w/2, y - h/2), w, h,
boxstyle=style,
facecolor=facecolor, edgecolor=edgecolor,
linewidth=1.8, zorder=3)
ax.add_patch(rect)
weight = "bold" if bold else "normal"
ax.text(x, y, text, ha="center", va="center",
fontsize=fontsize, color=text_color, weight=weight,
wrap=True, zorder=4,
multialignment="center")
def arrow(ax, x1, y1, x2, y2, color="#555555"):
ax.annotate("",
xy=(x2, y2), xytext=(x1, y1),
arrowprops=dict(arrowstyle="-|>", color=color,
lw=1.6, mutation_scale=16),
zorder=2)
def save(fig, path):
fig.savefig(path, dpi=150, bbox_inches="tight",
facecolor=fig.get_facecolor())
plt.close(fig)
print(f"Saved: {path}")
# ═══════════════════════════════════════════════════════════════════════════════
# CHART 1 – Parts of a Long Bone
# ═══════════════════════════════════════════════════════════════════════════════
def chart1():
fig, ax = plt.subplots(figsize=(9, 7))
fig.patch.set_facecolor("#F0F4FF")
ax.set_facecolor("#F0F4FF")
ax.set_xlim(0, 10); ax.set_ylim(0, 9)
ax.axis("off")
ax.set_title("Parts of a Long Bone", fontsize=16, fontweight="bold",
color="#1A237E", pad=12)
# Root
box(ax, 5, 8.3, 4, 0.7, "LONG BONE", "#1A237E", "#0D47A1", fontsize=12, bold=True)
# Two main divisions
box(ax, 2.5, 6.8, 3.5, 0.65, "EPIPHYSIS\n(Two ends)", "#1565C0", "#0D47A1", fontsize=10, bold=True)
box(ax, 7.5, 6.8, 3.5, 0.65, "DIAPHYSIS\n(Shaft)", "#00695C", "#004D40", fontsize=10, bold=True)
arrow(ax, 5, 7.95, 2.5, 7.13)
arrow(ax, 5, 7.95, 7.5, 7.13)
# Epiphysis children
epi = [
(2.5, 5.6, "Expanded articular ends", "#1976D2"),
(2.5, 4.7, "Separated from shaft by\nepiphyseal plate (growing bone)", "#1976D2"),
(2.5, 3.75, "Spongy bone surrounded\nby thin compact bone", "#1976D2"),
]
prev_y = 6.47
for (ex, ey, etxt, ec) in epi:
box(ax, ex, ey, 3.8, 0.65, etxt, ec, "#0D47A1", fontsize=9)
arrow(ax, ex, prev_y, ex, ey + 0.33)
prev_y = ey - 0.33
# Diaphysis children
dia = [
(7.5, 5.6, "Periosteum\n(outer fibrous membrane)", "#00897B"),
(7.5, 4.65, "Cortex\n(compact bone layer)", "#00897B"),
(7.5, 3.7, "Medullary Cavity\n(red/yellow bone marrow)", "#00897B"),
]
prev_y = 6.47
for (dx, dy, dtxt, dc) in dia:
box(ax, dx, dy, 3.8, 0.65, dtxt, dc, "#004D40", fontsize=9)
arrow(ax, dx, prev_y, dx, dy + 0.33)
prev_y = dy - 0.33
# Periosteum note
box(ax, 7.5, 2.6, 3.8, 0.75,
"Periosteum layers:\n• Outer fibrous • Inner osteogenic\nSharpey's fibres anchor it to bone",
"#E65100", "#BF360C", fontsize=8)
arrow(ax, 7.5, 3.37, 7.5, 2.98)
save(fig, "/home/daytona/workspace/blood-supply-flowcharts/chart1_parts_of_long_bone.png")
# ═══════════════════════════════════════════════════════════════════════════════
# CHART 2 – Blood Supply of a Long Bone
# ═══════════════════════════════════════════════════════════════════════════════
def chart2():
fig, ax = plt.subplots(figsize=(10, 10))
fig.patch.set_facecolor("#FFF8E1")
ax.set_facecolor("#FFF8E1")
ax.set_xlim(0, 10); ax.set_ylim(0, 12)
ax.axis("off")
ax.set_title("Blood Supply of a Long Bone", fontsize=16, fontweight="bold",
color="#B71C1C", pad=12)
# Root
box(ax, 5, 11.3, 5, 0.7, "BLOOD SUPPLY OF LONG BONE", "#B71C1C", "#7F0000",
fontsize=12, bold=True)
# Three sources
sources = [
(2, 9.7, "1. NUTRIENT ARTERY\n(Primary source)", "#C62828"),
(5, 9.7, "2. EPIPHYSEAL\nARTERIES", "#AD1457"),
(8, 9.7, "3. METAPHYSEAL\nARTERIES", "#6A1B9A"),
]
for (sx, sy, stxt, sc) in sources:
box(ax, sx, sy, 2.8, 0.8, stxt, sc, "#37474F", fontsize=9, bold=True)
arrow(ax, 5, 10.95, sx, sy + 0.4)
# Nutrient artery details
nu = [
(2, 8.4, "Enters via nutrient foramen"),
(2, 7.55, "Divides in medullary cavity\ninto longitudinal branches"),
(2, 6.65, "Proceeds toward each end\nof the bone"),
(2, 5.75, "Supplies:\n• Medullary cavity\n• Inner 2/3 of cortex\n• Metaphysis"),
]
prev_y = 9.3
for (nx, ny, ntxt) in nu:
box(ax, nx, ny, 3.0, 0.65, ntxt, "#E53935", "#B71C1C", fontsize=8.5)
arrow(ax, nx, prev_y, nx, ny + 0.33)
prev_y = ny - 0.33
# Nutrient foramen direction note
box(ax, 2, 4.6, 3.2, 0.85,
"Nutrient foramen direction:\nPoints AWAY from growing end\n"
"UL: Upper humerus, Lower radius/ulna\n"
"LL: Lower femur, Upper tibia",
"#FF8F00", "#E65100", fontsize=8, text_color="#1A1A1A")
arrow(ax, 2, 5.42, 2, 4.82+0.2)
# Epiphyseal artery details
ep = [
(5, 8.4, "Derived from periarterial\nvascular arcades"),
(5, 7.5, "Enter near articular surface"),
(5, 6.6, "Supply epiphyses\n(secondary ossification centers)"),
]
prev_y = 9.3
for (ex, ey, etxt) in ep:
box(ax, ex, ey, 3.0, 0.65, etxt, "#C2185B", "#880E4F", fontsize=8.5)
arrow(ax, ex, prev_y, ex, ey + 0.33)
prev_y = ey - 0.33
# Metaphyseal artery details
me = [
(8, 8.4, "Derived from neighboring\nsystemic vessels"),
(8, 7.5, "Pass directly into\nthe metaphysis"),
(8, 6.6, "Reinforce metaphyseal branches\nfrom primary nutrient artery"),
]
prev_y = 9.3
for (mx, my, mtxt) in me:
box(ax, mx, my, 2.8, 0.65, mtxt, "#7B1FA2", "#4A148C", fontsize=8.5)
arrow(ax, mx, prev_y, mx, my + 0.33)
prev_y = my - 0.33
# Final pathway
box(ax, 5, 3.5, 7.5, 0.75,
"Blood reaches osteocytes in compact bone via\nHAVERSIAN SYSTEMS (Osteons) - microscopic canal systems housing small blood vessels",
"#1B5E20", "#2E7D32", fontsize=9, bold=True)
arrow(ax, 2, 4.2, 4, 3.78)
arrow(ax, 5, 6.27, 5, 3.88)
arrow(ax, 8, 6.27, 6, 3.78)
save(fig, "/home/daytona/workspace/blood-supply-flowcharts/chart2_blood_supply.png")
# ═══════════════════════════════════════════════════════════════════════════════
# CHART 3 – Ossification of Bone
# ═══════════════════════════════════════════════════════════════════════════════
def chart3():
fig, ax = plt.subplots(figsize=(11, 10))
fig.patch.set_facecolor("#E8F5E9")
ax.set_facecolor("#E8F5E9")
ax.set_xlim(0, 12); ax.set_ylim(0, 12)
ax.axis("off")
ax.set_title("Ossification of Bone", fontsize=16, fontweight="bold",
color="#1B5E20", pad=12)
# Root
box(ax, 6, 11.3, 6, 0.7, "OSSIFICATION\n(Bone Formation from Mesenchyme)", "#1B5E20", "#388E3C",
fontsize=11, bold=True)
# Two types
box(ax, 3, 9.8, 4.5, 0.75, "1. INTRAMEMBRANOUS\nOSSIFICATION", "#2E7D32", "#1B5E20",
fontsize=10, bold=True)
box(ax, 9, 9.8, 4.5, 0.75, "2. ENDOCHONDRAL\nOSSIFICATION", "#558B2F", "#33691E",
fontsize=10, bold=True)
arrow(ax, 6, 10.95, 3, 10.17)
arrow(ax, 6, 10.95, 9, 10.17)
# Intramembranous
imem = [
(3, 8.7, "Directly from\nmesenchymal tissue"),
(3, 7.8, "Mesenchymal models form\nduring embryonic period"),
(3, 6.9, "Osteoblasts lay down\nbone directly"),
(3, 5.9, "Examples:\nSkull bones, Clavicle,\nMandible (jaw bones)"),
]
prev_y = 9.42
for (ix, iy, itxt) in imem:
box(ax, ix, iy, 4.2, 0.65, itxt, "#388E3C", "#1B5E20", fontsize=9)
arrow(ax, ix, prev_y, ix, iy + 0.33)
prev_y = iy - 0.33
# Endochondral
endo = [
(9, 8.7, "Via cartilage model\n(derived from mesenchyme)"),
(9, 7.8, "Cartilage models form\nduring fetal period"),
(9, 6.9, "Bone replaces most\nof the cartilage"),
(9, 5.9, "Examples:\nLong bones, Short bones,\nIrregular bones"),
]
prev_y = 9.42
for (ex, ey, etxt) in endo:
box(ax, ex, ey, 4.2, 0.65, etxt, "#689F38", "#33691E", fontsize=9)
arrow(ax, ex, prev_y, ex, ey + 0.33)
prev_y = ey - 0.33
# Ossification Centers section
box(ax, 6, 4.5, 8, 0.65, "OSSIFICATION CENTERS", "#F57F17", "#E65100",
fontsize=11, bold=True)
arrow(ax, 3, 5.57, 5, 4.83)
arrow(ax, 9, 5.57, 7, 4.83)
# Primary vs Secondary
box(ax, 3, 3.2, 4.8, 1.4,
"PRIMARY OSSIFICATION CENTER\n\n"
"• Appears before birth\n"
" (usually 8th week intrauterine)\n"
"• Forms the DIAPHYSIS",
"#E65100", "#BF360C", fontsize=9, bold=False)
box(ax, 9, 3.2, 4.8, 1.4,
"SECONDARY OSSIFICATION CENTER\n\n"
"• Appears after birth\n"
" (exceptions: lower femur,\n"
" upper tibia - appear before birth)\n"
"• Forms the EPIPHYSES",
"#0277BD", "#01579B", fontsize=9, bold=False)
arrow(ax, 6, 4.17, 3.5, 3.9)
arrow(ax, 6, 4.17, 8.5, 3.9)
# Bottom note
box(ax, 6, 1.5, 10, 0.85,
"Each ossification center = a point where osteoblasts on newly formed capillary loops\n"
"begin laying down lamellae (bone) in a centrifugal pattern",
"#37474F", "#263238", fontsize=9)
arrow(ax, 3, 2.5, 5, 1.78)
arrow(ax, 9, 2.5, 7, 1.78)
save(fig, "/home/daytona/workspace/blood-supply-flowcharts/chart3_ossification.png")
# ═══════════════════════════════════════════════════════════════════════════════
# CHART 4 – Parts of Young Bone (Epiphysis, Metaphysis, Diaphysis)
# ═══════════════════════════════════════════════════════════════════════════════
def chart4():
fig, ax = plt.subplots(figsize=(9, 8))
fig.patch.set_facecolor("#EDE7F6")
ax.set_facecolor("#EDE7F6")
ax.set_xlim(0, 10); ax.set_ylim(0, 10)
ax.axis("off")
ax.set_title("Parts of a Young (Growing) Bone", fontsize=15, fontweight="bold",
color="#4527A0", pad=12)
box(ax, 5, 9.3, 5.5, 0.65, "YOUNG BONE", "#4527A0", "#311B92",
fontsize=12, bold=True)
parts = [
(2, 7.7, "EPIPHYSIS", "#512DA8"),
(5.5, 7.7, "EPIPHYSEAL PLATE", "#7B1FA2"),
(8.5, 7.7, "METAPHYSIS", "#AD1457"),
]
diaphysis = (5, 6.3, "DIAPHYSIS", "#1565C0")
for (px, py, ptxt, pc) in parts:
box(ax, px, py, 2.6, 0.6, ptxt, pc, "#311B92", fontsize=9, bold=True)
arrow(ax, 5, 8.97, px, py + 0.3)
box(ax, diaphysis[0], diaphysis[1], 2.6, 0.6, diaphysis[2],
diaphysis[3], "#0D47A1", fontsize=9, bold=True)
arrow(ax, 5, 8.97, 5, 6.6)
# Epiphysis details
ep_details = [
"Ossify from secondary centres",
"Separated by epiphyseal plate\nduring growth",
"Spongy bone + thin compact\nouter layer",
"Blood supply: epiphyseal arteries\n(periarterial vascular arcades)",
]
prev_y = 7.4
for txt in ep_details:
ny = prev_y - 0.75
box(ax, 2, ny, 2.8, 0.6, txt, "#673AB7", "#4527A0", fontsize=8)
arrow(ax, 2, prev_y, 2, ny + 0.3)
prev_y = ny - 0.3
# Plate details
box(ax, 5.5, 6.6, 2.8, 0.6, "Growth cartilage zone\nbetween epiphysis & metaphysis",
"#8E24AA", "#6A1B9A", fontsize=8)
arrow(ax, 5.5, 7.4, 5.5, 6.9)
# Metaphysis details
me_details = [
"Flared part between plate\nand diaphysis",
"Rich blood supply",
"Metaphyseal arteries\nreinforce nutrient branches",
]
prev_y = 7.4
for txt in me_details:
ny = prev_y - 0.75
box(ax, 8.5, ny, 2.8, 0.6, txt, "#C2185B", "#880E4F", fontsize=8)
arrow(ax, 8.5, prev_y, 8.5, ny + 0.3)
prev_y = ny - 0.3
# Diaphysis details
di_details = [
"Shaft of the bone",
"Periosteum, Cortex,\nMedullary cavity",
"Nutrient artery\n(primary blood supply)",
"Inner 2/3 cortex supplied\nby nutrient artery branches",
]
prev_y = 6.0
for txt in di_details:
ny = prev_y - 0.72
box(ax, 5, ny, 3.0, 0.6, txt, "#1976D2", "#0D47A1", fontsize=8)
arrow(ax, 5, prev_y, 5, ny + 0.3)
prev_y = ny - 0.3
save(fig, "/home/daytona/workspace/blood-supply-flowcharts/chart4_young_bone.png")
if __name__ == "__main__":
chart1()
chart2()
chart3()
chart4()
print("All charts generated successfully!")
cd /home/daytona/workspace/blood-supply-flowcharts && python3 make_flowcharts.py 2>&1
cd /home/daytona/workspace/blood-supply-flowcharts && python3 -c " import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from PIL import Image charts = [ 'chart1_parts_of_long_bone.png', 'chart2_blood_supply.png', 'chart3_ossification.png', 'chart4_young_bone.png', ] with PdfPages('Blood_Supply_of_Bone_Flowcharts.pdf') as pdf: for chart in charts: img = Image.open(chart) fig, ax = plt.subplots(figsize=(img.width/150, img.height/150)) ax.imshow(img) ax.axis('off') fig.tight_layout(pad=0) pdf.savefig(fig, bbox_inches='tight') plt.close(fig) print('PDF saved successfully!') "
chart1 parts of long bone
Image · PNG
chart2 blood supply
Image · PNG
chart3 ossification
Image · PNG
chart4 young bone
Image · PNG
Blood Supply of Bone Flowcharts
PDF Document · PDF