Im having pain inleft ankel while night

Reading File
Finding Sources
Finding Sources
Searching the Web

left ankle pain at night causes diagnosis

Reading File
Reading File
Finding Sources
Here is a thorough overview of what could be causing your left ankle pain at night, based on authoritative medical sources:

Common Causes of Left Ankle Pain at Night

1. Gout (Very Common for Night Pain)

Gout is one of the most classic causes of sudden ankle pain that starts at night. According to Firestein & Kelley's Textbook of Rheumatology:
"Gout flares have a stereotypic pattern, with rapid onset of maximal pain within 24 hours of onset and gradual resolution over 1 to 2 weeks. These episodes often start during the night."
Key signs of gout:
  • Sudden, severe pain (can be excruciating)
  • Redness, warmth, and swelling over the ankle
  • Pain that is worst in the first 24 hours
  • Triggered by rich food, alcohol, or dehydration

2. Tarsal Tunnel Syndrome (Nerve Compression)

Compression of the posterior tibial nerve as it passes behind the inner ankle bone. Per Tintinalli's Emergency Medicine:
  • Burning pain, numbness, tingling in the sole and ankle
  • Pain is often worse at night and after prolonged standing
  • May cause distal calf pain as well
  • Positive Tinel sign (tapping behind medial ankle causes shooting pain)

3. Deep Peroneal Nerve Entrapment

Nerve compression on the top of the ankle/foot. From the same source:
  • Nighttime pain is common
  • Dorsal foot pain and numbness in the first toe web space
  • Worsened by tight footwear, ankle sprains, or overuse

4. Achilles Tendinitis / Tendinosis

Degeneration or inflammation of the Achilles tendon (back of the ankle). Per Firestein & Kelley's Rheumatology:
  • Posterior ankle pain, stiffness, and tenderness
  • Night pain can occur in advanced cases
  • Associated with Achilles tendon thickening or a heel spur

5. Osteoarthritis / Inflammatory Arthritis (RA)

  • Ankle joint inflammation leads to pain with activity, eventually pain at rest and at night
  • Morning stiffness is a hallmark of inflammatory arthritis (RA, psoriatic arthritis)
  • Campbell's Operative Orthopaedics notes: "With more advanced disease, less activity causes pain, and many patients describe pain with rest or at night."

6. Peripheral Neuropathy (e.g., Diabetes)

From Harrison's Principles of Internal Medicine:
"Pain typically involves the lower extremities, is usually present at rest, and worsens at night."
  • Common in diabetic patients
  • Burning, tingling, "pins and needles" sensation
  • Both feet often affected

7. Stress Fracture

  • Aching pain that worsens with activity and may persist at night
  • Common after increased physical activity or in those with osteoporosis
  • Localized tenderness over the bone

What To Watch For - Warning Signs (See a Doctor Promptly)

SymptomPossible Cause
Sudden severe pain + redness + swellingGout flare or infection (septic arthritis)
Burning/tingling + numbnessNerve compression or neuropathy
Pain with rest + morning stiffnessInflammatory arthritis
Fever + hot, swollen jointInfection - urgent care needed
Pain after new exercise/activityStress fracture

What You Can Do at Home (Short Term)

  • Rest your ankle and avoid putting weight on it
  • Ice the area - wrapped in cloth, 15-20 minutes every 2-3 hours
  • Elevate your leg when lying down to reduce swelling
  • Over-the-counter pain relief like ibuprofen or paracetamol can help if you have no contraindications
  • Avoid tight footwear or socks at night

When to See a Doctor

Please see a doctor if:
  • The pain is severe or suddenly worse
  • Your ankle is red, hot, and very swollen
  • You have fever
  • The pain has lasted more than a few days with no improvement
  • You have diabetes or circulation problems in your legs
  • You notice numbness or tingling along with the pain
A doctor can examine your ankle, check for gout (blood uric acid test), order an X-ray if needed, and recommend appropriate treatment. Do not self-diagnose - night pain in the ankle has many possible causes, and the right treatment depends on the correct diagnosis.

Disclaimer: This information is for general educational purposes only and is not a substitute for professional medical advice. Please consult a healthcare provider for a proper diagnosis and treatment plan.

My left ankle makes cracking and poping sounds while moving and I get lost of pain during night

Finding Sources
Finding Sources
Searching the Web

ankle cracking popping sounds with night pain causes crepitus

Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
The combination of cracking/popping + significant night pain in your left ankle is a meaningful clinical picture. Here is a detailed breakdown:

What Does Cracking/Popping (Crepitus) + Night Pain Mean?

Cracking sounds in a joint by themselves are often harmless. But when combined with significant pain at night, it suggests actual structural damage inside or around the ankle joint - not just normal gas bubbles. The key causes are:

Most Likely Causes

1. Osteoarthritis (Degenerative Joint Disease) - Most Common

Crepitus is a hallmark sign of osteoarthritis. Per S. Das's Manual on Clinical Surgery:
"Crepitus felt during movement of the joint suggests osteoarthritis."
In ankle osteoarthritis:
  • Cartilage between the joint bones wears away, causing bones to grind and produce cracking/grating sounds
  • Pain starts with activity, then progresses to rest pain and night pain as the disease advances
  • Stiffness after rest (especially morning stiffness)
  • Swelling and reduced range of movement

2. Osteochondral Talar Dome Fracture / Osteochondritis Dissecans

This is a focal area of cartilage and bone damage on the ankle's talus bone. Per Pfenninger & Fowler's Procedures for Primary Care:
"Prolonged pain (several weeks to months) following an inversion injury of the ankle, often associated with point tenderness in the area, decreased range of motion, crepitus, and an effusion, should lead the clinician to suspect an osteochondral talar dome fracture."
Key features:
  • History of a previous ankle twist/sprain that "never fully healed"
  • Cracking and clicking with movement
  • Night pain and aching at rest
  • Swelling that persists
  • Plain X-ray may be normal - requires MRI or bone scan for diagnosis

3. Peroneal Tendon Subluxation (Snapping/Popping on the Outer Ankle)

The peroneal tendons run along the outside of the ankle and can slip out of their groove. Per Campbell's Operative Orthopaedics and Miller's Review of Orthopaedics:
  • Produces a distinct snapping or popping sensation along the outer ankle
  • Pain in the retrofibular groove (behind the outer ankle bone)
  • Worsened by foot eversion movements
  • Can cause significant pain and instability

4. Ankle Tenosynovitis (Tendon Sheath Inflammation)

Inflammation of the tendon sheaths around the ankle. Per Campbell's Operative Orthopaedics:
"In tenosynovitis, pain over the anterior ankle and foot is the primary complaint, and crepitus is common in florid tenosynovitis. Night pain also may be present."

5. Loose Bodies in the Joint

Small fragments of cartilage or bone floating inside the joint cause:
  • Mechanical clicking and popping
  • Intermittent locking or catching sensation
  • Pain that varies with position

Key Questions to Help Identify the Cause

Ask yourself:
QuestionWhat it suggests
Did you have a previous ankle sprain/injury?Osteochondral damage, ligament laxity
Is the popping on the outer side of ankle?Peroneal tendon subluxation
Is there visible swelling or warmth?Arthritis, infection, or acute injury
Is morning stiffness present (>30 min)?Inflammatory arthritis (RA, gout)
Do you have diabetes or neuropathy?Diabetic neuropathic arthropathy (Charcot joint)
Did pain come on gradually over years?Osteoarthritis

What Should You Do

Short-term (Right Now):

  • Rest the ankle - avoid overloading it
  • Elevate the leg at night to reduce swelling
  • Ice the area (15-20 min, wrapped in cloth) if swollen or warm
  • Ibuprofen (if no allergy/contraindication) can reduce inflammation and night pain
  • Wear supportive footwear - avoid flat or unsupported shoes

See a Doctor For:

The combination of crepitus + significant night pain warrants a proper medical evaluation. The doctor will likely:
  1. Physical examination of the ankle - range of motion, point tenderness, swelling
  2. X-ray - to check for osteoarthritis, bone spurs, or fractures
  3. MRI - if X-ray is normal but symptoms persist (best for cartilage and tendon damage)
  4. Blood tests - uric acid (for gout), inflammatory markers (CRP, ESR)

Red Flags - Go to A&E / Emergency Immediately If:

  • Severe swelling + inability to bear weight
  • Ankle looks deformed or at an odd angle
  • Fever with a hot, red, swollen joint (possible joint infection)
  • Sudden severe pain after a fall or injury

Important: Cracking sounds with significant night pain should not be ignored. This combination often means there is structural damage inside the joint that needs imaging to properly diagnose. Please book an appointment with your doctor or an orthopaedic specialist. Early treatment prevents further damage.
Disclaimer: This is educational information only and does not replace a medical consultation.

Vitamin d biochemistry mbbs first year laq

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Loading Image
Here is a complete MBBS First Year Biochemistry LAQ answer on Vitamin D, written in exam format with all key headings an examiner expects:

VITAMIN D - Biochemistry LAQ

(Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics; Harrison's Principles of Internal Medicine 22E; Harper's Illustrated Biochemistry)

1. Introduction

Vitamin D is technically a hormone precursor rather than a classic vitamin, because under adequate sunlight exposure, the body can synthesize it entirely endogenously. It belongs to the fat-soluble vitamin group (A, D, E, K). Its primary role is in calcium and phosphate homeostasis, and deficiency leads to rickets in children and osteomalacia in adults.

2. Forms of Vitamin D

FormSourceChemical Name
Vitamin D2 (ergocalciferol)Plants, fungi, fortified foodsErgocalciferol
Vitamin D3 (cholecalciferol)Animal sources, skin synthesisCholecalciferol
Vitamin D3 has ~10x greater biological potency than D2 due to longer half-life and higher affinity for vitamin D-binding protein.

3. Sources

  • Endogenous: Synthesized in the skin from 7-dehydrocholesterol under UV-B radiation (290-315 nm)
  • Dietary: Fish liver oil, egg yolk, fortified milk, butter
  • Supplements: Available as D2 or D3

4. Synthesis and Metabolic Activation (Most Important - Draw This)

Vitamin D undergoes two sequential hydroxylations before becoming active:
Vitamin D Metabolism Pathway - Goodman & Gilman

Step-by-Step Pathway:

Step 1 - Skin (Photochemical Reaction):
  • UV-B light (sunlight) cleaves the B ring of 7-dehydrocholesterol (provitamin D3)
  • Forms pre-vitamin D3 → isomerizes (by body heat) to Vitamin D3 (Cholecalciferol)
  • Melanin and sunscreens reduce this step
Step 2 - Absorption and Transport:
  • Dietary vitamin D2/D3 absorbed in the small intestine with fat (requires bile salts)
  • Vitamin D3 (from skin or diet) enters the circulation bound to vitamin D-binding protein (DBP), an alpha-globulin synthesized in the liver
Step 3 - First Hydroxylation (Liver):
  • Enzyme: 25-hydroxylase (CYP27A1/CYP2R1) in liver microsomes and mitochondria
  • Product: 25-hydroxycholecalciferol = 25(OH)D3 = Calcidiol
  • This is the major circulating storage form (normal: 15-50 ng/mL)
  • Half-life: ~19 days
  • This reaction is NOT tightly regulated
Step 4 - Second Hydroxylation (Kidney):
  • Enzyme: 1-alpha-hydroxylase (CYP27B1) in proximal convoluted tubule cells
  • Product: 1,25-dihydroxycholecalciferol = 1,25(OH)₂D3 = Calcitriolthe active form
  • This is a tightly regulated step (the main control point)
Inactivation:
  • 24-hydroxylase (CYP24A1) converts calcidiol → 24,25(OH)₂D3 (inactive)
  • Also converts calcitriol → 1,24,25(OH)₃D3 (inactive)
  • This is the main degradation/inactivation pathway

5. Regulation of 1-alpha-Hydroxylase Activity

This is the key regulatory step. The enzyme is stimulated by:
  • PTH (parathyroid hormone) - main inducer
  • Hypocalcemia (low serum Ca²⁺)
  • Hypophosphatemia (low serum phosphate)
The enzyme is inhibited by:
  • Calcitriol itself (product inhibition / negative feedback)
  • FGF-23 (fibroblast growth factor-23, from osteocytes)
  • Hypercalcemia
  • Hyperphosphatemia
  • Calcitonin
Memory tip: PTH turns ON kidney hydroxylase; FGF23 and calcitriol turn it OFF.

6. Mechanism of Action

Calcitriol acts like a steroid hormone:
  1. Calcitriol (lipid-soluble) enters the target cell
  2. Binds the Vitamin D Receptor (VDR) - a nuclear receptor
  3. VDR forms a heterodimer with Retinoid X Receptor (RXR)
  4. VDR-RXR heterodimer binds to Vitamin D Response Elements (VDREs) on DNA
  5. Recruits coactivators → activates gene transcription
  6. Downstream: increases synthesis of calcium transport proteins (e.g., calbindin D)
VDRs are found widely: intestine, kidney, bone, parathyroid glands, immune cells, skin, and more.

7. Physiological Functions of Calcitriol (Active Vitamin D)

A. Intestine:

  • Increases calcium absorption (primary function) by inducing synthesis of:
    • Calbindin-D (calcium-binding protein)
    • Ca²⁺-ATPase (active transport)
  • Also increases phosphate absorption

B. Kidney:

  • Promotes reabsorption of calcium and phosphate from renal tubules

C. Bone:

  • At physiological levels: promotes bone mineralization (indirectly via increased Ca and P)
  • At high levels: stimulates osteoclast activity → bone resorption (mobilizes Ca²⁺)
  • Osteoblasts express VDR; calcitriol induces osteocalcin synthesis

D. Parathyroid Gland:

  • Inhibits PTH synthesis and secretion (negative feedback)

E. Immune System:

  • Promotes maturation and differentiation of monocytes and macrophages
  • Inhibits lymphocyte proliferation
  • Immune-modulating role

F. Skin:

  • Inhibits keratinocyte proliferation and promotes differentiation
  • Used therapeutically in psoriasis (calcipotriol)

G. Muscle:

  • Necessary for normal muscle function; deficiency → proximal myopathy

8. Daily Requirement

Age GroupRDA
Children (1-18 years)600 IU/day
Adults (19-70 years)600 IU/day
Adults (>70 years)800 IU/day
Pregnancy/Lactation600 IU/day
Normal serum 25(OH)D level: ≥20 ng/mL (50 nmol/L) - Institute of Medicine

9. Deficiency of Vitamin D

Causes:

  • Inadequate sunlight exposure (indoor lifestyle, dark skin, high latitudes)
  • Low dietary intake
  • Malabsorption (fat malabsorption, celiac disease, Crohn's disease)
  • Renal failure (failure of 1-alpha hydroxylation)
  • Liver disease (failure of 25-hydroxylation)
  • Anticonvulsants (accelerate vitamin D catabolism via CYP induction)

In Children → Rickets

  • Craniotabes (softening of skull bones)
  • Rachitic rosary (enlarged costochondral junctions)
  • Harrison's sulcus (inward pulling of lower ribs)
  • Genu valgum (knock knees) or Genu varum (bow legs)
  • Delayed fontanelle closure
  • Frontal bossing (square head)
  • X-ray: Cupped, frayed, widened epiphyses ("paintbrush appearance")

In Adults → Osteomalacia

  • Bone pain and tenderness
  • Proximal muscle weakness
  • Pseudofractures (Looser's zones) on X-ray
  • Hypocalcemia, hypophosphatemia, raised ALP
  • Pathological fractures

Lab findings in Vitamin D Deficiency:

ParameterChange
Serum Ca²⁺↓ or normal
Serum Phosphate
Serum ALP↑ (markedly)
PTH↑ (secondary hyperparathyroidism)
25(OH)D3↓ (best diagnostic marker)
1,25(OH)₂D3↓ (in severe deficiency)

10. Toxicity (Hypervitaminosis D)

  • Caused by excessive supplementation (NOT by excess sunlight - skin regulates photodegradation)
  • Features: Hypercalcemia, hypercalciuria
  • Symptoms: Nausea, vomiting, polyuria, polydipsia, metastatic calcification (soft tissues, kidneys)
  • Renal stones, nephrocalcinosis
  • Treatment: Stop supplementation, restrict calcium intake, glucocorticoids (reduce gut absorption)

11. Summary Diagram

7-Dehydrocholesterol (Skin)
        ↓ UV-B
Vitamin D3 (Cholecalciferol)
        ↓ 25-hydroxylase (Liver)
25(OH)D3 - Calcidiol [Storage form, measured clinically]
        ↓ 1α-hydroxylase (Kidney) ← Stimulated by PTH, ↓Ca, ↓PO4
1,25(OH)₂D3 - Calcitriol [Active hormone]
        ↓
   VDR → gene expression
   → ↑Ca absorption (gut)
   → ↑Ca reabsorption (kidney)
   → Bone mineralization
   → ↓PTH secretion

Exam Tip: The examiner expects you to cover: forms, sources, synthesis pathway with enzymes and organs, regulation, mechanism of action via VDR, functions (especially calcium homeostasis), and deficiency (rickets vs osteomalacia). This is a high-yield topic that often appears in both theory and viva in MBBS First Year Biochemistry.

Generate practice MCQs on Vitamin D biochemistry and metabolism

Here are 25 high-quality MCQs on Vitamin D Biochemistry and Metabolism, covering all MBBS First Year exam topics:

Practice MCQs: Vitamin D Biochemistry & Metabolism


SECTION A: Chemistry & Sources (Q1-Q5)


Q1. The provitamin for Vitamin D3 (cholecalciferol) in human skin is:
  • A) Ergosterol
  • B) 7-dehydrocholesterol
  • C) Desmosterol
  • D) Lanosterol
✅ Answer & Explanation
Answer: B - 7-dehydrocholesterol
7-dehydrocholesterol is present in animal tissues (including human skin) and is the direct precursor for Vitamin D3. UV-B radiation (290-315 nm) cleaves its B ring to form pre-vitamin D3, which then isomerizes by body heat to cholecalciferol.
Ergosterol is the provitamin found in plants and fungi and gives rise to Vitamin D2 (ergocalciferol).

Q2. Which of the following is the chemical name for the active form of Vitamin D?
  • A) Cholecalciferol
  • B) Ergocalciferol
  • C) Calcidiol
  • D) Calcitriol
✅ Answer & Explanation
Answer: D - Calcitriol
  • Cholecalciferol = Vitamin D3 (inactive)
  • Ergocalciferol = Vitamin D2 (inactive)
  • Calcidiol = 25(OH)D3 (storage form, inactive)
  • Calcitriol = 1,25(OH)₂D3 = active hormone

Q3. Vitamin D is best classified as a:
  • A) Fat-soluble vitamin
  • B) Water-soluble vitamin
  • C) Steroid hormone precursor
  • D) Both A and C
✅ Answer & Explanation
Answer: D - Both A and C
Vitamin D is fat-soluble (absorbed with dietary fat, requires bile salts). It is also technically a hormone precursor - the final active metabolite calcitriol acts exactly like a steroid hormone, binding nuclear receptors to regulate gene transcription.

Q4. Ergosterol (provitamin D2) is found in:
  • A) Animal liver only
  • B) Human skin
  • C) Plants and fungi
  • D) Fish oil
✅ Answer & Explanation
Answer: C - Plants and fungi
Ergosterol is exclusively found in plants and fungi. When irradiated with UV light, it forms ergocalciferol (Vitamin D2), which is used in fortified foods and vitamin supplements.

Q5. Which protein transports Vitamin D in the bloodstream?
  • A) Albumin only
  • B) Transferrin
  • C) Vitamin D-binding protein (DBP), an alpha-globulin
  • D) Retinol-binding protein
✅ Answer & Explanation
Answer: C - Vitamin D-binding protein (DBP), an alpha-globulin
DBP (also called transcalciferin) is the primary carrier protein for Vitamin D and its metabolites. It is an alpha-globulin synthesized in the liver. About 88% of 25(OH)D circulates bound to DBP, with a small fraction bound to albumin and only 0.03% free.

SECTION B: Metabolism & Activation (Q6-Q12)


Q6. The first hydroxylation of Vitamin D occurs in the:
  • A) Kidney - at position 1
  • B) Liver - at position 25
  • C) Skin - at position 24
  • D) Intestine - at position 1
✅ Answer & Explanation
Answer: B - Liver - at position 25
The first hydroxylation occurs in the liver at carbon-25, catalyzed by 25-hydroxylase (CYP27A1). The product is calcidiol [25(OH)D3], the major circulating form. This reaction is NOT tightly regulated.
The second hydroxylation (at carbon-1) occurs in the kidney.

Q7. The enzyme that catalyzes the final activation of Vitamin D in the kidney is:
  • A) 25-hydroxylase (CYP27A1)
  • B) 24-hydroxylase (CYP24A1)
  • C) 1-alpha-hydroxylase (CYP27B1)
  • D) 7-dehydrocholesterol reductase
✅ Answer & Explanation
Answer: C - 1-alpha-hydroxylase (CYP27B1)
1-alpha-hydroxylase (CYP27B1) is located in the proximal convoluted tubule cells of the kidney. It hydroxylates calcidiol at position 1-alpha to produce calcitriol (1,25(OH)₂D3) - the active form. This is the tightly regulated, key control step in Vitamin D metabolism.

Q8. What is the major circulating and storage form of Vitamin D used clinically to assess Vitamin D status?
  • A) 7-dehydrocholesterol
  • B) Cholecalciferol (Vitamin D3)
  • C) 25-hydroxycholecalciferol (calcidiol)
  • D) 1,25-dihydroxycholecalciferol (calcitriol)
✅ Answer & Explanation
Answer: C - 25-hydroxycholecalciferol (calcidiol)
Calcidiol [25(OH)D3] has a long half-life (~19 days) and is present in the highest concentration in the serum. It is the best clinical marker for assessing Vitamin D status/deficiency. Normal range: 15-50 ng/mL. A level below 20 ng/mL indicates deficiency.
Calcitriol is the active form but has a very short half-life (~4-6 hours) and is present in tiny amounts, making it unsuitable for routine assessment.

Q9. 24-hydroxylase (CYP24A1) acts on Vitamin D metabolites to produce:
  • A) The active form, calcitriol
  • B) Inactive metabolites (inactivation pathway)
  • C) The storage form, calcidiol
  • D) Pre-vitamin D3
✅ Answer & Explanation
Answer: B - Inactive metabolites (inactivation pathway)
24-hydroxylase is the catabolic enzyme that inactivates Vitamin D:
  • Calcidiol → 24,25(OH)₂D3 (inactive)
  • Calcitriol → 1,24,25(OH)₃D3 (inactive, then further degraded to calcitroic acid)
This enzyme is induced by calcitriol itself and FGF-23 as part of negative feedback regulation.

Q10. Which of the following STIMULATES 1-alpha-hydroxylase activity in the kidney?
  • A) High serum calcium
  • B) FGF-23
  • C) Calcitriol (product inhibition)
  • D) Parathyroid hormone (PTH)
✅ Answer & Explanation
Answer: D - Parathyroid hormone (PTH)
PTH is the major stimulator of renal 1-alpha-hydroxylase. When serum calcium falls → PTH rises → stimulates 1-alpha-hydroxylase → more calcitriol produced → increases gut calcium absorption → restores serum calcium.
Options A, B, and C are all inhibitors of the enzyme.

Q11. FGF-23 (Fibroblast Growth Factor 23) affects Vitamin D metabolism by:
  • A) Stimulating 1-alpha-hydroxylase in the kidney
  • B) Increasing calcitriol synthesis
  • C) Inducing 24-hydroxylase and inhibiting 1-alpha-hydroxylase (decreasing calcitriol)
  • D) Promoting 25-hydroxylation in the liver
✅ Answer & Explanation
Answer: C - Inducing 24-hydroxylase and inhibiting 1-alpha-hydroxylase (decreasing calcitriol)
FGF-23, secreted by osteocytes in response to high phosphate or high calcitriol, acts to:
  1. Inhibit 1-alpha-hydroxylase (CYP27B1) → less calcitriol production
  2. Stimulate 24-hydroxylase (CYP24A1) → accelerate calcitriol degradation
Net result: FGF-23 decreases calcitriol levels and reduces phosphate reabsorption in the kidney.

Q12. The half-life of 25(OH)D3 (calcidiol) is approximately:
  • A) 4-6 hours
  • B) 24 hours
  • C) 19 days
  • D) 3 months
✅ Answer & Explanation
Answer: C - 19 days
This long half-life is why 25(OH)D3 is the best marker of Vitamin D status - it reflects body stores accumulated over weeks. In contrast, the active form calcitriol has a very short half-life of only 4-6 hours, making it a poor marker of overall Vitamin D status.

SECTION C: Mechanism of Action (Q13-Q15)


Q13. The Vitamin D receptor (VDR) belongs to which class of receptors?
  • A) G-protein coupled receptor (GPCR)
  • B) Tyrosine kinase receptor
  • C) Nuclear receptor (intracellular)
  • D) Ion channel receptor
✅ Answer & Explanation
Answer: C - Nuclear receptor (intracellular)
Calcitriol, being fat-soluble, enters cells freely and binds the Vitamin D Receptor (VDR), which is a nuclear receptor. This places it in the same superfamily as steroid hormone receptors and thyroid hormone receptors.
VDR then heterodimerizes with the Retinoid X Receptor (RXR) and binds to Vitamin D Response Elements (VDREs) on DNA to regulate gene transcription.

Q14. After binding calcitriol, the VDR forms a heterodimer with which other receptor before binding DNA?
  • A) Glucocorticoid receptor (GR)
  • B) Androgen receptor (AR)
  • C) Retinoid X Receptor (RXR)
  • D) Thyroid hormone receptor (TR)
✅ Answer & Explanation
Answer: C - Retinoid X Receptor (RXR)
The VDR-calcitriol complex forms a heterodimer with RXR (which is activated by 9-cis-retinoic acid, a Vitamin A derivative). The VDR-RXR heterodimer then binds to specific DNA sequences called Vitamin D Response Elements (VDREs) and recruits coactivators to stimulate gene transcription.
This is why Vitamin A deficiency can impair Vitamin D function (insufficient 9-cis-retinoic acid for RXR).

Q15. Calcitriol increases intestinal calcium absorption primarily by inducing synthesis of:
  • A) Calcitonin
  • B) Calbindin-D (calcium-binding protein)
  • C) PTH
  • D) Osteocalcin
✅ Answer & Explanation
Answer: B - Calbindin-D (calcium-binding protein)
Calcitriol upregulates the gene for calbindin-D in intestinal enterocytes. Calbindin-D acts as an intracellular calcium ferry, allowing transcellular absorption of calcium. Calcitriol also increases expression of Ca²⁺-ATPase on the basolateral membrane for active extrusion of Ca²⁺ into the blood.

SECTION D: Functions & Deficiency (Q16-Q22)


Q16. Vitamin D deficiency in children causes:
  • A) Osteoporosis
  • B) Rickets
  • C) Osteomalacia
  • D) Scurvy
✅ Answer & Explanation
Answer: B - Rickets
  • ChildrenRickets (defective bone mineralization at growth plates, causing skeletal deformities)
  • AdultsOsteomalacia (defective mineralization of existing bone matrix, causing bone pain and fractures)
  • Osteoporosis is due to reduced bone mass (not defective mineralization) and is a separate condition
  • Scurvy is caused by Vitamin C deficiency

Q17. The "Rachitic rosary" seen in Vitamin D deficiency rickets refers to:
  • A) Softening of the skull
  • B) Bowing of the legs
  • C) Enlargement of costochondral junctions
  • D) Indrawing of the lower chest
✅ Answer & Explanation
Answer: C - Enlargement of costochondral junctions
The "rachitic rosary" refers to the beaded appearance of the chest wall due to enlargement of the costochondral junctions (where ribs meet cartilage) - looking like a rosary necklace.
Other features:
  • Craniotabes = softening of skull
  • Harrison's sulcus = indrawing of lower chest (ribs pulled inward by diaphragm)
  • Genu varum/valgum = bowing/knock knees

Q18. In Vitamin D deficiency, which lab finding is MOST characteristically elevated?
  • A) Serum calcium
  • B) Serum phosphate
  • C) Alkaline phosphatase (ALP)
  • D) 25-hydroxyvitamin D
✅ Answer & Explanation
Answer: C - Alkaline phosphatase (ALP)
ALP is markedly elevated in rickets and osteomalacia because osteoblasts are working overtime trying to mineralize defective osteoid. ALP is an osteoblast enzyme and its levels rise with increased osteoblast activity.
Serum Ca²⁺ is low or normal; serum phosphate is low; 25(OH)D is low (not elevated).

Q19. Secondary hyperparathyroidism in Vitamin D deficiency occurs because:
  • A) PTH stimulates vitamin D synthesis
  • B) Low serum calcium (from reduced gut absorption) stimulates PTH release
  • C) Calcitriol directly stimulates PTH secretion
  • D) FGF-23 inhibits PTH release
✅ Answer & Explanation
Answer: B - Low serum calcium (from reduced gut absorption) stimulates PTH release
The sequence in Vitamin D deficiency:
  1. ↓ Calcitriol → ↓ intestinal Ca²⁺ absorption → ↓ serum Ca²⁺
  2. Hypocalcemia → ↑ PTH secretion (parathyroid glands respond)
  3. Result: Secondary hyperparathyroidism
The elevated PTH then causes increased bone resorption and phosphaturia (explaining low serum phosphate in rickets).

Q20. Vitamin D toxicity (hypervitaminosis D) can be caused by:
  • A) Excessive sunlight exposure
  • B) Excessive oral supplementation
  • C) High dietary fish intake
  • D) Outdoor work in tropical climates
✅ Answer & Explanation
Answer: B - Excessive oral supplementation
Sunlight exposure does NOT cause Vitamin D toxicity because excess pre-vitamin D3 in the skin is converted to inactive photoproducts (lumisterol, tachysterol) by continued UV exposure - a natural safety mechanism.
Toxicity only occurs with excessive supplementation. Features include hypercalcemia, hypercalciuria, nausea, vomiting, polydipsia, and metastatic calcification in soft tissues and kidneys.

Q21. A patient with chronic renal failure develops bone disease. The mechanism is:
  • A) Decreased 25-hydroxylation in the liver
  • B) Decreased 1-alpha-hydroxylation in the kidney → low calcitriol
  • C) Increased FGF-23 has no role
  • D) Vitamin D is not related to renal disease
✅ Answer & Explanation
Answer: B - Decreased 1-alpha-hydroxylation in the kidney → low calcitriol
In chronic kidney disease (CKD):
  • Damaged proximal tubule cells → ↓ 1-alpha-hydroxylase activity
  • → ↓ calcitriol synthesis
  • → ↓ intestinal Ca²⁺ absorption → hypocalcemia
  • → secondary hyperparathyroidism
  • → renal osteodystrophy (combination of osteomalacia + osteitis fibrosa cystica)
Treatment: 1-alpha-calcidol or calcitriol supplementation (bypassing the defective kidney step).

Q22. Which anticonvulsant drug causes Vitamin D deficiency by inducing its catabolism?
  • A) Valproate (inhibits CYP enzymes)
  • B) Phenytoin and phenobarbitone (induce CYP450 enzymes)
  • C) Levetiracetam
  • D) Ethosuximide
✅ Answer & Explanation
Answer: B - Phenytoin and phenobarbitone (induce CYP450 enzymes)
Phenytoin and phenobarbitone are strong CYP450 enzyme inducers. They induce the hepatic microsomal enzymes that catabolize Vitamin D metabolites, leading to accelerated breakdown of calcidiol → osteomalacia in long-term users.
Patients on long-term anticonvulsant therapy should receive Vitamin D supplementation.

SECTION E: Clinical Viva-Style MCQs (Q23-25)


Q23. A 2-year-old child presents with bowing of legs, enlarged wrists, and frontal bossing. X-ray shows cupped and frayed epiphyses ("paintbrush appearance"). The BEST initial investigation is:
  • A) Serum calcitriol levels
  • B) X-ray of the skull
  • C) Serum 25-hydroxyvitamin D (25-OHD) level
  • D) Urine calcium
✅ Answer & Explanation
Answer: C - Serum 25-hydroxyvitamin D (25-OHD) level
This clinical picture is classic nutritional rickets. The best investigation to confirm Vitamin D deficiency is serum 25(OH)D3 - it is the best indicator of body stores and overall Vitamin D status.
Serum calcitriol (active form) has too short a half-life and can be normal or even elevated in early deficiency (due to PTH driving up 1-alpha-hydroxylase). ALP and serum Ca/PO4 are supportive findings.

Q24. Granulomatous diseases (like sarcoidosis) can cause hypercalcemia because:
  • A) Granulomas produce excess PTH
  • B) Activated macrophages in granulomas express 1-alpha-hydroxylase, producing excess calcitriol
  • C) FGF-23 is suppressed in sarcoidosis
  • D) Granulomas destroy the kidneys
✅ Answer & Explanation
Answer: B - Activated macrophages in granulomas express 1-alpha-hydroxylase, producing excess calcitriol
The 1-alpha-hydroxylase enzyme is normally expressed in renal proximal tubules (under tight regulation). However, in granulomatous diseases (sarcoidosis, tuberculosis, lymphoma), activated macrophages in granulomas also express 1-alpha-hydroxylase - but this extrarenal enzyme is NOT regulated by the normal feedback mechanisms.
Result: uncontrolled calcitriol overproduction → hypercalcemia (a classic exam scenario).

Q25. Which of the following statements about Vitamin D is CORRECT?
  • A) Vitamin D is water-soluble and requires no transport protein
  • B) The liver is the site of final activation of Vitamin D
  • C) Calcitriol inhibits its own synthesis by suppressing PTH and inducing 24-hydroxylase
  • D) Excess sunlight causes Vitamin D toxicity
✅ Answer & Explanation
Answer: C - Calcitriol inhibits its own synthesis by suppressing PTH and inducing 24-hydroxylase
Calcitriol exerts negative feedback by:
  1. Directly suppressing PTH secretion from the parathyroid gland (removing the main stimulator of 1-alpha-hydroxylase)
  2. Inducing 24-hydroxylase (CYP24A1) → accelerating its own degradation to inactive 1,24,25(OH)₃D3
Why other options are wrong:
  • A: Vitamin D is fat-soluble, transported by DBP
  • B: The kidney is the site of final (1-alpha) activation; the liver does the first (25) hydroxylation
  • D: Excess sunlight does NOT cause toxicity due to skin's photodegradation safety mechanism

Quick Score Sheet

QAnswerTopic
1BProvitamin in skin
2DActive form name
3DClassification
4CSource of ergosterol
5CTransport protein
6BFirst hydroxylation
7CRenal activation enzyme
8CClinical assessment marker
9B24-hydroxylase role
10DStimulator of 1-alpha-hydroxylase
11CFGF-23 role
12CHalf-life of calcidiol
13CVDR class
14CVDR heterodimerization
15BCalbindin-D
16BDeficiency in children
17CRachitic rosary
18CLab finding in deficiency
19BSecondary hyperPTH
20BToxicity cause
21BCKD bone disease
22BDrug-induced deficiency
23CBest investigation
24BSarcoidosis hypercalcemia
25CNegative feedback

Study tip: For exams, focus especially on: the two-step hydroxylation pathway (liver → kidney), regulation of 1-alpha-hydroxylase, calcitriol mechanism via VDR-RXR, and the clinical differences between rickets (children) and osteomalacia (adults). Questions 6-15 are highest yield for MBBS exams.

Create a study guide PDF on Vitamin D with key facts and diagrams

Reading File
Running Command

mkdir -p /tmp/workspace/vitamin-d-guide && ls /tmp/workspace/vitamin-d-guide/

Writing File

~/vitamin-d-guide/create_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, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.platypus.flowables import Flowable
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Arrow, Circle, Polygon
from reportlab.graphics import renderPDF
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Group
import reportlab.graphics.shapes as shapes

# ── Color palette ──────────────────────────────────────────────────────────
SUN_YELLOW    = colors.HexColor("#F5A623")
SKIN_PEACH    = colors.HexColor("#FFD9B3")
LIVER_RED     = colors.HexColor("#C0392B")
KIDNEY_BROWN  = colors.HexColor("#8E4B10")
ARROW_GREEN   = colors.HexColor("#27AE60")
ARROW_RED     = colors.HexColor("#E74C3C")
BOX_BLUE      = colors.HexColor("#2980B9")
BOX_LIGHT     = colors.HexColor("#EAF4FB")
HEADER_DARK   = colors.HexColor("#1A3A5C")
HEADER_MED    = colors.HexColor("#2471A3")
ACCENT_TEAL   = colors.HexColor("#1ABC9C")
WARN_ORANGE   = colors.HexColor("#E67E22")
LIGHT_GREY    = colors.HexColor("#F2F3F4")
TABLE_HEADER  = colors.HexColor("#1A3A5C")
TABLE_ALT     = colors.HexColor("#D6EAF8")
PAGE_BG       = colors.white


# ── Page setup ─────────────────────────────────────────────────────────────
PAGE_W, PAGE_H = A4
MARGIN = 1.8 * cm

doc = SimpleDocTemplate(
    "/tmp/workspace/vitamin-d-guide/Vitamin_D_Study_Guide.pdf",
    pagesize=A4,
    leftMargin=MARGIN, rightMargin=MARGIN,
    topMargin=MARGIN, bottomMargin=1.5*cm,
    title="Vitamin D – MBBS Biochemistry Study Guide",
    author="Orris Medical",
)

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

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

title_style = S("Title2", fontSize=26, textColor=colors.white,
                alignment=TA_CENTER, fontName="Helvetica-Bold",
                spaceAfter=4, leading=30)
subtitle_style = S("Subtitle", fontSize=13, textColor=colors.HexColor("#D6EAF8"),
                   alignment=TA_CENTER, fontName="Helvetica", spaceAfter=6)
h1 = S("H1", fontSize=14, textColor=colors.white, fontName="Helvetica-Bold",
        spaceBefore=10, spaceAfter=4, leading=18,
        backColor=HEADER_DARK, borderPad=6)
h2 = S("H2", fontSize=12, textColor=HEADER_DARK, fontName="Helvetica-Bold",
        spaceBefore=8, spaceAfter=3, leading=16,
        borderColor=ACCENT_TEAL, borderWidth=0, leftIndent=0)
body = S("Body2", fontSize=9.5, textColor=colors.HexColor("#2C3E50"),
          fontName="Helvetica", spaceAfter=4, leading=14, alignment=TA_JUSTIFY)
bullet = S("Bullet2", fontSize=9.5, textColor=colors.HexColor("#2C3E50"),
           fontName="Helvetica", spaceAfter=3, leading=14,
           leftIndent=14, bulletIndent=4)
bold_body = S("BoldBody", fontSize=9.5, textColor=HEADER_DARK,
              fontName="Helvetica-Bold", spaceAfter=3, leading=14)
small = S("Small", fontSize=8, textColor=colors.grey,
          fontName="Helvetica", spaceAfter=2, leading=11)
caption = S("Caption", fontSize=8, textColor=colors.HexColor("#5D6D7E"),
            fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=4)
key_fact = S("KeyFact", fontSize=9.5, textColor=colors.HexColor("#1A3A5C"),
             fontName="Helvetica-Bold", spaceAfter=3, leading=14,
             backColor=colors.HexColor("#FEF9E7"),
             borderColor=WARN_ORANGE, borderWidth=1, borderPad=5,
             leftIndent=6)
mcq_q = S("McqQ", fontSize=9.5, textColor=HEADER_DARK, fontName="Helvetica-Bold",
           spaceAfter=2, leading=14)
mcq_a = S("McqA", fontSize=9, textColor=colors.HexColor("#1D8348"),
           fontName="Helvetica-Bold", spaceAfter=1, leading=13)
mcq_opt = S("McqOpt", fontSize=9, textColor=colors.HexColor("#2C3E50"),
             fontName="Helvetica", spaceAfter=1, leading=13, leftIndent=10)

# ── Helper flowables ────────────────────────────────────────────────────────
def section_header(text):
    """Coloured section banner."""
    data = [[Paragraph(f"<font color='white'><b>{text}</b></font>", h1)]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), HEADER_DARK),
        ("TOPPADDING",    (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

def sub_header(text):
    data = [[Paragraph(f"<b>{text}</b>", S("sh", fontSize=11,
                textColor=colors.white, fontName="Helvetica-Bold",
                leading=15))]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), HEADER_MED),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
    ]))
    return t

def info_box(text, bg=BOX_LIGHT, border=BOX_BLUE):
    data = [[Paragraph(text, S("ib", fontSize=9.5, fontName="Helvetica",
                               textColor=HEADER_DARK, leading=14))]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), bg),
        ("BOX",           (0,0), (-1,-1), 1.5, border),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return t

def warning_box(text):
    return info_box(text, bg=colors.HexColor("#FEF9E7"), border=WARN_ORANGE)

def danger_box(text):
    return info_box(text, bg=colors.HexColor("#FDEDEC"), border=ARROW_RED)

def sp(n=1):
    return Spacer(1, n * 4)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#AED6F1"),
                      spaceAfter=4, spaceBefore=4)

# ── Metabolism Pathway Diagram ───────────────────────────────────────────────
class MetabolismDiagram(Flowable):
    def __init__(self, width, height):
        Flowable.__init__(self)
        self.width  = width
        self.height = height

    def draw(self):
        c = self.canv
        w, h = self.width, self.height

        # Background
        c.setFillColor(colors.HexColor("#F8FBFF"))
        c.setStrokeColor(colors.HexColor("#AED6F1"))
        c.setLineWidth(1)
        c.roundRect(0, 0, w, h, 8, fill=1, stroke=1)

        # Title
        c.setFillColor(HEADER_DARK)
        c.setFont("Helvetica-Bold", 11)
        c.drawCentredString(w/2, h - 20, "Vitamin D Metabolism Pathway")

        # ── Box positions (x_center, y_center) ──
        box_w, box_h = 130, 36
        bh = box_h

        # Row y positions
        y1 = h - 60   # Skin (7-DHC + UV) and Diet
        y2 = h - 140  # Cholecalciferol
        y3 = h - 220  # Liver → Calcidiol
        y4 = h - 300  # Kidney → Calcitriol
        y5 = h - 380  # Active & Inactive branches

        cx = w / 2  # center X

        def draw_box(cx_, cy_, label, sub="", color=BOX_BLUE, text_col=colors.white):
            c.setFillColor(color)
            c.setStrokeColor(colors.HexColor("#1A3A5C"))
            c.setLineWidth(0.8)
            c.roundRect(cx_ - box_w/2, cy_ - bh/2, box_w, bh, 6, fill=1, stroke=1)
            c.setFillColor(text_col)
            c.setFont("Helvetica-Bold", 9)
            c.drawCentredString(cx_, cy_ + (6 if sub else 0), label)
            if sub:
                c.setFont("Helvetica-Oblique", 7.5)
                c.drawCentredString(cx_, cy_ - 9, sub)

        def draw_arrow(x1, y1_, x2, y2_, col=ARROW_GREEN, label="", label_side="right"):
            c.setStrokeColor(col)
            c.setLineWidth(1.8)
            c.line(x1, y1_, x2, y2_)
            # Arrowhead
            import math
            angle = math.atan2(y2_ - y1_, x2 - x1)
            aw = 7
            c.setFillColor(col)
            c.setStrokeColor(col)
            ax = x2 - aw * math.cos(angle)
            ay = y2_ - aw * math.sin(angle)
            pts = [
                (x2, y2_),
                (ax + 4*math.sin(angle), ay - 4*math.cos(angle)),
                (ax - 4*math.sin(angle), ay + 4*math.cos(angle)),
            ]
            p = c.beginPath()
            p.moveTo(*pts[0]); p.lineTo(*pts[1]); p.lineTo(*pts[2]); p.close()
            c.drawPath(p, fill=1, stroke=0)
            if label:
                c.setFont("Helvetica-Oblique", 7.5)
                c.setFillColor(colors.HexColor("#5D6D7E"))
                lx = (x1+x2)/2 + (10 if label_side == "right" else -60)
                ly = (y1_+y2_)/2
                c.drawString(lx, ly, label)

        # ── Step 0: SUN + SKIN box ──
        # Sun symbol
        c.setFillColor(SUN_YELLOW)
        c.setStrokeColor(colors.HexColor("#E67E22"))
        c.setLineWidth(1)
        sun_x, sun_y = cx - 145, y1
        c.circle(sun_x, sun_y, 14, fill=1, stroke=1)
        c.setFont("Helvetica-Bold", 8)
        c.setFillColor(colors.white)
        c.drawCentredString(sun_x, sun_y - 3, "UV-B")
        # Sun rays
        c.setStrokeColor(SUN_YELLOW)
        c.setLineWidth(1.5)
        import math
        for i in range(8):
            ang = math.radians(i * 45)
            c.line(sun_x + 16*math.cos(ang), sun_y + 16*math.sin(ang),
                   sun_x + 22*math.cos(ang), sun_y + 22*math.sin(ang))

        # Skin box
        draw_box(cx, y1, "SKIN", "7-Dehydrocholesterol + UV-B", color=SKIN_PEACH,
                 text_col=HEADER_DARK)

        # Diet box (left side)
        draw_box(cx - 180, y2, "DIET / SUPPLEMENTS",
                 "Vit D2 (ergocalciferol) / D3", color=colors.HexColor("#D5F5E3"),
                 text_col=HEADER_DARK)

        # ── Cholecalciferol ──
        draw_box(cx, y2, "Cholecalciferol", "(Vitamin D3 – Inactive)",
                 color=colors.HexColor("#F9E79F"), text_col=HEADER_DARK)

        # ── Arrows: Skin → Cholecalciferol ──
        draw_arrow(cx, y1 - bh/2, cx, y2 + bh/2, col=ARROW_GREEN,
                   label="Photolysis + isomerization")

        # ── Arrow: Diet → Cholecalciferol ──
        draw_arrow(cx - 180 + box_w/2, y2, cx - box_w/2, y2,
                   col=colors.HexColor("#1ABC9C"), label="gut absorption")

        # ── LIVER box ──
        draw_box(cx, y3, "LIVER  →  Calcidiol",
                 "25(OH)D3  |  t½ ≈ 19 days  |  Storage form",
                 color=LIVER_RED, text_col=colors.white)
        draw_arrow(cx, y2 - bh/2, cx, y3 + bh/2, col=ARROW_GREEN,
                   label="25-hydroxylase (CYP27A1)")

        # ── KIDNEY box ──
        draw_box(cx, y4, "KIDNEY  →  Calcitriol",
                 "1,25(OH)₂D3  |  Active Hormone",
                 color=KIDNEY_BROWN, text_col=colors.white)
        draw_arrow(cx, y3 - bh/2, cx, y4 + bh/2, col=ARROW_GREEN,
                   label="1α-hydroxylase (CYP27B1)")

        # ── Regulation arrows on the right ──
        # PTH stimulates (green dashed-like)
        reg_x = cx + 175
        c.setFillColor(ARROW_GREEN)
        c.setFont("Helvetica-Bold", 8)
        c.drawString(reg_x - 10, (y3 + y4)/2 + 15, "PTH ↑")
        c.setFont("Helvetica", 7.5)
        c.setFillColor(colors.HexColor("#5D6D7E"))
        c.drawString(reg_x - 10, (y3 + y4)/2 + 4, "↓Ca stimulates")
        # Inhibitory: FGF23, Calcitriol
        c.setFillColor(ARROW_RED)
        c.setFont("Helvetica-Bold", 8)
        c.drawString(reg_x - 10, (y3 + y4)/2 - 10, "FGF23 ↓")
        c.drawString(reg_x - 10, (y3 + y4)/2 - 22, "Calcitriol ↓")
        c.setFont("Helvetica", 7.5)
        c.setFillColor(colors.HexColor("#5D6D7E"))
        c.drawString(reg_x - 10, (y3 + y4)/2 - 34, "(feedback inhibition)")

        # ── Active actions ──
        eff_y = y4 - bh/2 - 30
        # Intestine, Bone, Kidney boxes
        locs = [
            (cx - 165, eff_y, "INTESTINE", "↑ Ca²⁺ absorption\n(Calbindin-D)", colors.HexColor("#1ABC9C")),
            (cx,       eff_y, "BONE",      "Mineralization\n↑ Osteocalcin",   colors.HexColor("#2471A3")),
            (cx + 165, eff_y, "KIDNEY",    "↑ Ca/PO₄ reabsorption",          colors.HexColor("#8E44AD")),
        ]
        for lx, ly, lbl, lsub, lcol in locs:
            draw_box(lx, ly, lbl, lsub, color=lcol)
            draw_arrow(cx, y4 - bh/2, lx, ly + bh/2, col=colors.HexColor("#5D6D7E"))

        # ── 24-hydroxylase inactivation (right branch from kidney) ──
        inact_x = cx + 165
        inact_y = y4
        # small inactivation label
        c.setFillColor(colors.HexColor("#FDEDEC"))
        c.setStrokeColor(ARROW_RED)
        c.setLineWidth(0.8)
        c.roundRect(inact_x - 55, inact_y + 22, 110, 26, 4, fill=1, stroke=1)
        c.setFillColor(ARROW_RED)
        c.setFont("Helvetica-Bold", 7.5)
        c.drawCentredString(inact_x, inact_y + 38, "24-hydroxylase (CYP24A1)")
        c.setFont("Helvetica", 7)
        c.setFillColor(colors.HexColor("#5D6D7E"))
        c.drawCentredString(inact_x, inact_y + 27, "→ Inactive metabolites")

        # Legend
        leg_y = 14
        c.setFont("Helvetica-Bold", 7.5)
        c.setFillColor(ARROW_GREEN); c.rect(10, leg_y, 10, 8, fill=1, stroke=0)
        c.setFillColor(colors.HexColor("#2C3E50")); c.drawString(24, leg_y+1, "Activation pathway")
        c.setFillColor(ARROW_RED);  c.rect(140, leg_y, 10, 8, fill=1, stroke=0)
        c.setFillColor(colors.HexColor("#2C3E50")); c.drawString(154, leg_y+1, "Inhibition / Inactivation")
        c.setFillColor(ARROW_GREEN); c.rect(300, leg_y, 10, 8, fill=1, stroke=0)
        c.setFillColor(colors.HexColor("#2C3E50")); c.drawString(314, leg_y+1, "Stimulation (PTH)")


# ── Calcium Homeostasis Diagram ──────────────────────────────────────────────
class CalciumDiagram(Flowable):
    def __init__(self, width, height):
        Flowable.__init__(self)
        self.width = width
        self.height = height

    def draw(self):
        c = self.canv
        w, h = self.width, self.height

        c.setFillColor(colors.HexColor("#F0FAF5"))
        c.setStrokeColor(ACCENT_TEAL)
        c.setLineWidth(1)
        c.roundRect(0, 0, w, h, 8, fill=1, stroke=1)

        c.setFillColor(HEADER_DARK)
        c.setFont("Helvetica-Bold", 11)
        c.drawCentredString(w/2, h - 20, "Calcium Homeostasis: Role of Calcitriol, PTH & Calcitonin")

        box_w, box_h = 110, 32

        def box(cx_, cy_, txt, col, tcol=colors.white, sub=""):
            c.setFillColor(col); c.setStrokeColor(HEADER_DARK); c.setLineWidth(0.8)
            c.roundRect(cx_ - box_w/2, cy_ - box_h/2, box_w, box_h, 5, fill=1, stroke=1)
            c.setFillColor(tcol)
            c.setFont("Helvetica-Bold", 8.5)
            c.drawCentredString(cx_, cy_ + (5 if sub else 0), txt)
            if sub:
                c.setFont("Helvetica", 7)
                c.drawCentredString(cx_, cy_ - 7, sub)

        import math
        def arrow(x1, y1_, x2, y2_, col=ARROW_GREEN, lbl=""):
            c.setStrokeColor(col); c.setLineWidth(1.6)
            c.line(x1, y1_, x2, y2_)
            angle = math.atan2(y2_ - y1_, x2 - x1)
            aw = 7
            ax = x2 - aw * math.cos(angle); ay = y2_ - aw * math.sin(angle)
            pts = [(x2, y2_),
                   (ax + 4*math.sin(angle), ay - 4*math.cos(angle)),
                   (ax - 4*math.sin(angle), ay + 4*math.cos(angle))]
            p = c.beginPath(); p.moveTo(*pts[0]); p.lineTo(*pts[1]); p.lineTo(*pts[2]); p.close()
            c.setFillColor(col); c.drawPath(p, fill=1, stroke=0)
            if lbl:
                c.setFont("Helvetica-Oblique", 7)
                c.setFillColor(colors.HexColor("#5D6D7E"))
                mx, my = (x1+x2)/2, (y1_+y2_)/2
                c.drawCentredString(mx, my + 4, lbl)

        mid = w / 2
        # Serum Ca centre
        box(mid, h/2, "Serum Ca²⁺", colors.HexColor("#2980B9"), sub="Normal: 8.5-10.5 mg/dL")

        # Low Ca → PTH
        box(mid - 190, h/2 + 40, "Parathyroid", LIVER_RED, sub="PTH secreted")
        arrow(mid - box_w/2, h/2 + 5, mid - 190 + box_w/2, h/2 + 40, col=ARROW_RED, lbl="↓Ca → PTH↑")

        # PTH → Kidney (1α-OH)
        box(mid - 190, h/2 - 70, "KIDNEY", KIDNEY_BROWN, sub="1α-OH activated")
        arrow(mid - 190, h/2 + 40 - box_h/2, mid - 190, h/2 - 70 + box_h/2, col=ARROW_GREEN, lbl="PTH stimulates")

        # Kidney → Calcitriol
        box(mid, h/2 - 130, "Calcitriol", colors.HexColor("#8E44AD"), sub="1,25(OH)₂D3")
        arrow(mid - 190 + box_w/2, h/2 - 70, mid - box_w/2, h/2 - 130 + box_h/2, col=ARROW_GREEN)

        # Calcitriol → Intestine
        box(mid + 180, h/2 - 70, "INTESTINE", ACCENT_TEAL, sub="↑ Ca absorption")
        arrow(mid + box_w/2, h/2 - 130, mid + 180 - box_w/2, h/2 - 70 + box_h/2, col=ARROW_GREEN, lbl="↑ Calbindin-D")

        # Intestine → Serum Ca
        arrow(mid + 180, h/2 - 70 + box_h/2, mid + box_w/2, h/2 - 5, col=ARROW_GREEN, lbl="Ca²⁺ absorbed")

        # High Ca → Calcitonin
        box(mid + 180, h/2 + 50, "Calcitonin", colors.HexColor("#16A085"), sub="(C cells, Thyroid)")
        arrow(mid + box_w/2, h/2 + 10, mid + 180 - box_w/2, h/2 + 50, col=ARROW_RED, lbl="↑Ca → Calcitonin↑")

        # Calcitonin → Bone (inhibits resorption)
        box(mid + 180, h/2 + 130, "BONE", colors.HexColor("#2471A3"), sub="↓ Osteoclast activity")
        arrow(mid + 180, h/2 + 50 + box_h/2, mid + 180, h/2 + 130 - box_h/2, col=ARROW_RED, lbl="↓ Resorption")

        # PTH → Bone resorption
        box(mid - 190, h/2 + 130, "BONE", colors.HexColor("#E74C3C"), sub="↑ Osteoclast activity")
        arrow(mid - 190, h/2 + 40 + box_h/2, mid - 190, h/2 + 130 - box_h/2, col=ARROW_GREEN, lbl="PTH → resorption")

        # Caption
        c.setFont("Helvetica-Oblique", 7.5)
        c.setFillColor(colors.HexColor("#5D6D7E"))
        c.drawCentredString(w/2, 10, "Green arrows = stimulation/activation   |   Red arrows = response to hypercalcemia / inhibition")


# ── Cover page ───────────────────────────────────────────────────────────────
class CoverPage(Flowable):
    def __init__(self, w, h):
        Flowable.__init__(self)
        self.width = w
        self.height = h

    def draw(self):
        c = self.canv
        w, h = self.width, self.height

        # Gradient-like background (two rectangles)
        c.setFillColor(HEADER_DARK)
        c.rect(0, h*0.45, w, h*0.55, fill=1, stroke=0)
        c.setFillColor(colors.HexColor("#2471A3"))
        c.rect(0, 0, w, h*0.45, fill=1, stroke=0)

        # Sun illustration
        import math
        sun_x, sun_y, sun_r = w*0.82, h*0.78, 48
        c.setFillColor(SUN_YELLOW); c.setStrokeColor(colors.HexColor("#F39C12"))
        c.setLineWidth(2)
        c.circle(sun_x, sun_y, sun_r, fill=1, stroke=1)
        c.setFont("Helvetica-Bold", 10); c.setFillColor(colors.white)
        c.drawCentredString(sun_x, sun_y + 3, "UV-B")
        for i in range(12):
            ang = math.radians(i * 30)
            c.setStrokeColor(SUN_YELLOW); c.setLineWidth(2)
            c.line(sun_x + (sun_r+6)*math.cos(ang), sun_y + (sun_r+6)*math.sin(ang),
                   sun_x + (sun_r+16)*math.cos(ang), sun_y + (sun_r+16)*math.sin(ang))

        # Title text
        c.setFillColor(colors.white)
        c.setFont("Helvetica-Bold", 32)
        c.drawCentredString(w/2, h*0.72, "VITAMIN D")
        c.setFont("Helvetica-Bold", 18)
        c.setFillColor(colors.HexColor("#AED6F1"))
        c.drawCentredString(w/2, h*0.66, "Biochemistry Study Guide")
        c.setFont("Helvetica", 13)
        c.setFillColor(colors.HexColor("#D6EAF8"))
        c.drawCentredString(w/2, h*0.61, "MBBS First Year  |  Complete LAQ & MCQ Reference")

        # Divider line
        c.setStrokeColor(ACCENT_TEAL); c.setLineWidth(2)
        c.line(w*0.15, h*0.58, w*0.85, h*0.58)

        # Key topics in the lower half
        topics = [
            "✦  Chemistry & Forms",
            "✦  Synthesis Pathway (Skin → Liver → Kidney)",
            "✦  Metabolic Activation & Regulation",
            "✦  Mechanism of Action via VDR-RXR",
            "✦  Functions & Calcium Homeostasis",
            "✦  Deficiency: Rickets & Osteomalacia",
            "✦  Toxicity & Clinical Pearls",
        ]
        c.setFont("Helvetica", 11)
        c.setFillColor(colors.white)
        for i, t in enumerate(topics):
            c.drawCentredString(w/2, h*0.52 - i*22, t)

        # Footer
        c.setFont("Helvetica-Oblique", 9)
        c.setFillColor(colors.HexColor("#AED6F1"))
        c.drawCentredString(w/2, 28, "Orris Medical Education  ·  Sources: Goodman & Gilman, Harrison's, Harper's Biochemistry")
        c.drawCentredString(w/2, 16, "For educational purposes only – not a substitute for clinical judgment")


# ──────────────────────────────────────────────────────────────────────────────
# BUILD CONTENT
# ──────────────────────────────────────────────────────────────────────────────
story = []

# ── COVER ──
cover = CoverPage(PAGE_W - 2*MARGIN, PAGE_H - 2*MARGIN)
story.append(cover)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════
# SECTION 1: INTRODUCTION & CHEMISTRY
# ══════════════════════════════════════════════════════════════
story.append(section_header("1.  Introduction & Chemistry"))
story.append(sp(2))

story.append(Paragraph(
    "Vitamin D is technically a <b>steroid hormone precursor</b> rather than a true dietary vitamin, "
    "because under adequate sunlight exposure the human body can synthesise it entirely endogenously. "
    "It belongs to the fat-soluble vitamin group (A, D, E, K) and its primary biological role is in "
    "<b>calcium and phosphate homeostasis</b>, bone mineralisation, and immune modulation.",
    body))
story.append(sp())

# Forms table
story.append(sub_header("Forms of Vitamin D"))
story.append(sp(1))
forms_data = [
    ["Form", "Chemical Name", "Source", "Notes"],
    ["Vitamin D2", "Ergocalciferol", "Plants, fungi, fortified foods", "Provitamin: Ergosterol"],
    ["Vitamin D3", "Cholecalciferol", "Animal tissues, skin synthesis", "Provitamin: 7-Dehydrocholesterol"],
    ["Calcidiol (25-OHD)", "25-Hydroxycholecalciferol", "Liver (first hydroxylation)", "Major circulating / storage form"],
    ["Calcitriol", "1,25-Dihydroxycholecalciferol", "Kidney (second hydroxylation)", "ACTIVE HORMONE ← most important"],
    ["Calcitroic acid", "Degradation product", "Tissues (24-hydroxylase)", "Inactive – excreted in bile"],
]
ft = Table(forms_data, colWidths=[95, 130, 130, 130])
ft.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("BACKGROUND",    (0,5), (-1,5),  colors.HexColor("#FDEDEC")),
    ("FONTNAME",      (3,1), (3,1),   "Helvetica"),
    ("FONTNAME",      (3,4), (3,4),   "Helvetica-Bold"),
    ("TEXTCOLOR",     (3,4), (3,4),   LIVER_RED),
]))
story.append(ft)
story.append(sp(2))

story.append(warning_box(
    "<b>Key Fact:</b>  Vitamin D3 has ~10× greater biological potency than D2 due to a longer "
    "half-life and higher affinity for Vitamin D-binding protein (DBP)."
))
story.append(sp(2))

# Sources
story.append(sub_header("Sources of Vitamin D"))
story.append(sp(1))
src_data = [
    ["Source", "Detail"],
    ["Sunlight (endogenous)", "UV-B (290–315 nm) photolyses 7-dehydrocholesterol in skin → pre-vitamin D3 → Cholecalciferol (heat-isomerisation)"],
    ["Dietary (animal)", "Fish liver oil (cod, tuna), egg yolk, butter, liver, fatty fish"],
    ["Dietary (plant)", "Mushrooms (ergocalciferol after UV exposure), fortified cereals and milk"],
    ["Supplements", "Available as D2 (ergocalciferol) or D3 (cholecalciferol) capsules"],
]
st = Table(src_data, colWidths=[120, 365])
st.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  HEADER_MED),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
]))
story.append(st)
story.append(sp(2))

# ══════════════════════════════════════════════════════════════
# SECTION 2: METABOLISM PATHWAY
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("2.  Synthesis & Metabolic Activation Pathway"))
story.append(sp(2))

# Insert the big diagram
diag = MetabolismDiagram(PAGE_W - 2*MARGIN, 430)
story.append(diag)
story.append(sp(1))
story.append(Paragraph(
    "<i>Figure 1. Vitamin D metabolism: Skin photosynthesis or dietary absorption → "
    "25-hydroxylation in liver (CYP27A1) → 1α-hydroxylation in kidney (CYP27B1) → "
    "active calcitriol → organ effects. Inactivation by 24-hydroxylase (CYP24A1).</i>",
    caption))
story.append(sp(2))

# Enzyme table
story.append(sub_header("Key Enzymes in Vitamin D Metabolism"))
story.append(sp(1))
enz_data = [
    ["Enzyme", "Gene", "Location", "Reaction", "Regulation"],
    ["25-hydroxylase", "CYP27A1 / CYP2R1", "Liver (microsomes + mitochondria)", "Vit D3 → Calcidiol (25-OHD)", "NOT tightly regulated"],
    ["1α-hydroxylase", "CYP27B1", "Kidney – proximal convoluted tubule", "Calcidiol → Calcitriol", "TIGHTLY REGULATED ★"],
    ["24-hydroxylase", "CYP24A1", "Kidney, intestine, other tissues", "Calcidiol → 24,25(OH)₂D3 (inactive)\nCalcitriol → 1,24,25(OH)₃D3 (inactive)", "Induced by Calcitriol & FGF23"],
]
et = Table(enz_data, colWidths=[90, 70, 110, 120, 100])
et.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("TEXTCOLOR",     (0,0), (-1,0),  colors.white),
    ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 8),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 5),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ("FONTNAME",      (4,2), (4,2),   "Helvetica-Bold"),
    ("TEXTCOLOR",     (4,2), (4,2),   LIVER_RED),
]))
story.append(et)
story.append(sp(2))

# Regulation box
story.append(sub_header("Regulation of 1α-Hydroxylase (CYP27B1) — KEY EXAM TOPIC"))
story.append(sp(1))
reg_data = [
    ["STIMULATORS (↑ calcitriol production)", "INHIBITORS (↓ calcitriol production)"],
    [
        "• Parathyroid hormone (PTH) — MAIN stimulator\n"
        "• Hypocalcemia (↓ serum Ca²⁺)\n"
        "• Hypophosphatemia (↓ serum PO₄)\n"
        "• Prolactin, Growth hormone (minor)",
        "• Calcitriol itself (product/feedback inhibition)\n"
        "• FGF-23 (fibroblast growth factor-23) from osteocytes\n"
        "• Hypercalcemia\n"
        "• Hyperphosphatemia\n"
        "• Calcitonin (weak)"
    ],
]
rt = Table(reg_data, colWidths=[240, 245])
rt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (0,0),  colors.HexColor("#D5F5E3")),
    ("BACKGROUND",    (1,0), (1,0),  colors.HexColor("#FDEDEC")),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 8.5),
    ("GRID",          (0,0), (-1,-1), 0.8, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 7),
    ("BOTTOMPADDING", (0,0), (-1,-1), 7),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ("FONTSIZE",      (0,1), (-1,1), 8.5),
]))
story.append(rt)
story.append(sp(2))

story.append(warning_box(
    "<b>Memory Tip:</b>  PTH <b>turns ON</b> the kidney hydroxylase. "
    "FGF-23 and calcitriol (product) <b>turn it OFF</b>. "
    "Think: when calcium is low → PTH rises → kidney makes more calcitriol → gut absorbs more calcium. "
    "When enough calcium restored → calcitriol feeds back to suppress PTH and its own synthesis."
))

# ══════════════════════════════════════════════════════════════
# SECTION 3: MECHANISM OF ACTION
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("3.  Mechanism of Action — VDR Nuclear Receptor"))
story.append(sp(2))

story.append(Paragraph(
    "Calcitriol is lipid-soluble and crosses the cell membrane freely. It acts through the "
    "<b>Vitamin D Receptor (VDR)</b>, a member of the nuclear receptor superfamily (same family as "
    "steroid hormone, thyroid hormone, and retinoic acid receptors).",
    body))
story.append(sp(1))

moa_steps = [
    ("Step 1", "Calcitriol diffuses into the target cell across the plasma membrane (lipid-soluble)."),
    ("Step 2", "Binds the intracellular Vitamin D Receptor (VDR) with high affinity."),
    ("Step 3", "VDR-calcitriol complex heterodimerises with Retinoid X Receptor (RXR), which requires 9-cis-retinoic acid (Vitamin A metabolite) as its ligand."),
    ("Step 4", "VDR–RXR heterodimer translocates to the nucleus and binds Vitamin D Response Elements (VDREs) on target gene DNA."),
    ("Step 5", "Recruits co-activator proteins → chromatin remodelling → transcription activation."),
    ("Step 6", "Target genes are expressed: Calbindin-D, Ca²⁺-ATPase, osteocalcin, etc."),
]
moa_data = [[Paragraph(f"<b>{s}</b>", bold_body), Paragraph(d, body)] for s, d in moa_steps]
mt = Table(moa_data, colWidths=[55, 430])
mt.setStyle(TableStyle([
    ("ROWBACKGROUNDS",  (0,0), (-1,-1), [colors.HexColor("#EAF4FB"), colors.white]),
    ("GRID",            (0,0), (-1,-1), 0.3, colors.HexColor("#AED6F1")),
    ("TOPPADDING",      (0,0), (-1,-1), 5),
    ("BOTTOMPADDING",   (0,0), (-1,-1), 5),
    ("LEFTPADDING",     (0,0), (-1,-1), 6),
    ("VALIGN",          (0,0), (-1,-1), "TOP"),
]))
story.append(mt)
story.append(sp(2))

story.append(info_box(
    "<b>Vitamin A & D Interaction:</b>  RXR needs 9-cis-retinoic acid (a Vitamin A derivative) to form the "
    "heterodimer with VDR. Therefore <b>Vitamin A deficiency impairs Vitamin D signalling</b> even when "
    "calcitriol levels are normal — because RXR cannot bind DNA without its own ligand. "
    "Conversely, excess Vitamin A forms RXR homodimers, leaving no RXR free to partner with VDR."
))
story.append(sp(2))

# VDR distribution
story.append(sub_header("VDR Distribution and Extra-Skeletal Effects"))
story.append(sp(1))
vdr_data = [
    ["Tissue / Organ", "Effect of Calcitriol"],
    ["Small intestine (duodenum)", "↑ Calbindin-D9K & D28K → transcellular Ca²⁺ absorption (PRIMARY function)"],
    ["Kidney (distal tubule)", "↑ Ca²⁺ and PO₄ reabsorption"],
    ["Bone (osteoblasts)", "↑ Osteocalcin, bone matrix proteins; at high doses → ↑ osteoclastogenesis"],
    ["Parathyroid glands", "↓ PTH gene transcription (negative feedback)"],
    ["Skin (keratinocytes)", "↓ Proliferation, ↑ differentiation → used in psoriasis treatment (calcipotriol)"],
    ["Immune cells (monocytes, T-cells)", "↑ Macrophage maturation; immunomodulation; ↓ autoimmunity"],
    ["Muscle", "Maintains muscle function; deficiency → proximal myopathy"],
    ["Pancreas (β-cells)", "Insulin secretion support; VDD linked to type 2 DM risk"],
]
vt = Table(vdr_data, colWidths=[160, 325])
vt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("FONTNAME",      (0,1), (0,-1),  "Helvetica-Bold"),
]))
story.append(vt)

# ══════════════════════════════════════════════════════════════
# SECTION 4: CALCIUM HOMEOSTASIS
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("4.  Calcium Homeostasis Diagram"))
story.append(sp(2))

cal_diag = CalciumDiagram(PAGE_W - 2*MARGIN, 360)
story.append(cal_diag)
story.append(sp(1))
story.append(Paragraph(
    "<i>Figure 2. Calcium homeostasis loop. Low serum Ca²⁺ → PTH ↑ → 1α-hydroxylase activation → "
    "calcitriol ↑ → intestinal absorption ↑ → Ca²⁺ restored. High Ca²⁺ → calcitonin released → "
    "osteoclast inhibition → Ca²⁺ lowered.</i>",
    caption))
story.append(sp(2))

# Three hormones compare
story.append(sub_header("Comparison: PTH vs Calcitriol vs Calcitonin"))
story.append(sp(1))
comp_data = [
    ["Parameter", "PTH", "Calcitriol (Active Vit D)", "Calcitonin"],
    ["Secreted by", "Parathyroid chief cells", "Produced in kidney", "Thyroid C cells (parafollicular)"],
    ["Stimulus", "↓ Ca²⁺, ↓ Mg²⁺", "PTH, ↓ Ca²⁺, ↓ PO₄", "↑ Ca²⁺"],
    ["Effect on serum Ca", "↑ (raises Ca)", "↑ (raises Ca)", "↓ (lowers Ca)"],
    ["Effect on bone", "↑ Resorption (osteoclast)", "Mineralisation; mobilises Ca at high dose", "↓ Resorption (osteoclast inhibition)"],
    ["Effect on kidney", "↑ Ca reabsorption, ↓ PO₄ reabsorption (phosphaturia)", "↑ Ca + PO₄ reabsorption", "Minor"],
    ["Effect on gut", "Indirect (via calcitriol)", "↑↑ Ca + PO₄ absorption (MAIN effect)", "Minimal"],
    ["Half-life", "Minutes", "4–6 hours", "Minutes"],
]
ct = Table(comp_data, colWidths=[90, 120, 130, 115])
ct.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("TEXTCOLOR",     (0,0), (-1,0),  colors.white),
    ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 8),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 5),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ("FONTNAME",      (0,1), (0,-1),  "Helvetica-Bold"),
]))
story.append(ct)

# ══════════════════════════════════════════════════════════════
# SECTION 5: DEFICIENCY
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("5.  Vitamin D Deficiency — Rickets & Osteomalacia"))
story.append(sp(2))

story.append(sub_header("Causes of Vitamin D Deficiency"))
story.append(sp(1))
cause_data = [
    ["Category", "Examples"],
    ["Inadequate sunlight", "Indoor lifestyle, dark skin (melanin blocks UV-B), high-latitude living, winter months, sunscreen overuse"],
    ["Low dietary intake", "Vegan diet (no fish/eggs), exclusively breastfed infants (human milk is poor in Vit D)"],
    ["Malabsorption", "Celiac disease, Crohn's disease, cystic fibrosis, short bowel syndrome (fat malabsorption)"],
    ["Liver disease", "↓ 25-hydroxylation (CYP27A1 impaired)"],
    ["Renal failure (CKD)", "↓ 1α-hydroxylation (CYP27B1 impaired) → renal osteodystrophy"],
    ["Drug-induced", "Phenytoin, phenobarbitone (induce CYP450 → accelerate Vit D catabolism) — give supplements!"],
    ["Hereditary", "Vit D-dependent rickets type 1 (CYP27B1 mutation), type 2 (VDR mutation)"],
    ["Increased metabolism", "Hyperthyroidism, hyperparathyroidism, sarcoidosis (excess 1α-hydroxylase in macrophages)"],
]
caut = Table(cause_data, colWidths=[130, 355])
caut.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("FONTNAME",      (0,1), (0,-1),  "Helvetica-Bold"),
]))
story.append(caut)
story.append(sp(2))

# Rickets vs Osteomalacia side-by-side
story.append(sub_header("Rickets (Children) vs Osteomalacia (Adults)"))
story.append(sp(1))
rv_data = [
    [Paragraph("<b>RICKETS</b>\n(Children — open growth plates)", 
               S("rh", fontSize=10, fontName="Helvetica-Bold", textColor=colors.white, alignment=TA_CENTER)),
     Paragraph("<b>OSTEOMALACIA</b>\n(Adults — closed growth plates)",
               S("rh2", fontSize=10, fontName="Helvetica-Bold", textColor=colors.white, alignment=TA_CENTER))],
    [
        Paragraph(
            "• <b>Craniotabes</b> — softening of skull bones (earliest sign)\n"
            "• <b>Frontal bossing</b> — square-shaped head\n"
            "• <b>Delayed fontanelle closure</b>\n"
            "• <b>Rachitic rosary</b> — enlarged costochondral junctions\n"
            "• <b>Harrison's sulcus</b> — horizontal groove along lower ribs\n"
            "• <b>Pigeon chest / pectus carinatum</b>\n"
            "• <b>Genu varum</b> (bow legs) or <b>Genu valgum</b> (knock knees)\n"
            "• Delayed dentition, pot-belly\n"
            "• X-ray: Cupped, frayed, widened epiphyses\n  ('paintbrush' / 'champagne glass' appearance)",
            S("ric", fontSize=8.5, fontName="Helvetica", leading=14, textColor=HEADER_DARK)),
        Paragraph(
            "• <b>Bone pain</b> and diffuse tenderness (especially pelvis, spine, femur)\n"
            "• <b>Proximal muscle weakness</b> — waddling gait\n"
            "• <b>Pathological fractures</b>\n"
            "• <b>Looser's zones (Milkman's fractures)</b> — "
              "pseudofractures on X-ray\n"
            "• Tetany if hypocalcaemia is severe\n"
            "• Pelvic deformity in women → difficult labour\n"
            "• X-ray: Generalised osteopenia, cortical thinning,\n  Looser's zones (pathognomonic)",
            S("ost", fontSize=8.5, fontName="Helvetica", leading=14, textColor=HEADER_DARK)),
    ],
]
rvt = Table(rv_data, colWidths=[242, 242])
rvt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (0,0),  LIVER_RED),
    ("BACKGROUND",    (1,0), (1,0),  KIDNEY_BROWN),
    ("BACKGROUND",    (0,1), (0,1),  colors.HexColor("#FDEDEC")),
    ("BACKGROUND",    (1,1), (1,1),  colors.HexColor("#FDFEFE")),
    ("GRID",          (0,0), (-1,-1), 0.8, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 8),
    ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
]))
story.append(rvt)
story.append(sp(2))

# Lab findings
story.append(sub_header("Laboratory Findings in Vitamin D Deficiency"))
story.append(sp(1))
lab_data = [
    ["Parameter", "Change", "Reason"],
    ["Serum 25(OH)D3 (calcidiol)", "↓↓  (< 20 ng/mL = deficient)", "Best diagnostic marker of body stores"],
    ["Serum Ca²⁺", "↓ or normal", "Compensated by secondary ↑PTH"],
    ["Serum Phosphate", "↓", "PTH causes phosphaturia"],
    ["Alkaline Phosphatase (ALP)", "↑↑ (MARKEDLY)", "Osteoblast overactivity trying to mineralise osteoid"],
    ["Parathyroid Hormone (PTH)", "↑↑ (secondary hyperPTH)", "Hypocalcaemia drives parathyroid"],
    ["Serum 1,25(OH)₂D3 (calcitriol)", "↓ in severe deficiency; may be normal early", "PTH can maintain calcitriol temporarily"],
    ["Urinary calcium", "↓ (hypocalciuria)", "Less gut absorption, kidney conserves Ca"],
]
lt = Table(lab_data, colWidths=[160, 120, 205])
lt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("BACKGROUND",    (0,4), (-1,4),  colors.HexColor("#FDFEFE")),
    ("FONTNAME",      (1,4), (1,4),   "Helvetica-Bold"),
    ("TEXTCOLOR",     (1,4), (1,4),   LIVER_RED),
]))
story.append(lt)

# ══════════════════════════════════════════════════════════════
# SECTION 6: TOXICITY & REQUIREMENTS
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("6.  Toxicity, Requirements & Clinical Pearls"))
story.append(sp(2))

# Daily requirements
story.append(sub_header("Daily Requirements (RDA)"))
story.append(sp(1))
rda_data = [
    ["Age Group", "RDA (IU/day)", "Note"],
    ["Infants (0-12 months)", "400 IU", "Supplement if breastfed"],
    ["Children & Adults (1-70 years)", "600 IU", "Standard recommendation"],
    ["Adults > 70 years", "800 IU", "Reduced skin synthesis with age"],
    ["Pregnancy & Lactation", "600 IU", "Monitor serum 25-OHD"],
    ["Tolerable Upper Limit (adults)", "4000 IU/day", "Above this: risk of toxicity"],
]
rdat = Table(rda_data, colWidths=[160, 100, 225])
rdat.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("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), [colors.white, TABLE_ALT]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("BACKGROUND",    (0,6), (-1,6),  colors.HexColor("#FDEDEC")),
    ("FONTNAME",      (0,6), (-1,6),  "Helvetica-Bold"),
]))
story.append(rdat)
story.append(sp(2))

# Toxicity
story.append(sub_header("Hypervitaminosis D (Vitamin D Toxicity)"))
story.append(sp(1))
story.append(info_box(
    "<b>Cause:</b> ALWAYS due to excessive oral supplementation (NOT sunlight). "
    "Sunlight causes photodegradation of excess pre-vitamin D3 to inactive lumisterol and tachysterol — "
    "a natural protective mechanism.\n\n"
    "<b>Mechanism:</b> Excess calcitriol → hypercalcaemia + hypercalciuria\n\n"
    "<b>Features:</b>  Nausea, vomiting, anorexia, polyuria, polydipsia, constipation, weakness, "
    "confusion. Metastatic calcification (kidneys, blood vessels, soft tissues). Renal stones → renal failure.\n\n"
    "<b>Lab:</b>  ↑↑ serum Ca²⁺,  ↑ urinary Ca,  ↑ 25-OHD,  ↓ PTH (suppressed)\n\n"
    "<b>Treatment:</b>  Stop supplements · restrict dietary calcium · IV fluids · furosemide (calciuresis) · "
    "glucocorticoids (↓ intestinal Ca absorption) · bisphosphonates if severe"
))
story.append(sp(2))

# Clinical pearls
story.append(sub_header("High-Yield Clinical Pearls for Exams"))
story.append(sp(1))
pearls = [
    ("Best marker of Vitamin D status", "Serum 25(OH)D3 (calcidiol) — NOT calcitriol"),
    ("Best marker of active function", "Serum 1,25(OH)₂D3 (calcitriol)"),
    ("Site of 25-hydroxylation", "Liver (CYP27A1) — NOT regulated"),
    ("Site of 1α-hydroxylation", "Kidney PCT (CYP27B1) — TIGHTLY regulated"),
    ("Major stimulator of 1α-OH", "PTH (parathyroid hormone)"),
    ("Major inhibitors of 1α-OH", "FGF-23 and calcitriol itself (feedback inhibition)"),
    ("Inactivating enzyme", "24-hydroxylase (CYP24A1) — induced by calcitriol + FGF23"),
    ("VDR heterodimerises with", "RXR (Retinoid X Receptor — requires Vitamin A)"),
    ("Primary intestinal action", "Induces calbindin-D → transcellular Ca²⁺ absorption"),
    ("Why rickets ≠ osteomalacia", "Rickets = children (open growth plates deformed); Osteomalacia = adults"),
    ("Pathognomonic X-ray in osteomalacia", "Looser's zones (Milkman's pseudofractures)"),
    ("Earliest sign of rickets", "Craniotabes (ping-pong ball feel on skull)"),
    ("Drug causing Vit D deficiency", "Phenytoin / phenobarbitone (CYP inducers accelerate Vit D catabolism)"),
    ("Sarcoidosis + hypercalcaemia", "Macrophages in granulomas express unregulated 1α-hydroxylase → excess calcitriol"),
    ("CKD bone disease treatment", "1-alpha-calcidol or calcitriol (bypasses defective kidney step)"),
    ("Toxicity NOT from sunlight", "Photodegradation to lumisterol/tachysterol limits skin synthesis automatically"),
]
for param, value in pearls:
    row_data = [[
        Paragraph(f"<b>{param}</b>", S("pp", fontSize=8.5, fontName="Helvetica-Bold",
                                        textColor=HEADER_DARK, leading=12)),
        Paragraph(value, S("pv", fontSize=8.5, fontName="Helvetica",
                            textColor=colors.HexColor("#2C3E50"), leading=12)),
    ]]
    pt = Table(row_data, colWidths=[185, 300])
    pt.setStyle(TableStyle([
        ("GRID",          (0,0), (-1,-1), 0.3, colors.HexColor("#AED6F1")),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,0), (-1,-1), [colors.HexColor("#EAF4FB")]),
    ]))
    story.append(pt)

story.append(sp(2))

# ══════════════════════════════════════════════════════════════
# SECTION 7: QUICK REFERENCE SUMMARY
# ══════════════════════════════════════════════════════════════
story.append(PageBreak())
story.append(section_header("7.  Quick Reference Summary Diagram"))
story.append(sp(2))

# ASCII-style pathway as a nice table
story.append(sub_header("Step-by-Step Synthesis Pathway (Exam Diagram)"))
story.append(sp(1))
path_data = [
    ["STEP", "LOCATION", "SUBSTRATE → PRODUCT", "ENZYME", "REGULATION"],
    ["0 (Photo)", "Skin", "7-Dehydrocholesterol + UV-B → Pre-Vit D3 → Cholecalciferol (D3)", "Photolysis + heat isomerisation", "Melanin, sunscreen ↓"],
    ["1", "Liver", "Cholecalciferol → 25(OH)D3 (Calcidiol)", "25-Hydroxylase CYP27A1", "NOT regulated (substrate-driven)"],
    ["2 ★", "Kidney PCT", "25(OH)D3 → 1,25(OH)₂D3 (Calcitriol)", "1α-Hydroxylase CYP27B1", "PTH ↑, ↓Ca ↑, FGF23 ↓, Calcitriol ↓"],
    ["Inactivation", "Kidney, tissues", "Calcidiol/Calcitriol → 24,25-OH / 1,24,25-OH forms", "24-Hydroxylase CYP24A1", "Induced by calcitriol & FGF23"],
]
pat = Table(path_data, colWidths=[52, 62, 160, 110, 105])
pat.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0),  TABLE_HEADER),
    ("TEXTCOLOR",     (0,0), (-1,0),  colors.white),
    ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 8),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#F0FFF0"), colors.white,
                                       colors.HexColor("#FEF9E7"), colors.HexColor("#FDEDEC")]),
    ("GRID",          (0,0), (-1,-1), 0.5, colors.HexColor("#AED6F1")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 5),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ("FONTNAME",      (0,3), (0,3),   "Helvetica-Bold"),
    ("TEXTCOLOR",     (0,3), (0,3),   LIVER_RED),
    ("BACKGROUND",    (0,3), (-1,3),  colors.HexColor("#FEF9E7")),
]))
story.append(pat)
story.append(sp(2))

story.append(danger_box(
    "<b>★ Step 2 (1α-hydroxylation in kidney) is the KEY REGULATED STEP and the most common exam focus.</b>\n"
    "Stimulated by: PTH, ↓Ca, ↓PO₄  |  Inhibited by: Calcitriol (product inhibition), FGF-23, ↑Ca"
))
story.append(sp(2))

# Final memory box
story.append(sub_header("Must-Remember Facts (Viva Voce Ready)"))
story.append(sp(1))
must_facts = [
    "Vitamin D is a HORMONE PRECURSOR, not truly a vitamin when sunlight is adequate.",
    "Two forms: D2 (ergocalciferol from plants) and D3 (cholecalciferol from skin/animals). D3 is more potent.",
    "Provitamin in human skin = 7-DEHYDROCHOLESTEROL. Provitamin in plants = ERGOSTEROL.",
    "First hydroxylation at C-25 in the LIVER (CYP27A1) → Calcidiol (storage form, measured clinically, t½ = 19 days).",
    "Second hydroxylation at C-1α in the KIDNEY PCT (CYP27B1) → Calcitriol (active form, t½ = 4-6 hours).",
    "Calcitriol acts via VDR–RXR heterodimer → nuclear receptor → gene transcription.",
    "Primary action: ↑ intestinal Ca²⁺ absorption via CALBINDIN-D induction.",
    "Deficiency in children = RICKETS (growth plate deformity). In adults = OSTEOMALACIA (Looser's zones).",
    "ALP is markedly ↑ in both rickets and osteomalacia (hallmark lab finding).",
    "Secondary hyperPTH occurs in Vit D deficiency due to hypocalcaemia.",
    "Vitamin D TOXICITY comes only from supplements — sunlight NEVER causes toxicity (photodegradation).",
    "Sarcoidosis causes hypercalcaemia via unregulated 1α-hydroxylase in granuloma macrophages.",
    "Phenytoin/phenobarbitone induce CYP450 → accelerate Vit D degradation → supplement these patients.",
    "CKD patients get renal osteodystrophy due to ↓ 1α-hydroxylation → treat with calcitriol directly.",
]
for i, fact in enumerate(must_facts):
    bg = colors.HexColor("#EAF4FB") if i % 2 == 0 else colors.white
    fd = [[Paragraph(f"<b>{i+1}.</b>  {fact}",
                      S("mf", fontSize=8.5, fontName="Helvetica", leading=13,
                         textColor=HEADER_DARK))]]
    ft2 = Table(fd, colWidths=[PAGE_W - 2*MARGIN])
    ft2.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), bg),
        ("GRID",          (0,0), (-1,-1), 0.3, colors.HexColor("#AED6F1")),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ]))
    story.append(ft2)

story.append(sp(3))
story.append(Paragraph(
    "<i>Study Guide compiled from: Goodman & Gilman's Pharmacological Basis of Therapeutics | "
    "Harrison's Principles of Internal Medicine 22E | Harper's Illustrated Biochemistry 32nd Ed. "
    "For educational use only.</i>",
    S("disc", fontSize=7.5, textColor=colors.grey, fontName="Helvetica-Oblique",
       alignment=TA_CENTER)))

# ── Build PDF ──────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created successfully!")
Running Command

cd /tmp/workspace/vitamin-d-guide && python create_pdf.py 2>&1

Editing File

~/vitamin-d-guide/create_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/vitamin-d-guide/create_pdf.py'
Running Command

cd /tmp/workspace/vitamin-d-guide && python create_pdf.py 2>&1

Editing File

~/vitamin-d-guide/create_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/vitamin-d-guide/create_pdf.py'
Running Command

cd /tmp/workspace/vitamin-d-guide && python create_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/vitamin-d-guide/Vitamin_D_Study_Guide.pdf

Your Vitamin D Study Guide PDF is ready! Download it here:

Vitamin D Study Guide

PDF Document · PDF


What's Inside the PDF (7 Sections):

SectionContent
Cover PageIllustrated cover with UV-B sun graphic and topic overview
1. Introduction & ChemistryForms table (D2/D3/Calcidiol/Calcitriol), sources, key facts
2. Metabolism PathwayFull colour pathway diagram: Skin → Liver → Kidney → Organs, enzyme table, regulation stimulators vs inhibitors table
3. Mechanism of ActionVDR-RXR step-by-step table, VDR tissue distribution table, Vitamin A-D interaction
4. Calcium HomeostasisDiagram showing PTH/Calcitriol/Calcitonin feedback loop, comparison table of all three hormones
5. DeficiencyCauses table, Rickets vs Osteomalacia side-by-side comparison, lab findings table
6. Toxicity & Clinical PearlsRDA table, toxicity facts, 16 high-yield exam pearls
7. Quick ReferenceComplete 5-column pathway summary table, 14 must-remember facts

The PDF is formatted for easy printing and revision with colour-coded sections, highlighted key facts, and warning boxes for commonly tested points.
This is a shared conversation. Sign in to Orris to start your own chat.