import json, pathlib

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

article = {
    "topic": "Phenylketonuria (Pku)",
    "slug": "phenylketonuria-pku",
    "category_id": 15229,
    "summary": "The classic gene-environment metabolic disease — phenylalanine hydroxylase deficiency causing severe intellectual disability if untreated, entirely preventable through newborn screening and a lifelong low-phenylalanine diet.",
    "written_by": "claude-sonnet",
    "references": sources["references"],
    "short": [{
        "title": "In short",
        "content": """- Classic phenylketonuria (PKU) is an autosomal recessive disorder of phenylalanine hydroxylase (PAH), the enzyme that converts phenylalanine to tyrosine; the gene maps to chromosome 12q24.1, and PKU occurs in about 1 in 10,000-20,000 births.
- PKU is a classic gene-environment disease: the devastating neurodevelopmental effects require both the genetic defect AND dietary phenylalanine exposure — a child with the PKU genotype who is identified early and kept on a restrictive diet develops normally.
- Untreated PKU causes progressive brain disease: acquired microcephaly, severe intellectual disability (IQ under 30 if never treated), developmental delay, seizures, hypertonicity, behavioral problems, abnormal EEG, and irreversible damage by 8 weeks of age.
- Classic physical findings from excess phenylalanine/phenylacetic acid: fair skin, hair, and eyes (relative to unaffected family members), eczema, and a characteristic musty/mousy/wolflike odor in sweat and urine.
- Infants appear normal at birth; over 50% develop early symptoms (vomiting, irritability, eczematous rash, the characteristic odor) before diagnosis if newborn screening is missed.
- Classic PKU is defined by persistently elevated phenylalanine above 20 mg/dL with normal/low tyrosine; hyperphenylalaninemia variants run lower (4-10 mg/dL) and require less strict dietary management. Rare cases result from a deficiency of the cofactor tetrahydrobiopterin (BH4) or defects in biopterin synthesis, which need additional neurotransmitter treatment beyond diet alone.
- Newborn screening detects nearly 100% of PKU cases and has been standard in developed countries since the late 1960s (originally the bacterial-inhibition Guthrie test, now typically tandem mass spectrometry); screening is done after 24 hours of life in the US, after at least 48 hours in some other countries.
- Treatment is a lifelong phenylalanine-restricted diet — natural protein limited to essential needs, supplemented with a phenylalanine-free medical formula containing tyrosine and other amino acids, plus specially formulated low-phenylalanine foods; aspartame (which contains phenylalanine) must be avoided; breastfeeding can continue but must be carefully monitored by a PKU specialty clinic, and the diet needs ongoing monitoring by an experienced nutritionist and metabolic clinic.
- Good phenylalanine control by 3-4 weeks of age with sustained good control produces good neuropsychological outcomes, though minor deficits can occur, especially with poor dietary compliance; well-treated patients may have a mild tremor but are otherwise normal on exam, with normal cognitive outcomes in most diet-adherent patients.
- Maternal PKU is a persistent problem: an infant born to a mother with poorly controlled PKU can have microcephaly, congenital heart disease, and intellectual disability even without being homozygous for PKU themselves, from in-utero phenylalanine exposure — such infants need phenylalanine level measurement after feeding is established, and many geneticists recommend early quantitative amino acid analysis rather than relying on routine newborn screening alone in this scenario."""
    }],
    "long": [
        {"title": "Definition",
         "content": "Phenylketonuria (PKU) is an autosomal recessive disorder in which phenylalanine cannot be adequately converted to tyrosine because of deficient phenylalanine hydroxylase (PAH) activity — hence its alternate name, PAH deficiency. This causes high blood phenylalanine and large amounts of phenylpyruvic acid in the urine. Severe hyperphenylalaninemia causing PKU holds a distinct place in inherited metabolic disease: it was the first genetic disease treatable exclusively by dietary manipulation, and the first entirely preventable through universal newborn screening and presymptomatic dietary intervention."},
        {"title": "Epidemiology",
         "content": "PKU occurs in about 1 in 10,000 to 1 in 20,000 births (also cited as 1 in 10,000-15,000). It was a common cause of intellectual disability before the advent of newborn screening. Newborn screening for PKU has been implemented in most developed countries since the late 1960s, initially using the Guthrie bacterial-inhibition assay (first reported in 1963), later fluorimetry and colorimetry, and now most commonly tandem mass spectrometry. Screening occurs after 24 hours of life in the US and after at least 48 hours in some other countries."},
        {"title": "Etiology",
         "content": "Nearly all PKU cases result from mutations in the gene encoding phenylalanine hydroxylase, mapped to chromosome 12q24.1. PKU is a paradigmatic gene-environment disease: the genetic defect alone is not sufficient to cause the devastating neurodevelopmental outcome — that requires the additional environmental factor of dietary phenylalanine exposure, an essential amino acid normally metabolized by PAH. Because dietary phenylalanine exposure is nearly universal while PKU mutations are rare, PKU is conventionally classified as a genetic disease, though this frames only one of the two necessary factors. Classic PKU (deficient PAH) accounts for most cases; rare cases instead result from a deficiency of the cofactor tetrahydrobiopterin (BH4) or from defects in biopterin synthesis, which require additional treatment with various neurotransmitters beyond dietary restriction alone. Maternal PKU poses a distinct risk: because the PKU allele is common in the general population (about 1:20), a child of a mother with PKU is an obligate heterozygote with about a 1 in 80 risk of being affected, and in-utero exposure to a mother's uncontrolled high phenylalanine levels can cause fetal effects even in a child who is not homozygous for PKU."},
        {"title": "Clinical features",
         "content": "Infants with PKU appear normal at birth, but more than half develop early symptoms if undiagnosed, including vomiting, irritability, an eczematous rash, and a characteristic musty, mousy, wolflike, or stale-sweaty-locker-room odor from phenylacetic acid in sweat and urine. Untreated, PKU causes progressive brain disease: acquired microcephaly, developmental delay, seizures, hypertonicity, behavioral problems, and severe intellectual disability, with IQ below 30 in those who remain untreated; damage becomes irreversible by 8 weeks of age. Affected children are typically fair-skinned, fair-haired, and blue-eyed relative to unaffected family members, and EEGs are abnormal. Well-treated patients on an adequate diet may have a mild tremor but are otherwise normal on examination, with normal cognitive outcomes in most diet-adherent patients, though some experience mild to moderate residual deficits. An infant of a mother with poorly controlled PKU can present with microcephaly, congenital heart disease, and intellectual disability even without being homozygous for the disorder."},
        {"title": "Diagnostics",
         "content": "Newborn screening detects nearly 100% of PKU cases, making early diagnosis and prevention of cognitive deficits routinely achievable. Diagnosis is made by demonstrating an elevated serum phenylalanine concentration, and this must occur in the neonatal period given how quickly irreversible damage develops. Classic PKU is characterized by persistently elevated phenylalanine above 20 mg/dL with normal or low tyrosine and characteristic urinary derivatives; variants with persistent hyperphenylalaninemia instead show phenylalanine levels of 4-10 mg/dL. A urine ferric chloride test can be used acutely (e.g., in the emergency department) if the characteristic odor prompts suspicion outside the newborn screening pathway. For an infant born to a mother with PKU, many geneticists recommend early quantitative amino acid analysis rather than relying on routine newborn screening alone, given the elevated background risk and the possibility of prenatal phenylalanine exposure effects independent of the infant's own genotype."},
        {"title": "Treatment",
         "content": "Treatment is a lifelong diet restricted in phenylalanine, containing just enough natural protein (from fruits, vegetables, and limited starches) to meet essential phenylalanine needs for growth and maintenance, supplemented with a phenylalanine-free medical food formula providing tyrosine and other essential amino acids and nutrients, along with specially formulated low-phenylalanine foods. This phenylalanine-free formula should be started as soon as possible after birth. Breastfeeding can continue but must be carefully monitored by a PKU specialty clinic, since breast milk still contains phenylalanine. The diet requires ongoing, careful monitoring by a nutritionist experienced in PKU, with follow-up through a metabolic disease clinic. Aspartame, a sugar substitute that contains phenylalanine, must be avoided. Rare variants caused by BH4 or biopterin synthesis defects require additional treatment with various neurotransmitters beyond dietary phenylalanine restriction."},
        {"title": "Complications",
         "content": "Delaying dietary restriction after a positive PKU diagnosis leads to irreversible intellectual disability in most affected children, since neurologic damage from phenylalanine toxicity becomes irreversible by around 8 weeks of age. Even with treatment, minor neuropsychological deficits can occur, particularly with poor dietary compliance. Achieving good phenylalanine control by 3-4 weeks of age, and maintaining good average control thereafter, produces good neuropsychological outcomes overall. Maternal PKU remains a persistent problem, since a mother's uncontrolled phenylalanine levels during pregnancy can cause microcephaly, congenital heart disease, and intellectual disability in her offspring regardless of the infant's own PKU genotype."},
    ],
    "clinical": [
        {"title": "Confirming and initiating treatment for a positive newborn screen",
         "content": "When a newborn screen returns positive for PKU, start a low-protein diet and phenylalanine-free medical formula as soon as possible, then confirm the diagnosis with further testing (quantitative phenylalanine level, and genetic testing as indicated) — do not wait for confirmatory results before beginning dietary intervention, since delay risks irreversible intellectual disability, and damage becomes irreversible by about 8 weeks of age. Verify that the state's newborn screen was actually performed, given that many primary care clinicians are now unfamiliar with untreated PKU phenotypes precisely because screening has made the untreated disease rare. If an infant is not caught by screening, a characteristic musty/mousy odor, fair complexion relative to family members, eczema, vomiting, or irritability should prompt urgent phenylalanine testing (a urine ferric chloride test can be done acutely) rather than waiting for developmental delay to become apparent."},
        {"title": "Ongoing management and special scenarios",
         "content": "Manage confirmed PKU with a lifelong phenylalanine-restricted diet under the guidance of a metabolic clinic and a nutritionist experienced in PKU, aiming for good phenylalanine control by 3-4 weeks of age and sustained control thereafter to maximize neuropsychological outcome. Support continued breastfeeding where desired, but monitor phenylalanine levels closely given ongoing intake from breast milk. Counsel patients and families to avoid aspartame. For a newborn of a mother with known PKU, measure phenylalanine levels once enteral feeding is established and consider early quantitative amino acid analysis rather than relying on routine newborn screening alone, given the child's elevated background risk (about 1 in 80) and the possibility of in-utero phenylalanine-related effects (microcephaly, congenital heart disease, intellectual disability) even in a heterozygous, unaffected infant if maternal phenylalanine control was inadequate during pregnancy."},
    ],
}

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