================================================================================
Chapter 4: Gastrointestinal Monitoring
================================================================================

[Table of Contents]

GI tract monitoring with smart pills provides continuous, non-invasive measurement
of pH, temperature, pressure, and transit time - essential for diagnosis and
treatment optimization.

--------------------------------------------------------------------------------
4.1 pH Sensing and Analysis
--------------------------------------------------------------------------------

Normal GI pH Profile:
  Stomach (fasting): pH 1.5 - 3.5 (high acid, 0.05-0.1 M HCl)
  Duodenum: pH 5.5 - 6.5 (rapid rise, bicarbonate buffering)
  Jejunum: pH 6.0 - 7.0 (relatively stable)
  Ileum: pH 7.0 - 8.0 (gradual increase)
  Cecum/Colon: pH 5.5 - 7.5 (SCFA from bacterial metabolism)

Pathological Conditions Detected:
  GERD: Esophageal pH < 4 (> 5% time), DeMeester score > 14.7
  Zollinger-Ellison: Persistent gastric pH < 2 (gastrin-secreting tumor)
  Achlorhydria: Gastric pH > 4-6 (atrophic gastritis, PPI use)
  IBD: Increased pH variability, local pH decrease (inflammation)
  SIBO: Decreased small bowel pH (bacterial fermentation)

pH Measurement Protocols:
  24-Hour Ambulatory Monitoring:
    - Recording interval: 5-10 seconds continuously
    - Parameters: % time pH < 4, DeMeester score, reflux episodes
    - Advantage: Wireless capsule eliminates nasogastric catheter discomfort

  Transit pH Mapping:
    - Identify GI regions by pH transitions
    - Gastric-duodenal: pH > 4 sharp rise
    - Ileocecal: pH decrease (7.5 → 6.0)
    - Applications: Drug delivery optimization, motility assessment

Data Analysis:
  - Automated region segmentation (stomach, SI, colon)
  - Transit time calculation (pH transition markers)
  - Reflux event detection (pH < 4 drops, frequency, duration)
  - Correlation with patient diary (symptoms, meals, medications)

--------------------------------------------------------------------------------
4.2 Temperature Monitoring
--------------------------------------------------------------------------------

Core Body Temperature:
  Normal: 36.5 - 37.5°C with circadian variation (±0.5-1.0°C)
  GI tract: 37-37.5°C (stomach slightly influenced by food temperature)

Clinical Applications:
  Fever Detection: > 38°C (infection, inflammation, malignancy)
  Local Inflammation: 0.5-1.0°C elevation in inflamed bowel segments
  Ischemia: Temperature decrease from reduced blood flow
  Metabolic Disorders: Basal temperature shifts (hyper/hypothyroidism)

Temperature-Controlled Drug Release:
  - Thermoresponsive polymers (PNIPAM, LCST ~32°C adjustable)
  - Fever-triggered: LCST 38°C → release antipyretic when needed
  - Phase-transition waxes with external heating (magnetic nanoparticles)

--------------------------------------------------------------------------------
4.3 Pressure Measurement
--------------------------------------------------------------------------------

GI Motility Patterns:
  Esophagus: Primary peristalsis 30-180 mmHg, LES 10-30 mmHg basal
  Stomach: Accommodation 3-7 mmHg, grinding 20-100 mmHg, 3/min frequency
  Small intestine: Segmentation 20-60 mmHg, peristalsis 30-80 mmHg
  MMC (Migrating Motor Complex): Fasting pattern, 90-120 min cycles
  Colon: Haustral 50-100 mmHg, mass movements 100-200 mmHg

Pressure-Based Diagnostics:
  Achalasia: LES relaxation failure, absent esophageal peristalsis
  Gastroparesis: Weak contractions (< 20 mmHg), delayed emptying
  Intestinal pseudo-obstruction: Decreased amplitude, non-propulsive
  IBS: Abnormal contraction patterns, exaggerated responses
  Constipation: Slow transit (low activity) vs. outlet (sphincter dysfunction)

SmartPill Pressure Measurement:
  - Continuous recording (1-10 Hz sampling, 8-72 hours)
  - Contractile activity detection (amplitude, frequency)
  - Motor pattern identification (fed state, fasting MMC)
  - Transit correlation (rapid = high activity, slow = low activity)
  - Clinical utility: Motility assessment, constipation diagnosis

--------------------------------------------------------------------------------
4.4 Transit Time Tracking
--------------------------------------------------------------------------------

Normal Transit Times:
  Gastric emptying: 2-4 hours (solids), 1-2 hours (liquids)
  Small bowel: 3-5 hours (2-6 hr range)
  Colonic: 30-40 hours (12-72 hr range)
  Total: 40-50 hours mouth-to-anus (20-90 hr range)

Smart Pill Transit Measurement:
  - Gastric emptying: pH > 4 sharp rise (onset: ingestion, end: transition)
  - Small bowel: Onset at gastro-duodenal, end at ileocecal valve
  - Ileocecal marker: pH decrease (7.5 → 6.0), pressure pattern change
  - Colonic: Onset at ileocecal, end at excretion (signal loss)
  - Automated algorithms: ML classification with >90% accuracy

Transit Abnormalities:
  Delayed Gastric Emptying (> 4-5 hrs):
    - Causes: Diabetic gastroparesis, post-surgical, drugs (opioids)
    - Management: Prokinetics, dietary adjustment, gastric electrical stimulation

  Rapid Gastric Emptying (< 1 hr):
    - Causes: Dumping syndrome, hyperthyroidism
    - Management: Small frequent meals, complex carbs

  Slow Colonic Transit (> 72 hrs):
    - Condition: Slow-transit constipation
    - Management: Fiber, exercise, laxatives, prokinetics

  Rapid Colonic Transit (< 12 hrs):
    - Association: Diarrhea-predominant IBS, inflammation

Clinical Applications:
  Diagnosis: Constipation subtypes, diarrhea etiology, IBS classification
  Drug development: Absorption window determination, formulation optimization
  Personalized medicine: Individual transit profiling for custom dosing

Key Principle: Transit times show high inter-individual variability and are
influenced by diet, activity, medications - interpretation requires considering
these factors.

[Next: Chapter 5]
[Table of Contents]

================================================================================