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

references = [
 {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [4135, 4136]},
 {"title": "CURRENT Diagnosis and Treatment Pediatrics, Twenty-Fourth Edition", "author": "Hay, William W., Levin, Myron J., Deterding, Robin R., Abzug, Mark J.", "pages": [268, 357]},
 {"title": "Pediatric Environmental Health", "author": "American Academy of Pediatrics Council on Environmental Health,Ruth A. Etzel,Sophie J. Balk", "pages": [788, 796, 802, 805]},
 {"title": "Cover", "author": "Vitalsource Download", "pages": [4883]},
 {"title": "Pediatric emergency medicine (Sean M. Fox, Dale P. Woolridge (editors))", "author": None, "pages": [197]},
 {"title": "Pediatric Board Study Guide", "author": None, "pages": [844]},
 {"title": "Berkowitz's Pediatrics", "author": "Berkowitz, Carol D.;", "pages": [1111]},
 {"title": "Update in Pediatrics", "author": None, "pages": [138]},
]

short_md = """## In short

- Sunburn is the most common photosensitive reaction in children and is a UV-induced thermal injury, caused mainly by UVB radiation acting through an "erythema action spectrum" mainly in the UVB range.
- UVB-induced redness, tenderness, edema, and blistering appear 6-12 hours after exposure and peak at about 24 hours; severe sunburn can cause systemic fever, nausea, and headache.
- Immediate pigment darkening from UVA is a separate, short-lived (a few hours) effect and is not photoprotective.
- The Fitzpatrick classification of 6 sun-reactive skin types predicts an individual's expected sunburn and tanning tendency.
- Treatment: cool compresses and analgesics; a bland emollient such as plain petrolatum for the later desquamative phase; topical anesthetics are best avoided as they can cause contact dermatitis.
- Prevention: avoid sun during peak hours (commonly cited as 10 am-2 pm or 10 am-4 pm); use a broad-spectrum sunscreen with SPF 30 or greater (applied to exposed skin on both sunny and cloudy days) for infants 6 months and older, plus protective clothing, wide-brimmed hats, and sunglasses.
- Sunscreen safety is not established under 6 months of age, so infants under 6 months should rely on sun avoidance and appropriate clothing/hats rather than sunscreen; in extreme circumstances a minimal amount can be applied to small exposed areas like the face and back of the hands.
- Most people receive over 50% of their lifetime UV dose by age 20, so pediatric counseling matters: repeated sunburn and excessive sun exposure raise the risk of skin cancer, and blistering sunburns in childhood/adolescence specifically raise the risk of later melanoma.
"""

long_md = """## Definition

Sunburn is an acute erythematous reaction of the skin to excessive ultraviolet radiation (UVR) exposure, and it is the most common photosensitive reaction seen in children.

## Pathophysiology

Sunlight contains far more UVA than UVB radiation, but UVA must reach much larger doses than UVB to produce sunburn; the erythema (sunburn) action spectrum lies mainly in the UVB range. UVR exposure causes cutaneous vasodilation and increased dermal blood volume, producing erythema; the minimal dose needed to cause this erythema depends on skin type and thickness, epidermal melanin content, the skin's capacity to produce more melanin after exposure, and the intensity of the radiation. The Fitzpatrick classification describes six sun-reactive skin types based on expected sunburn and tanning tendency. At a cellular level, UVB generates reactive oxidation species that damage keratinocyte membranes, and part of the vasodilation of UVB-induced erythema is mediated by prostaglandins E2, E3, and F2-alpha along with other induced inflammatory cytokines. Separately, UVA produces immediate pigment darkening through photo-oxidative darkening of existing melanin and its transfer from melanocytes to keratinocytes; this darkening lasts only a few hours and, unlike true tanning, is not photoprotective.

## Clinical Features

UVB-induced sunburn effects - redness, tenderness, edema, and blistering, appearing as well-demarcated, severe erythema - begin 6-12 hours after exposure and peak at about 24 hours. Severe sunburn can produce systemic symptoms including fever, nausea, and headache. Postinflammatory hyperpigmentation can follow the acute reaction.

## Diagnostics

Diagnosis of sunburn is clinical, based on a history of UV exposure and the characteristic time course and appearance of erythema, tenderness, edema, or blistering. Sunburn is often not recognized promptly because symptoms typically do not begin until after the skin has already been damaged.

## Treatment

Sunburn should be treated with cool compresses and analgesics; treatment aimed at the peak erythema response is generally started once peak erythema is reached, at around 24 hours. Topical anesthetics are relatively ineffective and carry the added hazard of causing contact dermatitis, so they are best avoided. A bland emollient such as plain petrolatum is effective during the later desquamative phase as the burned skin peels. Counseling about preventing future sunburns should be given at the time of treatment.

## Prevention

Sun avoidance during peak UV hours (variably cited as 10 am to 2 pm or 10 am to 4 pm) is the most effective preventive measure. For children 6 months of age and older, a broad-spectrum sunscreen with an SPF of 30 or greater, protecting against both UVA and UVB, should be applied to exposed skin on both sunny and cloudy days; protective clothing (including long-sleeved swim shirts), wide-brimmed hats, and sunglasses are also important. Sunscreen safety has not been established in infants younger than 6 months, so sun avoidance, appropriate clothing, and hats are the recommended approach in this age group; in situations where shade is unavailable, only a minimal amount of sunscreen should be applied to small exposed areas such as the face and the backs of the hands.

## Complications

Repeated sunburn and excessive sun exposure are associated with skin cancer. Because more than half of a person's lifetime UV dose is typically received by age 20, pediatricians play a pivotal role in educating patients and families about the harmful, potentially malignant, and irreversible effects of prolonged sun and tanning-bed exposure. Sun-damaged skin shows a higher frequency of premature aging, senile elastosis, actinic keratoses, and squamous and basal cell carcinomas, and blistering sunburns specifically in childhood and adolescence significantly increase the risk of later malignant melanoma.
"""

clinical_md = """## Managing Acute Sunburn

Treat with cool compresses and oral analgesics; avoid topical anesthetics, which are relatively ineffective for sunburn and can themselves cause a contact dermatitis. Once peak erythema is reached (roughly 24 hours after exposure), a bland emollient such as plain petrolatum can be used through the desquamative (peeling) phase. Use the visit as an opportunity for prevention counseling, since instruction about preventing future sunburns should be delivered at the time of the burn itself.

## Sun Protection Counseling by Age

Advise sun avoidance during peak UV hours. In infants under 6 months, because sunscreen safety is not established at this age, recommend sun avoidance plus protective clothing and hats rather than sunscreen, reserving only a minimal application to small exposed areas (face, backs of the hands) for situations where shade is genuinely unavailable. From 6 months of age onward, recommend a broad-spectrum sunscreen of SPF 30 or greater applied to exposed skin on both sunny and cloudy days, together with protective clothing, wide-brimmed hats, and sunglasses. Reinforce that any sunburn - and blistering sunburn in particular during childhood and adolescence - raises long-term skin cancer risk, including melanoma, which is a key reason to counsel on sun protection at every opportunity.
"""

build_and_save(
    topic="Sunburn",
    slug="sunburn",
    category_id=15225,
    summary="Sunburn pathophysiology (UVB erythema), the treatment approach of cool compresses, analgesia and emollients, and age-based sun protection counseling.",
    references=references,
    short_md=short_md,
    long_md=long_md,
    clinical_md=clinical_md,
)
