import json, pathlib

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

article = {
    "topic": "Insulin Resistance",
    "slug": "insulin-resistance",
    "category_id": 15514,
    "summary": "From common obesity-associated insulin resistance with acanthosis nigricans to the rare, severe genetic insulin receptor syndromes like Donohue and Rabson-Mendenhall syndromes.",
    "written_by": "claude-sonnet",
    "references": sources["references"],
    "short": [{
        "title": "In short",
        "content": """- Insulin resistance is reduced tissue responsiveness to insulin's action; common causes in children are obesity and diabetes mellitus, with acanthosis nigricans seen in over 60% of children with a BMI above the 98th percentile.
- Acanthosis nigricans is velvety hyperpigmentation, classically in the axilla, from insulin resistance with compensatory hyperinsulinemia, where excess insulin binds and activates insulin-like growth factor receptors, promoting epidermal and fibroblast growth; other associated endocrinopathies include Cushing syndrome, polycystic ovary syndrome, thyroid disease, acromegaly, and pituitary hypogonadism, and certain drugs (insulin, oral contraceptives/sex hormones, nicotinic acid, corticosteroids, heroin) can also cause it.
- In one study, 49% of fifth-grade children with acanthosis nigricans had three or more features of insulin resistance/metabolic syndrome (insulin resistance, hypertension, HDL under 40 mg/dL, triglycerides over 150 mg/dL) in addition to obesity; it is estimated that about half of severely obese children are insulin resistant.
- Type 2 diabetes is diabetes with both insulin resistance and impaired beta-cell function; type 1 diabetes, by contrast, is defined by absolute insulin deficiency from beta-cell loss.
- Genetic insulin receptor defects cause a spectrum of insulin resistance syndromes from mutations in the INSR gene on chromosome 19: the mildest form (type A insulin resistance) causes hirsutism, hyperandrogenism, and cystic ovaries without obesity; the most severe, Donohue syndrome (leprechaunism), causes intrauterine growth restriction, fasting hypoglycemia, postprandial hyperglycemia, profound insulin resistance (insulin levels around 100x normal), marked acanthosis nigricans, and death typically before age 1; Rabson-Mendenhall syndrome causes extreme growth retardation, marked insulin resistance, and diabetes, diagnosed in infancy.
- Type A insulin resistance is typically diagnosed in adolescence with diabetes, insulin resistance, polycystic ovaries, and androgen excess signs, without obesity, and does not significantly impair life expectancy.
- Lipodystrophy causes insulin resistance through partial or total subcutaneous fat loss, with associated PCOS, elevated insulin, and diabetes; total lipodystrophy is caused by recessive mutations in Seipin or AGPAT2, and partial lipodystrophy by dominant mutations in lamin A/C or PPARG.
- In HIV, both protease inhibitor and NNRTI/NRTI antiretrovirals have been linked to insulin resistance, occurring at the adipose tissue level and more pronounced in children with lipodystrophy; a proposed mechanism is direct inhibition of GLUT4, the transporter responsible for insulin-stimulated glucose uptake into muscle and fat.
- Metformin has shown some benefit on BMI and insulin resistance scores in short 6-month trials in adolescents, but is not currently recommended for treating insulin resistance because evidence is limited; there is no consensus on treating prediabetes in children beyond lifestyle management, and initial treatment for associated dyslipidemia is always a 6-month trial of dietary and physical activity changes. Screen for and address comorbidities like PCOS and obstructive sleep apnea, which often share the same causal link to insulin resistance."""
    }],
    "long": [
        {"title": "Definition",
         "content": "Insulin resistance is reduced responsiveness of target tissues to the action of insulin, requiring higher insulin levels to achieve normal glucose uptake and metabolic effects. It ranges from a common, mild condition strongly associated with obesity to rare, severe genetic syndromes caused by insulin receptor gene mutations."},
        {"title": "Epidemiology",
         "content": "Common causes of insulin resistance in children are obesity and diabetes mellitus; acanthosis nigricans, its cutaneous marker, is seen in more than 60% of children with a body mass index above the 98th percentile. It is estimated that about half of severely obese children are insulin resistant. In a cohort study, 49% of fifth-grade children with acanthosis nigricans had three or more features of insulin resistance syndrome (evidence of insulin resistance, hypertension, HDL cholesterol under 40 mg/dL, triglycerides over 150 mg/dL) in addition to obesity, though no standardized pediatric definition of metabolic syndrome exists. Insulin resistance accounts for 10-50% of diabetes in adolescents, varying by ethnicity, generally reflecting relative rather than absolute insulin deficiency."},
        {"title": "Etiology",
         "content": "The most common causes of insulin resistance in children are obesity and type 2 diabetes mellitus, the latter defined by combined insulin resistance and impaired beta-cell function (in contrast to type 1 diabetes, defined by absolute insulin deficiency from beta-cell loss). Other endocrinopathies associated with insulin resistance include pituitary hypogonadism, Cushing syndrome, polycystic ovary syndrome, thyroid disease, and acromegaly; certain drugs (insulin itself, oral contraceptives and other sex hormones, nicotinic acid, corticosteroids, and heroin) are also implicated. A rare paraneoplastic form results from tumor-secreted growth factors. Genetic insulin receptor defects (variants in the INSR gene) impair insulin action at the receptor or in postreceptor signaling, producing a spectrum of syndromes: the mildest, type A insulin resistance, and the most severe, Donohue syndrome (leprechaolism/leprechaunism) and Rabson-Mendenhall syndrome. Lipodystrophy, whether total (recessive mutation in Seipin or AGPAT2) or partial (dominant mutation in lamin A/C or PPARG), causes insulin resistance through loss of subcutaneous fat and is associated with polycystic ovary syndrome, elevated insulin, and diabetes. In HIV, both protease inhibitors and NNRTI/NRTI antiretroviral drugs have been linked to insulin resistance, with a proposed mechanism of direct inhibition of the GLUT4 glucose transporter responsible for insulin-stimulated glucose uptake into muscle and fat; inflammatory cytokines and diminished adiponectin are also implicated. Chronic kidney disease can independently cause glucose intolerance and insulin resistance even at early stages, sometimes worsened by genetic conditions such as hepatocyte nuclear factor-1b mutations that cause renal cysts and atypical diabetes."},
        {"title": "Pathophysiology",
         "content": "Compensatory hyperinsulinemia from insulin resistance can cause insulin to bind and activate insulin-like growth factor receptors, promoting epidermal and fibroblast growth and producing the velvety hyperpigmentation of acanthosis nigricans, classically seen in the axilla. Genetic insulin resistance syndromes arise from homozygous or heterozygous INSR gene mutations on chromosome 19, spanning a severity spectrum: type A insulin resistance (mild), and the pediatric syndromes Donohue syndrome and Rabson-Mendenhall syndrome (severe). In lipodystrophy, loss of adipose tissue — a major determinant of insulin sensitivity — drives metabolic derangement; central adiposity from lipodystrophy is associated with more pronounced insulin resistance."},
        {"title": "Clinical features",
         "content": "Type A insulin resistance is diagnosed in adolescence and presents with diabetes, insulin resistance, polycystic ovaries, hirsutism, hyperandrogenism, and cystic ovaries, without obesity; acanthosis nigricans may be present, and life expectancy is not significantly impaired. Donohue syndrome (leprechaunism) presents with intrauterine growth restriction, fasting hypoglycemia, and postprandial hyperglycemia alongside profound insulin resistance — serum insulin levels around 100 times normal — with significant acanthosis nigricans, facial dysmorphism, and low-set ears; most affected children die before age 1. Rabson-Mendenhall syndrome, also from insulin receptor gene defects, presents in infancy with extreme growth retardation, marked insulin resistance, and diabetes. Lipodystrophy presents with partial or total loss of subcutaneous fat alongside polycystic ovary syndrome, elevated insulin, and diabetes."},
        {"title": "Diagnostics",
         "content": "Acanthosis nigricans on physical examination is a useful clinical marker prompting evaluation for insulin resistance, particularly in an obese child, and should also prompt consideration of associated endocrinopathies (Cushing syndrome, PCOS, thyroid disease, acromegaly) or a causative medication. Severe, syndromic presentations in infancy (intrauterine growth restriction with profound insulin resistance and hypoglycemia/hyperglycemia) should raise suspicion for Donohue or Rabson-Mendenhall syndrome and prompt genetic evaluation of the insulin receptor gene."},
        {"title": "Treatment",
         "content": "For common obesity-associated insulin resistance and its associated dyslipidemia, initial treatment always begins with a 6-month trial of lifestyle modification — improved dietary and physical activity patterns. Although some short (6-month) trials in small numbers of adolescents have shown metformin benefits on BMI and insulin resistance scores, metformin is not currently recommended for treating insulin resistance itself, and it should not be used to treat children and adolescents with insulin resistance who have normal glucose concentrations. There is no consensus in the pediatric diabetes community on treating prediabetes beyond lifestyle management. Children with MODY (maturity-onset diabetes of the young) subtypes 1 and 3 often respond to sulfonylureas as first-line therapy, an exception in pediatric diabetes management, while MODY 2 requires no treatment in childhood given its benign, persistent mild fasting hyperglycemia."},
        {"title": "Complications",
         "content": "Children found to have prediabetes or type 2 diabetes on screening should be referred to a pediatric endocrinologist for management and monitoring, and it is critical to screen for and address comorbid conditions such as PCOS and obstructive sleep apnea, which often share the same causal link to insulin resistance as other metabolic syndrome risk factors. In chronic kidney disease, insulin resistance correlates with declining renal function even at early CKD stages, and more than 50% of children develop hyperlipidemia (typically moderate hypertriglyceridemia, hypercholesterolemia, and low HDL/albumin) by the time they reach end-stage renal disease, contributing to cardiovascular risk. Donohue syndrome carries a very high mortality, with most affected children dying before 1 year of age."},
    ],
    "clinical": [
        {"title": "Recognizing insulin resistance in clinic",
         "content": "Examine any obese child for acanthosis nigricans (velvety hyperpigmentation, classically axillary), present in over 60% of children with BMI above the 98th percentile, as a marker prompting evaluation for insulin resistance and associated metabolic syndrome features (hypertension, HDL under 40 mg/dL, triglycerides over 150 mg/dL). If acanthosis nigricans or other insulin-resistance features are present without obesity, or with signs of androgen excess (hirsutism, irregular periods, polycystic ovaries), consider a genetic insulin receptor defect (type A insulin resistance in adolescence) or an underlying endocrinopathy (Cushing syndrome, PCOS, thyroid disease, acromegaly) or medication effect rather than assuming simple obesity-related insulin resistance. In an infant with intrauterine growth restriction plus fluctuating hypoglycemia and hyperglycemia and profound insulin resistance, consider Donohue or Rabson-Mendenhall syndrome and pursue genetic testing of the insulin receptor gene promptly given the poor prognosis of Donohue syndrome."},
        {"title": "Management approach",
         "content": "Start with a 6-month trial of lifestyle modification — dietary changes and increased physical activity — as first-line treatment for obesity-associated insulin resistance and any associated dyslipidemia; do not start metformin for insulin resistance alone, and never treat a child with insulin resistance but normal glucose concentrations with metformin, since it is not currently recommended for this indication despite some short-trial benefit signals. Refer any child with prediabetes or type 2 diabetes found on screening to a pediatric endocrinologist, and proactively screen for and manage comorbidities that share the insulin-resistance pathway, particularly PCOS and obstructive sleep apnea. For MODY, distinguish subtypes: MODY 1 and 3 usually respond to sulfonylureas as first-line therapy, while MODY 2 needs no pharmacologic treatment given its benign course. In a child with CKD, monitor for insulin resistance and hyperlipidemia even at early disease stages, since more than half develop hyperlipidemia by the time they reach ESRD."},
    ],
}

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