import json

references = [
  {"title": "Pediatric ICD-10-CM 2023", "author": "American Academy of Pediatrics Committee on Coding and Nomenclature;", "pages": [262]},
  {"title": "Textbook of Pediatric Gastroenterology, Hepatology and Nutrition (Stefano Guandalini, Anil Dhawan)", "author": None, "pages": [329]},
  {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [2294,2302,2697]},
  {"title": "Zitelli and Davis' Atlas of Pediatric Physical Diagnosis: Expert Consult - Online", "author": None, "pages": [692]},
  {"title": "Netters Pediatrics (Florin Т., Ludwig St.)", "author": None, "pages": [676,717]},
  {"title": "Cover", "author": "Vitalsource Download", "pages": [5453,5608]},
  {"title": "Signs and Symptoms in Pediatrics", "author": "Henry M. Adam,Jane Meschan Foy", "pages": [219]},
  {"title": "2021_Fleisher_&_Ludwig's_Textbook_of_Pediatric_Emergency_Medicine.epub", "author": None, "pages": []}
]

short = [{"title": "In short", "content": """- Neonatal intestinal obstruction classically presents with failure to pass meconium within 24–48 hours of life, feeding intolerance, abdominal distention, persistent vomiting, or aspiration of more than 20 mL of gastric secretions; prenatally it may present as third-trimester polyhydramnios, occurring earlier with more proximal obstructions.
- Localizing signs: nonbilious vomiting points proximal (to the ampulla of Vater); bilious vomiting can be proximal or distal but is always distal to the ampulla of Vater; a scaphoid abdomen suggests a proximal (often preduodenal) obstruction; a distended abdomen suggests a distal obstruction; maternal polyhydramnios suggests a proximal obstruction.
- High (proximal) obstruction: large-volume, frequent bilious emesis with little/no abdominal distention; pain is intermittent and relieved by vomiting. Distal small bowel obstruction: moderate-to-marked distention with emesis that becomes progressively feculent. Both eventually cause obstipation, though initial meconium passage can still occur if the obstruction is proximal or developed late in gestation.
- Intrinsic causes include congenital atresia (complete obliteration) or stenosis (narrowing) of the intestinal lumen — over 90% of intestinal atresia/stenosis occurs in the duodenum, jejunum, or ileum; colonic atresia is rare and may coexist with more proximal atresias.
- Extrinsic/mechanical causes in older children include adhesions from prior surgery or abdominal trauma (a common acquired cause), omphalomesenteric duct remnants (vitelline bands) causing internal herniation at the umbilicus/mesentery, and rotational anomalies creating paraduodenal or paracolic hernia spaces.
- Partial obstruction narrows the lumen enough to reduce but not eliminate flow, producing waxing/waning symptoms (patients with recurrent partial obstruction, e.g., Crohn's stricture, may learn to self-limit oral intake at symptom onset); complete obstruction halts forward propulsion entirely, and symptoms persist until mechanical decompression relieves it.
- Adhesion-related obstruction: early nasogastric decompression may resolve symptoms and prevent progression to complete obstruction; failure of early resolution should prompt emergency surgical exploration.
- Intussusception (proximal bowel telescoping into distal bowel) causes lymphatic/venous congestion, edema, strangulation, ischemia, and eventual necrosis if not reduced; it is fatal if left untreated, making prompt diagnosis and treatment critical.
- In cystic fibrosis, distal intestinal obstruction syndrome results from fecal material accumulating in the terminal ileum/cecum despite enzyme replacement; management escalates from continuing/increasing pancreatic enzymes and stool hydrators (polyethylene glycol) to oral/NG polyethylene glycol bowel lavage, and, for complete obstruction, a therapeutic contrast enema with large-volume IV fluids. For severe fecal impaction generally, milk-and-molasses, soap suds, and tap water enemas are now discouraged due to serious adverse event reports (including a death); surgical disimpaction may be needed in severe cases.
- Chronic intestinal pseudo-obstruction is a distinct entity — abnormal myoelectric activity or neuropathic/myopathic dysfunction causing obstruction-like symptoms (distention, vomiting, alternating diarrhea/constipation, radiographic bowel dilation) without a true mechanical blockage; bladder dysfunction often coexists, and bacterial overgrowth is an important cause of diarrhea in this syndrome."""}]

long = [
 {"title": "Definition", "content": """Intestinal obstruction is impaired forward passage of intestinal contents, classified as partial (the lumen is narrowed enough to reduce but not eliminate flow, producing waxing and waning symptoms) or complete (the bowel is entirely unable to propel its contents past the blockage, with symptoms persisting until the obstruction is mechanically relieved). It is further classified as intrinsic (inherent abnormality of intestinal innervation, mucus production, or luminal anatomy — most commonly congenital atresia or stenosis) versus extrinsic (a process compressing or trapping the bowel from outside, such as adhesions or an internal hernia). A related but distinct entity is intestinal pseudo-obstruction, in which obstruction-like symptoms occur without a true mechanical blockage, arising instead from abnormal myoelectric activity or neuropathic/myopathic dysfunction of the gut."""},
 {"title": "Etiology", "content": """Intrinsic causes are dominated by congenital disruption of the tubular gut, presenting as atresia (complete obliteration) or stenosis (narrowing) of the lumen; more than 90% of intestinal atresia and stenosis occurs in the duodenum, jejunum, or ileum, with colonic involvement rare and sometimes associated with more proximal atresias. Extrinsic and acquired causes become more prominent outside the neonatal period: adhesions from prior abdominal surgery or trauma are a common cause of obstruction in children with a surgical history; omphalomesenteric duct remnants (vitelline bands) can attach to the umbilicus or mesentery and create a site for internal bowel herniation; and intestinal rotational anomalies can leave abnormal spaces lateral to the duodenum, cecum, or sigmoid colon that predispose to bowel incarceration as paraduodenal or paracolic hernias. Intussusception — proximal bowel (intussusceptum) telescoping into a more distal segment (intussuscipiens) — causes obstruction both by mechanically collapsing the involved lumen and, if untreated, by inducing lymphatic and venous congestion, edema, strangulation, ischemia, and ultimately necrosis; it is fatal without reduction, making prompt recognition essential. In cystic fibrosis, distal intestinal obstruction syndrome results from accumulation of fecal material in the terminal ileum and cecum despite appropriate pancreatic enzyme replacement therapy. Chronic idiopathic intestinal pseudo-obstruction can be sporadic or autosomal dominant, resulting from visceral myopathy, visceral neuropathy, or a combination of both, and can involve the entire GI tract or be limited to certain segments (almost always including the small bowel); the analogous acute colonic form is called Ogilvie syndrome."""},
 {"title": "Clinical features", "content": """In the neonate, obstruction presents with failure to pass meconium within 24–48 hours of birth, feeding intolerance, abdominal distention, persistent vomiting, or aspiration of more than 20 mL of gastric secretions; prenatally, third-trimester polyhydramnios can be an early clue, appearing earlier in gestation with more proximal obstructions because of disrupted amniotic fluid dynamics. The level of obstruction produces distinct localizing patterns: obstruction proximal to the ampulla of Vater causes nonbilious vomiting, often with a scaphoid (rather than distended) abdomen, and is associated with maternal polyhydramnios; obstruction distal to the ampulla causes bilious vomiting. High (proximal) obstruction produces large-volume, frequent bilious emesis with little or no abdominal distention, and intermittent pain typically relieved by vomiting; distal small bowel obstruction produces moderate-to-marked distention with emesis that becomes progressively feculent. Both proximal and distal obstructions eventually cause obstipation, though initial meconium passage can still occur if the obstruction is high in the tract or developed late in intrauterine life. Idiopathic intestinal pseudo-obstruction in infancy often features prominent vomiting and diarrhea (sometimes alternating with constipation), while older children more often have an insidious course beginning with long-standing constipation before diarrhea emerges; intermittent or constant abdominal distention and urinary bladder dysfunction commonly coexist."""},
 {"title": "Diagnostics", "content": """Accurate diagnosis of neonatal intestinal obstruction depends on a thorough history, careful physical examination, and directed radiologic studies, since the specific anatomic cause (duodenal atresia, jejunoileal atresia, malrotation with volvulus, meconium ileus, Hirschsprung disease, and others) each carries characteristic diagnostic features. In pseudo-obstruction, radiographic bowel dilation with disordered motility (without a demonstrable transition point or mechanical blockage) is the key distinguishing finding from true mechanical obstruction, and bacterial overgrowth should be evaluated as a contributor to diarrhea in this syndrome."""},
 {"title": "Treatment", "content": """Management depends on the underlying cause and whether obstruction is partial or complete. For adhesion-related obstruction, early nasogastric decompression can alleviate symptoms and halt progression to complete obstruction; failure of early resolution should prompt emergency surgical exploration. Complete obstruction from any structural cause generally requires surgical correction of the underlying anatomic problem. For distal intestinal obstruction syndrome in cystic fibrosis, intermittent symptoms are managed by continuing or increasing pancreatic enzyme replacement and adding stool hydrators such as polyethylene glycol; if this fails or symptoms are more severe, large-volume bowel lavage with a balanced polyethylene glycol solution (given orally or via nasogastric tube) is used; for complete obstruction, a contrast enema combined with large-volume intravenous fluids can be therapeutic. For severe fecal impaction more generally, surgical disimpaction may be necessary in the most severe cases; milk-and-molasses, soap suds, and tap water enemas have fallen out of favor given case reports of serious adverse events, including a death, and should be avoided in favor of safer bowel-clearance methods."""}
]

clinical = [
 {"title": "Approach at the bedside", "content": """Use the vomiting pattern and abdominal exam to localize the obstruction before imaging confirms it: nonbilious vomiting with a scaphoid abdomen points to a proximal, preduodenal process, while bilious vomiting with a distended abdomen points to a more distal obstruction; ask about maternal polyhydramnios in the neonatal history, since this also favors a proximal lesion. In any neonate who has not passed meconium within 24–48 hours of birth, or who has feeding intolerance, distention, persistent vomiting, or is aspirating more than 20 mL of gastric contents, pursue prompt evaluation for intestinal obstruction with directed imaging rather than watchful waiting.

In an older child with a prior abdominal surgery presenting with obstructive symptoms, start with nasogastric decompression for suspected adhesive obstruction, since this can resolve symptoms and prevent progression; if the obstruction does not begin to resolve promptly, move to emergency surgical exploration rather than prolonging conservative management. Consider intussusception urgently in any infant with intermittent severe abdominal pain, vomiting, and lethargy, since delayed reduction risks strangulation, ischemia, and necrosis, and the condition is fatal if left untreated.

In a patient with cystic fibrosis and new obstructive symptoms, escalate stepwise: continue or increase pancreatic enzymes and add polyethylene glycol for intermittent symptoms, move to large-volume PEG bowel lavage (oral or NG) if this fails, and reserve a therapeutic contrast enema with concurrent large-volume IV fluids for complete obstruction. For any child with severe fecal impaction, avoid milk-and-molasses, soap suds, or tap water enemas given documented serious adverse events, and consider surgical disimpaction if impaction is severe and unresponsive to safer measures. If a child presents with a longstanding history of alternating constipation/diarrhea, abdominal distention, and no demonstrable mechanical blockage on imaging, consider chronic intestinal pseudo-obstruction and evaluate for coexisting bladder dysfunction and bacterial overgrowth as part of the workup."""}
]

article = {
 "topic": "Intestinal Obstruction",
 "slug": "intestinal-obstruction",
 "category_id": 15064,
 "summary": "Localizing pediatric intestinal obstruction by vomiting pattern and abdominal exam, its intrinsic and extrinsic causes, and stepwise management including cystic fibrosis-related obstruction and pseudo-obstruction.",
 "written_by": "claude-sonnet",
 "references": references,
 "short": short,
 "long": long,
 "clinical": clinical
}
with open("/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/articles/intobstruction.article.json", "w") as f:
    json.dump(article, f, indent=1)
print("done")
