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": [220, 328, 1258]},
 {"title": "Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024", "author": None, "pages": [2162]},
 {"title": "Gomella's Neonatology: Management, Procedures, On-Call Problems, Diseases, and Drugs, Eighth Edition", "author": "Tricia Lacy Gomella, Fabien G. Eyal and Fayez Bany-Mohammed", "pages": [1231]},
 {"title": "Red Book Atlas 4th Ed.indb", "author": "American Academy of Pediatrics;Carol J. Baker, MD, FAAP;", "pages": [118]},
 {"title": "Red_Book_2021_2024_Report_of_the_Comm_z_library_sk,_1lib_sk,", "author": None, "pages": [309]},
 {"title": "2021_Fleisher_&_Ludwig's_Textbook_of_Pediatric_Emergency_Medicine.epub", "author": None, "pages": []},
 {"title": "The Harriet Lane Handbook (The Johns Hopkins Hospital)", "author": None, "pages": [148]},
 {"title": "The Harriet Lane Handbook 22nd Edition (2020) (The Johns Hopkins Hospital)", "author": None, "pages": [148]},
]

short_md = """## In short

- Trichomoniasis is caused by the flagellated protozoan Trichomonas vaginalis; it is the second most common sexually transmitted infection worldwide (over 156 million new cases annually) and, by one estimate, the most common parasitic infection in the US (about 2.6 million prevalent cases, 6.9 million incident infections per year; another source cites 3.7 million annual US infections).
- Transmission is perinatal (during passage through an infected birth canal) or sexual; vaginal trichomoniasis is rare before menarche, so its presence in a prepubertal child should raise concern for sexual abuse and prompt a child protective services investigation.
- In a perinatally infected neonate, vaginal discharge can persist for several weeks and the infection is usually self-limited; treatment is generally not recommended for newborns, and intense social investigation may not be warranted for this age group specifically (as distinct from an older infant/prepubertal child).
- Neonatal trichomonal vaginitis presents as a thin whitish or yellowish discharge appearing within 10 days of birth, possibly persisting for months if untreated; affected infants may be fussy but are otherwise well.
- Postpubertal trichomoniasis: about 50% of infected women develop symptomatic vaginitis with vaginal itching, a malodorous, frothy, green-gray or yellowish discharge, and dysuria; postcoital bleeding and dyspareunia can occur; the vulva may be erythematous and the cervix friable.
- "Strawberry cervix" (colpitis macularis) - punctate hemorrhages, sometimes with vesicles or papules - is pathognomonic for trichomoniasis but is visible to the naked eye (without colposcopy) in only about 2% of infected patients.
- Many infected men and up to 30% of infected women are asymptomatic; many infected women report scant or nondescript discharge rather than the classic picture.
- Diagnosis: wet-mount microscopy of vaginal discharge mixed with saline can show motile flagellated protozoa but has only about 60-70% sensitivity even when performed well; T. vaginalis in urine must be distinguished from Trichomonas hominis, a nonpathogenic GI contaminant.
- Women treated for trichomoniasis should be retested 3 months after treatment because of high reinfection rates, and sexual partners should be treated to prevent reinfection.
"""

long_md = """## Definition

Trichomoniasis is an infection caused by the flagellated protozoan Trichomonas vaginalis. Vulvovaginitis is the symptomatic form of the disease in females, but T. vaginalis has also been implicated in pelvic inflammatory disease, pregnancy loss, chronic prostatitis, and an increased risk of HIV transmission.

## Epidemiology

Trichomoniasis is the second most common sexually transmitted infection worldwide, with more than 156 million new cases occurring annually. In the United States, it has been described as the most common parasitic infection, with an estimated prevalence of 2.6 million cases and 6.9 million incident infections per year (another source cites 3.7 million annual US infections). Factors associated with higher prevalence include female sex, membership in underrepresented minority groups, poverty, lower educational attainment, younger age at first sexual intercourse, multiple sexual partners, and a recent Chlamydia infection. Most infected men, and up to 30% of infected women, are asymptomatic. Despite being easily treated, sequelae of untreated infection remain a significant source of morbidity because of high reinfection rates from untreated partners, underrecognition of asymptomatic cases, and imperfect diagnostic sensitivity.

## Transmission

Trichomoniasis is transmitted perinatally (during passage through an infected birth canal) or through sexual contact. Vaginal trichomoniasis is rare before menarche, so a new diagnosis in an older infant or prepubertal child should prompt careful investigation, including involvement of child protective services, for suspected sexual abuse. This concern does not typically apply to a neonate whose infection can be attributed to perinatal transmission from an infected mother, where intense social investigation may not be warranted, since discharge can simply persist for several weeks in this setting.

## Clinical Features

Perinatally acquired trichomonal vaginitis presents in a small proportion of vaginally delivered female neonates, typically as a thin, whitish or yellowish vaginal discharge appearing within about 10 days after birth; some infants harbor only a few organisms and never develop clinical disease, while others have discharge that can persist for several months if untreated. Affected infants may be fussy but are otherwise well, and infection is generally self-limited. After puberty, the classic presentation is a pruritic, frothy, yellowish (or green-gray, malodorous) vaginal discharge with vaginal itching and dysuria; about 50% of infected women develop this symptomatic vaginitis. Postcoital bleeding and dyspareunia can occur, and the vulva may be erythematous with a friable cervix. "Strawberry cervix" (colpitis macularis) - punctate cervical hemorrhages sometimes with accompanying vesicles or papules - is pathognomonic for trichomoniasis but is visible without colposcopy in only about 2% of infected patients. Many infected women, however, report scant or nondescript discharge rather than this classic picture, and do not complain of excessive discharge at all.

## Diagnostics

Wet-mount microscopy (mixing vaginal discharge with normal saline) can detect the motile flagellated protozoan directly, but sensitivity is only about 60-70% even when performed well. When T. vaginalis is identified in urine, it must be distinguished from Trichomonas hominis, a nonpathogenic protozoan contaminant found in the gastrointestinal tract, to avoid a false-positive diagnosis.

## Treatment

Neonatal trichomoniasis acquired perinatally is generally self-limited, and treatment is not typically recommended in this setting. In postpubertal patients, treatment follows standard STI treatment protocols (per current CDC guidelines). Because of high rates of reinfection, women treated for trichomoniasis should be retested 3 months after treatment, and sexual partners should be treated concurrently to prevent reinfection of the index patient.

## Differential Diagnosis / Considerations in Children

Because vaginal trichomoniasis is rare before menarche, any prepubertal child found to have T. vaginalis should be evaluated for sexual abuse via a structured child protective services investigation, distinguishing this scenario clearly from perinatal transmission in a neonate, which does not carry the same implication. Laboratory testing should also carefully exclude Trichomonas hominis as a nonpathogenic urinary contaminant before attributing a positive finding to true T. vaginalis infection.
"""

clinical_md = """## Evaluating Trichomoniasis by Age

In a female neonate with vaginal discharge in the first days to weeks after birth, consider perinatally acquired trichomonal vaginitis, especially if the infant is otherwise well but fussy; recognize this is typically self-limited and generally does not require treatment or an intensive social work-up, distinct from an older child. In any older infant or prepubertal child with a new diagnosis of trichomoniasis, treat this as a sentinel finding for possible sexual abuse - since vaginal trichomoniasis is rare before menarche - and initiate a structured child protective services investigation rather than assuming an innocent explanation. When T. vaginalis is reported on a urine specimen, confirm it is not actually Trichomonas hominis (a nonpathogenic GI contaminant) before proceeding with an abuse evaluation or treatment, since this distinction changes the entire clinical and social response.

## Managing Symptomatic Trichomoniasis in Adolescents/Adults

In a postpubertal patient with vaginal itching, a malodorous frothy discharge, and dysuria, examine for a friable cervix and look for (but do not rely on) a strawberry cervix, since this pathognomonic finding is visible to the naked eye in only about 2% of cases. Use wet-mount microscopy for rapid bedside diagnosis, but remember its sensitivity is only 60-70%, so a negative wet mount does not exclude infection if clinical suspicion remains - consider more sensitive testing (such as NAAT) when available. After treating a confirmed case, schedule retesting at 3 months given high reinfection rates, and ensure sexual partners are treated concurrently to prevent the patient's reinfection.
"""

build_and_save(
    topic="Trichomoniasis",
    slug="trichomoniasis",
    category_id=14996,
    summary="Trichomoniasis: perinatal vs sexual transmission, the strawberry-cervix and wet-mount diagnostic limitations, and why a diagnosis in a prepubertal child (unlike a neonate) mandates a sexual abuse investigation.",
    references=references,
    short_md=short_md,
    long_md=long_md,
    clinical_md=clinical_md,
)
