import json

references = [
  {"title": "Cover", "author": "Vitalsource Download", "pages": [2926]},
  {"title": "Berkowitz's Pediatrics", "author": "Berkowitz, Carol D.;", "pages": [1198,1199,1200,1203]},
  {"title": "Update in Pediatrics", "author": None, "pages": [686]},
  {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [1486]},
  {"title": "Zitelli and Davis' Atlas of Pediatric Physical Diagnosis: Expert Consult - Online", "author": None, "pages": [288,293]},
  {"title": "Signs and Symptoms in Pediatrics", "author": "Henry M. Adam,Jane Meschan Foy", "pages": [649]},
  {"title": "Caring for the Hospitalized Child", "author": "Section on Hospital Medicine, American Academy of Pediatrics;Jeffrey C. Gershel;Daniel A. Rauch;", "pages": [452]},
  {"title": "Algorithms in Pediatrics", "author": None, "pages": [600]}
]

short = [{"title": "In short", "content": """- JIA = arthritis of unknown cause lasting at least 6 weeks with onset before age 16, after excluding infection, neoplasm, orthopedic disorders, other chronic inflammatory/autoimmune conditions, and metabolic/endocrine disease. It is a clinical diagnosis — no lab test (ANA, RF) is required or sufficient on its own.
- Arthritis is defined as joint swelling on exam, OR pain on range of motion plus limited range of motion, in one or more joints.
- US epidemiology: prevalence about 1 in 1000 children (96 per 100,000); annual incidence about 14 per 100,000 (or 1.4 per 10,000). Most common in white children (typically oligoarticular JIA), least common in Black and Asian children; females affected more than males, consistent with most autoimmune disease.
- ILAR classifies JIA into 7 categories based on joint count/pattern and features in the first 6 months: oligoarticular (persistent or extended), RF-negative polyarticular, RF-positive polyarticular, systemic, enthesitis-related arthritis, psoriatic arthritis, and undifferentiated. The presenting subtype in the first 6 months may not match the child's ultimate disease course.
- Subtype profile: oligoarticular — peak age 4 years, ≤4 joints, insidious onset, girls>boys, normal acute phase reactants. RF-negative polyarticular — peak age 2–5 years, ≥5 joints, insidious, girls>boys, elevated acute phase reactants. RF-positive polyarticular — peak age 12 years, ≥5 joints, rapid onset, girls>boys, elevated acute phase reactants. Systemic — any age <16, variable joint count and onset, girls=boys, elevated acute phase reactants (macrophage activation syndrome causes a relative drop in these markers, a red flag).
- Systemic JIA (sJIA) is the subtype most likely encountered by a hospitalist; peak onset age 2 years (range 1–5); unlike most JIA subtypes, fever IS expected — suspect after 2 weeks of fever, confirm after 6 weeks of arthritis; it is a diagnosis of exclusion made only after thorough evaluation for infectious and neoplastic causes of fever.
- Adolescents 16 or older with new chronic idiopathic arthritis are classified as having adult rheumatoid arthritis, not JIA — the age-16 cutoff is a hard diagnostic boundary.
- Symptoms: joint pain/swelling, limp (often worse in the morning), morning stiffness; systemic JIA adds fever and rash. Exam: arthritis most often in the knee, with swelling, warmth, limited motion, and pain on motion/tenderness. Leg-length discrepancy (from chronic hyperemia to an open epiphysis, classically the distal femur) and muscle atrophy suggest a chronic process.
- Complications include chronic anterior uveitis (often asymptomatic — hence scheduled ophthalmologic screening based on ANA status and age at diagnosis), leg-length discrepancy, and joint flexion contracture, all of which can impair daily activities and school function.
- Early referral and early treatment matter: they reduce morbidity affecting growth/development and pain, and improve time to and rate of remission.
- Monoarticular (single-joint) onset is usually oligoarticular JIA (large joint, afebrile or low-grade fever); rarely, systemic JIA can also start monoarticular (knee or hip) — look for rash, hepatosplenomegaly, lymphadenopathy, pericarditis, or iritis in that case. Single-joint onset is unusual for SLE; rheumatic fever, Kawasaki disease, juvenile dermatomyositis, and some viral infections can also start with monoarticular arthritis."""}]

long = [
 {"title": "Definition", "content": """Juvenile idiopathic arthritis (JIA) is arthritis of unknown cause, lasting at least 6 consecutive weeks, with onset before age 16, after excluding infection, neoplasm, orthopedic disorders, other chronic inflammatory or autoimmune conditions, and inherited metabolic or endocrine disease. Arthritis itself is defined as joint swelling on examination, or a joint with both pain on range of motion and limitation of range of motion. JIA is a clinical diagnosis: no laboratory test, including antinuclear antibody (ANA) or rheumatoid factor (RF), is either necessary or sufficient to make the diagnosis. The term JIA (via the International League of Associations for Rheumatology, ILAR, classification) has replaced the older terms "juvenile rheumatoid arthritis" and "juvenile chronic arthritis," in part because RF antibodies are absent in most affected children. Adolescents aged 16 or older presenting with new chronic idiopathic arthritis are classified as having adult rheumatoid arthritis rather than JIA."""},
 {"title": "Epidemiology", "content": """JIA is the most common rheumatic disease of childhood and one of the more common chronic pediatric illnesses overall. In the United States, prevalence is estimated at about 1 in 1000 children (96 per 100,000), with an annual incidence of about 14 per 100,000 (roughly 1.4 per 10,000). JIA occurs across all racial and ethnic groups but with variable frequency: it is most prevalent among white children (typically the oligoarticular subtype) and least prevalent among Black and Asian children. As with most autoimmune diseases, females are affected more often than males."""},
 {"title": "Etiology", "content": """The precise etiology and pathogenesis of JIA remain largely unknown, and the genetic contribution is complex, which is part of why clean distinctions between subtypes remain difficult and multiple classification schemes have been proposed. The ILAR system divides JIA into seven categories based on the number and pattern of joints involved and other clinical features present within the first 6 months of illness: oligoarticular (persistent or extended), RF-negative polyarticular, RF-positive polyarticular, systemic, enthesitis-related arthritis, psoriatic arthritis, and undifferentiated arthritis. Notably, the JIA subtype apparent at presentation may not match the child's ultimate disease course over time."""},
 {"title": "Clinical features", "content": """Each JIA subtype has a characteristic profile. Oligoarticular JIA has a peak age of onset around 4 years, involves 4 or fewer joints, has an insidious onset, and is more common in girls; acute phase reactants are typically normal. RF-negative polyarticular JIA peaks at 2–5 years, involves 5 or more joints, has an insidious onset, is more common in girls, and shows elevated acute phase reactants. RF-positive polyarticular JIA peaks around age 12, involves 5 or more joints, has a rapid onset, is more common in girls, and shows elevated acute phase reactants — this subtype behaves most like adult rheumatoid arthritis. Systemic JIA can begin at any age under 16, has a variable joint count and onset pattern, affects girls and boys equally, and shows elevated acute phase reactants (a relative drop in these markers can signal the serious complication macrophage activation syndrome). General presenting symptoms across subtypes include joint pain and swelling, limp, and morning-predominant pain and stiffness; systemic JIA additionally features fever and rash. On exam, arthritis most often affects the knee, presenting as swelling, warmth, limited range of motion, and pain on motion or tenderness. A child with JIA may be noted to limp mainly in the mornings, have new difficulty with handwriting, or show regression of gross motor milestones. Leg-length discrepancy — from chronic inflammation driving excess blood flow to an open epiphysis, most classically the distal femoral epiphysis — and muscle atrophy of the affected limb both suggest an established, chronic process rather than an acute one. Complications, including long-standing anterior uveitis (which is frequently asymptomatic), leg-length discrepancy, and joint flexion contracture, can impair activities of daily living and school performance."""},
 {"title": "Diagnostics", "content": """Diagnosis is clinical and requires objective arthritis (as defined above) persisting for a minimum of 6 consecutive weeks, together with exclusion of other causes of childhood arthritis using a structured differential and directed testing (which may include Lyme serology in endemic areas, antistreptolysin O titer, and other tests to rule out infectious, postinfectious, and neoplastic causes) rather than relying on ANA or RF results to confirm the diagnosis. Acute phase reactants differ by subtype and can help support (though not by themselves establish) a specific subtype diagnosis: normal in oligoarticular JIA, elevated in polyarticular and systemic JIA, and a relative decrease specifically raising concern for macrophage activation syndrome. Because chronic anterior uveitis is often asymptomatic yet can cause serious visual complications, scheduled ophthalmologic screening exams are recommended for children with JIA, with frequency determined by ANA status and age at diagnosis. Systemic JIA specifically is a diagnosis of exclusion: it can be suspected after 2 weeks of unexplained fever and confirmed once arthritis has been present for 6 weeks, but only after a thorough evaluation has excluded infectious and neoplastic causes of the fever."""},
 {"title": "Differential diagnosis", "content": """Monoarticular (single-joint) onset most often reflects oligoarticular JIA — typically a large joint, with the child either afebrile or having only a low-grade fever. Rarely, systemic JIA can also present initially as monoarticular disease (usually knee or hip); in that scenario, actively look for other systemic features — rheumatoid rash, hepatosplenomegaly, lymphadenopathy, pericarditis, or (rarely) iritis — to support the diagnosis. Single-joint involvement is unusual for systemic lupus erythematosus, which typically presents with polyarticular disease when arthritis is a feature. Other conditions that can occasionally begin with monoarticular arthritis include rheumatic fever, Kawasaki disease, juvenile dermatomyositis, and certain viral infections, and these should be actively excluded as part of the differential before settling on a JIA diagnosis."""}
]

clinical = [
 {"title": "Practical approach", "content": """When a child presents with joint pain/swelling and a morning-predominant pattern of pain or stiffness lasting more than 6 weeks, evaluate systematically for JIA: characterize the joint count and pattern (oligoarticular ≤4 joints vs. polyarticular ≥5 joints), note the tempo of onset (insidious vs. rapid), and look specifically for systemic features (fever, rash, hepatosplenomegaly, lymphadenopathy, serositis) that would point toward systemic JIA rather than one of the other subtypes. Remember that ANA and RF are neither required nor sufficient for diagnosis — order them to help refine subtype and guide uveitis screening, not to rule JIA in or out.

If fever is prominent, do not assume systemic JIA prematurely: treat it as a diagnosis of exclusion, pursuing a thorough infectious and oncologic workup before confirming, and note that most other JIA subtypes should not be associated with fever, so its presence should specifically raise or lower your suspicion for the systemic subtype. Watch acute phase reactants over time in any child with established JIA, particularly systemic JIA — a relative fall in previously elevated inflammatory markers is a red flag for macrophage activation syndrome rather than reassuring improvement.

Screen for asymptomatic anterior uveitis on the schedule appropriate to the child's ANA status and age at diagnosis, since this complication frequently causes no symptoms until vision is already threatened. Assess for and document leg-length discrepancy and muscle atrophy at follow-up visits, since these indicate an established, chronic disease process needing more aggressive management, and address functional impact directly — ask about handwriting difficulty, morning limp, and any regression of gross motor skills, since these are practical markers of disease impact on daily life and school. Refer to pediatric rheumatology early, since earlier treatment improves both time to remission and overall rate of achieving remission, and delayed referral increases morbidity related to growth, development, and pain."""}
]

article = {
 "topic": "Juvenile Idiopathic Arthritis",
 "slug": "juvenile-idiopathic-arthritis",
 "category_id": 15172,
 "summary": "ILAR classification of JIA into 7 subtypes with their distinguishing age, joint pattern, and lab profile, systemic JIA as a diagnosis of exclusion, and screening for silent uveitis.",
 "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/jia.article.json", "w") as f:
    json.dump(article, f, indent=1)
print("done")
