import json, pathlib

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

article = {
    "topic": "Parasitic Infection",
    "slug": "parasitic-infection",
    "category_id": 14950,
    "summary": "The global and domestic burden of pediatric parasitic disease, the intestinal protozoa that actually cause diarrhea in US children, and why stool ova-and-parasite testing is so often the wrong test.",
    "written_by": "claude-sonnet",
    "references": sources["references"],
    "short": [{
        "title": "In short",
        "content": """- Parasitic diseases are a major cause of global pediatric morbidity and mortality, with the heaviest burden in low- and middle-income countries; Plasmodium falciparum (malaria) alone causes 1-2.7 million deaths annually, and parasitic worm infections account for an estimated 39 million disability-adjusted life years, disproportionately in the developing world.
- Parasitic infections can impair growth and development in children, with downstream effects on cognitive function, education, and later economic productivity.
- Children who have only ever resided in developed countries are usually free of tissue parasites, with few exceptions (Toxocara, Toxoplasma); travel or residence in an endemic area is the key risk factor for tissue and additional intestinal parasites.
- In the United States, the most common infections children actually acquire include giardiasis, pinworm infection, and head lice; Trichomonas is the single most common parasitic infection in the US overall, with about 7.4 million infections annually.
- Water and pet exposure are classic routes for specific parasites: Giardia lamblia, Cryptosporidium parvum, Toxoplasma gondii, and Toxocara canis.
- Giardia intestinalis (lamblia) is the most common intestinal protozoal infection in children in the US and worldwide, classically from contaminated water (including pools, since it resists chlorination) or fecal-oral spread, with daycare centers a major source; 25% of infected people are asymptomatic, which facilitates spread to household contacts.
- A common misperception is that intestinal helminths (worms) are common causes of diarrhea — with rare exceptions (e.g., Trichuris dysentery syndrome), they are not; parasitic diarrhea is almost exclusively caused by protozoa (Giardia, Cryptosporidium, Entamoeba).
- More than 90% of stool ova-and-parasite (O&P) examinations performed in the US are negative, and O&P is rarely the correct test for a child with diarrhea — protozoal causes of diarrhea are now more commonly and accurately diagnosed with molecular (PCR-based) methods rather than traditional O&P microscopy.
- Antiparasitic medication selection can be complex: some agents lack FDA approval, some are approved only for specific pediatric indications, and a few antiparasitic drugs are available only through the CDC; drug effectiveness has often been established through use in countries with endemic infection."""
    }],
    "long": [
        {"title": "Definition",
         "content": "Parasites causing human disease represent a diverse, highly evolved, and complex group of organisms. They can be organized by major biologic classification and by their predominant site of interaction with the human host — intestinal versus blood/tissue — a framework that helps organize the wide range of parasitic pathogens encountered in pediatric practice."},
        {"title": "Epidemiology",
         "content": "Parasitic disease causes extensive global morbidity and mortality in children, with the heaviest burden in low- and middle-income countries. Plasmodium falciparum alone causes 1-2.7 million deaths annually. Parasitic worm (helminth) infections account for an estimated 39 million disability-adjusted life years worldwide, disproportionately affecting the developing world. Parasitic infection can impair childhood growth and development, with knock-on effects on cognitive function, educational attainment, and later economic productivity. Although less common in industrialized nations, parasites remain an important pathogen class to recognize even there, since both endemic (locally acquired) and imported (travel-related) cases are regularly encountered in pediatric practice. The incidence of specific parasitic infections varies greatly by geographic area; children who have traveled to or lived in an endemic area are at risk for a wider range of intestinal and tissue parasites, whereas children who have resided only in developed countries are usually free of tissue parasites, with few exceptions such as Toxocara and Toxoplasma. In the United States specifically, Trichomonas is the most common parasitic infection overall, with about 7.4 million infections annually, though this is covered separately as a sexually transmitted infection; among non-STI parasitic infections, giardiasis, pinworm infection, and head lice are the most commonly encountered in US children."},
        {"title": "Etiology",
         "content": "Intestinal parasites infect millions of people worldwide, particularly in developing countries with poor access to potable water and in patients with comorbidities. The most common intestinal parasites in US children are Giardia lamblia (intestinalis), Entamoeba histolytica, and Cryptosporidium parvum. Giardia is a flagellated protozoan and the most common cause of parasitic enteritis in the US; it spreads via contaminated water (including pools, since it is resistant to chlorination) and via fecal-oral or direct person-to-person contact, with outbreaks common in daycare centers. Contaminated water and pet exposure are classic routes for Giardia lamblia, Cryptosporidium parvum, Toxoplasma gondii, and Toxocara canis specifically. A significant proportion of childhood diarrheal disease worldwide is caused by parasitic infection, principally amoebae, flagellates, and coccidia; heavy helminth infections can cause specific clinical syndromes, though helminths are a much less common cause of diarrhea than protozoa."},
        {"title": "Clinical features",
         "content": "Giardiasis can occur at any age, though it is rare in neonates; classic exposure is to contaminated water in rural areas or areas with faulty purification, though even ostensibly clean urban supplies and mountain streams can be intermittently contaminated. About 25% of infected people are asymptomatic, which facilitates ongoing spread to household contacts. Food-borne outbreaks also occur, and high transmission rates are seen among men who have sex with men; domestic pets are rarely a source of human Giardia infection because of strain differences between human and animal Giardia. A common misperception is that intestinal helminths are common causes of diarrhea; with rare exceptions such as Trichuris dysentery syndrome, they are not — parasitic diarrhea is almost exclusively caused by protozoa (Giardia, Cryptosporidium, Entamoeba)."},
        {"title": "Diagnostics",
         "content": "Searching for intestinal parasites is expensive for the patient and time-consuming for the laboratory: more than 90% of stool ova-and-parasite (O&P) examinations performed in the US are negative. Because parasitic diarrhea is almost exclusively protozoal rather than helminthic, and protozoal pathogens (Giardia, Cryptosporidium, Entamoeba) are now commonly diagnosed with molecular (PCR-based) methods, a standard O&P exam is rarely the correct test to order for a child presenting with diarrhea. Selection of which children to evaluate for parasitic infection should be guided by travel history, residence in or exposure to an endemic area, and specific exposures (contaminated water, pets, daycare) rather than reflexive stool testing."},
        {"title": "Treatment",
         "content": "The landscape of antiparasitic medications can be confusing: some agents are not FDA-approved, others are approved only for specific pediatric indications, and a few antiparasitic drugs are available only through the CDC. Effectiveness of some newer antiparasitic drugs has been established primarily through use in countries with endemic infection. Cooperation among governmental and private institutions has made a significant impact in helping eradicate or reduce the incidence of parasitic infections in resource-limited areas."},
        {"title": "Complications",
         "content": "Beyond acute illness, parasitic infection can impair growth and development in children, with lasting effects on cognitive function, educational achievement, and economic productivity into adulthood — an important long-term consequence beyond the immediate infectious illness, particularly relevant in the high-burden regions where these infections are most prevalent."},
    ],
    "clinical": [
        {"title": "Deciding whom and how to test",
         "content": "Before ordering parasitic testing in a child with diarrhea, consider the pretest probability: more than 90% of stool O&P exams in the US are negative, and helminths are rarely the cause of diarrhea. Reserve broad parasitic workup for children with a specific risk factor — travel to or residence in an endemic area, daycare attendance with a known outbreak, exposure to contaminated water (well water, a pool, a stream), or pet/animal contact — rather than ordering an O&P reflexively on every child with loose stools. When protozoal infection (Giardia, Cryptosporidium, Entamoeba) is genuinely suspected, favor molecular (PCR-based) stool testing over traditional O&P microscopy, since these are now the more accurate and commonly used diagnostic approach for these organisms."},
        {"title": "Recognizing and managing giardiasis specifically",
         "content": "Suspect giardiasis in a child with diarrhea and a history of exposure to potentially contaminated water (well water, a stream, or even a treated pool, since Giardia resists chlorination), daycare attendance, or a household contact with similar symptoms — remembering that 25% of infected individuals are asymptomatic, so an asymptomatic carrier in the household can be the ongoing source. Because pets are rarely a source of human Giardia infection (due to host-specific strain differences), focus exposure history on water sources, daycare, and person-to-person contact rather than the family dog or cat. When selecting antiparasitic treatment for any confirmed parasitic infection, verify FDA approval status and pediatric-specific indications before prescribing, since the antiparasitic drug landscape includes agents with limited approval or that are available only through the CDC."},
    ],
}

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/parasitic-infection.article.json")
out.write_text(json.dumps(article, indent=1))
print(out)
