import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from lib import build_and_save

references = [
 {"title": "2021_Fleisher_&_Ludwig's_Textbook_of_Pediatric_Emergency_Medicine.epub", "author": None, "pages": []},
 {"title": "Zitelli and Davis' Atlas of Pediatric Physical Diagnosis: Expert Consult - Online", "author": None, "pages": [404, 668]},
 {"title": "Cover", "author": "Vitalsource Download", "pages": [8021]},
 {"title": "CURRENT Diagnosis and Treatment Pediatrics, Twenty-Fourth Edition", "author": "Hay, William W., Levin, Myron J., Deterding, Robin R., Abzug, Mark J.", "pages": [1064]},
 {"title": "Pediatric Board Study Guide", "author": None, "pages": [422]},
 {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [3461]},
 {"title": "Ghai Essential Pediatrics, 9e (Vinod K Paul, Arvind Bagga)", "author": "CamScanner", "pages": [520]},
 {"title": "Algorithms in Pediatrics", "author": None, "pages": [583]},
]

short_md = """## In short

- Thyroid nodules are far less common in children than adults - sonographically detectable in only about 1-2% of children versus 19-67% of adults - but carry a much higher malignancy risk: about 20-25% in children versus 5-15% in adults (some sources cite a range as wide as 10-50%, narrowing to about 5% for incidentally found nodules).
- Thyroid cancer itself is rare, accounting for only about 1-1.5% of all childhood cancers, and nodules are about twice as common in girls.
- First-line evaluation is serum TSH plus neck ultrasound; a low TSH suggests an autonomous (hyperfunctioning) nodule, which should be evaluated with radionuclide scintigraphy and generally does not need biopsy since these are rarely malignant.
- With a normal or elevated TSH, proceed to ultrasound; fine-needle aspiration biopsy (FNAB, ideally ultrasound-guided) is indicated for a sonographically suspicious nodule or one 1 cm or more in diameter.
- Features suggesting malignancy: rapid growth, a firm or hard nodule with fixation to adjacent structures or limited mobility, satellite/enlarged lymph nodes, hoarseness or dysphagia, a history of neck/head irradiation, and a family history of medullary thyroid carcinoma or multiple endocrine neoplasia (MEN).
- About half of solitary thyroid nodules are cystic lesions, and a well-circumscribed nodule is usually a benign cyst; a multinodular goiter is usually from thyroiditis or iodine deficiency and is almost always benign.
- Calcitonin is elevated in medullary thyroid cancer, which occurs as part of MEN-2A (medullary thyroid cancer, hyperparathyroidism, pheochromocytoma) and MEN-2B (medullary thyroid cancer, pheochromocytoma, mucosal neuromas), both due to RET oncogene mutations; prophylactic thyroidectomy is recommended by age 5 years for certain MEN-2A mutations and by 6 months of age for certain MEN-2B mutations.
- Prior neck/head irradiation is a well-documented risk factor for later thyroid cancer, historically from radiation given for "enlarged thymus" and, after the 1986 Chernobyl accident, from environmental radiation exposure in children who later developed papillary thyroid carcinoma.
"""

long_md = """## Definition

A thyroid nodule is a discrete lesion within the thyroid gland that is palpably or sonographically distinct from the surrounding thyroid tissue; it may represent a benign cyst, colloid or adenomatous nodule, an area of thyroiditis, or a thyroid neoplasm.

## Epidemiology

Thyroid nodules increase in frequency with age and are far less common in children than adults: sonographically detectable nodules occur in only about 1-2% of children compared with 19-67% of adults. In a US study, 1.8% of children aged 11-18 years had a palpable thyroid nodule, falling to 0.45% on follow-up two decades later, suggesting many nodules regress over time. Nodules are about twice as common in girls. Despite their lower frequency in children, the malignancy risk within a pediatric thyroid nodule is substantially higher than in adults - commonly cited as 20-25% versus 5-15% in adults, though reported pediatric rates range as widely as 10-50%, narrowing to around 5% for nodules discovered incidentally. Thyroid cancer overall remains rare in childhood, accounting for only about 1-1.5% of all pediatric cancers.

## Etiology

Most pediatric thyroid nodules are benign: benign adenomatous or colloid nodules, congenital cysts, or nodules arising in the context of chronic lymphocytic (Hashimoto) thyroiditis. A thyroid mass appearing suddenly or enlarging rapidly can indicate hemorrhage into a cyst, a benign adenoma, or an infectious process. A multinodular goiter is usually caused by thyroiditis and/or iodine deficiency and is almost always benign. Recognized risk factors for malignancy include prior radiation exposure to the head or neck (historically from radiation given for "enlarged thymus," and after environmental exposures such as the 1986 Chernobyl accident, both associated with later papillary thyroid carcinoma) and a family history of medullary thyroid carcinoma or multiple endocrine neoplasia (MEN) syndromes, which arise from activating mutations of the RET oncogene.

## Clinical Features

Most pediatric thyroid nodules are asymptomatic and are first noticed by a parent or found incidentally by a physician during a routine exam or on imaging performed for another indication. Thyroid function is usually normal even when a nodule harbors cancer. Features that raise concern for malignancy include a firm or hard nodule with limited mobility or fixation to adjacent structures, rapid growth, a nodule 1 cm or larger with irregular or calcified borders, satellite or enlarged cervical lymph nodes, and (less commonly) dysphagia or hoarseness. A well-circumscribed nodule is more often a benign cyst - about half of solitary thyroid nodules are cystic.

## Diagnostics

Evaluation begins with a serum TSH. A low TSH suggests a hyperfunctioning (autonomous) nodule, which should be assessed with radionuclide scintigraphy (123-I or 99mTc-pertechnetate); these "hot" nodules are generally not malignant and typically do not require biopsy. With a normal or elevated TSH, a neck ultrasound should be obtained, evaluating gland size and the number, size, and appearance of any nodules. A "cold" nodule on uptake scanning is often seen in thyroid cancer. Ultrasound-guided fine-needle aspiration biopsy (FNAB) is indicated for any sonographically suspicious nodule or one measuring 1 cm or more in diameter, and assists in establishing the diagnosis. Calcitonin is elevated in medullary thyroid cancer, and associated biochemical abnormalities (such as hypercalcemia from hyperparathyroidism) may point toward an MEN type 2 syndrome; genetic testing for RET mutations is used when MEN-2A or MEN-2B is suspected.

## Treatment

Definitive management depends on the diagnosis. Suppressive thyroxine therapy for a simple euthyroid goiter has limited benefit and is generally avoided; surgery for goiter is reserved for cases large enough to cause respiratory compromise. Every pediatric thyroid nodule warrants complete evaluation and urgent outpatient follow-up with a specialist experienced in pediatric thyroid nodules, given the comparatively higher malignancy risk in children. In known or strongly suspected MEN2 syndromes, prophylactic thyroidectomy timing is guided by the specific RET mutation - by age 5 years for certain MEN-2A mutations and by 6 months of age for certain MEN-2B mutations - reflecting early genetic diagnosis and risk stratification.

## Complications

Because malignancy risk is proportionally higher in pediatric thyroid nodules than in adults, delayed recognition and evaluation carry a greater consequence in children. A dedicated American Thyroid Association task force has developed evidence-based guidelines specifically for the evaluation and management of thyroid nodules and differentiated thyroid cancer in children and adolescents, reflecting the distinct approach this age group requires compared with adult thyroid nodule management.
"""

clinical_md = """## Initial Work-Up of a Pediatric Thyroid Nodule

Every thyroid nodule identified in a child merits complete evaluation, given the higher relative malignancy risk compared with adults. Start with a serum TSH and a neck ultrasound. If TSH is low, obtain radionuclide scintigraphy to assess for an autonomous (hyperfunctioning) nodule; these are generally benign and usually do not need biopsy. If TSH is normal or elevated, proceed with ultrasound characterization of the nodule and gland; refer for ultrasound-guided fine-needle aspiration biopsy if the nodule is sonographically suspicious or 1 cm or larger. Take a history specifically asking about prior neck/head irradiation and family history of thyroid disease, medullary thyroid carcinoma, or MEN syndromes, since these change the pretest probability of malignancy substantially. Arrange urgent outpatient follow-up with a specialist experienced in pediatric thyroid nodules for any child in whom a nodule is found, since same-visit reassurance is not appropriate even for an asymptomatic, incidentally discovered nodule.

## Red Flags and Syndromic Considerations

Treat the following as pointers toward malignancy warranting expedited work-up: rapid nodule growth, a firm or hard nodule fixed to surrounding structures, satellite or enlarged cervical lymph nodes, a nodule 1 cm or larger with irregular or calcified borders, and new hoarseness or dysphagia. Check a calcitonin level and consider RET genetic testing when there is a family history of medullary thyroid carcinoma, pheochromocytoma, hyperparathyroidism, or mucosal neuromas suggestive of MEN-2A or MEN-2B - identifying a causative RET mutation can prompt prophylactic thyroidectomy on a defined timeline (by age 5 years for certain MEN-2A mutations, by 6 months of age for certain MEN-2B mutations), so early genetic counseling and testing in affected families is important.
"""

build_and_save(
    topic="Thyroid Nodule",
    slug="thyroid-nodule",
    category_id=15236,
    summary="Pediatric thyroid nodules: why they carry higher malignancy risk than in adults, the TSH-and-ultrasound evaluation pathway, FNAB indications, and MEN2/RET considerations.",
    references=references,
    short_md=short_md,
    long_md=long_md,
    clinical_md=clinical_md,
)
