import json

SRC = "/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/prose/mid/mid-01.json"
DST = "/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/prose/mid/mid-01.done.json"

with open(SRC, "r", encoding="utf-8") as f:
    data = json.load(f)

replacements = {}

replacements["4348a568a2a2c7cad1a3d3a511a8dda8"] = (
    "Circulation is restored, fluid and electrolyte deficits are corrected gradually, "
    "and an insulin infusion is started after fluids per local protocol."
)

replacements["2327236ef0724264b08e3b6c4464fe82"] = (
    "Accurate, serial anthropometry is the foundation of evaluation: weight, length/height, and head circumference should be measured carefully and plotted over time. WHO growth charts are preferred over CDC charts for children younger than 2 years, since they identify a lower proportion of children as underweight. Measurement technique matters - standing height should never be recorded as if it were recumbent length, since a child's standing height reads shorter than supine length. For infants born preterm, correction is made for gestational age when plotting: weight is adjusted until 24 months, head circumference until 18 months, and length/height until 40 months of age. Beyond the growth chart itself, evaluation requires a detailed feeding/dietary history, birth and past medical history, developmental assessment, and a thorough psychosocial evaluation of the family, since undernutrition reflects a complex interaction of medical, nutritional, emotional, and social factors rather than a single cause."
)

replacements["178c81600aed4edb8363a69de8d3b961"] = (
    "- Grief is the emotional response to loss (bereavement is the family's broader adaptation); it is a normal reaction, not a disease, unless prolonged or complicated.\n"
    "- Under age 3: little or no concept of death; children react to loss of the caregiver itself with despair, separation anxiety, detachment, irritability, or lethargy; severe reactions can produce mutism or [[104|failure to thrive]].\n"
    "- Ages 3–5: regressive behaviors are typical, especially bed-wetting and thumb-sucking.\n"
    "- Ages 6–10 (school-age): nonspecific somatic complaints predominate — headache, abdominal pain, chest pain, fatigue — along with poor academic performance or school phobia.\n"
    "- Adolescents: grief may surface as high-risk behavior (substance use, delinquency, precocious sexual activity) and withdrawal from peers rather than overt sadness.\n"
    "- Duration flags for concern: preschoolers, unusual if symptoms persist beyond 6 months; school-age children, beyond 3 months; adolescents, somatic complaints usually resolve within 3 months — high-risk behavior or peer withdrawal at any point is atypical.\n"
    "- Kübler-Ross stages of grief: denial, anger, bargaining, [[204|depression]], acceptance.\n"
    "- Temes described three grief behavior patterns: numbness (mechanical functioning, social insulation), disorganization (intensely painful feelings of loss), and reorganization (re-entry into normal social life).\n"
    "- Medication is not first-line for uncomplicated grief; an anxiolytic or antidepressant is reserved for severe sleep disruption, incapacitating anxiety, or intense hyperarousal, and paired with psychotherapy.\n"
    "- A follow-up visit is scheduled about 1 month after the death to reassess family coping; in one series of infant death, 3% of mothers had prolonged grief and 18% developed PTSD."
)

replacements["87e4423978d54526b7f6856aeb8513dc"] = (
    "- CDC defines intimate partner violence (IPV) as a pattern of physical violence, sexual violence, stalking, and psychological aggression by a current or former intimate partner, meant to establish control (social isolation, deprivation, intimidation).\n"
    "- Childhood exposure occurs when a child sees, hears, or observes the effects of verbal or physical assault between partners; some states (e.g., Connecticut) classify a child's exposure to IPV as maltreatment, requiring pediatricians to report to CPS.\n"
    "- Epidemiology: roughly 8.5 million women and 4 million men in the US report lifetime physical violence, rape, or stalking by an intimate partner; among dating adolescents, 12% of girls and 7% of boys report physical violence in the prior 12 months; in 2007, IPV accounted for 14% of homicides nationally, mostly female victims.\n"
    "- Cycle of violence has 3 phases: tension-building (threats), the violent episode (physical/sexual/emotional/psychological assault), and the honeymoon phase (apology, re-bonding) — phases escalate over time as violence becomes more frequent/severe and the honeymoon phase shortens.\n"
    "- At least 50% of women with sexual IPV report multiple rapes; roughly two-thirds of men and women with physical IPV report multiple assault episodes; violence can continue after the relationship ends, most often as stalking.\n"
    "- Children exposed to IPV show more internalizing ([[204|depression]], anxiety, somatization) and externalizing (ADHD, aggression) disorders, plus [[82|developmental delay]], low self-esteem, PTSD symptoms/hypervigilance, poor academic performance/truancy, and antisocial behavior.\n"
    "- IPV is associated with increased incidence of direct [[329|child abuse]] in the home; children can also be injured incidentally (e.g., held in a parent's arms during an assault) or while trying to intervene.\n"
    "- Adolescent-specific risk factors: female gender, age <24 years, high-risk sexual behavior, alcohol/substance use, social isolation, depression, poverty; IPV is screened for at all adolescent health visits.\n"
    "- Warning signs in the medical visit: frequent ED/urgent care visits while avoiding primary care, missed appointments, frequent pregnancy/STI testing requests, multiple abortions, late prenatal care, inappropriate affect, reluctance to undress, an overly attentive partner, and injuries without a consistent explanation (especially head/neck/teeth/breasts/abdomen/genitals) or bruises at different stages of healing."
)

replacements["23b8c54076d346d3a769123010a04181"] = (
    "Antiviral therapy for chronic pediatric hepatitis B is age-restricted for several agents, with entecavir and telbivudine approved above age 16 and tenofovir more recently available above age 12. For postexposure prophylaxis after a percutaneous or permucosal exposure in an unimmunized person: if the source is HBsAg-positive, HBIG (0.06 mL/kg, maximum 5 mL, IM) is given and the hepatitis B vaccine series is begun; if the source is HBsAg-negative, the vaccine series is begun alone; if the source is untested or unknown, the vaccine series is begun. If the exposed person was previously immunized and responded adequately, no treatment is necessary. If immunized but with an inadequate response (anti-HBs less than 10 mIU/mL) and the source is HBsAg-positive, HBIG is given immediately, with either HBIG repeated in 1 month or reimmunization initiated."
)

replacements["15e538796ed549b6a50d096cd9c8e459"] = (
    "The mainstay of management is dietary lactose reduction rather than complete dairy avoidance. Most children and adolescents can tolerate at least 12 g of lactose in a single dose (roughly 1 cup of milk or yogurt); tolerance varies between individuals, and most types of cheese are naturally low in lactose. Tolerance is generally better when lactose-containing foods are eaten in small portions spread throughout the day, alongside other foods, rather than in one large dose. Lactase enzyme supplements (tablets or liquid, e.g., Lactaid) taken with or added to dairy can reduce lactose content by about 70% and help prevent symptoms; lactose-reduced/lactose-free milk products are also widely available. Regular, small, ongoing consumption of lactose-containing products can increase lactose tolerance over time. In children whose symptoms developed during an acute diarrheal illness, one approach is to limit lactose intake to about 2-3 g/kg/day (roughly 30-50 mL/kg/day of whole cow's milk) and mix milk with cereals, or substitute fermented dairy products such as yogurt, buttermilk, paneer, or cottage cheese, which are better tolerated than plain milk. Whenever dairy intake is reduced or eliminated, the child's continued intake of adequate calcium and vitamin D from other dietary sources or supplementation is ensured, since dairy is an important source of these nutrients for bone health and growth."
)

replacements["510c014a33a04ec68c946b0388889700"] = (
    "For outpatient management in a child tolerating oral intake, cephalexin or cefadroxil is appropriate. For inpatient management, intravenous antibiotics are started: ceftriaxone 50 mg/kg/day (maximum 2 g/day) or cefotaxime 150 mg/kg/day divided every 8 hours (maximum 6 g/day), since most E. coli are resistant to ampicillin. If there is increased risk for Pseudomonas (prior Pseudomonas UTI, chronic indwelling catheter, neurogenic bladder), IV ciprofloxacin 18–30 mg/kg/day divided every 8 hours (maximum 1.2 g/day) or oral ciprofloxacin 20–30 mg/kg/day divided every 12 hours (maximum 1.5 g/day) is used. If there is a risk factor for Enterococcus (genitourinary instrumentation, renal anomaly) or gram-positive rods are seen on Gram stain, empiric ampicillin 100 mg/kg/day divided every 6 hours (maximum 4 g/day) is added. If Staphylococcus aureus grows from urine culture, hematogenous spread is considered as the source rather than an ascending UTI. Standard treatment duration is 7 days, with extension up to 14 days considered if the patient has not improved after 3 days of therapy; transition to oral antibiotics occurs once the patient is clinically improving."
)

replacements["c82949549c744d2785a1620bb1e189fc"] = (
    "In any child with altered mental status from suspected poisoning, a bedside glucose is obtained immediately. An ECG should be obtained for cardiotoxic or unknown ingestions, looking for changes suggestive of a specific toxin requiring targeted intervention - for example, a widened QRS complex suggests tricyclic antidepressant overdose. Routine urine drug screening is often unhelpful, as many clinically important substances are not detected by standard panels, including cyanide, clonidine, organophosphates, beta-blockers, calcium channel blockers, and iron. Specific blood levels are useful and should be obtained for certain known or suspected poisonings, such as acetaminophen."
)

replacements["b0751cb617924c5fae3f0836c90edaaa"] = (
    "- Acute poisoning is a common and important cause of pediatric morbidity and mortality, especially in developing countries\n"
    "- In one series, household products caused about 47% of pediatric poisonings (kerosene, pyrethroids, rodenticides, mercury thermometers, phenyl, detergents, corrosives), drugs about 22% (benzodiazepines, anticonvulsants, thyroid hormone, iron, paracetamol), agricultural pesticides about 9% (aluminum phosphide, organophosphates, organochlorines), industrial chemicals about 8%, bites/stings about 3%, and plants/plant derivatives about 1.5%\n"
    "- The majority of poisonings in children under 5 are accidental (reflecting curious, exploratory behavior and mouthing of objects); in older children and teenagers, poisoning is more often intentional\n"
    "- Seven basic routes of poison exposure: oral (ingestion), ocular, dermal, inhalational, transplacental, parenteral, and envenomation\n"
    "- Acute poisoning is typified by the curious young child who accesses a medication or cleaning product, or the adolescent who takes an intentional polypharmaceutical overdose; chronic poisoning develops over time from accumulation (e.g., lead, other heavy metals, or repeated supratherapeutic acetaminophen dosing)\n"
    "- Initial evaluation follows ABCDs: Airway/Antidotes, Breathing, Circulation, Disability/Decontamination; most substances have no specific antidote, so supportive care is the mainstay of treatment\n"
    "- In any child with [[142|altered mental status]], a bedside glucose is checked; an ECG is obtained for cardiotoxic or unknown ingestions (e.g., widened QRS suggests tricyclic antidepressant overdose)\n"
    "- Routine urine drug screening is often unhelpful, since it misses many substances including cyanide, clonidine, organophosphates, beta-blockers, calcium channel blockers, and iron; specific blood levels are useful for certain poisonings (e.g., acetaminophen)\n"
    "- Acetaminophen overdose progresses through phases: Phase 1 (first 24 hours) nonspecific nausea/malaise/vomiting; Phase 2 (24-72 hours) resolution of those symptoms with emerging RUQ pain, hepatomegaly, and rising transaminases (the toxic NAPQI metabolite is hepatotoxic)\n"
    "- The US poison control hotline (1-800-222-1222) should be available at all times to call for guidance on any suspected poisoning"
)

replacements["516dbd7a55a04c4d8313589650339032"] = (
    "For IgE-mediated food allergy, the most helpful confirmatory tests are skin-prick testing and measurement of food-specific IgE antibodies in blood; both can yield false positives, but a stronger response increases the likelihood of true allergy, and a negative skin test makes IgE-mediated allergy unlikely. For non-IgE-mediated (intestinal) milk protein allergy, skin testing is unreliable and not indicated, since it detects circulating IgE antibodies rather than the T-cell-mediated immune response responsible for these reactions. Diagnosis instead relies on double-blind oral food challenge with the suspected protein under careful observation, or on dietary elimination followed by disappearance of occult stool blood and improvement in other symptoms; small bowel biopsy findings, when obtained, are nonspecific. For allergic (eosinophilic) proctocolitis specifically, proctosigmoidoscopy characteristically shows aphthous ulcers, and rectal biopsy shows more than 6 eosinophils per high-power field with eosinophilic cryptitis. A structured diagnostic algorithm for suspected cow's milk protein allergy proceeds: complete withdrawal of milk and milk products; if diarrhea/blood in stool persists, compliance is checked and occult bovine milk sources are looked for, then soy-based formula is withdrawn as well (considering concomitant soy allergy) before concluding no response; if there is a response, a milk-free diet is continued for 1 year, then milk is reintroduced with careful vigilance - resuming elimination if symptoms recur, or continuing milk if they do not. If symptoms persist despite milk and soy elimination, egg, peanut, and fish are also considered for removal (multiple food protein allergy), and if there is still no response, a transition is made to an exclusive extensively hydrolyzed or elemental diet; ongoing lack of response should prompt specialist referral and reconsideration of other diagnoses, including [[122|immunodeficiency]], [[254|inflammatory bowel disease]], and [[152|tuberculosis]], with detailed re-evaluation including repeat endoscopy and small bowel imaging."
)

replacements["9f6d564d531b47409dfa18dd80b5d743"] = (
    "- Cow's milk protein allergy is the most common food allergy in infants, and dietary protein hypersensitivity overall affects 6-8% of children in the first 5 years of life\n"
    "- Two distinct immunologic mechanisms: IgE-mediated (immediate, minutes after ingestion, can occur at any age, involves skin/oropharyngeal/respiratory/GI/cardiovascular symptoms ranging mild to life-threatening) and non-IgE/T-cell-mediated (delayed, GI-predominant)\n"
    "- Non-IgE syndromes include milk protein enterocolitis/allergic (eosinophilic) proctocolitis - bloody diarrhea in the first few months of life, often in breastfed infants reacting to maternal dietary protein, improving within days of removing milk protein - and food protein-induced enterocolitis syndrome (FPIES), which can cause repetitive vomiting severe enough to cause shock\n"
    "- Milk protein enteropathy is a distinct non-IgE entity causing small bowel villous flattening, steatorrhea, hypoproteinemia, occult blood loss, and [[354|chronic diarrhea]]\n"
    "- Skin-prick testing is NOT reliable for non-IgE-mediated reactions (it detects circulating IgE antibodies, not the T-cell-mediated response responsible) - it is only useful for IgE-mediated allergy, where a negative result makes IgE-mediated allergy unlikely and a stronger positive raises likelihood, though false positives occur\n"
    "- Double-blind oral food challenge, or dietary elimination with disappearance of occult blood/symptoms, is often needed to confirm intestinal (non-IgE) milk protein allergy since small bowel biopsy findings are nonspecific\n"
    "- Up to 40-50% of infants with cow's milk protein allergy also react to soy protein, so formula-fed infants generally need an extensively hydrolyzed (not soy) formula, and breastfeeding mothers should avoid both cow milk and soy\n"
    "- Allergic (eosinophilic) proctocolitis/milk protein enterocolitis is diagnosed by proctosigmoidoscopy showing aphthous ulcers and rectal biopsy showing more than 6 eosinophils/hpf plus eosinophilic cryptitis; almost all infants outgrow it by 1-2 years of age, and allergic colitis specifically is self-limited, usually resolving by 8-12 months\n"
    "- A structured elimination/reintroduction algorithm exists: complete milk withdrawal, reassessment for symptom resolution, a milk-free diet continued for 1 year, then carefully monitored reintroduction - if symptoms recur, elimination is resumed; if multiple foods are suspected, egg/peanut/fish are sequentially removed, and referral is made to a specialist with reconsideration of other diagnoses ([[122|immunodeficiency]], IBD, TB) if there's no response to an extensively hydrolyzed or elemental diet\n"
    "- For anaphylactic-type (IgE-mediated) reactions, a medical alert bracelet and epinephrine autoinjector training are provided; allergist consultation is recommended for long-term management of non-IgE intestinal protein allergy as well"
)

replacements["9777d7e992e347d0bf1d268bb98748d0"] = (
    "- Obstructive sleep apnea syndrome (OSAS) is recurrent partial or complete upper airway obstruction during sleep, causing increased respiratory effort, disrupted sleep, and abnormal gas exchange; it exists on a continuum from benign primary snoring (regular snoring without apneas, arousals, or gas exchange abnormality) to full OSAS.\n"
    "- Prevalence documented by overnight sleep study is about 1–5% of children (sources cite 1–3% and 1–5%), peaking at ages 2–8 (specifically 2–6 years in some sources), coinciding with the time tonsils/adenoids are relatively largest compared to the upper airway.\n"
    "- Over 95% of pediatric OSAS is caused by structural airway obstruction (chiefly adenotonsillar hypertrophy); the remainder is neurologic in origin. Other disease associations: [[257|obesity]], [[98|allergic rhinitis]], [[385|laryngomalacia]], mucopolysaccharidoses, Down syndrome, craniofacial syndromes, [[164|cerebral palsy]], [[171|hypothyroidism]], and nasal masses.\n"
    "- Key history features: frequent snoring (≥3 nights/week), labored breathing during sleep, gasping/snorting or witnessed apnea episodes, sleep enuresis (especially secondary enuresis), sleeping seated or with neck hyperextended, cyanosis, morning headache, daytime sleepiness, ADHD-like symptoms, and learning problems.\n"
    "- Key exam findings: underweight or overweight, tonsillar hypertrophy, adenoidal facies, micrognathia/retrognathia, high-arched palate, [[104|failure to thrive]], and [[92|hypertension]].\n"
    "- Diagnosis is confirmed by polysomnography — an apnea-hypopnea index (AHI) of 1 or more per hour of sleep meets ICSD-3 criteria for pediatric OSA (though a total AHI cutoff below 1.5 is also commonly used in practice, given limited data supporting the ICSD-3 threshold); complications like elevated blood pressure are usually not seen until AHI reaches 5 or higher, and hypoxemia depth also matters independent of AHI.\n"
    "- Untreated OSAS can cause periodic hypoxemia, hypercarbia, neurocognitive impairment, behavioral problems, failure to thrive, cor pulmonale, pulmonary hypertension, systemic hypertension, and right-sided heart failure.\n"
    "- Polysomnography distinguishes primary snoring from true OSAS, determines severity, and can detect central sleep apnea, which changes management — this distinction matters because central apnea, unlike obstructive apnea, may not respond to adenotonsillectomy or standard OSA treatment.\n"
    "- Adenotonsillectomy is the primary treatment when adenotonsillar hypertrophy is the cause (also indicated for adenotonsillar hypertrophy causing speech defects, craniofacial growth abnormality, dysphagia, or cor pulmonale); continuous positive airway pressure (CPAP) is used for children who are not surgical candidates or who do not respond to surgery. Appropriate OSA treatment can improve behavior and cognitive function.\n"
    "- OSA and nocturnal [[107|asthma]] can overlap and mimic each other; OSA is evaluated for in patients with unstable, poorly controlled asthma (especially if overweight/obese), since nasal CPAP improves outcomes in patients who truly have coexisting apnea, but can disrupt sleep in asthma patients without apnea — confirming the correct diagnosis before treating matters."
)

replacements["1bdb27a4306e4c42980a366cc621d2e2"] = (
    "- Compartment syndrome develops when interstitial pressure inside a closed, unyielding fascial compartment exceeds capillary perfusion pressure — clinically, elevation to roughly 35-45 mmHg — obstructing venous outflow and then arteriolar/capillary flow, causing muscle and neurovascular ischemia.\n"
    "- In children, the classic adult \"5 Ps\" (pain, pallor, paresthesia, pulselessness, paralysis) are unreliable; the \"3 As\" are used instead — anxiety, agitation, and an increasing analgesia requirement — since pulselessness, pallor, and paralysis are late findings and their absence does not rule out the diagnosis.\n"
    "- Pain out of proportion to the injury, or pain increasing despite analgesia, plus pain with passive stretch of the digits, is the most common and earliest presentation; a child may show only one sign or symptom.\n"
    "- Lower leg (tibia/fibula) fractures cause about 60% of pediatric compartment syndromes; a displaced proximal tibial metaphyseal fracture is the single fracture most likely to be complicated by it, and supracondylar humerus and displaced forearm fractures are also well-documented causes.\n"
    "- Displaced supracondylar fractures can injure the anterior interosseous artery and forearm flexor compartment, leading to the classic Volkmann contracture if unrecognized.\n"
    "- Adolescents 14 years and older have a higher risk of compartment syndrome with tibial shaft fractures than younger children.\n"
    "- Diagnosis can be supported by compartment pressure measurement: normal is about 8 mmHg in adults and 10-15 mmHg in children; an absolute pressure ≥30 mmHg, or a diastolic blood pressure minus compartment pressure under 30 mmHg, are indications for fasciotomy.\n"
    "- Immediate treatment: any cast or splint is removed or split, the limb is elevated only to heart level (elevating above the heart reduces tissue perfusion and worsens ischemia), and urgent orthopedic consultation is obtained; definitive treatment is prompt fasciotomy.\n"
    "- Rare variants: abdominal compartment syndrome (from intra-abdominal [[92|hypertension]], e.g., bowel obstruction or burns) is immediately life-threatening via IVC compression, and a distinct neonatal compartment syndrome can present in the delivery room as a swollen, paralyzed, dysvascular limb with a sentinel bullous or open forearm lesion."
)

replacements["8676a40cca76482fa23c340c2ca03cde"] = (
    "- Sunburn is the most common photosensitive reaction in children and is a UV-induced thermal injury, caused mainly by UVB radiation acting through an \"erythema action spectrum\" mainly in the UVB range.\n"
    "- UVB-induced redness, tenderness, edema, and blistering appear 6-12 hours after exposure and peak at about 24 hours; severe sunburn can cause systemic fever, nausea, and headache.\n"
    "- Immediate pigment darkening from UVA is a separate, short-lived (a few hours) effect and is not photoprotective.\n"
    "- The Fitzpatrick classification of 6 sun-reactive skin types predicts an individual's expected sunburn and tanning tendency.\n"
    "- Treatment: cool compresses and analgesics; a bland emollient such as plain petrolatum for the later desquamative phase; topical anesthetics are best avoided as they can cause contact dermatitis.\n"
    "- Prevention: sun is avoided during peak hours (commonly cited as 10 am-2 pm or 10 am-4 pm); a broad-spectrum sunscreen with SPF 30 or greater (applied to exposed skin on both sunny and cloudy days) is used for infants 6 months and older, plus protective clothing, wide-brimmed hats, and sunglasses.\n"
    "- Sunscreen safety is not established under 6 months of age, so infants under 6 months should rely on sun avoidance and appropriate clothing/hats rather than sunscreen; in extreme circumstances a minimal amount can be applied to small exposed areas like the face and back of the hands.\n"
    "- Most people receive over 50% of their lifetime UV dose by age 20, so pediatric counseling matters: repeated sunburn and excessive sun exposure raise the risk of skin cancer, and blistering sunburns in childhood/adolescence specifically raise the risk of later [[215|melanoma]]."
)

replacements["ac250b92b7e64833ae80a32bea2ed656"] = (
    "- Toxic ingestion has a bimodal age distribution: accidental, exploratory ingestions peak at ages 1-4 years (also common under age 5 generally), while intentional ingestions/suicide attempts are more common in adolescents and young adults.\n"
    "- Exploratory ingestion in a toddler reflects host, agent, and environmental factors together: host risks include peak age 1-4 years, male gender, hyperactivity, and increased finger-to-mouth activity or pica; agent risks include easy access, an attractive appearance/taste (classic examples: iron tablets that resemble candy, and mouthwash, which can be brightly colored, pleasant-tasting, sold without child-safety caps, and contain 15-25% ethanol); environmental risks include an acute stressor (a move, a new sibling) or chronic issues like parental illness.\n"
    "- Caustic ingestion is the leading toxic exposure in children; most exposures are to mild alkali agents (household bleach, detergents), which can be relatively benign, but button battery ingestions are increasingly common and can be extremely dangerous. Liquid agents generally cause more injury than solids, and strong alkalis cause especially severe damage; severity depends on the agent's type, concentration, quantity, and duration of contact.\n"
    "- Toxic ingestion should be considered in the differential for almost any symptom complex, including [[142|altered mental status]] or behavior, metabolic derangement, cardiac dysrhythmia, hypotension/shock, seizure, [[151|respiratory distress]] or apnea, cyanosis, vomiting, and diarrhea — when symptoms don't fit a recognizable clinical syndrome, ingestion should be suspected.\n"
    "- Classic symptom pairs to check for: bradycardia or tachycardia, hypothermia or hyperthermia, respiratory [[204|depression]] or hyperpnea, hypotension or [[92|hypertension]], mydriasis or miosis.\n"
    "- Toxic ingestion accounts for up to 32.5% of pediatric ataxia cases; agents linked to ataxia include antihistamines, alcohol, anticonvulsants (especially phenytoin and carbamazepine), piperazine, barbiturates, carbon monoxide, organic solvents, and bromides.\n"
    "- The most frequent childhood poisonings involve readily accessible household products (cosmetics, hair products, cleaning substances, analgesics), but the most lethal or potentially lethal poisonings are typically pharmaceuticals — antimalarials, beta-blockers, calcium channel blockers, camphor, antidiarrheals, salicylates, opioids, and tricyclic antidepressants.\n"
    "- Coma from toxic ingestion typically has a slower onset than coma from trauma and may be preceded by delirium or other abnormal behavior; toxins can impair neuronal function directly or via hypoxia, acidosis, enzyme inhibition, [[321|hypoglycemia]], or [[315|seizures]].\n"
    "- Because pediatric ingestions are often unwitnessed and young children cannot reliably report what or how much they took, other evidence of metabolic derangement (hypoglycemia, [[170|hyponatremia]], hyperammonemia) is evaluated for alongside the standard history and exam; a strong index of suspicion is essential when the history is unclear."
)

replacements["e1b31534cc3d4d6383c3ff3495d9ddc8"] = (
    "- Irritable bowel syndrome (IBS) is a functional disorder of gut-brain interaction, affecting up to 3% of school-aged children, causing recurrent crampy abdominal pain with altered bowel habits, without long-term structural damage.\n"
    "- IBS is classified into the same subtypes as adult IBS by stool pattern: IBS with [[201|constipation]] (IBS-C), IBS with diarrhea (IBS-D, about a third of pediatric IBS), IBS with mixed constipation and diarrhea, and unspecified IBS.\n"
    "- Diagnostic criteria (Rome IV) require abdominal pain at least 4 days per month for at least 2 months, associated with defecation and/or a change in stool frequency and/or a change in stool form, without alarm features such as rectal bleeding, [[349|anemia]], weight loss, or fever.\n"
    "- Children with IBS do not have nighttime diarrhea, unlike infectious or secretory diarrhea; characteristic features include partially formed or liquid first-morning stool, increased daytime frequency, a bowel movement after each meal (a prominent gastrocolic reflex), 3-10 mucus-containing stools per day, and alternating constipation.\n"
    "- Affected children remain well overall — good appetite, no weight loss, growth impairment, fever, leukocytosis, steatorrhea, or protein malabsorption — which is the key distinction from [[254|inflammatory bowel disease]] or celiac disease.\n"
    "- Pathophysiology involves altered GI motility (abnormally forceful small-intestine contractions) and visceral hypersensitivity (pain at lower balloon-inflation volumes than controls), modulated by psychosocial factors like stress and anxiety; symptoms can be precipitated by a prior GI infection, and a positive family history is common.\n"
    "- Conditions to rule out before diagnosing IBS: late-onset [[255|lactose intolerance]], excess fructose/sorbitol ingestion, celiac disease, and inflammatory bowel disease — all of which can mimic IBS symptoms.\n"
    "- For a child with both constipation and abdominal pain, the constipation is treated first; only if discomfort persists should the child be treated for IBS-constipation-predominant subtype.\n"
    "- Treatment is largely supportive and often challenging: a high-residue/high-fiber diet is first-line for diarrhea-predominant IBS, with anticholinergics, tricyclic antidepressants (for diarrhea-predominant IBS under experienced supervision), probiotics, peppermint oil, elimination diets, behavioral treatments, and psychotherapy all showing some evidence of benefit."
)

changed_ids = set(replacements.keys())
count = 0
for entry in data:
    sid = entry["section_id"]
    if sid in changed_ids:
        entry["content"] = replacements[sid]
        count += 1

with open(DST, "w", encoding="utf-8") as f:
    json.dump(data, f, indent=2, ensure_ascii=False)

print(f"Applied {count} replacements out of {len(replacements)} defined; total entries: {len(data)}")
