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

references = [
 {"title": "Red Book 2018", "author": "Kimberlin, David W.; Long, Sarah S.; Brady, Michael T.", "pages": [510]},
 {"title": "2021_Fleisher_&_Ludwig's_Textbook_of_Pediatric_Emergency_Medicine.epub", "author": None, "pages": []},
 {"title": "Netters Pediatrics (Florin Т., Ludwig St.)", "author": None, "pages": [619]},
 {"title": "Red Book Atlas 4th Ed.indb", "author": "American Academy of Pediatrics;Carol J. Baker, MD, FAAP;", "pages": [325]},
 {"title": "Red_2021_2024_Report_of_the_Comm_z_library_sk,_1lib_sk,", "author": None, "pages": [476]},
 {"title": "Cover", "author": "Vitalsource Download", "pages": [4939, 5959]},
 {"title": "Illustrated Textbook of Paediatrics (Tom Lissauer, Will Carroll)", "author": "Lissauer, Tom,Carroll, Will", "pages": [294]},
 {"title": "Red Book Atlas of Pediatric Infectious Diseases", "author": "American Academy of Pediatrics,Carol J. Baker, MD, FAAP", "pages": [281]},
]

short_md = """## In short

- Worldwide, more than half a million children under 15 years are infected with HIV (over 3 million children under 15 by another estimate); pediatric infection is most commonly transmitted from an infected mother before or during birth, and can also occur via breast milk, contaminated blood/blood products, or rarely sexual abuse.
- About 20% of infants with untreated HIV present in the first 3-6 months of life with an AIDS-defining illness (such as Pneumocystis jiroveci pneumonia, serious bacterial infection, or serious fungal infection); CD4 count can be normal even at the time of PJP presentation in an infant.
- Early clinical manifestations of untreated pediatric HIV include unexplained fevers, generalized lymphadenopathy, hepatosplenomegaly, failure to thrive, persistent/recurrent oral and diaper candidiasis, recurrent diarrhea, parotitis, hepatitis, CNS disease (encephalopathy, hyperreflexia, hypertonia, floppiness, developmental delay), lymphoid interstitial pneumonia (LIP), recurrent invasive bacterial infections, and other opportunistic infections.
- Findings more common in children than adults with HIV: recurrent bacterial infections, chronic parotid swelling, and lymphocytic interstitial pneumonitis - chronic parotid swelling and LIP are both associated with slower disease progression.
- Geographic variation: systemic/pulmonary findings predominate in the US/Europe, while chronic diarrhea, pneumonia, wasting, and severe malnutrition predominate in Africa.
- Pediatric HIV is classified (in children under 13) by clinical stage and immunologic status, emphasizing CD4+ T-lymphocyte count/percentage as the critical immunologic and prognostic marker (plasma HIV-1 RNA/viral load is not part of this classification).
- With timely diagnosis and effective combination antiretroviral therapy (cART/HAART), clinical manifestations and AIDS-defining illnesses are now rare among children in the US and other industrialized countries, and most perinatally infected children survive into adulthood with adherence to ART; treatment also includes Pneumocystis jirovecii pneumonia prophylaxis.
- HIV-infected children in the ED should be roomed rapidly to prevent nosocomial infection, with pulse oximetry checked at triage since indolent hypoxemia can be an early sign of PJP; they are also at risk for overwhelming bacterial and viral sepsis like other immunocompromised children.
- A wide variety of cutaneous manifestations occur, generally common childhood dermatoses/infections that are unusually severe, poorly responsive to therapy, and recurrent - skin disease can be the first evidence of HIV-related illness.
"""

long_md = """## Definition

Human immunodeficiency virus (HIV) infection in children leads, if untreated, to a complex immunosuppressive state that increases the risk of serious morbidity and mortality. Pediatric HIV is most commonly acquired perinatally, from an infected mother before or during birth, and can also be transmitted via breast milk, transfusion of contaminated blood or blood products, or, rarely, sexual abuse.

## Epidemiology

Worldwide, estimates place more than half a million (one source: over 3 million) children under 15 years of age living with HIV. A generation ago, an HIV diagnosis in a child was considered a near-certain death sentence; today, children born with HIV can have essentially normal childhoods provided they receive long-term combination antiretroviral therapy (cART/HAART/ART). With timely diagnosis in pregnant women, infants, and children, and appropriate treatment, clinical manifestations of HIV infection - including AIDS-defining illnesses - are now rare among children in the United States and other industrialized countries, and the majority of perinatally infected children are surviving into adulthood where ART is available and adhered to.

## Clinical Features

Physical examination at birth is normal in most infected infants. Early manifestations of untreated pediatric HIV infection include unexplained fevers, generalized lymphadenopathy, hepatomegaly, splenomegaly, failure to thrive, persistent or recurrent oral and diaper candidiasis, recurrent diarrhea, parotitis/chronic parotid swelling, hepatitis, CNS disease (encephalopathy, hyperreflexia, hypertonia, floppiness, developmental delay), lymphoid interstitial pneumonia (LIP), recurrent invasive bacterial infections, recurrent upper respiratory infections (otitis media, sinusitis), pneumonia (Pneumocystis jiroveci or recurrent bacterial), and other opportunistic infections (viral, parasitic, fungal). Initial symptoms are often subtle (lymphadenopathy, hepatosplenomegaly) or nonspecific (failure to thrive, chronic/recurrent diarrhea, respiratory symptoms, oral thrush), sometimes distinguishable only by their persistence. About 20% of infants with untreated HIV present in the first 3-6 months of life with an AIDS-defining illness such as PJP or a serious bacterial or fungal infection; notably, CD4 count can be normal even at the time of PJP presentation in an infant. Findings more common in children than in adults with HIV include recurrent bacterial infections, chronic parotid swelling, and LIP - the last two are, somewhat counterintuitively, associated with slower disease progression, and early-onset progressive neurologic deterioration is also more characteristic of pediatric disease. Geographic variation is notable: systemic and pulmonary findings are common in the US and Europe, while chronic diarrhea, pneumonia, wasting, and severe malnutrition predominate in Africa. A wide variety of cutaneous manifestations occur, generally representing common childhood dermatoses and infections that behave atypically - unusually severe, poorly responsive to treatment, and recurrent; skin disease can sometimes be the first clue to underlying HIV infection, though cutaneous findings have become less common and less severe with effective antiretroviral therapy.

## Diagnostics

Children under 13 years are classified by clinical stage of disease and immunologic status, with CD4+ T-lymphocyte count and percentage serving as the critical immunologic parameter and marker of prognosis in the pediatric classification system; plasma HIV-1 RNA (viral load) is not included in this particular classification scheme, though some clinical guidelines still reference it and the older 1994 CDC immunologic classification. Coinfection with hepatitis C virus occurs in a small proportion of HIV-infected children (about 1.5% in one large cohort), acquired primarily through perinatal transmission, which is more frequent from coinfected mothers with higher HCV viremia; diagnosing HCV in an HIV-coinfected child may require direct molecular (PCR) viral detection, since HCV antibody may not develop in some of these children.

## Treatment

Long-term administration of combination/highly active antiretroviral therapy (cART/HAART) is required to keep HIV-infected children healthy, combined with a holistic approach addressing the child's and family's overall functioning and quality of life. Treatment also includes prophylaxis against Pneumocystis jirovecii pneumonia. When maternal HIV viral levels are well controlled with antiretroviral therapy, the perinatal transmission rate of coinfecting HCV decreases to levels seen in women without HIV coinfection, illustrating the broader benefit of effective maternal ART.

## Complications

Pediatric HIV raises complex psychosocial issues for the family and healthcare providers, including decisions about when and what to tell the HIV-infected child (and siblings), confidentiality, and support for treatment adherence. In the emergency setting, HIV-infected children should be roomed as rapidly as possible to reduce risk of acquiring a nosocomial infection, with pulse oximetry checked at triage since indolent hypoxemia can be an early sign of PJP; these children are also at risk for overwhelming bacterial and viral sepsis, similar to other immunocompromised children.
"""

clinical_md = """## Recognizing Pediatric HIV and Early Complications

Maintain suspicion for HIV infection in any infant with unexplained, persistent fevers, generalized lymphadenopathy, hepatosplenomegaly, failure to thrive, persistent/recurrent oral or diaper candidiasis, recurrent diarrhea, or chronic parotid swelling - especially when findings persist beyond what is typical for isolated common illnesses. Remember that up to 20% of untreated infected infants present in the first 3-6 months of life with an AIDS-defining illness such as PJP, and that CD4 count can be misleadingly normal even during PJP in an infant, so a normal CD4 does not exclude serious opportunistic infection in this age group. In a known HIV-infected child presenting acutely, room the child quickly to reduce nosocomial infection risk, check pulse oximetry at triage (indolent hypoxemia can be an early PJP sign), and maintain a lower threshold for serious bacterial or viral sepsis given the underlying immunosuppression.

## Managing the Child with Confirmed HIV

Ensure long-term adherence to combination antiretroviral therapy, since consistent ART use is what has transformed pediatric HIV from a near-uniformly fatal diagnosis into a condition compatible with essentially normal childhood and survival into adulthood. Add Pneumocystis jirovecii pneumonia prophylaxis as indicated. Track clinical stage and CD4+ T-lymphocyte count/percentage over time as the primary immunologic and prognostic markers in children under 13. Screen for hepatitis C coinfection when relevant perinatal risk factors are present, using molecular (PCR) testing rather than relying on antibody testing alone, since some coinfected children do not seroconvert. Address the psychosocial dimension proactively - guide families on disclosure timing and content for the child and siblings, safeguard confidentiality, and provide structured adherence support, since these factors are as important to long-term outcomes as the antiretroviral regimen itself.
"""

build_and_save(
    topic="Hiv Infection",
    slug="hiv-infection",
    category_id=15623,
    summary="Pediatric HIV: transmission routes, early manifestations including AIDS-defining illness in the first months of life, pediatric-specific findings like chronic parotid swelling and LIP, and the CD4-based classification and ART-based management approach.",
    references=references,
    short_md=short_md,
    long_md=long_md,
    clinical_md=clinical_md,
)
