import json, pathlib

sources = json.loads(pathlib.Path("/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/articles/substance-intoxication.sources.json").read_text())

article = {
    "topic": "Substance Intoxication",
    "slug": "substance-intoxication",
    "category_id": 15884,
    "summary": "From toddlers who accidentally swallow household products to adolescents who binge drink, the epidemiology of pediatric substance exposure and the stabilize-then-identify approach that applies across all of it.",
    "written_by": "claude-sonnet",
    "references": sources["references"],
    "short": [{
        "title": "In short",
        "content": """- Acute poisoning/intoxication is a common and challenging pediatric emergency; children are vulnerable because of their curious, exploring nature and tendency to put objects in their mouths. In children, accidental exposure (about 96.9%) far outweighs intentional (about 3.1%), with peak incidence of accidental ingestion in the second year of life and about 85% of accidental poisonings occurring under age 5; in older children and teenagers, ingestions are largely intentional instead.
- Common poisoning categories vary by setting: in high-income countries, pharmaceuticals and household products/chemicals predominate; in low- and middle-income countries, pesticides, kerosene, and cleaning agents are also major contributors. One dataset breaks this down as household products (about 47%), drugs (about 22%), agricultural pesticides (about 9%), industrial chemicals (about 8%), bites/stings (about 3%), and plants (about 1.5%); another cites kerosene (30-50%), drugs (11%), pesticides (11%), and snakebites (10-20%) as leading causes.
- Substances commonly harmful in children include alcohol, acids and alkalis, bleach, digoxin, batteries, iron, paracetamol (acetaminophen), petroleum distillates, salicylates, and tricyclic antidepressants; most ingested substances, however, do not cause serious illness.
- Children can also be exposed passively — transplacentally, via breast milk, by inhalation, or simply by being in an environment where drugs of abuse (marijuana, cocaine, PCP, methamphetamine) are used or manufactured — any of which can produce severe intoxication.
- Alcohol is the substance most frequently abused by children and adolescents in the US, and its use is linked to the leading causes of death and serious injury in this age group (motor vehicle crashes, homicide, suicide); among youth who drink, the proportion who binge drink rises from about 50% at ages 12-14 to about 72% at ages 18-20 — pediatricians should ask every adolescent about alcohol use, and prevention is more effective than later intervention.
- Alcohol poisoning sources in children include not just beverages but mouthwash, hand sanitizer, food extracts (vanilla, almond), rubbing alcohol, and even powdered alcohol; concomitant exposure to other depressant drugs worsens intoxication severity. In adults, blood alcohol of 50-80 mg/dL is considered impairing and 80-100 mg/dL intoxicating (comparable pediatric figures are not established).
- A positive history for substance exposure can be difficult to obtain, and a toxicology screen is not always helpful, so a strong index of suspicion is essential; substance use or withdrawal should be considered in the differential for any adolescent with chronic, persistent irritability.
- Toxic ingestion is a major cause of pediatric ataxia (up to 32.5% of cases), with implicated agents including antihistamines, alcohol, anticonvulsants (especially phenytoin and carbamazepine), barbiturates, carbon monoxide, and organic solvents; when symptoms don't fit a recognizable clinical syndrome, ingestion should become a specific concern, and metabolic derangements (hypoglycemia, hyponatremia, hyperammonemia) should also be checked.
- Universal management principles: immediate attention to airway, breathing, and circulation first; then identification and quantification of the substance via history (from witnesses, family, friends) and exam; then symptomatic/supportive care, removal of unabsorbed poison (from GI tract, skin, eyes, other body cavities), measures to hasten elimination of absorbed poison, and a specific antidote if one is available."""
    }],
    "long": [
        {"title": "Definition",
         "content": "Substance intoxication in children encompasses the spectrum from accidental household poisoning in toddlers to intentional recreational substance use and self-harm attempts in adolescents. Acute poisoning is a common and challenging pediatric emergency and an important cause of morbidity and mortality, particularly in developing countries."},
        {"title": "Epidemiology",
         "content": "Accidental exposure vastly outweighs intentional poisoning in children overall (about 96.9% versus 3.1% in one dataset), with peak incidence of accidental ingestion in the second year of life and about 85% of accidental poisonings occurring in children under age 5. In older children and adolescents, ingestions are more often intentional (suicide attempts or recreational use). Alcohol is the substance most frequently abused by children and adolescents in the United States, and its use is associated with the leading causes of death and serious injury at this age — motor vehicle accidents, homicide, and suicide. Among youth who drink, the proportion who drink heavily is higher than among adult drinkers, rising from about 50% at ages 12-14 to about 72% at ages 18-20."},
        {"title": "Etiology",
         "content": "Children are vulnerable to poisoning because of their curious, exploring nature and propensity to put objects in their mouths. Common poisoning categories differ by setting: in high-income countries, pharmaceuticals and household products/chemicals predominate, while low- and middle-income countries also see substantial pesticide, kerosene, and cleaning agent exposures. One reported breakdown includes household products (about 47%, e.g., kerosene, pyrethroids, rodenticides, mercury, phenyl, detergents, corrosives), drugs (about 22%, e.g., benzodiazepines, anticonvulsants, thyroid hormone, iron, acetaminophen), agricultural pesticides (about 9%), industrial chemicals (about 8%), bites and stings (about 3%), and plants/plant derivatives (about 1.5%); another dataset from a different setting cites kerosene (30-50%), drugs (11%), pesticides (11%), and snakebites (10-20%) as leading causes. Substances known to be potentially harmful in children include alcohol, acids and alkalis, bleach, digoxin, batteries, iron, paracetamol (acetaminophen), petroleum distillates, salicylates, and tricyclic antidepressants — though most substances children ingest do not cause serious illness. Alcohol poisoning in children can arise not just from beverages but from mouthwash, hand sanitizer, food extracts (vanilla, almond), rubbing alcohol, tinctures, cosmetics, and even powdered alcohol preparations; concomitant exposure to other depressant drugs increases the seriousness of alcohol intoxication. Children can also be exposed to substances passively — transplacentally, through breast milk, by inhalation, or simply by being in an environment where drugs of abuse (marijuana, cocaine, PCP, methamphetamine) are used or manufactured — any of which can be sufficient to produce severe intoxication."},
        {"title": "Clinical features",
         "content": "Symptoms and signs of poisoning vary widely by substance; physical examination may reveal pallor (suggesting hemolysis) or cyanosis (suggesting methemoglobinemia), among other findings specific to the ingested agent. Toxic ingestion is a major cause of pediatric ataxia, accounting for up to 32.5% of cases, with implicated agents including antihistamines, alcohol, anticonvulsants (especially phenytoin and carbamazepine), piperazine, barbiturates, carbon monoxide, organic solvents, and bromides. Symptoms of ingestion are often nonspecific, and when a presentation does not fit a recognizable clinical syndrome, ingestion should become a specific concern. In adults, blood alcohol levels of 50-80 mg/dL are considered compatible with impaired faculties and 80-100 mg/dL with intoxication (comparable pediatric figures are not established)."},
        {"title": "Diagnostics",
         "content": "A comprehensive history should be obtained from witnesses, family members, and friends regarding the nature of the substance and circumstances of exposure. A positive history can be difficult to elicit, and toxicologic screening is not always helpful, so a strong index of suspicion remains essential. Substance use or withdrawal should be part of the differential diagnosis for any adolescent presenting with chronic, persistent irritability. Physical and neurological examination following initial stabilization can provide clues to the substance involved and the severity of exposure. When considering toxic ingestion, it is also important to evaluate for other evidence of metabolic derangement, such as hypoglycemia, hyponatremia, and hyperammonemia."},
        {"title": "Treatment",
         "content": "Management begins with immediate attention to airway, breathing, and circulation (ABCs) and rapid assessment of mental status, before proceeding to identification and quantification of the poison. Core management principles include: removal of the source of poison; initial resuscitation and stabilization; symptomatic and supportive measures; removal of unabsorbed poison (from the gastrointestinal tract, skin, eyes, or other body cavities); measures to hasten elimination of already-absorbed poison; and use of a specific antidote when one is available. As with any high-risk adolescent behavior, prevention (through anticipatory guidance and routinely asking every adolescent about alcohol use) is more effective than intervention after the fact."},
    ],
    "clinical": [
        {"title": "Initial stabilization and history-taking",
         "content": "Prioritize airway, breathing, circulation, and mental status assessment immediately in any child with suspected substance intoxication, before pursuing a detailed history or diagnostic workup. Once stabilized, gather a comprehensive history from witnesses, family, and friends about the nature of the substance, timing, and circumstances, recognizing that a clear history is often unavailable and that toxicology screening does not always clarify the picture — maintain a high index of suspicion regardless. Consider passive or environmental exposure (transplacental, breast milk, inhalation, or presence where drugs are used or manufactured) in an infant or young child with unexplained intoxication signs, and consider substance use or withdrawal in any adolescent with chronic, persistent irritability. Examine for pallor (hemolysis) or cyanosis (methemoglobinemia) as clues to specific toxic mechanisms, and evaluate for ataxia and metabolic derangement (hypoglycemia, hyponatremia, hyperammonemia) alongside the standard exam."},
        {"title": "Management principles and prevention",
         "content": "Follow the standard sequence: stabilize ABCs, remove the source of poison, provide supportive care, decontaminate (GI tract, skin, eyes, or other exposed body cavity as relevant), consider measures to hasten elimination of absorbed toxin, and give a specific antidote when one exists. For adolescents specifically, screen proactively for alcohol use at every visit rather than waiting for a presentation of intoxication, given that alcohol is the most commonly abused substance in this age group and binge drinking prevalence rises sharply with age (about 50% of drinkers at 12-14 years to about 72% at 18-20 years); remember that alcohol exposure in children can come from unexpected sources like hand sanitizer, mouthwash, and food extracts, not just beverages. Emphasize prevention — safe storage of medications and household chemicals, anticipatory guidance for families with toddlers, and routine adolescent substance-use screening — since prevention is more effective than intervention after intoxication has already occurred."},
    ],
}

for v in ("short", "long", "clinical"):
    for s in article[v]:
        assert s["title"].strip() and s["content"].strip()

out = pathlib.Path("/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/articles/substance-intoxication.article.json")
out.write_text(json.dumps(article, indent=1))
print(out)
