flow chartbon powder classification
Create a flowchart diagram showing powder classification method for pharm d 1 st year student pharmacuetics ....flow chart
powder classification pharmacognosy pharmaceutics fineness sieve BP USP grades
https://pharmastate.academy/powder-fineness-and-sieves/
mkdir -p /home/daytona/workspace/powder-classification && ls /home/daytona/works…
~/powder-classification/flowchart.py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
fig, ax = plt.subplots(figsize=(20, 28))
ax.set_xlim(0, 20)
ax.set_ylim(0, 28)
ax.axis('off')
# ── colour palette ──────────────────────────────────────────────────────────
C_TITLE = "#1A237E" # dark navy
C_MAIN = "#283593" # main header
C_BASIS = "#1565C0" # basis boxes
C_COARSE = "#6A1B9A" # coarse
C_MOD = "#2E7D32" # moderately coarse
C_FINE = "#0277BD" # fine
C_VFINE = "#E65100" # very fine
C_SFINE = "#880E4F" # superfine
C_NOTE = "#37474F" # note / USP
C_ARROW = "#455A64"
C_BG = "#F5F5F5"
fig.patch.set_facecolor('#FAFAFA')
ax.set_facecolor('#FAFAFA')
# ── helpers ──────────────────────────────────────────────────────────────────
def rounded_box(ax, x, y, w, h, color, text, fontsize=10, textcolor='white',
radius=0.4, bold=False, multi=None):
box = FancyBboxPatch((x - w/2, y - h/2), w, h,
boxstyle=f"round,pad={radius}",
linewidth=1.5, edgecolor='white',
facecolor=color, zorder=3)
ax.add_patch(box)
fw = 'bold' if bold else 'normal'
if multi:
ax.text(x, y, multi, ha='center', va='center', fontsize=fontsize,
color=textcolor, fontweight=fw, multialignment='center', zorder=4,
linespacing=1.4)
else:
ax.text(x, y, text, ha='center', va='center', fontsize=fontsize,
color=textcolor, fontweight=fw, zorder=4)
def arrow(ax, x1, y1, x2, y2, color=C_ARROW, lw=2.0):
ax.annotate("", xy=(x2, y2), xytext=(x1, y1),
arrowprops=dict(arrowstyle="-|>", color=color,
lw=lw, mutation_scale=20),
zorder=2)
def diamond(ax, cx, cy, w, h, color, text, fontsize=9):
dx, dy = w/2, h/2
xs = [cx, cx+dx, cx, cx-dx, cx]
ys = [cy+dy, cy, cy-dy, cy, cy+dy]
ax.fill(xs, ys, color=color, zorder=3)
ax.plot(xs, ys, color='white', lw=1.5, zorder=4)
ax.text(cx, cy, text, ha='center', va='center', fontsize=fontsize,
color='white', fontweight='bold', zorder=5)
# ════════════════════════════════════════════════════════════════════
# TITLE
# ════════════════════════════════════════════════════════════════════
rounded_box(ax, 10, 27.2, 18, 0.9, C_TITLE,
"CLASSIFICATION OF PHARMACEUTICAL POWDERS",
fontsize=15, bold=True, radius=0.3)
ax.text(10, 26.55, "PharmD 1st Year | Pharmaceutics",
ha='center', va='center', fontsize=10, color=C_MAIN, style='italic')
# ════════════════════════════════════════════════════════════════════
# STARTING NODE
# ════════════════════════════════════════════════════════════════════
rounded_box(ax, 10, 25.8, 6, 0.65, C_MAIN,
"PHARMACEUTICAL POWDER", fontsize=12, bold=True, radius=0.4)
arrow(ax, 10, 25.47, 10, 24.85)
# ════════════════════════════════════════════════════════════════════
# BASIS DIAMOND
# ════════════════════════════════════════════════════════════════════
diamond(ax, 10, 24.35, 5, 0.9, C_BASIS, "BASIS OF CLASSIFICATION", fontsize=10)
# Three basis arrows
arrow(ax, 7.5, 24.35, 3.2, 23.2)
arrow(ax, 10, 23.9, 10, 23.2)
arrow(ax, 12.5, 24.35, 16.8, 23.2)
# ════════════════════════════════════════════════════════════════════
# THREE BASIS COLUMNS
# ════════════════════════════════════════════════════════════════════
# Labels
basis_labels = [
(3.2, 23.05, "1. PARTICLE SIZE\n(Fineness)"),
(10, 23.05, "2. ORIGIN /\nNATURE"),
(16.8, 23.05, "3. PHYSICAL /\nCHEMICAL PROPERTIES"),
]
for bx, by, bt in basis_labels:
rounded_box(ax, bx, by, 5.6, 0.75, C_BASIS,
"", fontsize=9, bold=True, multi=bt, radius=0.3)
# ════════════════════════════════════════════════════════════════════
# COLUMN 1 — PARTICLE SIZE (main column, centre-left)
# ════════════════════════════════════════════════════════════════════
arrow(ax, 3.2, 22.67, 3.2, 22.1)
rounded_box(ax, 3.2, 21.85, 5.8, 0.5, "#4527A0",
"PHARMACOPOEIAL STANDARDS (IP / BP / USP)",
fontsize=8.5, bold=True, radius=0.25)
arrow(ax, 3.2, 21.6, 3.2, 21.0)
# Five grades table — each as a row
grades = [
# (y, color, grade name, sieve, description)
(20.55, C_COARSE, "① COARSE POWDER", "2000/355 µm", "All particles pass #2000; ≤40% pass #355"),
(19.65, C_MOD, "② MODERATELY COARSE POWDER", "710/250 µm", "All particles pass #710; ≤40% pass #250"),
(18.75, C_FINE, "③ FINE POWDER", "355/180 µm", "All particles pass #355; ≤40% pass #180"),
(17.85, C_VFINE, "④ VERY FINE POWDER", "180/125 µm", "All particles pass #180; ≤40% pass #125"),
(16.95, C_SFINE, "⑤ SUPERFINE (Extra Fine) POWDER", "125/90 µm", "All particles pass #125; ≤40% pass #90"),
]
# Arrow into first grade
arrow(ax, 3.2, 21.0, 3.2, 20.82)
for i, (gy, gc, gname, gsieve, gdesc) in enumerate(grades):
# Grade name box (left)
rounded_box(ax, 1.6, gy, 2.8, 0.65, gc,
gname, fontsize=8, bold=True, radius=0.2)
# Sieve box (middle)
rounded_box(ax, 4.2, gy, 2.0, 0.65, gc,
f"Sieve:\n{gsieve}", fontsize=7.5, radius=0.2)
# Description box (right side)
rounded_box(ax, 7.2, gy, 3.2, 0.65, gc,
gdesc, fontsize=7, radius=0.2)
# Connect arrow between grade boxes
ax.annotate("", xy=(3.15, gy), xytext=(2.5, gy),
arrowprops=dict(arrowstyle="-|>", color='white', lw=1.2,
mutation_scale=12), zorder=5)
ax.annotate("", xy=(5.1, gy), xytext=(4.6, gy),
arrowprops=dict(arrowstyle="-|>", color='white', lw=1.2,
mutation_scale=12), zorder=5)
# Arrow down to next grade
if i < len(grades) - 1:
arrow(ax, 3.2, gy - 0.33, 3.2, gy - 0.57)
# USP note box
rounded_box(ax, 3.2, 15.8, 6.2, 0.6, C_NOTE,
"USP: Coarse / Moderately Fine / Fine / Very Fine / Extremely Fine",
fontsize=7.5, radius=0.2)
arrow(ax, 3.2, 16.62, 3.2, 16.1)
# ════════════════════════════════════════════════════════════════════
# COLUMN 2 — ORIGIN / NATURE (centre)
# ════════════════════════════════════════════════════════════════════
arrow(ax, 10, 22.67, 10, 22.1)
origin_items = [
(21.75, "#00695C", "VEGETABLE\nPOWDERS", "Eg: Ginger, Cinnamon,\nDigitalis, Senna"),
(20.6, "#00838F", "ANIMAL\nPOWDERS", "Eg: Dried Thyroid,\nPancreatin"),
(19.45, "#1565C0", "MINERAL\nPOWDERS", "Eg: Talc, Kaolin,\nCalamine"),
(18.3, "#37474F", "SYNTHETIC /\nCHEMICAL","Eg: Aspirin, Sulpha\ndrugs, Starch"),
]
rounded_box(ax, 10, 22.0, 4.0, 0.35, "#004D40",
"BY ORIGIN", fontsize=8.5, bold=True, radius=0.2)
arrow(ax, 10, 21.82, 10, 21.57)
for i, (oy, oc, oname, oeg) in enumerate(origin_items):
rounded_box(ax, 9.1, oy, 2.5, 0.75, oc,
oname, fontsize=8, bold=True, radius=0.2)
rounded_box(ax, 12.0, oy, 3.2, 0.75, oc,
oeg, fontsize=7.5, radius=0.2)
ax.annotate("", xy=(10.35, oy), xytext=(9.9, oy),
arrowprops=dict(arrowstyle="-|>", color='white', lw=1.0,
mutation_scale=10), zorder=5)
if i < len(origin_items)-1:
arrow(ax, 9.1, oy-0.38, 9.1, oy-0.55)
# ════════════════════════════════════════════════════════════════════
# COLUMN 3 — PHYSICAL / CHEMICAL PROPERTIES (right)
# ════════════════════════════════════════════════════════════════════
arrow(ax, 16.8, 22.67, 16.8, 22.1)
prop_items = [
(21.75, "#B71C1C", "SIMPLE\nPOWDERS", "Single active ingredient\nEg: Aspirin powder"),
(20.6, "#C62828", "COMPOUND\nPOWDERS", "Mix of 2+ ingredients\nEg: Compound Chalk Powder"),
(19.45, "#AD1457", "DUSTING\nPOWDERS", "Applied externally to skin\nEg: Talc, Zinc Oxide"),
(18.3, "#6A1B9A", "EFFERVESCENT\nPOWDERS","Contain acid + carbonate\nEg: Seidlitz Powder"),
(17.15, "#283593", "DENTIFRICE\nPOWDERS", "Used for oral hygiene\nEg: Tooth Powder"),
(16.0, "#00695C", "DOUCHE\nPOWDERS", "Dissolved before use\nEg: Vaginal douche"),
]
rounded_box(ax, 16.8, 22.0, 4.6, 0.35, "#B71C1C",
"BY USE / FORMULATION", fontsize=8.5, bold=True, radius=0.2)
arrow(ax, 16.8, 21.82, 16.8, 21.57)
for i, (py, pc, pname, peg) in enumerate(prop_items):
rounded_box(ax, 15.7, py, 2.5, 0.75, pc,
pname, fontsize=8, bold=True, radius=0.2)
rounded_box(ax, 18.8, py, 3.5, 0.75, pc,
peg, fontsize=7.5, radius=0.2)
ax.annotate("", xy=(16.95, py), xytext=(16.45, py),
arrowprops=dict(arrowstyle="-|>", color='white', lw=1.0,
mutation_scale=10), zorder=5)
if i < len(prop_items)-1:
arrow(ax, 15.7, py-0.38, 15.7, py-0.55)
# ════════════════════════════════════════════════════════════════════
# ADVANTAGES BOX (bottom)
# ════════════════════════════════════════════════════════════════════
rounded_box(ax, 10, 14.7, 18, 1.1, C_NOTE,
"",
fontsize=9, radius=0.3,
multi=(
"KEY POINTS ▸ Sieves are numbered by nominal aperture size in µm "
"▸ Finer powder = greater surface area = better dissolution\n"
"▸ IP / BP use 5 grades (Coarse → Superfine) "
"▸ Powders assessed by % passing through two sieves"
))
# ════════════════════════════════════════════════════════════════════
# FOOTER
# ════════════════════════════════════════════════════════════════════
ax.text(10, 14.05, "PharmD 1st Year · Pharmaceutics · Powder Classification · IP / BP / USP Standards",
ha='center', va='center', fontsize=8, color='#78909C', style='italic')
plt.tight_layout(pad=0.5)
plt.savefig("/home/daytona/workspace/powder-classification/powder_classification_flowchart.png",
dpi=180, bbox_inches='tight', facecolor='#FAFAFA')
print("Saved!")
Create a PowerPoint presentation on powder classification for easy studying