Alkaline phosphatase 10 marks pg answer
| Source | Heat/Urea Inhibition | L-Phenylalanine Inhibition | Anodal Mobility |
|---|---|---|---|
| Biliary (Liver) | + (50%) | - | 1 (fastest) |
| Bone | +++ (90%) | - | 2 |
| Placental | - (0%) | +++ | 3 |
| Intestinal | + | +++ | 4 |
| Condition | Mechanism |
|---|---|
| Obstructive jaundice (choledocholithiasis, cholangiocarcinoma) | Bile duct obstruction - bile acid-induced synthesis |
| Primary biliary cholangitis (PBC) | Antimitochondrial antibody-positive; intrahepatic cholestasis |
| Primary sclerosing cholangitis (PSC) | Associated with IBD |
| Drug-induced cholestasis | e.g., chlorpromazine, oral contraceptives |
| Hepatic infiltration / metastases | ALP is the most sensitive marker of hepatic metastases among liver enzymes |
| Granulomatous disease (sarcoidosis, TB) | Infiltrative hepatic involvement |
| Sepsis, amyloidosis, Langerhans cell histiocytosis | Rare infiltrative causes |
| Condition | Notes |
|---|---|
| Paget disease | Most common cause of markedly elevated bone ALP in adults |
| Healing fractures | Transient elevation |
| Rickets / Osteomalacia | Compensatory osteoblastic activity |
| Hyperparathyroidism (primary/secondary) | Increased bone turnover |
| Osteogenic sarcoma / Bone metastases | |
| Acromegaly | Increased bone turnover |
| Physiologic (growth spurts, pregnancy) |
| Condition | Mechanism |
|---|---|
| Hypophosphatasia | Inborn deficiency of ALP gene (ALPL) - leads to rickets-like bone disease |
| Malnutrition / Zinc deficiency | ALP requires zinc as cofactor |
| Wilson disease | Copper displaces zinc from the enzyme; classic in acute liver failure with hemolysis |
| Hypothyroidism | Reduced bone turnover |
| Pernicious anemia | |
| Cardiac surgery with bypass (transient) | |
| Hemolysis | Falsely lowers ALP in vitro |
| Estrogen therapy, theophylline | Drug-related |

| Test | Hepatic ALP | Bone ALP |
|---|---|---|
| GGT | Elevated | Normal |
| 5'-Nucleotidase | Elevated | Normal |
| Heat stability | 50% inactivated | 90% inactivated |
| ALP elevated | ALP decreased |
|---|---|
| Obstructive jaundice | Hypophosphatasia |
| PBC / PSC | Wilson disease (ALF) |
| Hepatic metastases | Malnutrition / Zinc deficiency |
| Paget disease | Hypothyroidism |
| Healing fractures | Hemolysis (artifactual) |
| Rickets / Osteomalacia | Estrogen therapy |
| Pregnancy (placental) | |
| Malignancy (Regan isoenzyme) |
Generate answer in Orthopaedic Post graduate exam point of view
Key concept: Bone ALP = marker of osteoblast number and activity = marker of BONE FORMATION (not resorption)
| Marker Type | Test | Correlates With |
|---|---|---|
| Bone Formation | Total ALP | Osteoblast numbers, liver/kidney disease |
| Bone Formation | Bone-specific ALP (BALP) | Osteoblast numbers (more specific) |
| Bone Formation | Osteocalcin | Osteoblast numbers |
| Bone Formation | PINP, PICP | Type I collagen synthesis |
| Bone Resorption | CTX, NTX | Bone collagen degradation |
| Bone Resorption | TRAP | Osteoclast numbers |
| Bone Resorption | Deoxypyridinoline | Bone collagen degradation |
| Disorder | Serum Calcium | Serum Phosphorus | Serum ALP | Urine |
|---|---|---|---|---|
| Osteoporosis | Normal | Normal | Normal | Normal Ca |
| Osteomalacia / Rickets | Low/Normal | Low | HIGH | Low Ca |
| Hyperparathyroidism | Normal-High | Normal-Low | Normal-High | High Ca |
| Renal Osteodystrophy | Low | High | High | - |
| Paget Disease | Normal | Normal | Very HIGH | ↑Hydroxyproline |
| Multiple Myeloma | Normal | Normal | Normal | Bence-Jones protein |

| Condition | Treatment | ALP Response |
|---|---|---|
| Paget disease | Bisphosphonates (zoledronate) | Normalization = adequate disease control |
| Rickets/Osteomalacia | Vitamin D + Calcium | ALP falls as mineralization improves |
| Hyperparathyroidism | Parathyroidectomy | ALP may transiently rise (hungry bone syndrome), then normalize |
| Renal osteodystrophy | Dialysis, phosphate binders, Vit D | Bone ALP used to guide therapy |
| Osteosarcoma | Neoadjuvant chemotherapy | Normalization = good histological response |
Create pdf
ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace/alp-ortho
mkdir -p /home/daytona/workspace/alp-ortho && ls /home/daytona/workspace/alp-ortho
~/alp-ortho/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, HRFlowable, KeepTogether)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
OUTPUT = "/home/daytona/workspace/alp-ortho/Alkaline_Phosphatase_Ortho_PG.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm,
topMargin=2*cm, bottomMargin=2*cm,
title="Alkaline Phosphatase - Orthopaedic PG Answer",
author="Orris Medical AI"
)
# ── Colour palette ───────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1B3A6B")
TEAL = colors.HexColor("#0D7377")
GOLD = colors.HexColor("#F5A623")
LGREY = colors.HexColor("#F4F6FA")
MGREY = colors.HexColor("#DDE3ED")
WHITE = colors.white
RED = colors.HexColor("#C0392B")
GREEN = colors.HexColor("#1A6B3C")
styles = getSampleStyleSheet()
# ── Custom paragraph styles ──────────────────────────────────────────────────
title_style = ParagraphStyle("Title2",
fontSize=18, fontName="Helvetica-Bold",
textColor=WHITE, alignment=TA_CENTER,
spaceAfter=4, leading=22)
subtitle_style = ParagraphStyle("Subtitle",
fontSize=11, fontName="Helvetica",
textColor=MGREY, alignment=TA_CENTER,
spaceAfter=2)
h1 = ParagraphStyle("H1",
fontSize=13, fontName="Helvetica-Bold",
textColor=WHITE, backColor=NAVY,
spaceBefore=14, spaceAfter=6,
leftIndent=-0.3*cm, rightIndent=-0.3*cm,
leading=18, borderPadding=(5,8,5,8))
h2 = ParagraphStyle("H2",
fontSize=11, fontName="Helvetica-Bold",
textColor=NAVY, spaceBefore=10, spaceAfter=4,
leading=14, borderPadding=(2,0,2,0))
h3 = ParagraphStyle("H3",
fontSize=10, fontName="Helvetica-BoldOblique",
textColor=TEAL, spaceBefore=7, spaceAfter=3, leading=13)
body = ParagraphStyle("Body",
fontSize=9.5, fontName="Helvetica",
textColor=colors.HexColor("#2C2C2C"),
spaceBefore=2, spaceAfter=3,
leading=14, alignment=TA_JUSTIFY)
bullet = ParagraphStyle("Bullet",
fontSize=9.5, fontName="Helvetica",
textColor=colors.HexColor("#2C2C2C"),
spaceBefore=1, spaceAfter=1,
leftIndent=14, leading=13,
bulletIndent=4)
keybox = ParagraphStyle("KeyBox",
fontSize=9.5, fontName="Helvetica-Bold",
textColor=NAVY, backColor=colors.HexColor("#EBF3FB"),
borderColor=TEAL, borderWidth=1,
spaceBefore=6, spaceAfter=6,
leftIndent=6, rightIndent=6,
borderPadding=(5,8,5,8), leading=14)
note = ParagraphStyle("Note",
fontSize=8.5, fontName="Helvetica-Oblique",
textColor=colors.HexColor("#555555"),
spaceBefore=2, spaceAfter=4, leading=12)
# ── Table helpers ────────────────────────────────────────────────────────────
def th(txt):
return Paragraph(f"<b>{txt}</b>", ParagraphStyle("TH",
fontSize=8.5, fontName="Helvetica-Bold",
textColor=WHITE, alignment=TA_CENTER, leading=11))
def td(txt, bold=False, color=None, align=TA_LEFT):
fn = "Helvetica-Bold" if bold else "Helvetica"
tc = color or colors.HexColor("#2C2C2C")
return Paragraph(txt, ParagraphStyle("TD",
fontSize=8.5, fontName=fn, textColor=tc,
alignment=align, leading=11))
def make_table(headers, rows, col_widths, alt_color=LGREY):
data = [[th(h) for h in headers]]
for i, row in enumerate(rows):
bg = alt_color if i % 2 == 0 else WHITE
data.append([td(c) for c in row])
t = Table(data, colWidths=col_widths, repeatRows=1)
style_cmds = [
("BACKGROUND", (0,0), (-1,0), NAVY),
("ROWBACKGROUNDS", (0,1), (-1,-1), [alt_color, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBBBBB")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 5),
("RIGHTPADDING", (0,0), (-1,-1), 5),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("ROWBACKGROUNDS", (0,0), (-1,0), [NAVY]),
]
t.setStyle(TableStyle(style_cmds))
return t
# ── Build story ──────────────────────────────────────────────────────────────
story = []
W = A4[0] - 4*cm # usable width
# ── HEADER BANNER ────────────────────────────────────────────────────────────
banner_data = [[Paragraph(
"<font color='white'><b>ALKALINE PHOSPHATASE (ALP)</b></font><br/>"
"<font color='#DDE3ED' size='11'>Orthopaedic Postgraduate Examination Answer | 10 Marks</font>",
ParagraphStyle("Banner", fontSize=18, fontName="Helvetica-Bold",
textColor=WHITE, alignment=TA_CENTER, leading=26))]]
banner = Table(banner_data, colWidths=[W])
banner.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 14),
("BOTTOMPADDING", (0,0), (-1,-1), 14),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
("ROUNDEDCORNERS", [6]),
]))
story.append(banner)
story.append(Spacer(1, 10))
# ── 1. Introduction ──────────────────────────────────────────────────────────
story.append(Paragraph("1. Introduction", h1))
story.append(Paragraph(
"Alkaline phosphatase (ALP) is a <b>zinc-dependent membrane-bound ectoenzyme</b> that hydrolyzes "
"phosphate monoesters under alkaline conditions (optimum pH ~9). It is attached to cell membranes "
"via a glycosylphosphatidylinositol (GPI) anchor. From an orthopaedic perspective, "
"<b>bone ALP (tissue-nonspecific ALP, TNSALP)</b> is the most clinically relevant isoenzyme, "
"produced by osteoblasts during active bone formation and mineralization.", body))
story.append(Spacer(1, 4))
ref_data = [
[td("Normal adult serum ALP", bold=True), td("30-120 IU/L (lab-dependent)")],
[td("Half-life (bone ALP)", bold=True), td("~40-48 hours")],
[td("Half-life (total serum ALP)", bold=True), td("~7 days")],
[td("Gene (bone/liver/kidney ALP)", bold=True), td("ALPL gene, chromosome 1")],
[td("Measurement method", bold=True), td("Colorimetric: p-nitrophenol formation at 410 nm")],
]
ref_t = Table(ref_data, colWidths=[7*cm, 9.5*cm])
ref_t.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0), (-1,-1), [LGREY, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, MGREY),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
]))
story.append(ref_t)
# ── 2. Biochemical Role in Bone ──────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("2. Biochemical Role in Bone Mineralization", h1))
story.append(Paragraph(
"Bone ALP is produced by osteoblasts during the <b>matrix maturation phase</b>. "
"Matrix vesicles budding from osteoblasts are markedly enriched in bone ALP. "
"Its primary function is:", body))
story.append(Paragraph(
"Hydrolyzes inorganic <b>pyrophosphate (PPi) → inorganic phosphate (Pi)</b>", bullet))
story.append(Paragraph(
"PPi is a potent inhibitor of hydroxyapatite crystal formation - bone ALP destroys this inhibition", bullet))
story.append(Paragraph(
"Promotes <b>hydroxyapatite deposition</b> in the osteoid matrix", bullet))
story.append(Paragraph(
"Also cleaves pyridoxal-5'-phosphate (PLP) and phosphoethanolamine (PEA) - substrates that accumulate in hypophosphatasia", bullet))
story.append(Spacer(1, 4))
key_data = [[Paragraph(
"<b>Key Concept:</b> Bone ALP = Marker of OSTEOBLAST number and activity = Marker of BONE FORMATION (not resorption). "
"It rises whenever osteoblasts are stimulated, regardless of whether mineralization is adequate.",
ParagraphStyle("Key2", fontSize=9.5, fontName="Helvetica",
textColor=NAVY, leading=14))]]
key_t = Table(key_data, colWidths=[W])
key_t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#EBF3FB")),
("BOX", (0,0), (-1,-1), 1.5, TEAL),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING", (0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
story.append(key_t)
# ── 3. Bone Turnover Markers ─────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("3. ALP as a Bone Turnover Marker", h1))
story.append(Paragraph(
"In orthopaedics, bone turnover markers are classified into formation and resorption markers:", body))
story.append(Spacer(1, 4))
bm_headers = ["Type", "Marker", "Reflects"]
bm_rows = [
["Bone Formation", "Total ALP", "Osteoblast numbers + liver/kidney disease"],
["Bone Formation", "Bone-specific ALP (BALP)", "Osteoblast numbers (more specific)"],
["Bone Formation", "Osteocalcin (OC)", "Osteoblast numbers"],
["Bone Formation", "PINP / PICP", "Type I collagen synthesis rate"],
["Bone Resorption", "CTX / NTX (telopeptides)", "Bone collagen degradation"],
["Bone Resorption", "TRAP (tartrate-resistant acid phosphatase)", "Osteoclast numbers"],
["Bone Resorption", "Deoxypyridinoline", "Bone collagen cross-link degradation"],
]
story.append(make_table(bm_headers, bm_rows, [4*cm, 6*cm, 6.5*cm]))
story.append(Paragraph(
"Source: Rockwood and Green's Fractures in Adults, 10th ed. (2025), Table 4-2", note))
# ── 4. Lab Profile Table ─────────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("4. Metabolic Bone Disease - Lab Profile (Most Exam-Critical Table)", h1))
lp_headers = ["Disorder", "Serum Ca", "Serum PO4", "ALP", "Urine / Other"]
lp_rows = [
["Osteoporosis", "Normal", "Normal", "Normal", "Normal Ca"],
["Osteomalacia / Rickets", "Low/Normal", "Low", "HIGH", "Low Ca, low PO4"],
["Hyperparathyroidism", "Normal-High", "Normal-Low", "Normal-High", "High Ca, high PTH"],
["Renal Osteodystrophy", "Low", "High", "High", "High PO4, raised PTH"],
["Paget Disease", "Normal", "Normal", "VERY HIGH", "Urine hydroxyproline raised"],
["Multiple Myeloma", "High", "Normal", "NORMAL", "Bence-Jones protein"],
["Hypophosphatasia", "Normal", "Normal", "LOW", "Urine PEA raised (diagnostic)"],
]
story.append(make_table(lp_headers, lp_rows, [4.2*cm, 2.4*cm, 2.4*cm, 2.4*cm, 5*cm]))
story.append(Paragraph(
"Source: Rockwood and Green's Fractures in Adults, 10th ed. (2025), Table 25-5; "
"Miller's Review of Orthopaedics, 9th ed.", note))
# ── 5. Disease-Specific ───────────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("5. Disease-Specific Orthopaedic Relevance", h1))
# Paget
story.append(Paragraph("A. Paget Disease of Bone [HIGHEST YIELD]", h2))
paget_pts = [
"<b>ALP is the single most sensitive and specific marker</b> for diagnosis and monitoring of Paget disease",
"Reflects markedly increased <b>osteoblastic bone formation</b> in Paget's",
"Extent of ALP elevation correlates with skeletal involvement (highest when skull involved)",
"Currently ALP is <b>2-4x ULN</b> at diagnosis (previously 10x ULN; milder phenotype now observed)",
"<b>Bone-specific ALP is more sensitive than total ALP</b> in mild/monostotic Paget disease",
"ALP + urine <b>pyridinium cross-links</b> used together to monitor disease activity",
"With bisphosphonate treatment (zoledronate 5 mg IV single dose), ALP normalizes - confirms response",
"Serum and urine calcium usually normal; may rise with immobilization (e.g., post-fracture)",
"Complication: ~<b>1% develop secondary osteosarcoma</b> (higher risk in polyostotic disease)",
]
for p in paget_pts:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("B. Rickets and Osteomalacia", h2))
for p in [
"Elevated ALP with <b>low calcium and low phosphorus</b> is the classic triad",
"In severe osteomalacia, bone ALP may be <b>markedly raised without increased mineralization</b> (mineralizing defect - osteoid accumulates)",
"<b>Familial hypophosphatemic rickets</b> (X-linked dominant, FGF23 mutation): low phosphorus, normal Ca, <b>high ALP</b>",
"Treatment of X-linked hypophosphatemic rickets: <b>Burosumab</b> (anti-FGF23 monoclonal antibody) - first-line",
]:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("C. Hyperparathyroidism / Brown Tumors", h2))
for p in [
"Diagnosis established by: <b>serum Ca, PO4, ALP, and PTH levels</b> - NOT by histology alone",
"High Ca, low PO4, elevated ALP, high PTH = primary hyperparathyroidism",
"Brown tumor mimics giant cell tumor histologically; differentiated by biochemistry",
"Orthopaedic management: treating actual or impending <b>pathologic fractures</b>",
]:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("D. Renal Osteodystrophy", h2))
for p in [
"Low calcium, high phosphorus, elevated ALP (secondary hyperparathyroidism effect on osteoblasts)",
"<b>Bone-specific ALP is preferred over osteocalcin in renal failure</b> - not cleared by glomerular filtration",
"ALP may be misleading in patients on calcitriol (1,25(OH)2D regulates bone ALP synthesis)",
]:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("E. Bone Metastases", h2))
for p in [
"ALP elevated in <b>osteoblastic metastases</b> (e.g., prostate cancer) due to reactive osteoblast stimulation",
"May be normal in purely osteolytic lesions (e.g., <b>multiple myeloma - ALP classically normal</b>)",
"ALP is also the <b>most sensitive marker of hepatic metastases</b> among all liver enzymes",
]:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("F. Osteosarcoma", h2))
for p in [
"ALP <b>may be elevated</b> reflecting osteoblastic tumor matrix production",
"<b>Elevated pre-treatment ALP = poor prognosis</b> in osteosarcoma",
"Post-neoadjuvant chemotherapy normalization of ALP = good histological response",
"Not a specific tumor marker but useful prognostic indicator",
]:
story.append(Paragraph(f"• {p}", bullet))
story.append(Spacer(1, 5))
story.append(Paragraph("G. Fracture Healing", h2))
for p in [
"ALP rises transiently during fracture healing, reflecting osteoblastic callus formation",
"Peaks at ~2-3 weeks post-fracture; returns to baseline on consolidation",
"Persistent elevation beyond expected timeline suggests <b>non-union</b> or underlying metabolic bone disease",
]:
story.append(Paragraph(f"• {p}", bullet))
# ── 6. Hypophosphatasia ───────────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("6. Hypophosphatasia - LOW ALP (Critical Orthopaedic Condition)", h1))
hypo_data = [
[td("Inheritance", bold=True), td("Autosomal recessive (AR)")],
[td("Gene defect", bold=True), td("Loss-of-function mutation in ALPL gene (TNSALP)")],
[td("Mechanism", bold=True), td("Cannot break down PPi → PPi accumulates → inhibits hydroxyapatite formation → poor mineralization")],
[td("Clinical features", bold=True), td("Rickets-like bone deformity, pathological fractures, premature tooth loss, bone pain")],
[td("Diagnostic marker", bold=True), td("Elevated urinary phosphoethanolamine (PEA) - PATHOGNOMONIC; elevated plasma PLP")],
[td("Treatment", bold=True), td("Asfotase alfa (recombinant TNSALP enzyme replacement therapy) - approved")],
[td("IMPORTANT", bold=True), td("Bisphosphonates are CONTRAINDICATED - they further inhibit mineralization")],
]
hypo_t = Table(hypo_data, colWidths=[4.5*cm, 12*cm])
hypo_t.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0), (-1,-1), [LGREY, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, MGREY),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("BACKGROUND", (0,6), (-1,6), colors.HexColor("#FDECEA")),
("TEXTCOLOR", (0,6), (-1,6), RED),
("FONTNAME", (0,6), (-1,6), "Helvetica-Bold"),
]))
story.append(hypo_t)
story.append(Paragraph(
"Source: Miller's Review of Orthopaedics, 9th ed.; Tietz Textbook of Laboratory Medicine, 7th ed.", note))
# ── 7. Monitoring Treatment ──────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(Paragraph("7. Monitoring Treatment with ALP", h1))
mon_headers = ["Condition", "Treatment", "ALP Response / Significance"]
mon_rows = [
["Paget disease", "Bisphosphonates (zoledronate IV)", "Normalization = adequate disease control"],
["Rickets / Osteomalacia", "Vitamin D + Calcium", "ALP falls as mineralization improves"],
["Hyperparathyroidism", "Parathyroidectomy", "Transient rise (hungry bone syndrome), then normalization"],
["Renal osteodystrophy", "Dialysis, phosphate binders, Vit D", "Bone ALP guides therapy"],
["Osteosarcoma", "Neoadjuvant chemotherapy", "Normalization = good histological response"],
["Osteoporosis treatment", "Bisphosphonate / teriparatide", "ALP less sensitive than PINP for acute response"],
]
story.append(make_table(mon_headers, mon_rows, [4.5*cm, 5*cm, 7*cm]))
# ── 8. High Yield Summary ─────────────────────────────────────────────────────
story.append(Spacer(1, 10))
story.append(Paragraph("8. High-Yield Exam Points Summary", h1))
hi_data = [
["1", "Bone ALP = osteoblast marker = bone FORMATION marker (not resorption)"],
["2", "Paget disease = highest ALP elevation of all metabolic bone diseases"],
["3", "Multiple myeloma = NORMAL ALP despite widespread bone destruction (osteolytic, no osteoblastic reaction)"],
["4", "Hypophosphatasia = LOW ALP + rickets-like picture. Bisphosphonates CONTRAINDICATED"],
["5", "Wilson disease = LOW ALP + jaundice + Coombs-negative hemolysis (copper displaces zinc cofactor)"],
["6", "Bone-specific ALP preferred in renal failure (not filtered by kidney, unlike osteocalcin)"],
["7", "Bisphosphonate treatment response in Paget's monitored by serial ALP levels"],
["8", "Elevated pre-treatment ALP in osteosarcoma = poor prognosis"],
["9", "Hungry bone syndrome post-parathyroidectomy: ALP transiently spikes (osteoblasts become hyperactive)"],
["10", "Physiologic elevation: ALP is 2x adult levels in growing children and third-trimester pregnancy (normal)"],
]
hi_t = Table(
[[td(r[0], bold=True, color=WHITE, align=TA_CENTER), td(r[1])] for r in hi_data],
colWidths=[1*cm, 15.5*cm]
)
hi_t.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0), (-1,-1), [colors.HexColor("#1B3A6B"), colors.HexColor("#2A4F8A")]),
("TEXTCOLOR", (0,0), (0,-1), WHITE),
("TEXTCOLOR", (1,0), (1,-1), WHITE),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#3A5FA0")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 7),
("RIGHTPADDING", (0,0), (-1,-1), 7),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("FONTNAME", (0,0), (0,-1), "Helvetica-Bold"),
]))
story.append(hi_t)
# ── 9. Isoenzymes Table ───────────────────────────────────────────────────────
story.append(Spacer(1, 10))
story.append(Paragraph("9. ALP Isoenzymes - Heat Stability (For Completeness)", h1))
iso_headers = ["Source", "Heat/Urea Inhibition", "L-Phenylalanine Inhibition", "Anodal Mobility"]
iso_rows = [
["Biliary (Liver)", "+ (50%)", "-", "1 (fastest)"],
["Bone", "+++ (90% - 'bone burns')", "-", "2"],
["Placental", "- (0%, heat stable)", "+++", "3"],
["Intestinal", "+", "+++", "4"],
]
story.append(make_table(iso_headers, iso_rows, [3.5*cm, 5*cm, 5*cm, 3*cm]))
story.append(Paragraph(
"GGT / 5'-nucleotidase: if elevated alongside ALP = hepatobiliary source; "
"if normal = bone or other non-hepatic source. Isoenzyme fractionation has largely "
"been replaced by GGT and 5'-NT in clinical practice.",
ParagraphStyle("Note2", fontSize=9, fontName="Helvetica-Oblique",
textColor=colors.HexColor("#555"), leading=12, spaceBefore=4)))
# ── Sources ───────────────────────────────────────────────────────────────────
story.append(Spacer(1, 10))
story.append(HRFlowable(width=W, thickness=1, color=MGREY))
story.append(Spacer(1, 4))
story.append(Paragraph("<b>References</b>", ParagraphStyle("RefH",
fontSize=9, fontName="Helvetica-Bold", textColor=NAVY, spaceBefore=2)))
refs = [
"Rockwood and Green's Fractures in Adults, 10th ed. (2025) - Bone turnover markers; metabolic bone disease lab values",
"Campbell's Operative Orthopaedics, 15th ed. (2026) - Paget disease management and ALP monitoring",
"Miller's Review of Orthopaedics, 9th ed. - Metabolic bone disease; hypophosphatasia",
"Tietz Textbook of Laboratory Medicine, 7th ed. - Bone ALP biochemistry and role in mineralization",
"Firestein & Kelley's Textbook of Rheumatology - Bone turnover markers; Paget disease treatment",
"Goldman-Cecil Medicine, International ed. - Approach to elevated ALP",
"Quick Compendium of Clinical Pathology, 5th ed. - Isoenzyme characteristics",
]
for r in refs:
story.append(Paragraph(f"• {r}", ParagraphStyle("Ref",
fontSize=8.5, fontName="Helvetica", textColor=colors.HexColor("#444"),
leftIndent=10, spaceBefore=1, leading=12)))
# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
cd /home/daytona/workspace/alp-ortho && python generate_pdf.py 2>&1
ls -lh /home/daytona/workspace/alp-ortho/Alkaline_Phosphatase_Ortho_PG.pdf
Alkaline Phosphatase Ortho PG
PDF Document · PDF
| Section | Content |
|---|---|
| 1 | Introduction - biochemistry, normal values, gene |
| 2 | Role in bone mineralization (PPi → Pi pathway) |
| 3 | ALP as a bone turnover marker - full classification table |
| 4 | Metabolic bone disease lab profile table (Ca / PO4 / ALP) - most exam-critical |
| 5 | Disease-specific sections: Paget, Rickets, HPT, Renal osteodystrophy, Metastases, Osteosarcoma, Fracture healing |
| 6 | Hypophosphatasia - low ALP, contraindication of bisphosphonates |
| 7 | Monitoring treatment with ALP |
| 8 | 10 High-Yield exam points (highlighted table) |
| 9 | Isoenzymes heat stability table |
Unable to download pdf gile
ls -lh /home/daytona/workspace/alp-ortho/ && file /home/daytona/workspace/alp-ortho/Alkaline_Phosphatase_Ortho_PG.pdf
cp /home/daytona/workspace/alp-ortho/Alkaline_Phosphatase_Ortho_PG.pdf /home/daytona/workspace/ALP_Ortho_PG.pdf && ls -lh /home/daytona/workspace/ALP_Ortho_PG.pdf
ALP Ortho PG
PDF Document · PDF
/home/daytona/workspace/alp-ortho/Alkaline_Phosphatase_Ortho_PG.pdfCreate a Word document (.docx) instead
~/alp-ortho/generate_docx.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, WidthType, BorderStyle, ShadingType,
VerticalAlign, Header, Footer, PageNumber, NumberFormat,
UnderlineType, PageBreak
} = require('docx');
const fs = require('fs');
// ── Colour constants ─────────────────────────────────────────────────────────
const NAVY = "1B3A6B";
const TEAL = "0D7377";
const GOLD = "F5A623";
const LGREY = "EEF2F8";
const MGREY = "DDE3ED";
const WHITE = "FFFFFF";
const RED = "C0392B";
const DKTEXT = "1A1A2E";
// ── Helpers ──────────────────────────────────────────────────────────────────
function noBorder() {
return { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
}
function thinBorder() {
return { style: BorderStyle.SINGLE, size: 4, color: MGREY };
}
function heading1(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, color: WHITE, size: 24, font: "Calibri" })],
heading: HeadingLevel.HEADING_1,
shading: { type: ShadingType.SOLID, color: NAVY, fill: NAVY },
spacing: { before: 240, after: 100 },
indent: { left: 0 },
});
}
function heading2(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, color: NAVY, size: 22, font: "Calibri" })],
heading: HeadingLevel.HEADING_2,
spacing: { before: 180, after: 60 },
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: TEAL } }
});
}
function heading3(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, italics: true, color: TEAL, size: 20, font: "Calibri" })],
spacing: { before: 140, after: 40 },
});
}
function body(text, opts = {}) {
return new Paragraph({
children: [new TextRun({
text,
size: 20,
font: "Calibri",
color: DKTEXT,
bold: opts.bold || false,
italics: opts.italic || false,
})],
spacing: { before: 40, after: 40 },
alignment: opts.center ? AlignmentType.CENTER : AlignmentType.JUSTIFIED,
});
}
function bullet(runs) {
// runs = array of {text, bold?, color?}
const children = runs.map(r => new TextRun({
text: r.text,
size: 20,
font: "Calibri",
color: r.color || DKTEXT,
bold: r.bold || false,
italics: r.italic || false,
}));
return new Paragraph({
children,
bullet: { level: 0 },
spacing: { before: 30, after: 30 },
indent: { left: 360, hanging: 260 },
});
}
function note(text) {
return new Paragraph({
children: [new TextRun({ text, size: 17, font: "Calibri", italics: true, color: "666666" })],
spacing: { before: 20, after: 30 },
});
}
function spacer() {
return new Paragraph({ children: [new TextRun({ text: "" })], spacing: { before: 60, after: 60 } });
}
function keyBox(text) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.SINGLE, size: 12, color: TEAL },
bottom: { style: BorderStyle.SINGLE, size: 12, color: TEAL },
left: { style: BorderStyle.SINGLE, size: 12, color: TEAL },
right: { style: BorderStyle.SINGLE, size: 12, color: TEAL },
},
rows: [new TableRow({ children: [new TableCell({
shading: { type: ShadingType.SOLID, color: "EBF3FB", fill: "EBF3FB" },
margins: { top: 100, bottom: 100, left: 150, right: 150 },
children: [new Paragraph({
children: [new TextRun({ text, bold: true, size: 20, font: "Calibri", color: NAVY })],
alignment: AlignmentType.JUSTIFIED,
})],
})]})],
});
}
// ── Table builders ───────────────────────────────────────────────────────────
function makeTable(headers, rows, colPcts, headerBg = NAVY) {
const allBorder = {
top: thinBorder(), bottom: thinBorder(), left: thinBorder(), right: thinBorder(),
insideH: thinBorder(), insideV: thinBorder(),
};
const headerRow = new TableRow({
tableHeader: true,
children: headers.map((h, i) => new TableCell({
shading: { type: ShadingType.SOLID, color: headerBg, fill: headerBg },
width: { size: colPcts[i], type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 100 },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text: h, bold: true, color: WHITE, size: 18, font: "Calibri" })],
alignment: AlignmentType.CENTER,
})],
})),
});
const dataRows = rows.map((row, ri) => new TableRow({
children: row.map((cell, ci) => {
const bg = ri % 2 === 0 ? LGREY : WHITE;
const isRed = cell.startsWith("!RED!");
const isBold = cell.startsWith("!BOLD!");
const text = cell.replace(/^!(RED|BOLD)!/, "");
return new TableCell({
shading: { type: ShadingType.SOLID, color: isRed ? "FDECEA" : bg, fill: isRed ? "FDECEA" : bg },
width: { size: colPcts[ci], type: WidthType.PERCENTAGE },
margins: { top: 70, bottom: 70, left: 100, right: 100 },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({
text,
size: 18,
font: "Calibri",
color: isRed ? RED : DKTEXT,
bold: isBold || isRed,
})],
alignment: AlignmentType.LEFT,
})],
});
}),
}));
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: allBorder,
rows: [headerRow, ...dataRows],
});
}
function makeKVTable(rows) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: thinBorder(), bottom: thinBorder(), left: thinBorder(),
right: thinBorder(), insideH: thinBorder(), insideV: thinBorder(),
},
rows: rows.map((row, ri) => new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? LGREY : WHITE, fill: ri % 2 === 0 ? LGREY : WHITE },
width: { size: 30, type: WidthType.PERCENTAGE },
margins: { top: 70, bottom: 70, left: 120, right: 100 },
children: [new Paragraph({
children: [new TextRun({ text: row[0], bold: true, size: 18, font: "Calibri", color: NAVY })],
})],
}),
new TableCell({
shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? LGREY : WHITE, fill: ri % 2 === 0 ? LGREY : WHITE },
width: { size: 70, type: WidthType.PERCENTAGE },
margins: { top: 70, bottom: 70, left: 100, right: 100 },
children: [new Paragraph({
children: [new TextRun({ text: row[1], size: 18, font: "Calibri", color: DKTEXT })],
})],
}),
],
})),
});
}
// ── DOCUMENT CONTENT ─────────────────────────────────────────────────────────
const children = [];
// ── TITLE BANNER ─────────────────────────────────────────────────────────────
children.push(new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: { top: noBorder(), bottom: noBorder(), left: noBorder(), right: noBorder() },
rows: [new TableRow({ children: [new TableCell({
shading: { type: ShadingType.SOLID, color: NAVY, fill: NAVY },
margins: { top: 200, bottom: 200, left: 300, right: 300 },
children: [
new Paragraph({
children: [new TextRun({ text: "ALKALINE PHOSPHATASE (ALP)", bold: true, color: WHITE, size: 36, font: "Calibri" })],
alignment: AlignmentType.CENTER,
}),
new Paragraph({
children: [new TextRun({ text: "Orthopaedic Postgraduate Examination Answer | 10 Marks", color: MGREY, size: 22, font: "Calibri" })],
alignment: AlignmentType.CENTER,
spacing: { before: 60 },
}),
],
})]})],
}));
children.push(spacer());
// ── 1. Introduction ──────────────────────────────────────────────────────────
children.push(heading1("1. Introduction"));
children.push(body(
"Alkaline phosphatase (ALP) is a zinc-dependent membrane-bound ectoenzyme that hydrolyzes phosphate monoesters under alkaline conditions (optimum pH ~9). It is attached to cell membranes via a glycosylphosphatidylinositol (GPI) anchor. From an orthopaedic perspective, bone ALP (tissue-nonspecific ALP, TNSALP) is the most clinically relevant isoenzyme, produced by osteoblasts during active bone formation and mineralization."
));
children.push(spacer());
children.push(makeKVTable([
["Normal adult serum ALP", "30–120 IU/L (lab-dependent)"],
["Half-life (bone ALP)", "~40–48 hours"],
["Half-life (total serum ALP)", "~7 days"],
["Gene (bone/liver/kidney ALP)", "ALPL gene, chromosome 1"],
["Measurement method", "Colorimetric: p-nitrophenol formation at 410 nm"],
]));
// ── 2. Biochemical Role ──────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("2. Biochemical Role in Bone Mineralization"));
children.push(body("Bone ALP is produced by osteoblasts during the matrix maturation phase. Matrix vesicles budding from osteoblasts are markedly enriched in bone ALP. Its primary functions are:"));
children.push(bullet([{text: "Hydrolyzes inorganic ", }, {text: "pyrophosphate (PPi) → inorganic phosphate (Pi)", bold: true}]));
children.push(bullet([{text: "PPi is a potent inhibitor of hydroxyapatite crystal formation — bone ALP destroys this inhibition"}]));
children.push(bullet([{text: "Promotes ", }, {text: "hydroxyapatite deposition", bold: true}, {text: " in the osteoid matrix"}]));
children.push(bullet([{text: "Also cleaves pyridoxal-5'-phosphate (PLP) and phosphoethanolamine (PEA) — substrates that accumulate in hypophosphatasia"}]));
children.push(spacer());
children.push(keyBox("Key Concept: Bone ALP = Marker of OSTEOBLAST number and activity = Marker of BONE FORMATION (not resorption). It rises whenever osteoblasts are stimulated, regardless of whether mineralization is adequate."));
// ── 3. Bone Turnover Markers ─────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("3. ALP as a Bone Turnover Marker"));
children.push(body("Bone turnover markers are classified into formation and resorption markers:"));
children.push(spacer());
children.push(makeTable(
["Type", "Marker", "Reflects"],
[
["Bone Formation", "Total ALP", "Osteoblast numbers + liver/kidney disease"],
["Bone Formation", "Bone-specific ALP (BALP)", "Osteoblast numbers (more specific)"],
["Bone Formation", "Osteocalcin (OC)", "Osteoblast numbers"],
["Bone Formation", "PINP / PICP", "Type I collagen synthesis rate"],
["Bone Resorption", "CTX / NTX (telopeptides)", "Bone collagen degradation"],
["Bone Resorption", "TRAP", "Osteoclast numbers"],
["Bone Resorption", "Deoxypyridinoline", "Bone collagen cross-link degradation"],
],
[22, 30, 48]
));
children.push(note("Source: Rockwood and Green's Fractures in Adults, 10th ed. (2025), Table 4-2"));
// ── 4. Lab Profile ───────────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("4. Metabolic Bone Disease — Lab Profile [Most Exam-Critical Table]"));
children.push(makeTable(
["Disorder", "Serum Ca", "Serum PO4", "ALP", "Urine / Other"],
[
["Osteoporosis", "Normal", "Normal", "Normal", "Normal Ca"],
["Osteomalacia / Rickets", "Low/Normal", "Low", "HIGH", "Low Ca, low PO4"],
["Hyperparathyroidism", "Normal-High", "Normal-Low", "Normal-High", "High Ca, high PTH"],
["Renal Osteodystrophy", "Low", "High", "High", "High PO4, raised PTH"],
["Paget Disease", "Normal", "Normal", "VERY HIGH", "Urine hydroxyproline ↑"],
["Multiple Myeloma", "High", "Normal", "NORMAL", "Bence-Jones protein"],
["!RED!Hypophosphatasia", "!RED!Normal", "!RED!Normal", "!RED!LOW", "!RED!Urine PEA raised (diagnostic)"],
],
[24, 13, 13, 15, 35]
));
children.push(note("Source: Rockwood and Green's Fractures in Adults, 10th ed. (2025); Miller's Review of Orthopaedics, 9th ed."));
// ── 5. Disease-Specific ───────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("5. Disease-Specific Orthopaedic Relevance"));
children.push(heading2("A. Paget Disease of Bone [HIGHEST YIELD]"));
const pagetBullets = [
[{text: "ALP is the ", }, {text: "single most sensitive and specific marker", bold: true}, {text: " for diagnosis and monitoring of Paget disease"}],
[{text: "Reflects markedly increased ", }, {text: "osteoblastic bone formation", bold: true}],
[{text: "Extent of ALP elevation correlates with skeletal involvement (highest when skull is involved)"}],
[{text: "Currently ALP is ", }, {text: "2–4x ULN", bold: true}, {text: " at diagnosis (previously 10x ULN — milder phenotype now observed)"}],
[{text: "Bone-specific ALP is ", }, {text: "more sensitive than total ALP", bold: true}, {text: " in mild/monostotic Paget disease"}],
[{text: "ALP + urine ", }, {text: "pyridinium cross-links", bold: true}, {text: " used together to monitor disease activity"}],
[{text: "Bisphosphonate treatment (zoledronate 5 mg IV single dose) response confirmed by ALP normalization"}],
[{text: "Serum and urine calcium usually normal; may rise with immobilization (e.g., post-fracture)"}],
[{text: "Complication: ~"}, {text: "1% develop secondary osteosarcoma", bold: true, color: RED}, {text: " (higher risk in polyostotic disease)"}],
];
pagetBullets.forEach(b => children.push(bullet(b)));
children.push(heading2("B. Rickets and Osteomalacia"));
[
[{text: "Elevated ALP with "}, {text: "low calcium and low phosphorus", bold: true}, {text: " is the classic triad"}],
[{text: "In severe osteomalacia, bone ALP may be markedly raised "}, {text: "without increased mineralization", bold: true}, {text: " (mineralizing defect — osteoid accumulates)"}],
[{text: "Familial hypophosphatemic rickets", bold: true}, {text: " (X-linked dominant, FGF23 mutation): low PO4, normal Ca, high ALP"}],
[{text: "Treatment: "}, {text: "Burosumab", bold: true}, {text: " (anti-FGF23 monoclonal antibody) — first-line therapy"}],
].forEach(b => children.push(bullet(b)));
children.push(heading2("C. Hyperparathyroidism / Brown Tumors"));
[
[{text: "Diagnosis by: "}, {text: "serum Ca, PO4, ALP, and PTH levels", bold: true}, {text: " — NOT histology alone"}],
[{text: "High Ca, low PO4, elevated ALP, high PTH = primary hyperparathyroidism"}],
[{text: "Brown tumor mimics giant cell tumor histologically; differentiated by biochemistry"}],
[{text: "Orthopaedic management: treating actual or impending "}, {text: "pathologic fractures", bold: true}],
].forEach(b => children.push(bullet(b)));
children.push(heading2("D. Renal Osteodystrophy"));
[
[{text: "Low calcium, high phosphorus, elevated ALP (secondary hyperparathyroidism effect on osteoblasts)"}],
[{text: "Bone-specific ALP preferred over osteocalcin in renal failure", bold: true}, {text: " — not cleared by glomerular filtration"}],
[{text: "ALP may be misleading in patients on calcitriol (1,25(OH)2D regulates bone ALP synthesis)"}],
].forEach(b => children.push(bullet(b)));
children.push(heading2("E. Bone Metastases"));
[
[{text: "ALP elevated in "}, {text: "osteoblastic metastases", bold: true}, {text: " (e.g., prostate cancer) due to reactive osteoblast stimulation"}],
[{text: "May be normal in purely osteolytic lesions — "}, {text: "multiple myeloma: ALP classically NORMAL", bold: true}],
[{text: "ALP is also the "}, {text: "most sensitive marker of hepatic metastases", bold: true}, {text: " among all liver enzymes"}],
].forEach(b => children.push(bullet(b)));
children.push(heading2("F. Osteosarcoma"));
[
[{text: "ALP may be elevated reflecting osteoblastic tumor matrix production"}],
[{text: "Elevated pre-treatment ALP = "}, {text: "poor prognosis", bold: true, color: RED}],
[{text: "Post-neoadjuvant chemotherapy normalization of ALP = good histological response"}],
[{text: "Not a specific tumor marker but a useful prognostic indicator"}],
].forEach(b => children.push(bullet(b)));
children.push(heading2("G. Fracture Healing"));
[
[{text: "ALP rises transiently during fracture healing, reflecting osteoblastic callus formation"}],
[{text: "Peaks at ~2–3 weeks post-fracture; returns to baseline on consolidation"}],
[{text: "Persistent elevation beyond expected timeline suggests "}, {text: "non-union", bold: true}, {text: " or underlying metabolic bone disease"}],
].forEach(b => children.push(bullet(b)));
// ── 6. Hypophosphatasia ───────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("6. Hypophosphatasia — LOW ALP (Critical Orthopaedic Condition)"));
children.push(new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: thinBorder(), bottom: thinBorder(), left: thinBorder(),
right: thinBorder(), insideH: thinBorder(), insideV: thinBorder(),
},
rows: [
["Inheritance", "Autosomal recessive (AR)", false],
["Gene defect", "Loss-of-function mutation in ALPL gene (TNSALP)", false],
["Mechanism", "Cannot break down PPi → PPi accumulates → inhibits hydroxyapatite formation → poor mineralization", false],
["Clinical features", "Rickets-like bone deformity, pathological fractures, premature tooth loss, bone pain, craniosynostosis", false],
["Diagnostic marker", "Elevated urinary phosphoethanolamine (PEA) — PATHOGNOMONIC; elevated plasma PLP", false],
["Treatment", "Asfotase alfa (recombinant TNSALP enzyme replacement therapy) — approved", false],
["⚠ CONTRAINDICATED", "Bisphosphonates — they further inhibit mineralization and worsen the condition", true],
].map((row, ri) => new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: row[2] ? "FDECEA" : (ri % 2 === 0 ? LGREY : WHITE), fill: row[2] ? "FDECEA" : (ri % 2 === 0 ? LGREY : WHITE) },
width: { size: 25, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 120, right: 100 },
children: [new Paragraph({ children: [new TextRun({ text: row[0], bold: true, size: 18, font: "Calibri", color: row[2] ? RED : NAVY })] })],
}),
new TableCell({
shading: { type: ShadingType.SOLID, color: row[2] ? "FDECEA" : (ri % 2 === 0 ? LGREY : WHITE), fill: row[2] ? "FDECEA" : (ri % 2 === 0 ? LGREY : WHITE) },
width: { size: 75, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 100 },
children: [new Paragraph({ children: [new TextRun({ text: row[1], size: 18, font: "Calibri", bold: row[2], color: row[2] ? RED : DKTEXT })] })],
}),
],
})),
}));
children.push(note("Source: Miller's Review of Orthopaedics, 9th ed.; Tietz Textbook of Laboratory Medicine, 7th ed."));
// ── 7. Monitoring Treatment ──────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("7. Monitoring Treatment with ALP"));
children.push(makeTable(
["Condition", "Treatment", "ALP Response / Significance"],
[
["Paget disease", "Bisphosphonates (zoledronate IV)", "Normalization = adequate disease control"],
["Rickets / Osteomalacia", "Vitamin D + Calcium", "ALP falls as mineralization improves"],
["Hyperparathyroidism", "Parathyroidectomy", "Transient rise (hungry bone syndrome), then normalization"],
["Renal osteodystrophy", "Dialysis, phosphate binders, Vit D", "Bone ALP guides therapy"],
["Osteosarcoma", "Neoadjuvant chemotherapy", "Normalization = good histological response"],
["Osteoporosis", "Bisphosphonate / teriparatide", "ALP less sensitive than PINP for acute treatment response"],
],
[25, 30, 45]
));
// ── 8. High-Yield Summary ─────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("8. High-Yield Exam Points Summary"));
const hiYield = [
"Bone ALP = osteoblast marker = bone FORMATION marker (not resorption)",
"Paget disease = highest ALP elevation of all metabolic bone diseases",
"Multiple myeloma = NORMAL ALP despite widespread bone destruction (osteolytic, no osteoblastic reaction)",
"Hypophosphatasia = LOW ALP + rickets-like picture. Bisphosphonates CONTRAINDICATED",
"Wilson disease = LOW ALP + jaundice + Coombs-negative hemolysis (copper displaces zinc cofactor)",
"Bone-specific ALP preferred in renal failure (not filtered by kidney, unlike osteocalcin)",
"Bisphosphonate treatment response in Paget's monitored by serial ALP levels",
"Elevated pre-treatment ALP in osteosarcoma = poor prognosis",
"Hungry bone syndrome post-parathyroidectomy: ALP transiently spikes (osteoblasts become hyperactive)",
"Physiologic elevation: ALP is 2x adult levels in growing children and third-trimester pregnancy — NOT pathological",
];
children.push(new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: thinBorder(), bottom: thinBorder(), left: thinBorder(),
right: thinBorder(), insideH: thinBorder(), insideV: thinBorder(),
},
rows: hiYield.map((point, i) => new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: NAVY, fill: NAVY },
width: { size: 6, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 100 },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text: `${i + 1}`, bold: true, size: 20, font: "Calibri", color: GOLD })],
alignment: AlignmentType.CENTER,
})],
}),
new TableCell({
shading: { type: ShadingType.SOLID, color: i % 2 === 0 ? "1B3A6B" : "22487A", fill: i % 2 === 0 ? "1B3A6B" : "22487A" },
width: { size: 94, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 140, right: 100 },
children: [new Paragraph({
children: [new TextRun({ text: point, size: 20, font: "Calibri", color: WHITE })],
})],
}),
],
})),
}));
// ── 9. Isoenzymes ─────────────────────────────────────────────────────────────
children.push(spacer());
children.push(heading1("9. ALP Isoenzymes — Heat Stability"));
children.push(makeTable(
["Source", "Heat/Urea Inhibition", "L-Phenylalanine Inhibition", "Anodal Mobility"],
[
["Biliary (Liver)", "+ (50%)", "-", "1 (fastest)"],
["Bone", "+++ (90% — 'bone burns')", "-", "2"],
["Placental", "– (0%, heat stable)", "+++", "3"],
["Intestinal", "+", "+++", "4"],
],
[22, 28, 28, 22]
));
children.push(body("GGT / 5'-nucleotidase: if elevated alongside ALP = hepatobiliary source; if normal = bone or other non-hepatic source.", { italic: true }));
// ── References ────────────────────────────────────────────────────────────────
children.push(spacer());
children.push(new Paragraph({
children: [new TextRun({ text: "References", bold: true, size: 20, font: "Calibri", color: NAVY })],
border: { top: { style: BorderStyle.SINGLE, size: 6, color: MGREY } },
spacing: { before: 120, after: 60 },
}));
[
"Rockwood and Green's Fractures in Adults, 10th ed. (2025)",
"Campbell's Operative Orthopaedics, 15th ed. (2026)",
"Miller's Review of Orthopaedics, 9th ed.",
"Tietz Textbook of Laboratory Medicine, 7th ed.",
"Firestein & Kelley's Textbook of Rheumatology, 2-Volume Set",
"Goldman-Cecil Medicine, International ed.",
"Quick Compendium of Clinical Pathology, 5th ed.",
].forEach(r => children.push(new Paragraph({
children: [new TextRun({ text: `• ${r}`, size: 17, font: "Calibri", color: "444444" })],
spacing: { before: 20, after: 20 },
})));
// ── Build document ────────────────────────────────────────────────────────────
const doc = new Document({
creator: "Orris Medical AI",
title: "Alkaline Phosphatase - Orthopaedic PG Answer",
description: "10-mark PG answer on Alkaline Phosphatase for Orthopaedic postgraduate exams",
sections: [{
properties: {
page: {
margin: { top: 720, bottom: 720, left: 900, right: 900 },
},
},
headers: {
default: new Header({
children: [new Paragraph({
children: [
new TextRun({ text: "Alkaline Phosphatase (ALP) — Orthopaedic PG Answer", size: 16, font: "Calibri", color: "888888" }),
],
alignment: AlignmentType.RIGHT,
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: MGREY } },
})],
}),
},
footers: {
default: new Footer({
children: [new Paragraph({
children: [
new TextRun({ text: "Generated by Orris Medical AI | For educational purposes only | Page ", size: 16, font: "Calibri", color: "888888" }),
new TextRun({ children: [PageNumber.CURRENT], size: 16, font: "Calibri", color: "888888" }),
new TextRun({ text: " of ", size: 16, font: "Calibri", color: "888888" }),
new TextRun({ children: [PageNumber.TOTAL_PAGES], size: 16, font: "Calibri", color: "888888" }),
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: MGREY } },
})],
}),
},
children,
}],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/alp-ortho/ALP_Ortho_PG_Exam.docx", buffer);
console.log("DOCX created successfully.");
}).catch(err => {
console.error("Error:", err);
process.exit(1);
});
cd /home/daytona/workspace/alp-ortho && node generate_docx.js 2>&1
ls -lh /home/daytona/workspace/alp-ortho/ALP_Ortho_PG_Exam.docx && python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/alp-ortho/ALP_Ortho_PG_Exam.docx 2>&1
python3 -c " import zipfile z = zipfile.ZipFile('/home/daytona/workspace/alp-ortho/ALP_Ortho_PG_Exam.docx') names = z.namelist() print('Files in docx:', names[:10]) # Quick XML check content = z.read('word/document.xml') print('document.xml size:', len(content), 'bytes') print('Valid XML start:', content[:60]) "
ALP Ortho PG Exam
Word Document · DOCX