import json

references = [
  {"title": "Zitelli and Davis' Atlas of Pediatric Physical Diagnosis: Expert Consult - Online", "author": None, "pages": [638]},
  {"title": "MedStudy Pediatrics Core 11th Edition 2024-2025", "author": None, "pages": [455]},
  {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [3630,3631,3634,3639]},
  {"title": "Pediatric ICD-10-CM 2023", "author": "American Academy of Pediatrics Committee on Coding and Nomenclature;", "pages": [74,212]},
  {"title": "Berkowitz's Pediatrics", "author": "Berkowitz, Carol D.;", "pages": [521]}
]

short = [{"title": "In short", "content": """- Generalized epilepsy is the most common type of childhood epilepsy, accounting for about 50% of all pediatric epilepsy; it involves diffuse abnormal electrical activity from both cerebral hemispheres from the very onset of the seizure (as opposed to focal epilepsy, which starts in one area and can secondarily generalize).
- Classic clinical features of generalized-onset seizures: abrupt onset, loss or alteration of awareness, variable bilateral symmetric motor activity with tone changes, no warning/aura, and bilateral synchronous epileptiform activity on EEG.
- Absence seizures: brief (5–20 seconds), sudden staring or behavioral arrest with abrupt recovery, often with facial automatisms (eye flutter, chewing, ocular supraversion); classic EEG shows generalized 3-per-second spike-and-wave discharges, activatable by hyperventilation. Peak incidence age 3–8 years (onset can occur in adolescence); strong genetic predisposition; occurs in otherwise neurologically/intellectually normal children; often outgrown by late childhood/adolescence.
- 40–60% of absence seizure patients go on to have a generalized tonic-clonic seizure at some point; in childhood absence epilepsy specifically, about 25% develop generalized tonic-clonic seizures (half before, half after absence onset).
- Generalized tonic-clonic seizures (formerly "grand mal") are the classic generalized-onset seizure type; the combined tonic-clonic pattern is rare in infancy (simple febrile seizures being the common generalized tonic-clonic event at that age) but becomes more recognizable in early childhood.
- Genetic generalized epilepsy syndromes map to specific ion-channel/receptor genes: GABRA1 (absence, idiopathic generalized epilepsy, juvenile myoclonic epilepsy), GABRB3 and GABRG2 (childhood absence, epileptic encephalopathy, GEFS+), among others — reflecting a strong hereditary component to many generalized epilepsies.
- Generalized epilepsy with febrile seizures plus (GEFS+): autosomal dominant, highly variable phenotype, onset usually in early childhood with remission by mid-childhood; combines multiple febrile seizures with later afebrile generalized seizures (tonic-clonic, absence, myoclonic, atonic, or myoclonic-astatic) of variable severity; febrile seizures persisting after age 6, or occurring together with afebrile generalized seizures and a family history of epilepsy, should raise suspicion for GEFS+, which generally carries a benign prognosis.
- Almost any epilepsy type can be preceded by febrile seizures, but specific syndromes typically start that way: GEFS+, severe myoclonic epilepsy of infancy (Dravet syndrome), and (in many patients) temporal lobe epilepsy from mesial temporal sclerosis.
- Benign myoclonic epilepsy of infancy presents with myoclonic (and other) seizures in the first year of life with generalized 3-Hz spike-and-slow-wave discharges; it can initially resemble more severe epileptic encephalopathies, with the diagnosis clarified only on follow-up.
- ICD-10-CM codes generalized idiopathic epilepsy under G40.3, with specific named subtypes: absence epileptic syndrome (G40.A, including childhood absence/pyknolepsy and juvenile absence epilepsy) and juvenile myoclonic epilepsy (G40.B), each further split by intractability."""}]

long = [
 {"title": "Definition", "content": """Generalized epilepsy is defined by seizures that arise from diffuse, simultaneous abnormal electrical activity across both cerebral hemispheres from the very onset of the event — distinct from focal (localization-related/partial) epilepsy, in which the seizure begins in one brain region and may or may not secondarily generalize. Generalized seizures can be convulsive or nonconvulsive; in children, nonconvulsive generalized seizures most often present as absence epilepsy. Other generalized seizure types — tonic, tonic-clonic, atonic, and myoclonic — are defined by the specific motor activity observed during the event."""},
 {"title": "Epidemiology", "content": """Generalized epilepsy is the most common form of epilepsy in childhood, accounting for roughly 50% of all pediatric epilepsy diagnoses. Absence epilepsy specifically has a peak incidence between ages 3 and 8 years, though onset can occur as late as adolescence, and it carries a strong genetic predisposition. Childhood absence epilepsy typically begins in mid-childhood, and most affected children outgrow it before adulthood."""},
 {"title": "Etiology", "content": """Many generalized epilepsy syndromes have an identified genetic basis involving ion channel and neurotransmitter receptor genes. GABA receptor gene variants illustrate this: GABRA1 mutations are linked to absence seizures, idiopathic generalized epilepsy, epileptic encephalopathy, and juvenile myoclonic epilepsy with onset spanning infancy through adolescence; GABRB3 mutations to childhood absence epilepsy and epileptic encephalopathy with onset from the neonatal period through childhood; and GABRG2 mutations to childhood absence epilepsy, GEFS+, and idiopathic generalized epilepsy with neonatal or infantile onset. Beyond GABA receptors, mutations in nicotinic acetylcholine and glutamate receptor genes are linked to various generalized and focal epilepsy syndromes across different ages of onset. Generalized epilepsy with febrile seizures plus (GEFS+) is a specific autosomal dominant syndrome with highly variable phenotype and expression, even within the same family, where different relatives may show different combinations of febrile and generalized seizure types. Almost any epilepsy type can be preceded by febrile seizures, but a few syndromes characteristically start this way: GEFS+, severe myoclonic epilepsy of infancy (Dravet syndrome), and, in many patients, temporal lobe epilepsy secondary to mesial temporal sclerosis."""},
 {"title": "Clinical features", "content": """Generalized-onset seizures share several classic features: abrupt onset without warning or aura, loss or alteration of awareness, variable bilateral and symmetric motor activity with changes in muscle tone, and bilateral, synchronous epileptiform activity on EEG. Absence seizures are brief (5–20 seconds), presenting as sudden staring or arrest of activity with abrupt recovery, often accompanied by facial automatisms such as eye flutter, chewing movements, or upward eye deviation; they occur in children who are otherwise neurologically and intellectually normal. Generalized tonic-clonic seizures (formerly called grand mal seizures) are the classic generalized-onset seizure type; the combined tonic-clonic pattern is rare in infancy — where generalized tonic-clonic seizures more often reflect a simple febrile seizure — but becomes a more typical epilepsy presentation in early childhood. GEFS+ manifests as generalized febrile seizures, sometimes persisting after age 6 (atypically late for ordinary febrile seizures), together with afebrile generalized convulsions and a positive family history of epilepsy with variable phenotypes; the same family may show simple febrile seizures, febrile seizures after age 6, febrile seizures plus absences, atonic or myoclonic seizures, or more severe phenotypes such as myoclonic-astatic epilepsy or Dravet syndrome. Benign myoclonic epilepsy of infancy presents with myoclonic and other seizure types beginning in the first year of life."""},
 {"title": "Diagnostics", "content": """EEG is central to diagnosing generalized epilepsy syndromes. Absence epilepsy shows a characteristic pattern of generalized three-per-second spike-and-wave discharges, which can be provoked by hyperventilation during EEG testing — a useful bedside/clinic maneuver when absence seizures are suspected. Benign myoclonic epilepsy of infancy shows generalized 3-Hz spike-and-slow-wave discharges; because this pattern and clinical picture can initially resemble more severe epileptic encephalopathies, the diagnosis is often clarified only with clinical follow-up over time rather than at the first presentation. Genetic testing for known ion channel and receptor gene variants (GABRA1, GABRB3, GABRG2, and others) can support the diagnosis of specific generalized epilepsy syndromes, particularly when the phenotype or family history suggests a hereditary generalized epilepsy such as GEFS+ or juvenile myoclonic epilepsy."""},
 {"title": "Differential diagnosis", "content": """Because febrile seizures and generalized epilepsy overlap clinically, distinguishing ordinary simple febrile seizures from an emerging generalized epilepsy syndrome matters: febrile seizures continuing after age 6, or occurring alongside afebrile generalized seizures with a family history of epilepsy, should raise suspicion for GEFS+ rather than being dismissed as typical febrile seizures. Among the benign generalized epilepsies, childhood absence epilepsy must be distinguished from juvenile absence epilepsy and from more severe generalized epileptic encephalopathies, since prognosis and the likelihood of an eventual tonic-clonic seizure differ (about 25% of childhood absence epilepsy patients develop generalized tonic-clonic seizures, versus 40–60% of absence seizure patients more broadly). ICD-10-CM formally separates generalized idiopathic epilepsy (G40.3) from specific named syndromes — absence epileptic syndrome (G40.A, covering childhood absence/pyknolepsy and juvenile absence epilepsy) and juvenile myoclonic epilepsy (G40.B) — each further subclassified as intractable or not, reflecting how clinically distinct these entities are despite sharing a generalized-onset mechanism."""}
]

clinical = [
 {"title": "Approach to suspected generalized epilepsy", "content": """When a child presents with episodes of sudden staring or brief behavioral arrest lasting seconds, consider absence seizures and obtain an EEG with hyperventilation, since this can provoke the classic generalized 3-per-second spike-and-wave pattern and support the diagnosis; reassure families that most children with typical childhood absence epilepsy are neurologically and intellectually normal and often outgrow the condition by late childhood or adolescence, while still counseling that roughly a quarter will develop a generalized tonic-clonic seizure at some point (and 40–60% of absence-seizure patients more broadly).

Distinguish an evolving generalized epilepsy syndrome from ordinary febrile seizures when the clinical picture doesn't fit the usual pattern: febrile seizures persisting past age 6, febrile seizures occurring alongside afebrile generalized seizures, or a strong family history of epilepsy with variable seizure types should prompt evaluation for GEFS+ rather than reassurance about typical febrile seizure outcomes. In an infant presenting with myoclonic seizures in the first year of life, keep benign myoclonic epilepsy of infancy on the differential, but recognize that distinguishing it from more severe epileptic encephalopathies (e.g., Dravet syndrome, West syndrome) often requires clinical follow-up rather than a single EEG or visit — avoid over-committing to either diagnosis prematurely.

Since many generalized epilepsy syndromes have an identifiable genetic basis (GABA receptor and other ion channel gene variants), consider genetic testing when the seizure phenotype, age of onset, and family history fit a recognizable hereditary pattern, since this can refine prognosis and inform family counseling about recurrence risk in future children and other relatives. Code and document the specific syndrome (e.g., absence epileptic syndrome vs. juvenile myoclonic epilepsy vs. other generalized epilepsy) and its intractability status, since these formal distinctions track meaningfully different management and prognosis pathways."""}
]

article = {
 "topic": "Generalized Epilepsy",
 "slug": "generalized-epilepsy",
 "category_id": 15266,
 "summary": "How generalized-onset seizures differ from focal seizures, the genetics and EEG signatures behind pediatric generalized epilepsy syndromes, and distinguishing benign syndromes from febrile-seizure mimics like GEFS+.",
 "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/genepilepsy.article.json", "w") as f:
    json.dump(article, f, indent=1)
print("done")
