attachment
attachment

explain in detail baout topics from apurba sastri must to know good to know and undertadingd concept

Reading File
The image shows a PowerPoint on Genital Tract Infections by Dr. Shreyashi, covering topics from what appears to be Apurba Sastri's microbiology curriculum. Let me search the medical library for all these topics simultaneously.
Finding Sources
Finding Sources
Finding Sources
Now let me read the key sections in parallel - Sherris microbiology (closest to Apurba Sastri level), Robbins pathology for infections, and the Tietz lab medicine genital tract infections:
Reading File
Reading File
Reading File
Excellent content retrieved. Now let me get the Robbins pathology genital tract infections section and Robbins NGU sections, plus search for molluscum and Bartholinitis:
Reading File
Finding Sources
Finding Sources
Now let me get more detail from Robbins on HPV/genital warts and cervicitis, and from Tietz on Whiff test/clue cells:
Reading File
Reading File
Now let me get the HPV/genital warts and cervicitis sections from Robbins, and search for relevant images:
Reading File
Searching Images

bacterial vaginosis clue cells vaginal smear

This four-panel image provides a side-by-side comparison of Bacterial Vaginosis (BV) and a normal vaginal microbiome through colposcopic and microscopic examinations. Panels A and B are colposcopic clinical photographs of the cervix and vaginal vault. Panel A (BV) displays characteristic thin, homogeneous, milk-white discharge coating the vaginal walls. In contrast, Panel B (Normal) shows a healthy cervix with clear, physiological secretions. Panels C and D show Gram-stained microscopic slides of vaginal smears. Panel C (BV) demonstrates the presence of 'clue cells'—vaginal epithelial cells heavily encrusted with coccobacilli (Gardnerella-like microbes) that obscure the cell margins. Panel D (Normal) shows a healthy microbiome dominated by large, purple-stained Gram-positive rods, consistent with Lactobacillus species, and clear epithelial cells without bacterial adherence. This comparison illustrates the clinical and laboratory findings used in Amsel criteria and Nugent scoring for the diagnosis of dysbiosis in the female reproductive tract.

This four-panel image provides a side-by-side comparison of Bacterial Vaginosis (BV) and a normal vaginal microbiome through colposcopic and microscopic examinations. Panels A and B are colposcopic clinical photographs of the cervix and vaginal vault. Panel A (BV) displays characteristic thin, homogeneous, milk-white discharge coating the vaginal walls. In contrast, Panel B (Normal) shows a healthy cervix with clear, physiological secretions. Panels C and D show Gram-stained microscopic slides of vaginal smears. Panel C (BV) demonstrates the presence of 'clue cells'—vaginal epithelial cells heavily encrusted with coccobacilli (Gardnerella-like microbes) that obscure the cell margins. Panel D (Normal) shows a healthy microbiome dominated by large, purple-stained Gram-positive rods, consistent with Lactobacillus species, and clear epithelial cells without bacterial adherence. This comparison illustrates the clinical and laboratory findings used in Amsel criteria and Nugent scoring for the diagnosis of dysbiosis in the female reproductive tract.

This comparison chart utilizes optical coherence tomography (OCT) or similar high-resolution diagnostic imaging to illustrate the progression of a polymicrobial bacterial vaginosis (BV) biofilm. The visual is divided into three sequential panels. The first panel, labeled 'BV', depicts a dense, continuous, and brightly fluorescent orange-red layer adhering to the vaginal epithelial surface, representing a mature pathogenic biofilm often composed of Gardnerella vaginalis and Atopobium vaginae. The middle panel shows the clinical intervention with 'Metronidazole', showing a blue-tinted transitional phase where the biofilm structure is being disrupted. The final panel, labeled 'Asymptomatic', demonstrates the state after treatment. In this state, the biofilm appears less dense, fragmented, and more diffuse, indicating successful thinning and disruption of the adhering microbial community. This educational visual emphasizes the persistence of subclinical biofilms even in asymptomatic states, which contributes to the high recurrence rates of BV. It is designed for medical professionals and students focusing on gynecology, microbiology, and infectious disease management.

This comparison chart utilizes optical coherence tomography (OCT) or similar high-resolution diagnostic imaging to illustrate the progression of a polymicrobial bacterial vaginosis (BV) biofilm. The visual is divided into three sequential panels. The first panel, labeled 'BV', depicts a dense, continuous, and brightly fluorescent orange-red layer adhering to the vaginal epithelial surface, representing a mature pathogenic biofilm often composed of Gardnerella vaginalis and Atopobium vaginae. The middle panel shows the clinical intervention with 'Metronidazole', showing a blue-tinted transitional phase where the biofilm structure is being disrupted. The final panel, labeled 'Asymptomatic', demonstrates the state after treatment. In this state, the biofilm appears less dense, fragmented, and more diffuse, indicating successful thinning and disruption of the adhering microbial community. This educational visual emphasizes the persistence of subclinical biofilms even in asymptomatic states, which contributes to the high recurrence rates of BV. It is designed for medical professionals and students focusing on gynecology, microbiology, and infectious disease management.

Conventional Pap smear cytology of a cervicovaginal sample stained with Papanicolaou stain. The smear demonstrates abundant squamous epithelial cells with clusters of intermediate and superficial cells. Within these cell clusters there are numerous oval budding yeast forms measuring 1–2 μm and filamentous pseudohyphae; the pseudohyphae are eosinophilic and stain unevenly, extending between cells and forming short branches. A prominent neutrophilic inflammatory component is present. The yeast elements and pseudohyphae are characteristic of Candida species (most commonly Candida albicans) causing vulvovaginitis or cervicitis in appropriate clinical settings. These features differentiate from non-filamentous yeasts and from malignant cells, and are best corroborated by clinical symptoms (pruritus, discharge) and culture or adjunct studies. Diagnostic significance lies in identifying fungal infection with inflammatory response; differential diagnoses include other Candida species, other yeasts lacking pseudohyphae, bacterial superinfection, or non-infectious causes of inflammation. The specimen shows no cytologic evidence of neoplasia. This image is useful for education on fungal cytology, diagnostic verification of candidiasis in cervical/vaginal cytology, and correlates with antifungal therapy planning. Clinicians should consider repeat smear or culture if symptoms persist despite therapy. Pathologic correlation: Candida infection; fungal morphology; budding yeast; pseudohyphae; neutrophils; cervicovaginal candidiasis.

Conventional Pap smear cytology of a cervicovaginal sample stained with Papanicolaou stain. The smear demonstrates abundant squamous epithelial cells with clusters of intermediate and superficial cells. Within these cell clusters there are numerous oval budding yeast forms measuring 1–2 μm and filamentous pseudohyphae; the pseudohyphae are eosinophilic and stain unevenly, extending between cells and forming short branches. A prominent neutrophilic inflammatory component is present. The yeast elements and pseudohyphae are characteristic of Candida species (most commonly Candida albicans) causing vulvovaginitis or cervicitis in appropriate clinical settings. These features differentiate from non-filamentous yeasts and from malignant cells, and are best corroborated by clinical symptoms (pruritus, discharge) and culture or adjunct studies. Diagnostic significance lies in identifying fungal infection with inflammatory response; differential diagnoses include other Candida species, other yeasts lacking pseudohyphae, bacterial superinfection, or non-infectious causes of inflammation. The specimen shows no cytologic evidence of neoplasia. This image is useful for education on fungal cytology, diagnostic verification of candidiasis in cervical/vaginal cytology, and correlates with antifungal therapy planning. Clinicians should consider repeat smear or culture if symptoms persist despite therapy. Pathologic correlation: Candida infection; fungal morphology; budding yeast; pseudohyphae; neutrophils; cervicovaginal candidiasis.

Searching Images

genital warts condyloma acuminata HPV

Clinical photograph of the female external genitalia showing extensive human papillomavirus (HPV) infection presenting as condyloma acuminata (genital warts). The lesions are characterized by multiple raised, exophytic, and papillary growths with a verrucous (cauliflower-like) texture. The distribution is widespread across the vulvar area, involving the labia minora, labia majora, and the vaginal introitus. Morphologically, the lesions appear flesh-colored to pale pink, with some areas exhibiting a whitish, hyperkeratotic surface. There is evidence of epithelial thickening and irregular surface contours, deviating from normal smooth mucosal architecture. This image illustrates the typical clinical presentation of low-risk HPV-induced benign neoplasia, which is a key diagnostic feature in gynecology and dermatology for distinguishing between infectious viral warts and other vulvar intraepithelial neoplasia (VIN) or malignant conditions.

Clinical photograph of the female external genitalia showing extensive human papillomavirus (HPV) infection presenting as condyloma acuminata (genital warts). The lesions are characterized by multiple raised, exophytic, and papillary growths with a verrucous (cauliflower-like) texture. The distribution is widespread across the vulvar area, involving the labia minora, labia majora, and the vaginal introitus. Morphologically, the lesions appear flesh-colored to pale pink, with some areas exhibiting a whitish, hyperkeratotic surface. There is evidence of epithelial thickening and irregular surface contours, deviating from normal smooth mucosal architecture. This image illustrates the typical clinical presentation of low-risk HPV-induced benign neoplasia, which is a key diagnostic feature in gynecology and dermatology for distinguishing between infectious viral warts and other vulvar intraepithelial neoplasia (VIN) or malignant conditions.

Two-panel clinical photograph demonstrating condyloma acuminata (genital warts) and its surgical management in a patient with systemic lupus erythematosus. Image (a) shows extensive, multifocal, hypertrophic verrucous lesions involving the vulva, perineum, and perianal region. The lesions exhibit a classic 'cauliflower-like' morphology with a rough, filiform texture and varied pigmentation ranging from skin-toned to brownish-grey. Image (b) shows the same anatomical region post-surgical excision. The surgical site features approximated skin edges secured with blue interrupted sutures extending through the labia and perineum. A yellow drainage tube is positioned for fluid management. Evidence of post-operative erythema and inflammation is visible. This comparison illustrates the clinical manifestation of severe HPV-related verrucous disease in an immunocompromised state and the immediate results of surgical debulking and reconstruction.

Two-panel clinical photograph demonstrating condyloma acuminata (genital warts) and its surgical management in a patient with systemic lupus erythematosus. Image (a) shows extensive, multifocal, hypertrophic verrucous lesions involving the vulva, perineum, and perianal region. The lesions exhibit a classic 'cauliflower-like' morphology with a rough, filiform texture and varied pigmentation ranging from skin-toned to brownish-grey. Image (b) shows the same anatomical region post-surgical excision. The surgical site features approximated skin edges secured with blue interrupted sutures extending through the labia and perineum. A yellow drainage tube is positioned for fluid management. Evidence of post-operative erythema and inflammation is visible. This comparison illustrates the clinical manifestation of severe HPV-related verrucous disease in an immunocompromised state and the immediate results of surgical debulking and reconstruction.

This gross clinical photograph shows external genital warts (condylomata acuminata) arising from the penile shaft and adjacent pubic skin. The image demonstrates multiple raised, flesh-colored papules with a rough, keratotic surface, arranged in clusters along the hair-bearing genital skin. The lesions are exophytic and papillomatous, measuring a few millimeters to over a centimeter in greatest dimension, with subtle erythema at the base and no obvious ulceration or drainage. The appearance is characteristic for HPV-induced genital warts, most commonly caused by HPV types 6 and 11, though other oncogenic types (2, 16, 18, 31, 33, 35, 39, 45, 51–56, 59) can be involved. Clinical diagnosis is supported by the typical morphology: verrucous, pink-to-flesh-colored papules that may coalesce into plaques. In the absence of histology, koilocytosis and epithelial hyperplasia would be expected on biopsy. Transmission is via sexual contact with minor trauma; autoinoculation and concurrent sexually transmitted infections may occur; incidence is higher in sexually active adults aged 20–40. The image is useful for educational illustration, differential diagnosis with verruca vulgaris and condyloma lata, and for teaching clinicians to recognize HPV-related anogenital lesions and counsel patients regarding treatment and prevention. Management considerations include topical therapy, ablative options, and vaccination discussion with patients.

This gross clinical photograph shows external genital warts (condylomata acuminata) arising from the penile shaft and adjacent pubic skin. The image demonstrates multiple raised, flesh-colored papules with a rough, keratotic surface, arranged in clusters along the hair-bearing genital skin. The lesions are exophytic and papillomatous, measuring a few millimeters to over a centimeter in greatest dimension, with subtle erythema at the base and no obvious ulceration or drainage. The appearance is characteristic for HPV-induced genital warts, most commonly caused by HPV types 6 and 11, though other oncogenic types (2, 16, 18, 31, 33, 35, 39, 45, 51–56, 59) can be involved. Clinical diagnosis is supported by the typical morphology: verrucous, pink-to-flesh-colored papules that may coalesce into plaques. In the absence of histology, koilocytosis and epithelial hyperplasia would be expected on biopsy. Transmission is via sexual contact with minor trauma; autoinoculation and concurrent sexually transmitted infections may occur; incidence is higher in sexually active adults aged 20–40. The image is useful for educational illustration, differential diagnosis with verruca vulgaris and condyloma lata, and for teaching clinicians to recognize HPV-related anogenital lesions and counsel patients regarding treatment and prevention. Management considerations include topical therapy, ablative options, and vaccination discussion with patients.

Searching Images

molluscum contagiosum pearly dome shaped papules umbilicated

This is a clinical dermatology photograph illustrating Molluscum contagiosum. Modality and technique: clinical photography; perspective: close-up, surface view of the skin. Anatomical context: cutaneous epidermis, likely trunk or extremities. The image shows multiple small, discrete, dome-shaped papules, 2–5 mm in diameter, with smooth, slightly shiny surfaces and a central umbilication. Lesions are flesh-colored to pale pink against normal skin; surrounding skin may be mildly erythematous in susceptible individuals. Papules appear clustered in groups, consistent with localized contagion and autoinoculation. There is no crusting, scaling, vesiculation, or pustulation evident. Overall, the pattern is highly suggestive of molluscum contagiosum, a benign poxvirus infection. If histology were obtained, one would expect Henderson-Patterson bodies within keratinocytes. Clinically, molluscum presents as painless, pearly, umbilicated papules, most common in children but also seen in adults with atopy or immunosuppression. Differential considerations include verruca vulgaris, epidermal inclusion cysts, milia, syringomas, and folliculitis; central umbilication helps distinguish molluscum. Clinical significance: contagious via direct contact and fomites; usually self-limited but treated in persistent or symptomatic cases. This image is suitable for dermatology education, visual diagnosis training, pediatric skin disease curricula, and clinical decision support. Endemic in many regions; consider screening for other pediatric skin infections.

This is a clinical dermatology photograph illustrating Molluscum contagiosum. Modality and technique: clinical photography; perspective: close-up, surface view of the skin. Anatomical context: cutaneous epidermis, likely trunk or extremities. The image shows multiple small, discrete, dome-shaped papules, 2–5 mm in diameter, with smooth, slightly shiny surfaces and a central umbilication. Lesions are flesh-colored to pale pink against normal skin; surrounding skin may be mildly erythematous in susceptible individuals. Papules appear clustered in groups, consistent with localized contagion and autoinoculation. There is no crusting, scaling, vesiculation, or pustulation evident. Overall, the pattern is highly suggestive of molluscum contagiosum, a benign poxvirus infection. If histology were obtained, one would expect Henderson-Patterson bodies within keratinocytes. Clinically, molluscum presents as painless, pearly, umbilicated papules, most common in children but also seen in adults with atopy or immunosuppression. Differential considerations include verruca vulgaris, epidermal inclusion cysts, milia, syringomas, and folliculitis; central umbilication helps distinguish molluscum. Clinical significance: contagious via direct contact and fomites; usually self-limited but treated in persistent or symptomatic cases. This image is suitable for dermatology education, visual diagnosis training, pediatric skin disease curricula, and clinical decision support. Endemic in many regions; consider screening for other pediatric skin infections.

Imaging modality: Clinical photography of dermatologic lesions using color digital capture. The subject is in vivo skin on the forearm/elbow region. The view shows multiple small, discrete, dome-shaped papules ranging 2–5 mm in diameter. Lesions are pink to flesh-colored with a subtle sheen. Several papules appear slightly umbilicated, a classic feature of Molluscum contagiosum; the surface is smooth with minimal scaling or crusting. The distribution is localized to the extensor forearm without extensive involvement of other sites in this image. The epidermis over the lesions is mildly elevated, and the surrounding skin shows dermatitis-like redness, which can accompany secondary irritation.

Molluscum contagiosum is a poxvirus-induced dermal infection commonly seen in children but also in adults, transmitted by direct contact or shared items. The image depicts typical clinical morphology: pearly to flesh-toned papules with central indentation and mild erythema. Imaging alone is not diagnostic; histopathology would show molluscum bodies within keratinocytes. Clinically, the diagnosis is supported by autoinoculation and spread pattern, especially in immunocompromised individuals. Differential considerations include viral warts (HPV), folliculitis, and spongiotic dermatitis. Management ranges from observation for spontaneous resolution to destructive therapies such as curettage, cantharidin, and cryotherapy, with infection control and cosmetic considerations. This image serves as a reference for recognition, tele-dermatology triage, and differential diagnosis practice.

Imaging modality: Clinical photography of dermatologic lesions using color digital capture. The subject is in vivo skin on the forearm/elbow region. The view shows multiple small, discrete, dome-shaped papules ranging 2–5 mm in diameter. Lesions are pink to flesh-colored with a subtle sheen. Several papules appear slightly umbilicated, a classic feature of Molluscum contagiosum; the surface is smooth with minimal scaling or crusting. The distribution is localized to the extensor forearm without extensive involvement of other sites in this image. The epidermis over the lesions is mildly elevated, and the surrounding skin shows dermatitis-like redness, which can accompany secondary irritation. Molluscum contagiosum is a poxvirus-induced dermal infection commonly seen in children but also in adults, transmitted by direct contact or shared items. The image depicts typical clinical morphology: pearly to flesh-toned papules with central indentation and mild erythema. Imaging alone is not diagnostic; histopathology would show molluscum bodies within keratinocytes. Clinically, the diagnosis is supported by autoinoculation and spread pattern, especially in immunocompromised individuals. Differential considerations include viral warts (HPV), folliculitis, and spongiotic dermatitis. Management ranges from observation for spontaneous resolution to destructive therapies such as curettage, cantharidin, and cryotherapy, with infection control and cosmetic considerations. This image serves as a reference for recognition, tele-dermatology triage, and differential diagnosis practice.

Searching Images

Chlamydia trachomatis elementary body reticulate body intracellular

A pathophysiology diagram illustrating the biphasic developmental cycle of Chlamydia trachomatis within a columnar epithelial host cell. The process is mapped across six key stages: (1) Cellular invasion, where infectious green Elementary Bodies (EBs) adhere and enter via cytoskeletal rearrangement; (2) Primary differentiation of EBs into larger blue replicative Reticulate Bodies (RBs) within an initial inclusion; (3) RB replication via binary fission and inclusion expansion (8-48 hours post-infection); (4) A persistence pathway where stressors induce the formation of orange Aberrant Bodies (ABs); (5) Secondary differentiation as RBs convert back into EBs (24-72 hours); and (6) EB release through host cell lysis or extrusion. The diagram highlights molecular mediators, including Type III Secretion System (T3SS) effectors (e.g., TarP, TmeA), transcription factors (e.g., ChxR, ArgR), and proteases (e.g., CPAF). A central temporal dial correlates these morphological changes with hours post-infection (hPI). This educational resource characterizes the intracellular pathogenesis of Chlamydia, detailing the transition between infectious and replicative forms.

A pathophysiology diagram illustrating the biphasic developmental cycle of Chlamydia trachomatis within a columnar epithelial host cell. The process is mapped across six key stages: (1) Cellular invasion, where infectious green Elementary Bodies (EBs) adhere and enter via cytoskeletal rearrangement; (2) Primary differentiation of EBs into larger blue replicative Reticulate Bodies (RBs) within an initial inclusion; (3) RB replication via binary fission and inclusion expansion (8-48 hours post-infection); (4) A persistence pathway where stressors induce the formation of orange Aberrant Bodies (ABs); (5) Secondary differentiation as RBs convert back into EBs (24-72 hours); and (6) EB release through host cell lysis or extrusion. The diagram highlights molecular mediators, including Type III Secretion System (T3SS) effectors (e.g., TarP, TmeA), transcription factors (e.g., ChxR, ArgR), and proteases (e.g., CPAF). A central temporal dial correlates these morphological changes with hours post-infection (hPI). This educational resource characterizes the intracellular pathogenesis of Chlamydia, detailing the transition between infectious and replicative forms.

A pathophysiology diagram illustrating the immune response to Chlamydia trachomatis infection in human mucosa. The top section depicts the initial infection phase, where C. trachomatis elementary bodies (EBs) enter columnar epithelial cells to form intracellular inclusions. Within the underlying mucosa, the diagram shows the recruitment and activation of myeloid dendritic cells, macrophages, T cells, B cells (secreting MOMP antibodies), and neutrophils (contributing to cell death). A central hexagonal node represents the massive release of inflammatory cytokines (IFN-γ, IL-6, IL-8, IL-12, IL-10), which leads to a divergence between pathogenesis (tissue injury) and epithelial protection. The lower portion details acute inflammation and post-infection sequelae, highlighting the role of plasmacytoid dendritic cells, B cells, and T cells in IFN-γ production. This phase transitions into a persistent autoimmune response involving Ct-hsp10 and Ct-hsp60 antibodies, ultimately resulting in collateral tissue damage and scar formation. The diagram is designed for intermediate-level medical education on infectious disease immunology and gynecological pathology.

A pathophysiology diagram illustrating the immune response to Chlamydia trachomatis infection in human mucosa. The top section depicts the initial infection phase, where C. trachomatis elementary bodies (EBs) enter columnar epithelial cells to form intracellular inclusions. Within the underlying mucosa, the diagram shows the recruitment and activation of myeloid dendritic cells, macrophages, T cells, B cells (secreting MOMP antibodies), and neutrophils (contributing to cell death). A central hexagonal node represents the massive release of inflammatory cytokines (IFN-γ, IL-6, IL-8, IL-12, IL-10), which leads to a divergence between pathogenesis (tissue injury) and epithelial protection. The lower portion details acute inflammation and post-infection sequelae, highlighting the role of plasmacytoid dendritic cells, B cells, and T cells in IFN-γ production. This phase transitions into a persistent autoimmune response involving Ct-hsp10 and Ct-hsp60 antibodies, ultimately resulting in collateral tissue damage and scar formation. The diagram is designed for intermediate-level medical education on infectious disease immunology and gynecological pathology.

I now have enough comprehensive information to write the full detailed response. Let me update the todos and compose the answer.Here is the complete, detailed breakdown of all topics from the Genital Tract Infections slide (Apurba Sastri Microbiology curriculum), organized into Must Know, Good to Know, and Understanding the Concept for each topic.

GENITAL TRACT INFECTIONS - Complete Topic Breakdown

(Apurba Sastri / Dr. Shreyashi's Curriculum)


OVERVIEW - Understanding the Framework

The genital tract can be infected at multiple levels:
  • Lower tract: Vulva, vagina, cervix, urethra, Bartholin's gland
  • Upper tract: Uterus, fallopian tubes, ovaries (PID)
Key pathogens are divided into:
  • Bacteria: N. gonorrhoeae, C. trachomatis, G. vaginalis, Mycoplasma, Treponema
  • Viruses: HPV, HSV, Poxvirus (Molluscum)
  • Parasites: Trichomonas vaginalis
  • Fungi: Candida albicans
Normal vaginal pH is acidic (3.8-4.5), maintained by Lactobacillus species. When this protection is disrupted, infections emerge.

1. VAGINITIS

Must Know

FeatureBacterial VaginosisCandidiasisTrichomoniasis
CauseGardnerella vaginalis + anaerobesCandida albicansTrichomonas vaginalis (protozoan)
DischargeThin, gray-white, fishy smellThick white "curd-like"Yellow, frothy, foul
pH>4.5<4.5>4.5
Wet MountClue cellsPseudohyphae + budding yeastMotile flagellated trophozoites
KOH (Whiff test)POSITIVE (fishy amine odor)NegativeNegative
STI?No (dysbiosis)NoYes
TreatmentMetronidazoleFluconazole / ClotrimazoleMetronidazole

Good to Know

  • Trichomoniasis causes "strawberry cervix" - fiery red cervical mucosa with dilated vessels on colposcopy
  • T. vaginalis is the most prevalent non-viral STI worldwide (~3.7 million in the US alone)
  • Only 30% of T. vaginalis infected people develop symptoms
  • Trichomoniasis in pregnancy causes premature rupture of membranes and preterm delivery
  • Candidiasis is NOT an STI - it is a disruption of normal flora; predisposing factors include diabetes, pregnancy, antibiotics, immunosuppression (neutrophil/Th17 deficiency)
  • Amsel criteria (for BV): requires 3 of 4 - homogeneous discharge, pH >4.5, clue cells on wet mount, positive whiff test

Understanding the Concept

The key concept in vaginitis is vaginal microbiome balance. Normally, Lactobacillus dominates and produces lactic acid keeping pH low. In BV, there is a polymicrobial dysbiosis - Lactobacillus is depleted, and Gardnerella vaginalis, Prevotella, Mobiluncus, and anaerobes overgrow. This is NOT an infection by a single new pathogen - it is an ecological shift. Clue cells are vaginal epithelial cells studded with G. vaginalis (coccobacilli), giving them a shaggy, stippled border that obscures the cell margin.
BV vs Normal - Clue cells on gram smear
Panel C shows clue cells (BV); Panel D shows normal Lactobacillus-dominant microbiome

2. BACTERIAL VAGINOSIS (BV)

Must Know

  • Cause: Polymicrobial - Gardnerella vaginalis (primary), Mobiluncus, Prevotella, Peptostreptococcus
  • Key Gram stain finding: Clue cells = epithelial cells coated with coccobacilli
  • Whiff test: Adding 10% KOH to vaginal discharge releases amines - produces FISHY odor = POSITIVE
  • Nugent score: Used for lab diagnosis (Gram stain scoring of vaginal flora)
  • Amsel criteria: 3 of 4 required (homogeneous discharge, pH>4.5, clue cells, positive whiff)
  • Treatment: Metronidazole (oral or vaginal gel)

Good to Know

  • BV in pregnancy: associated with premature labor, preterm birth, and postpartum endometritis
  • BV increases susceptibility to HIV and other STIs by disrupting mucosal barrier
  • The attachment of N. gonorrhoeae to the cervix is actually ENHANCED by enzymes from the cervicovaginal microbiota in BV - this is a critical concept for understanding co-infections
  • Recurrence is very common (~50% in 1 year) - linked to biofilm formation by G. vaginalis

Understanding the Concept

BV is best understood as a microbiome imbalance, not a classical infection. The dominant Lactobacillus (which produce H₂O₂ and lactic acid) are replaced by anaerobes. This raises vaginal pH, alters the immune environment, and allows opportunists to proliferate. The fishy odor comes from the production of amines (putrescine, cadaverine) by anaerobic bacteria metabolizing proteins - KOH volatilizes these amines.
Sources: Sherris & Ryan's Medical Microbiology 8e; Robbins & Kumar Basic Pathology; Tietz Textbook of Laboratory Medicine 7e

3. CERVICITIS

Must Know

  • Primary causes: Chlamydia trachomatis AND Neisseria gonorrhoeae (the two most important)
  • Emerging cause: Mycoplasma genitalium (responsible for up to 30% of recurrent cases)
  • Symptoms: Mucopurulent vaginal discharge, intermenstrual bleeding, pelvic pain, dyspareunia
  • Lab diagnosis: NAAT (Nucleic Acid Amplification Test) is the GOLD STANDARD - can be performed on genital swabs or urine
  • Complication: Can ascend to cause PID (pelvic inflammatory disease) - most important complication

Good to Know

  • Many cervicitis cases are asymptomatic: Only 6% of C. trachomatis infected females have symptoms; only 14% with N. gonorrhoeae have signs
  • Gonococcal cervicitis: Gram stain shows intracellular gram-negative diplococci inside neutrophils
  • Chlamydial cervicitis: Discharge is watery to mucopurulent with neutrophil predominance
  • Gonorrhea and Chlamydia co-infection is common, so treating for both simultaneously is standard practice
  • N. gonorrhoeae can disseminate causing: septic arthritis (knees most common), tenosynovitis, vesicular skin lesions, fever

Understanding the Concept

Cervicitis is the gateway infection to PID. Gonococcal PID spreads upward along mucosal surfaces (cervix → endocervix → fallopian tubes). This is why it causes acute suppurative salpingitis with neutrophil infiltration. Non-gonococcal (Chlamydial) PID spreads through lymphatics/venous channels rather than mucosa - causing deeper tissue inflammation. Endometrium is characteristically spared in gonorrhea (reason unknown), but fallopian tubes are severely affected.

4. BARTHOLINITIS (Bartholin Gland Abscess/Infection)

Must Know

  • Bartholin glands: Located at 4 o'clock and 8 o'clock positions at the vaginal introitus; provide lubrication during intercourse
  • Bartholinitis = infection/inflammation of the Bartholin gland or duct
  • Bartholin cyst = blockage of duct → duct distends with secretion (not infected); if infected = abscess
  • Organisms: Often polymicrobial - E. coli, Staphylococcus, Streptococci; STI organisms like N. gonorrhoeae and C. trachomatis may also cause it
  • Treatment:
    • Abscess: Incision and drainage (I&D) + Word catheter placement
    • Recurrent: Marsupialization (surgical creation of a permanent opening)
    • Excision reserved for carcinoma suspicion (especially in women >40)

Good to Know

  • Bartholin gland carcinoma is rare but must be excluded in older women with "recurrent bartholinitis"
  • Word catheter is placed into the cyst for drainage and reevaluated weekly - allows epithelialization of a permanent tract
  • Bartholin gland abscess is one of the most common vulvar emergencies seen in gynecology OPD

Understanding the Concept

The Bartholin gland opens via a duct. When the duct is blocked (by inflammation, debris, or anatomy), secretions accumulate forming a cyst. Secondary infection turns the cyst into a painful, fluctuant abscess. Because the gland sits in loose areolar tissue with rich blood supply, infections can spread rapidly. Marsupialization creates a permanent new opening, preventing recurrence by maintaining a patent drainage channel.

5. GENITAL WARTS (Condyloma Acuminata)

Must Know

  • Cause: Human Papillomavirus (HPV), primarily types 6 and 11 (LOW-RISK types - benign warts)
  • High-risk types (16, 18, 31, 33) - cause dysplasia and cancer, NOT warts
  • Appearance: Fleshy, exophytic, cauliflower-like, verrucous (warty) papules on genitals, perineum, perianal area
  • Histology key finding: Koilocytes = epithelial cells with pyknotic nuclei surrounded by a clear perinuclear halo (viral cytopathic effect)
  • Transmission: Sexual contact, also vertical (mother to child during delivery) → laryngeal papillomatosis in newborn
  • Diagnosis: Clinical (appearance); Pap smear/colposcopy for cervical HPV
  • Treatment: Podophyllin, Podophyllotoxin, Imiquimod (immune modifier), TCA (trichloroacetic acid), cryotherapy, laser, surgical excision

Good to Know

  • HPV is the most common STI globally
  • Condylomata acuminata = condyloma from Latin "pointed warts" (contrast with condyloma lata of syphilis which are FLAT)
  • Cervical HPV → CIN (cervical intraepithelial neoplasia) → cervical cancer (HPV 16/18 integration into host genome → inactivates p53 and Rb tumor suppressors)
  • Vaccination: Gardasil 9 (9-valent) protects against HPV 6, 11, 16, 18, 31, 33, 45, 52, 58
  • Aceto-white test: Application of 5% acetic acid to affected area turns warts white - used in colposcopy
Condyloma acuminata - cauliflower-like vulvar lesions
Multiple raised, verrucous, cauliflower-like lesions typical of HPV-induced condyloma acuminata

Understanding the Concept

HPV infects the basal layer of stratified squamous epithelium through micro-abrasions. Low-risk HPV types 6/11 stay episomal (not integrated into host DNA) and cause proliferative but benign warts. High-risk types 16/18 can integrate into the host genome, disrupting TP53 and RB tumor suppressors - leading to uncontrolled cell proliferation and eventual malignancy. This is why the same virus can cause both harmless warts AND cancer depending on the HPV type.
Sources: Robbins, Cotran & Kumar Pathologic Basis of Disease; Tietz Textbook of Laboratory Medicine 7e

6. MOLLUSCUM CONTAGIOSUM

Must Know

  • Cause: Molluscum Contagiosum Virus (MCV) - a Poxvirus (DNA virus)
  • 4 types: MCV-1 (most common overall), MCV-2 (most often sexually transmitted)
  • Appearance: Pearly, dome-shaped papules (1-5 mm), with central umbilication (dimple) - PATHOGNOMONIC
  • Histology: Henderson-Patterson bodies (molluscum bodies) = large eosinophilic intracytoplasmic inclusions in keratinocytes
  • Transmission:
    • Children (2-12 yr): Direct contact / fomites (towels, etc.) - trunk, arms, legs
    • Adults: Sexual transmission - genitals, lower abdomen, buttocks, inner thighs
  • Incubation: ~6 weeks
  • Self-limiting: Usually resolves in 6-12 months in immunocompetent patients

Good to Know

  • In HIV/immunosuppressed patients: lesions are large, numerous, and persistent (>100 lesions); atypical giant molluscum can occur on face
  • Diagnosis is clinical - based on characteristic appearance (pearly dome with central dimple)
  • Treatment when needed: Curettage, cryotherapy, cantharidin (vesicant), imiquimod, laser
  • NOT a notifiable STI but is considered a sexually transmissible infection in adults
Molluscum contagiosum - dome-shaped papules with central umbilication
Classic flesh-colored dome-shaped papules with central umbilication - hallmark of molluscum contagiosum

Understanding the Concept

The central umbilication (dimple) on molluscum papules is caused by the Henderson-Patterson bodies (huge intracytoplasmic poxvirus inclusions) filling and distending the keratinocytes, eventually causing the central epidermal breakdown and dimple. The "waxy core" you can express from the center contains these virus-laden cells. In immunocompromised patients, the failure of T-cell immunity to clear the virus explains the uncontrolled proliferation and extensive lesions.
Sources: Robbins, Cotran & Kumar Pathologic Basis of Disease; Goldman-Cecil Medicine

7. NON-GONOCOCCAL URETHRITIS (NGU)

Must Know

  • Definition: Urethritis NOT caused by N. gonorrhoeae
  • Most common cause: Chlamydia trachomatis (serovars D-K) - most common bacterial STI worldwide
  • Second cause: Mycoplasma genitalium - up to 30% of recurrent NGU in males
  • Other causes: Trichomonas vaginalis, Ureaplasma urealyticum, HSV
  • ~50% cases: No pathogen identified
  • Chlamydia lifecycle (MUST KNOW):
    • Elementary body (EB): Infectious, metabolically inert, extracellular form - enters host cell by receptor-mediated endocytosis
    • Reticulate body (RB): Non-infectious, metabolically active, intracellular replicating form - replicates using host cell energy
    • EB → RB → new EBs → cell lysis/extrusion → spread

Good to Know

  • Chlamydia is an obligate intracellular pathogen - cannot be grown on regular culture media; requires cell culture
  • Has affinity for columnar epithelial cells (cervix, urethra, conjunctiva, fallopian tube)
  • Clinical features of NGU are similar to gonococcal urethritis but generally milder: watery to mucoid discharge, dysuria, urethral itching
  • Complications of untreated Chlamydia:
    • Women: PID, infertility, ectopic pregnancy, chronic pelvic pain
    • Men: Epididymitis, prostatitis
    • Neonates (from infected mother during delivery): Ophthalmia neonatorum (conjunctivitis - most common) and neonatal pneumonia
    • Reactive arthritis (Reiter's syndrome): Urethritis + Arthritis + Conjunctivitis ("Can't see, can't pee, can't climb a tree")
  • Fitz-Hugh-Curtis syndrome: Perihepatitis caused by C. trachomatis (or gonorrhea) spreading to perihepatic capsule - presents as RUQ pain
Chlamydia trachomatis lifecycle - elementary and reticulate bodies
The biphasic developmental cycle: EB (infectious) → RB (replicating) → new EBs → lysis/extrusion

Understanding the Concept

The key concept for Chlamydia is its obligate intracellular existence and biphasic life cycle. Since Chlamydia cannot produce its own ATP ("energy parasite"), it must exist inside host cells. The EB is the "travel form" - tough enough to survive outside cells but metabolically dormant. Once inside, it converts to the RB which uses the host cell's ribosomes and energy to replicate, making it vulnerable to antibiotics that penetrate cells (tetracyclines, macrolides). The inclusion bodies visible on Giemsa stain (or in cell culture) represent vesicles containing developing organisms.
Why is NGU more common than GU? Chlamydia causes 50% more STI cases than gonorrhea globally; it is often asymptomatic, leading to silent transmission and widespread reservoir in the population. It is NOT detectable by standard Gram stain (no gram-negative diplococci seen on smear in NGU, unlike GU).
Sources: Robbins & Kumar Basic Pathology; Tietz Textbook of Laboratory Medicine 7e

QUICK COMPARISON TABLE - Lab Diagnosis Summary

DiseaseOrganismKey Lab FindingPreferred Test
BVG. vaginalis + anaerobesClue cells; pH >4.5; Whiff+Wet mount + Amsel criteria / Nugent score
Candida vaginitisC. albicansPseudohyphae + budding yeastKOH mount / Pap smear
TrichomoniasisT. vaginalisMotile flagellated protozoaWet mount (immediate); NAAT
Cervicitis (GC)N. gonorrhoeaeIntracellular gram-neg diplococci in PMNsNAAT (gold standard); Culture
Cervicitis (NGU)C. trachomatisInclusion bodies (Giemsa/immunofluorescence)NAAT (gold standard)
Genital wartsHPV 6/11Koilocytes on histology/PapClinical; Colposcopy + aceto-white
MolluscumPoxvirus MCVHenderson-Patterson (molluscum) bodiesClinical; Histology
BartholinitisPolymicrobialCulture (polymicrobial)Clinical + pus culture

MEMORY AIDS

  • BV mnemonic: "CLUE cells + FISHY smell + GRAY discharge + pH >4.5" = BV
  • Chlamydia EB vs RB: "EB = Extracellular, Enters cell"; "RB = Replicates inside"
  • Molluscum: "Pearly + Dimple + Pox" = Henderson-Patterson bodies
  • NGU causes: "Chlamydia is #1, Mycoplasma is #2, Trichomonas #3, Ureaplasma #4, ~50% unknown"
  • Reactive arthritis triad: "Can't see (conjunctivitis) + Can't pee (urethritis) + Can't climb a tree (arthritis)"
  • HPV types: "6, 11 = Warts (six-eleven sounds like heaven = benign)"; "16, 18 = Cancer (sixteen-eighteen = serious age = malignant)"
  • Bartholin anatomy: "Bartholin is at 4 and 8 o'clock positions at the vaginal introitus"

Sources consulted: Sherris & Ryan's Medical Microbiology 8e, Robbins & Kumar Basic Pathology, Robbins Cotran & Kumar Pathologic Basis of Disease, Tietz Textbook of Laboratory Medicine 7e, Goldman-Cecil Medicine, Harrison's Principles of Internal Medicine 22e

can u make pdf with photos too

Reading File
Running Command

ls /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "workspace ready"

Running Command

mkdir -p /tmp/workspace/genital-tract-infections && cd /tmp/workspace/genital-tract-infections && python3 -c "import reportlab; import PIL; import requests; print('All libs OK')"

Writing File

~/genital-tract-infections/build_pdf.py


import requests
import os
from io import BytesIO
from PIL import Image as PILImage

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    Image, HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import Flowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY

OUTPUT = "/tmp/workspace/genital-tract-infections/Genital_Tract_Infections_Apurba_Sastri.pdf"

# ── colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a3a5c")
MID_BLUE    = colors.HexColor("#2563a8")
LIGHT_BLUE  = colors.HexColor("#dbeafe")
ACCENT_RED  = colors.HexColor("#c0392b")
GOLD        = colors.HexColor("#f39c12")
GREEN       = colors.HexColor("#1e8449")
LIGHT_GREEN = colors.HexColor("#d5f5e3")
LIGHT_GREY  = colors.HexColor("#f0f4f8")
WHITE       = colors.white
BLACK       = colors.HexColor("#1a1a1a")
TABLE_HEAD  = colors.HexColor("#1a3a5c")
TABLE_ALT   = colors.HexColor("#eaf0fb")

W, H = A4

# ── styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    base = styles["Normal"]
    return ParagraphStyle(name, parent=base, **kw)

title_style   = S("DocTitle",  fontSize=22, textColor=WHITE,      alignment=TA_CENTER, fontName="Helvetica-Bold", spaceAfter=4)
sub_style     = S("DocSub",    fontSize=12, textColor=LIGHT_BLUE, alignment=TA_CENTER, fontName="Helvetica",      spaceAfter=2)
h1_style      = S("H1",        fontSize=15, textColor=WHITE,      fontName="Helvetica-Bold", spaceAfter=4, leading=20)
h2_style      = S("H2",        fontSize=12, textColor=DARK_BLUE,  fontName="Helvetica-Bold", spaceAfter=3, leading=15)
h3_style      = S("H3",        fontSize=10.5, textColor=MID_BLUE, fontName="Helvetica-Bold", spaceAfter=2, leading=14)
body_style    = S("Body",      fontSize=9.5, textColor=BLACK,     fontName="Helvetica",      spaceAfter=3, leading=14, alignment=TA_JUSTIFY)
bullet_style  = S("Bullet",    fontSize=9.5, textColor=BLACK,     fontName="Helvetica",      spaceAfter=2, leading=13, leftIndent=14, bulletIndent=4)
caption_style = S("Caption",   fontSize=8,   textColor=colors.HexColor("#555555"), fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=6)
must_style    = S("Must",      fontSize=9,   textColor=colors.HexColor("#7b2000"), fontName="Helvetica-Bold",   spaceAfter=2, leading=13)
note_style    = S("Note",      fontSize=8.5, textColor=colors.HexColor("#1a5276"), fontName="Helvetica-Oblique", spaceAfter=2, leading=13)
source_style  = S("Source",    fontSize=7.5, textColor=colors.HexColor("#777777"), fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=3)

# ── helper: download image ───────────────────────────────────────────────────
def fetch_img(url, max_w, max_h, cache_dir="/tmp/workspace/genital-tract-infections/img_cache"):
    os.makedirs(cache_dir, exist_ok=True)
    fname = os.path.join(cache_dir, url.split("/")[-1][:60] + ".jpg")
    if not os.path.exists(fname):
        try:
            r = requests.get(url, timeout=20)
            img = PILImage.open(BytesIO(r.content)).convert("RGB")
            img.save(fname, "JPEG", quality=85)
        except Exception as e:
            print(f"  [WARN] Could not fetch {url}: {e}")
            return None
    try:
        img = PILImage.open(fname)
        iw, ih = img.size
        scale = min(max_w / iw, max_h / ih, 1.0)
        return Image(fname, width=iw * scale, height=ih * scale)
    except:
        return None

# ── coloured section banner ──────────────────────────────────────────────────
class ColorBanner(Flowable):
    def __init__(self, text, bg=DARK_BLUE, text_color=WHITE, height=28, font_size=13):
        super().__init__()
        self.text = text
        self.bg = bg
        self.text_color = text_color
        self.height = height
        self.font_size = font_size
        self.width = W - 4 * cm

    def draw(self):
        self.canv.setFillColor(self.bg)
        self.canv.roundRect(0, 0, self.width, self.height, 6, fill=1, stroke=0)
        self.canv.setFillColor(self.text_color)
        self.canv.setFont("Helvetica-Bold", self.font_size)
        self.canv.drawString(10, 8, self.text)

def banner(text, bg=DARK_BLUE, font_size=13):
    return [Spacer(1, 4*mm), ColorBanner(text, bg=bg, font_size=font_size), Spacer(1, 3*mm)]

# ── coloured box paragraph ────────────────────────────────────────────────────
def colored_box(paragraphs, bg=LIGHT_BLUE, border=MID_BLUE):
    data = [[p] for p in paragraphs]
    t = Table(data, colWidths=[W - 4*cm - 10])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0, 0), (-1, -1), bg),
        ("BOX",           (0, 0), (-1, -1), 0.8, border),
        ("TOPPADDING",    (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
        ("LEFTPADDING",   (0, 0), (-1, -1), 8),
        ("RIGHTPADDING",  (0, 0), (-1, -1), 8),
        ("ROWBACKGROUNDS",(0, 0), (-1, -1), [bg]),
    ]))
    return [t, Spacer(1, 3*mm)]

def must_box(items):
    paras = [Paragraph(f"<b>MUST KNOW</b>", must_style)] + \
            [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=colors.HexColor("#fff5f5"), border=ACCENT_RED)

def gtk_box(items):
    paras = [Paragraph(f"<b>GOOD TO KNOW</b>", S("gtk", fontSize=9, textColor=GREEN, fontName="Helvetica-Bold", spaceAfter=2))] + \
            [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=LIGHT_GREEN, border=GREEN)

def concept_box(text):
    paras = [Paragraph("<b>UNDERSTANDING THE CONCEPT</b>", S("con", fontSize=9, textColor=colors.HexColor("#1a5276"), fontName="Helvetica-Bold", spaceAfter=2)),
             Paragraph(text, note_style)]
    return colored_box(paras, bg=colors.HexColor("#eaf4fb"), border=MID_BLUE)

# ── table helper ─────────────────────────────────────────────────────────────
def data_table(headers, rows, col_widths=None):
    data = [headers] + rows
    if col_widths is None:
        col_widths = [(W - 4*cm) / len(headers)] * len(headers)
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND",    (0, 0), (-1, 0),  TABLE_HEAD),
        ("TEXTCOLOR",     (0, 0), (-1, 0),  WHITE),
        ("FONTNAME",      (0, 0), (-1, 0),  "Helvetica-Bold"),
        ("FONTSIZE",      (0, 0), (-1, 0),  8),
        ("FONTNAME",      (0, 1), (-1, -1), "Helvetica"),
        ("FONTSIZE",      (0, 1), (-1, -1), 7.5),
        ("BACKGROUND",    (0, 1), (-1, -1), WHITE),
        ("ROWBACKGROUNDS",(0, 1), (-1, -1), [WHITE, TABLE_ALT]),
        ("GRID",          (0, 0), (-1, -1), 0.4, colors.HexColor("#bbbbbb")),
        ("TOPPADDING",    (0, 0), (-1, -1), 4),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 4),
        ("LEFTPADDING",   (0, 0), (-1, -1), 5),
        ("RIGHTPADDING",  (0, 0), (-1, -1), 5),
        ("VALIGN",        (0, 0), (-1, -1), "TOP"),
        ("WORDWRAP",      (0, 0), (-1, -1), "LTR"),
    ]
    for i, row in enumerate(rows):
        for j, cell in enumerate(row):
            data[i+1][j] = Paragraph(str(cell), S(f"tc{i}{j}", fontSize=7.5, leading=11))
    for j, h in enumerate(headers):
        data[0][j] = Paragraph(str(h), S(f"th{j}", fontSize=8, fontName="Helvetica-Bold", textColor=WHITE, leading=11))
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle(style))
    return [t, Spacer(1, 4*mm)]

# ── cover page ────────────────────────────────────────────────────────────────
def cover_page():
    elems = []
    elems.append(Spacer(1, 3*cm))

    # Title block
    title_data = [
        [Paragraph("GENITAL TRACT INFECTIONS", title_style)],
        [Paragraph("Apurba Sastri Microbiology | Dr. Shreyashi's Lecture Series", sub_style)],
        [Spacer(1, 6*mm)],
        [Paragraph("Must Know • Good to Know • Understanding Concepts", sub_style)],
    ]
    title_table = Table(title_data, colWidths=[W - 4*cm])
    title_table.setStyle(TableStyle([
        ("BACKGROUND",  (0, 0), (-1, -1), DARK_BLUE),
        ("TOPPADDING",  (0, 0), (-1, -1), 10),
        ("BOTTOMPADDING",(0,0), (-1, -1), 10),
        ("LEFTPADDING", (0, 0), (-1, -1), 15),
        ("RIGHTPADDING",(0, 0), (-1, -1), 15),
        ("ROUNDEDCORNERS", (0, 0), (-1, -1), [10, 10, 10, 10]),
    ]))
    elems.append(title_table)
    elems.append(Spacer(1, 8*mm))

    # Topics covered
    topics = [
        "1. Vaginitis (BV, Candidiasis, Trichomoniasis)",
        "2. Bacterial Vaginosis (BV) - Detailed",
        "3. Cervicitis",
        "4. Bartholinitis (Bartholin Gland Abscess)",
        "5. Genital Warts (Condyloma Acuminata / HPV)",
        "6. Molluscum Contagiosum",
        "7. Non-Gonococcal Urethritis (NGU / Chlamydia)",
        "8. Comparative Lab Diagnosis Table",
        "9. Memory Aids & Quick Review",
    ]
    cover_box = [Paragraph("<b>TOPICS COVERED</b>", h2_style)] + \
                [Paragraph(t, bullet_style) for t in topics]
    elems += colored_box(cover_box, bg=LIGHT_BLUE, border=DARK_BLUE)

    elems.append(Spacer(1, 8*mm))
    elems.append(Paragraph(
        "Sources: Sherris & Ryan's Medical Microbiology 8e | Robbins & Kumar Basic Pathology | "
        "Robbins Cotran & Kumar Pathologic Basis of Disease | Tietz Textbook of Laboratory Medicine 7e | "
        "Goldman-Cecil Medicine | Harrison's Principles of Internal Medicine 22e",
        source_style))
    elems.append(PageBreak())
    return elems

# ── image URLs ────────────────────────────────────────────────────────────────
IMG_BV    = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c1fa959fcc374c1282fd18b4fc6f2e0999f056e3a4464124d3d2ad884a63e5d7.jpg"
IMG_WARTS = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_f22a328614c60567db07558682ea89501c602a2c4d80550646855ef6a1040e72.jpg"
IMG_WARTS2= "https://cdn.orris.care/cdss_images/Pathology_1760048447732_4e23fea8-0e9a-4fce-8240-9aa3265760a5.jpg"
IMG_MOL   = "https://cdn.orris.care/cdss_images/DermNetNZ_1760036332003_c7f2f3ed-f769-431e-8214-8558079981c8.jpg"
IMG_CHLAM = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_edfdac49febd0d5695812492031d93f3ff249227bf971234304df196a5d3e572.jpg"
IMG_MOL2  = "https://cdn.orris.care/cdss_images/DermNetNZ_1760036166077_f138fb39-f0a3-459e-9018-121c00df07a5.jpg"

# ── MAIN BUILD ────────────────────────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(OUTPUT, pagesize=A4,
                            leftMargin=2*cm, rightMargin=2*cm,
                            topMargin=2*cm, bottomMargin=2*cm)
    story = []

    # ── Cover ─────────────────────────────────────────────────────────────────
    story += cover_page()

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 0 - Overview
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("OVERVIEW — Genital Tract Infections Framework", bg=DARK_BLUE)
    story.append(Paragraph(
        "Genital tract infections affect the lower tract (vulva, vagina, cervix, urethra, Bartholin's gland) "
        "and can ascend to the upper tract (uterus, fallopian tubes, ovaries) causing PID. Normal vaginal pH "
        "is <b>3.8–4.5</b> maintained by <b>Lactobacillus</b> species. When this barrier is disrupted, "
        "pathogens colonise and cause disease.", body_style))
    story += data_table(
        ["Category", "Pathogen", "Disease"],
        [
            ["Bacteria", "Neisseria gonorrhoeae", "Cervicitis, Urethritis, PID, Disseminated GC"],
            ["Bacteria", "Chlamydia trachomatis", "NGU, Cervicitis, PID, LGV, Ophthalmia neonatorum"],
            ["Bacteria", "Gardnerella vaginalis + anaerobes", "Bacterial Vaginosis"],
            ["Bacteria", "Polymicrobial", "Bartholinitis / Bartholin gland abscess"],
            ["Virus", "HPV 6/11 (low-risk)", "Condyloma acuminata (Genital warts)"],
            ["Virus", "HPV 16/18 (high-risk)", "Cervical dysplasia → carcinoma"],
            ["Virus", "Poxvirus (MCV)", "Molluscum contagiosum"],
            ["Protozoan", "Trichomonas vaginalis", "Trichomoniasis / Vaginitis"],
            ["Fungus", "Candida albicans", "Vulvovaginal candidiasis"],
        ],
        col_widths=[3*cm, 6.5*cm, 7*cm]
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 1 - Vaginitis Comparison
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("1. VAGINITIS — Three Causes Compared", bg=MID_BLUE)
    story += data_table(
        ["Feature", "Bacterial Vaginosis", "Candidiasis", "Trichomoniasis"],
        [
            ["Cause", "G. vaginalis + anaerobes", "Candida albicans", "Trichomonas vaginalis"],
            ["Discharge", "Thin, gray-white, homogeneous", "Thick, white, 'curd-like'", "Yellow, frothy, foul-smelling"],
            ["pH", ">4.5", "<4.5 (normal)", ">4.5"],
            ["Wet Mount", "Clue cells", "Pseudohyphae + budding yeast", "Motile flagellated trophozoites"],
            ["KOH/Whiff Test", "POSITIVE (fishy amine odor)", "Pseudohyphae visible", "Not used"],
            ["Itch/Pruritis", "Mild/absent", "Severe pruritis + erythema", "Present"],
            ["Cervix", "Normal", "Erythematous", "Strawberry cervix"],
            ["STI?", "No (dysbiosis)", "No", "Yes"],
            ["Treatment", "Metronidazole", "Fluconazole / Clotrimazole", "Metronidazole"],
        ],
        col_widths=[3*cm, 4.5*cm, 4.5*cm, 4.5*cm]
    )

    # BV image
    img_bv = fetch_img(IMG_BV, max_w=13*cm, max_h=7*cm)
    if img_bv:
        story.append(KeepTogether([
            img_bv,
            Paragraph("BV (Panel C): clue cells — epithelial cells coated with coccobacilli. "
                      "Normal (Panel D): Lactobacillus-dominant flora with clear cells.", caption_style),
            Spacer(1, 3*mm)
        ]))

    story += must_box([
        "Amsel criteria for BV (3 of 4 required): homogeneous discharge, pH >4.5, clue cells on wet mount, positive whiff test",
        "Clue cell = vaginal epithelial cell studded/coated with G. vaginalis coccobacilli — shaggy, stippled border",
        "Whiff test: 10% KOH added to discharge → fishy odor from volatilised amines = POSITIVE in BV",
        "Trichomoniasis: ONLY sexually transmitted vaginitis — causes strawberry cervix",
        "Nugent score: Gram stain scoring of vaginal flora (0-10); ≥7 = BV",
    ])
    story += gtk_box([
        "Trichomoniasis in pregnancy → premature rupture of membranes + preterm birth",
        "BV in pregnancy → associated with premature labour and postpartum endometritis",
        "BV increases susceptibility to HIV by disrupting mucosal barrier",
        "T. vaginalis is the most prevalent non-viral STI worldwide (~3.7 million in US alone)",
        "Only 30% of T. vaginalis infected people develop symptoms — most are asymptomatic carriers",
        "Candida is NOT an STI — it is a disruption of normal flora; triggered by antibiotics, diabetes, pregnancy, immunosuppression",
    ])
    story += concept_box(
        "Normal vaginal pH <4.5 is maintained by Lactobacillus which produces lactic acid and H2O2. In BV, a "
        "POLYMICROBIAL DYSBIOSIS occurs — not an infection by a single new pathogen. Lactobacillus is depleted, "
        "anaerobes overgrow, pH rises, and amines (putrescine, cadaverine) produced by anaerobes give the fishy smell. "
        "KOH volatilises these amines, making the whiff test positive. Clue cells represent G. vaginalis adherence "
        "to epithelial surface via fimbriae, masking the normal cell border."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 2 - Bacterial Vaginosis
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("2. BACTERIAL VAGINOSIS (BV) — In Detail", bg=MID_BLUE)
    story.append(Paragraph(
        "BV is the most common vaginal condition in women of reproductive age. It is a <b>polymicrobial dysbiosis</b>, "
        "not a classical infection. The dominant feature is uncomfortable vaginal discharge with a 'fishy' odor.", body_style))
    story += must_box([
        "Causative organisms: Gardnerella vaginalis (primary) + Mobiluncus, Prevotella, Peptostreptococcus (anaerobes)",
        "Gram stain: Clue cells = epithelial cells coated with gram-variable coccobacilli",
        "Whiff test (Amine test): 10% KOH to discharge → fishy odor POSITIVE",
        "Amsel criteria: 3 of 4 — (i) homogeneous discharge, (ii) pH >4.5, (iii) clue cells, (iv) +ve whiff",
        "Nugent score: 0–3 normal; 4–6 intermediate; 7–10 = BV",
        "Treatment: Metronidazole 500 mg BD x 7 days (oral) OR metronidazole vaginal gel 0.75%",
    ])
    story += gtk_box([
        "BV + pregnancy → premature labour, PPROM, postpartum endometritis",
        "BV increases risk of acquiring gonorrhea, chlamydia, HIV",
        "G. vaginalis forms a dense BIOFILM on vaginal epithelium — this explains high recurrence rates (50% in 1 year)",
        "Attachment of N. gonorrhoeae to cervix is ENHANCED by enzymes from BV microbiota (unmasks receptor)",
        "Recurrent BV: consider treatment of partner, prolonged metronidazole, boric acid suppositories",
    ])
    story += concept_box(
        "Why does BV smell fishy? Anaerobic bacteria in BV metabolise proteins to produce AMINES (putrescine, "
        "cadaverine, trimethylamine). These amines are non-volatile at normal vaginal pH but become volatile (gaseous) "
        "when KOH raises the pH — this is the basis of the WHIFF TEST. The 'clue cell' is formed when G. vaginalis "
        "adheres so densely to the epithelial surface that the cell's sharp, clear border is completely obscured by "
        "the bacterial coating — giving it a 'stippled' or 'shaggy' appearance on wet mount."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 3 - Cervicitis
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("3. CERVICITIS", bg=DARK_BLUE)
    story.append(Paragraph(
        "Cervicitis is inflammation of the cervix. It is the <b>gateway infection to PID</b>. The two most important "
        "causative organisms are <b>Neisseria gonorrhoeae</b> and <b>Chlamydia trachomatis</b>.", body_style))
    story += must_box([
        "Primary causes: Chlamydia trachomatis (most common) + Neisseria gonorrhoeae",
        "Emerging cause: Mycoplasma genitalium (up to 30% recurrent cervicitis/urethritis in males)",
        "Symptoms: mucopurulent discharge, intermenstrual bleeding, pelvic pain, dyspareunia",
        "Gold Standard Diagnosis: NAAT (Nucleic Acid Amplification Test) — on genital swab or urine",
        "Gonococcal cervicitis Gram stain: intracellular gram-negative diplococci INSIDE neutrophils",
        "Most important complication: Pelvic Inflammatory Disease (PID) → infertility, ectopic pregnancy",
    ])
    story += gtk_box([
        "MOST cervicitis is asymptomatic: Only 6% of Chlamydia-infected females and 14% with gonorrhea have signs",
        "Gonorrhea and Chlamydia co-infection is common — always treat BOTH simultaneously (dual therapy)",
        "Disseminated gonococcal infection (DGI): septic arthritis (knees), tenosynovitis, fever, vesicular skin lesions",
        "Fitz-Hugh-Curtis syndrome: perihepatitis from Chlamydia/GC spreading to perihepatic capsule → RUQ pain",
        "Chlamydia is the MOST COMMON bacterial STI worldwide",
        "Culture: needed for GC antibiotic sensitivity testing; less sensitive than NAAT; takes ~48 hours",
    ])
    story += concept_box(
        "GONOCOCCAL PID spreads upward along mucosal surfaces (cervix → endocervix → fallopian tubes), causing "
        "ACUTE SUPPURATIVE SALPINGITIS with neutrophil infiltration and pus filling the tube. The endometrium is "
        "characteristically SPARED in gonorrhea (reason unclear). NON-GONOCOCCAL (Chlamydial) PID spreads through "
        "lymphatics/venous channels — causing deeper tissue inflammation. This explains why chlamydial PID tends to "
        "cause more silent scarring and tubal factor infertility despite fewer acute symptoms."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 4 - Bartholinitis
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("4. BARTHOLINITIS (Bartholin Gland Infection / Abscess)", bg=DARK_BLUE)
    story.append(Paragraph(
        "Bartholin glands are paired mucus-secreting glands located at the <b>4 o'clock and 8 o'clock</b> positions "
        "at the vaginal introitus. They lubricate the vagina during intercourse. Blockage of the duct → cyst; "
        "infection of a cyst or gland → abscess.", body_style))
    story += must_box([
        "Location: 4 o'clock and 8 o'clock at the vaginal introitus (posterior labia minora)",
        "Organisms: POLYMICROBIAL — E. coli, Staphylococcus, Streptococci; also N. gonorrhoeae, C. trachomatis",
        "Presentation: Unilateral painful vulvar swelling, fluctuant mass, erythema, difficulty walking/sitting",
        "Bartholin cyst = duct obstruction (no infection) → painless or mildly painful",
        "Bartholin abscess = infected cyst → severely painful, fever, tender",
        "Treatment: Abscess → I&D + Word catheter (for drainage and epithelialisation)",
        "Recurrent: Marsupialization (surgical creation of permanent opening)",
        "Women >40 with 'recurrent bartholinitis': ALWAYS BIOPSY to exclude Bartholin gland carcinoma",
    ])
    story += gtk_box([
        "Word catheter: small balloon catheter placed in the abscess cavity; kept in place for 4–6 weeks to allow "
        "new epithelialised tract to form, preventing reaccumulation",
        "Marsupialization: suturing the walls of the cyst to the labial skin to create a permanent drainage opening",
        "Bartholin gland carcinoma: rare; most common initial symptom = vulvar mass or perineal pain; "
        "10% have history of prior Bartholin gland inflammation",
        "Bartholin abscess is one of the most common vulvar emergencies in gynecology OPD",
    ])
    story += concept_box(
        "The Bartholin gland drains via a 2 cm duct that opens just lateral to the hymen. When this duct is blocked "
        "(by mucus plug, inflammation, squamous cell proliferation), secretions accumulate forming a CYST. Bacterial "
        "superinfection — most commonly by gut/skin flora (E. coli, Staphylococcus) or STI pathogens — converts it to "
        "a painful ABSCESS. The gland sits in loose areolar tissue with a rich vascular supply, allowing rapid spread. "
        "Word catheter drainage + epithelialisation creates a new permanent channel, preventing recurrence."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 5 - Genital Warts (HPV)
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("5. GENITAL WARTS (Condyloma Acuminata) — HPV", bg=colors.HexColor("#7d3c98"))
    story.append(Paragraph(
        "Condyloma acuminata are benign genital warts caused by low-risk HPV types. HPV is the "
        "<b>most common STI globally</b>. The same virus family causes both benign warts (low-risk HPV) "
        "and cervical cancer (high-risk HPV).", body_style))

    # Images side by side
    img_w1 = fetch_img(IMG_WARTS, max_w=7.5*cm, max_h=6*cm)
    img_w2 = fetch_img(IMG_WARTS2, max_w=7.5*cm, max_h=6*cm)
    if img_w1 and img_w2:
        img_row = Table([[img_w1, img_w2]], colWidths=[8*cm, 8.5*cm])
        img_row.setStyle(TableStyle([("ALIGN", (0,0), (-1,-1), "CENTER")]))
        story.append(img_row)
        story.append(Paragraph(
            "Left: Extensive cauliflower-like vulvar condyloma acuminata. "
            "Right: Penile shaft genital warts — raised, flesh-colored papules (HPV 6/11).",
            caption_style))
        story.append(Spacer(1, 3*mm))

    story += must_box([
        "Cause: HPV types 6 and 11 (LOW-RISK — cause warts, NOT cancer)",
        "HIGH-RISK HPV types: 16, 18, 31, 33 → cervical dysplasia (CIN) → cervical cancer",
        "Appearance: Fleshy, exophytic, CAULIFLOWER-LIKE verrucous papules on genitals, perineum, perianal",
        "Histology KEY FINDING: KOILOCYTES = epithelial cells with pyknotic/raisinoid nuclei + perinuclear clear halo",
        "Vertical transmission: HPV passed during delivery → LARYNGEAL PAPILLOMATOSIS in newborn",
        "Diagnosis: Clinical appearance; Pap smear + colposcopy for cervical HPV",
        "Aceto-white test: 5% acetic acid turns HPV lesions white on colposcopy",
        "Treatment: Podophyllin, Podophyllotoxin, Imiquimod, TCA, Cryotherapy, Laser, Surgery",
        "Prevention: Gardasil-9 vaccine (HPV 6, 11, 16, 18, 31, 33, 45, 52, 58)",
    ])
    story += gtk_box([
        "Condylomata ACUMINATA (pointed warts) vs Condylomata LATA of secondary syphilis (FLAT, broad-based warts)",
        "HPV 16/18 integration into host genome → inactivates p53 AND Rb tumour suppressors → malignant transformation",
        "Cervical cancer: HPV is responsible for ~99.7% of all cases — it is the most preventable cancer via vaccination",
        "Recurrence of warts is common as HPV persists latently in basal keratinocytes",
        "Immunosuppression (HIV, transplant): warts are larger, more extensive, respond poorly to treatment",
    ])
    story += concept_box(
        "HPV infects the BASAL LAYER of stratified squamous epithelium through micro-abrasions during sexual contact. "
        "LOW-RISK HPV types (6/11) remain EPISOMAL (circular DNA outside nucleus) and cause proliferative but benign "
        "warts — they produce proteins that stimulate epithelial growth without genome integration. HIGH-RISK types "
        "(16/18) can INTEGRATE into host genome, causing production of viral oncoproteins E6 (degrades p53) and "
        "E7 (inactivates Rb retinoblastoma protein). Loss of these tumour suppressors removes normal cell cycle "
        "checkpoints → uncontrolled proliferation → dysplasia → invasive carcinoma. Koilocytes represent the "
        "cytopathic effect of HPV: viral proteins disrupt keratin filaments and cause perinuclear vacuolisation."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 6 - Molluscum Contagiosum
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("6. MOLLUSCUM CONTAGIOSUM", bg=colors.HexColor("#1a6644"))
    story.append(Paragraph(
        "Molluscum contagiosum is a <b>poxvirus infection</b> causing characteristic pearly, dome-shaped papules "
        "with central umbilication. The appearance is pathognomonic.", body_style))

    img_m1 = fetch_img(IMG_MOL, max_w=7.5*cm, max_h=5.5*cm)
    img_m2 = fetch_img(IMG_MOL2, max_w=7.5*cm, max_h=5.5*cm)
    if img_m1 and img_m2:
        img_row = Table([[img_m1, img_m2]], colWidths=[8*cm, 8.5*cm])
        img_row.setStyle(TableStyle([("ALIGN", (0,0), (-1,-1), "CENTER")]))
        story.append(img_row)
        story.append(Paragraph(
            "Classic molluscum contagiosum: multiple dome-shaped, flesh-colored papules with central umbilication (dimple). "
            "Right: lesions on forearm with surrounding dermatitis from secondary irritation.",
            caption_style))
        story.append(Spacer(1, 3*mm))

    story += must_box([
        "Cause: Molluscum Contagiosum Virus (MCV) — a POXVIRUS (large DNA virus)",
        "4 types: MCV-1 (most common overall), MCV-2 (most commonly sexually transmitted)",
        "Appearance: Pearly, dome-shaped papules (1–5 mm), with CENTRAL UMBILICATION (dimple) — PATHOGNOMONIC",
        "Histology: HENDERSON-PATTERSON BODIES = large eosinophilic intracytoplasmic inclusions in keratinocytes",
        "Incubation period: ~6 weeks (range 2 weeks – 6 months)",
        "Transmission — Children: direct contact / fomites (towels); Adults: sexual transmission",
        "Location — Children: trunk, arms, legs; Adults (STI): genitals, lower abdomen, inner thighs, buttocks",
        "Self-limiting: resolves in 6–12 months in immunocompetent patients",
        "Diagnosis: CLINICAL (characteristic appearance alone is diagnostic)",
    ])
    story += gtk_box([
        "HIV/Immunosuppressed patients: lesions are GIANT (>1 cm), numerous (>100), persistent, atypical — especially face",
        "Treatment when needed: curettage, cryotherapy, cantharidin (vesicant), imiquimod, laser ablation",
        "Differential: verruca vulgaris (HPV warts — rough, no umbilication), milia (no umbilication), folliculitis",
        "Molluscum is NOT a notifiable STI in most countries, but is classified as an STI in adults",
        "The 'waxy core' can be expressed from the central dimple — contains Henderson-Patterson body-laden cells",
    ])
    story += concept_box(
        "The characteristic CENTRAL UMBILICATION (dimple) in molluscum is caused by massive accumulation of "
        "HENDERSON-PATTERSON BODIES (intracytoplasmic poxvirus inclusion bodies) inside keratinocytes. These "
        "inclusions become so large they displace the nucleus to the periphery, distend the cell, and eventually cause "
        "central epidermal breakdown — creating the visible dimple. In immunocompromised patients (HIV CD4 <100), "
        "the failure of T-cell-mediated immunity to recognise and destroy infected cells explains the uncontrolled "
        "viral proliferation, resulting in giant, disfiguring, confluent lesions."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 7 - NGU / Chlamydia
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("7. NON-GONOCOCCAL URETHRITIS (NGU) — Chlamydia trachomatis", bg=ACCENT_RED)
    story.append(Paragraph(
        "NGU is urethritis NOT caused by Neisseria gonorrhoeae. <b>Chlamydia trachomatis</b> is the most common "
        "bacterial STI worldwide and the leading cause of NGU. It is an <b>obligate intracellular pathogen</b> "
        "with a unique biphasic life cycle.", body_style))

    img_ch = fetch_img(IMG_CHLAM, max_w=13*cm, max_h=7*cm)
    if img_ch:
        story.append(KeepTogether([
            img_ch,
            Paragraph(
                "Chlamydia trachomatis biphasic developmental cycle: EB (Elementary Body) = infectious form; "
                "RB (Reticulate Body) = intracellular replicating form. EB → RB → new EBs → cell lysis/extrusion.",
                caption_style),
            Spacer(1, 3*mm)
        ]))

    story += must_box([
        "Most common cause of NGU: Chlamydia trachomatis (serovars D–K) — most common bacterial STI worldwide",
        "2nd cause: Mycoplasma genitalium (up to 30% recurrent NGU males)",
        "Other causes: Trichomonas vaginalis, Ureaplasma urealyticum, HSV; ~50% no pathogen found",
        "CHLAMYDIA LIFE CYCLE — MUST MEMORISE:",
        "  Elementary Body (EB): INFECTIOUS form, metabolically INERT, survives extracellularly, enters cell via receptor-mediated endocytosis",
        "  Reticulate Body (RB): NON-INFECTIOUS, metabolically ACTIVE, replicates using host cell energy (ATP parasite)",
        "  EB → RB (inside phagosome) → RB replicates (binary fission) → RB → EB (secondary differentiation) → cell lysis → new EBs released",
        "Obligate intracellular: CANNOT produce own ATP; uses host cell ribosomes and energy",
        "Tropism: Columnar epithelial cells (cervix, urethra, conjunctiva, fallopian tube, rectum)",
        "Gold Standard diagnosis: NAAT on genital swab or urine",
    ])
    story += gtk_box([
        "NEONATAL CHLAMYDIA (vertical transmission during vaginal delivery):",
        "  - Ophthalmia neonatorum (conjunctivitis) — most common; appears 5–14 days after birth",
        "  - Neonatal pneumonia — appears 4–12 weeks after birth; afebrile, staccato cough",
        "REACTIVE ARTHRITIS (Reiter's syndrome): Urethritis + Arthritis + Conjunctivitis ('Can't pee, can't see, can't climb a tree')",
        "Fitz-Hugh-Curtis syndrome: perihepatitis from C. trachomatis (or GC) spreading via peritoneum to liver capsule → RUQ pain",
        "LGV (Lymphogranuloma Venereum): caused by C. trachomatis serovars L1-3; causes genital ulcer + inguinal lymphadenopathy (buboes) + proctitis",
        "Chlamydia culture: requires live cell culture (McCoy cells); impractical for routine diagnosis",
        "Cannot be seen on standard Gram stain (unlike gonorrhea — hence 'NON-gonococcal')",
        "Giemsa stain or Immunofluorescence can demonstrate inclusion bodies in cell culture",
        "Treatment: Doxycycline 100 mg BD x 7 days OR Azithromycin 1 g single dose; treat partner concurrently",
    ])
    story += concept_box(
        "Chlamydia is classified as an OBLIGATE INTRACELLULAR pathogen because it cannot synthesise its own ATP — "
        "it is an 'energy parasite' that hijacks the host cell's mitochondrial ATP. The EB is the 'survival capsule' — "
        "small, dense, metabolically inert (like a spore), able to survive in the extracellular environment long enough "
        "for transmission. Once inside a host columnar epithelial cell (via receptor-mediated endocytosis), it escapes "
        "lysosomal fusion (a key virulence mechanism) and differentiates into the RB. The RB is large, metabolically "
        "active, replicates by binary fission, and uses the host's ribosomes and energy. After ~24-72 hours, RBs "
        "re-condense back into EBs, which burst out of the cell (lysis) or are extruded, infecting new cells. "
        "This entire cycle takes place within a PHAGOSOME/INCLUSION VESICLE visible on Giemsa as dark inclusion bodies."
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 8 - Comparative Lab Table
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("8. COMPARATIVE LABORATORY DIAGNOSIS", bg=DARK_BLUE)
    story += data_table(
        ["Disease", "Organism", "Key Smear/Lab Finding", "Preferred Test", "Treatment"],
        [
            ["BV", "G. vaginalis + anaerobes", "Clue cells; pH >4.5; Whiff +ve", "Wet mount + Amsel/Nugent criteria", "Metronidazole"],
            ["Candida vaginitis", "Candida albicans", "Pseudohyphae + budding yeast on KOH", "KOH mount / Pap smear / Culture", "Fluconazole / Clotrimazole"],
            ["Trichomoniasis", "T. vaginalis", "Motile pear-shaped flagellated protozoa on wet mount", "Wet mount (immediate!); NAAT", "Metronidazole"],
            ["GC Cervicitis/Urethritis", "N. gonorrhoeae", "Intracellular Gram-neg diplococci in PMNs", "NAAT (gold standard); Culture for sensitivity", "Ceftriaxone + Azithromycin"],
            ["NGU/Cervicitis", "C. trachomatis", "Inclusion bodies (Giemsa, IF); NAAT positive", "NAAT on swab or urine", "Doxycycline / Azithromycin"],
            ["Genital Warts", "HPV 6/11", "Koilocytes on biopsy/Pap smear", "Clinical; Colposcopy + aceto-white", "Podophyllin, Imiquimod, Cryotherapy"],
            ["Molluscum Contagiosum", "Poxvirus MCV", "Henderson-Patterson bodies on histology", "Clinical (umbilicated papule)", "Curettage, Cryotherapy, Cantharidin"],
            ["Bartholinitis/Abscess", "Polymicrobial", "Pus culture (mixed flora, GC/Chlamydia)", "Clinical + culture of pus", "I&D + Word catheter; Marsupialization"],
        ],
        col_widths=[3*cm, 3.5*cm, 4*cm, 3.5*cm, 2.5*cm]
    )
    story.append(PageBreak())

    # ═══════════════════════════════════════════════════════════════════════════
    # SECTION 9 - Memory Aids
    # ═══════════════════════════════════════════════════════════════════════════
    story += banner("9. MEMORY AIDS & QUICK REVIEW", bg=GOLD)
    mem_data = [
        ["BV Diagnosis",
         "CLUE cells + FISHY smell + GRAY discharge + pH >4.5 = BV\nAmsel 3/4: discharge + pH>4.5 + clue cells + whiff+"],
        ["Chlamydia lifecycle",
         "EB = Extracellular, Enters cell (infectious, inert)\nRB = Replicates inside (non-infectious, active)"],
        ["Molluscum",
         "Pearly + DIMPLE + Pox virus = Henderson-Patterson bodies\nMCV-1 most common; MCV-2 = sexually transmitted"],
        ["NGU causes rank",
         "Chlamydia #1 → Mycoplasma #2 → Trichomonas #3 → Ureaplasma #4 → ~50% unknown"],
        ["Reactive arthritis",
         "'Can't see (conjunctivitis) + Can't pee (urethritis) + Can't climb a tree (arthritis)'"],
        ["HPV types",
         "6, 11 = Warts (benign, episomal DNA)\n16, 18 = Cancer (integrate genome, inactivate p53 + Rb)"],
        ["Bartholin anatomy",
         "4 o'clock and 8 o'clock positions at vaginal introitus\nWord catheter → Marsupialization → Excision (if >40: biopsy)"],
        ["Strawberry cervix",
         "Trichomonas vaginalis — dilated mucosal vessels → red spots on colposcopy"],
        ["Vertical Chlamydia",
         "Mother → baby during birth: Ophthalmia neonatorum (5-14 days) then Pneumonia (4-12 wks)"],
        ["Neonatal conjunctivitis",
         "Chlamydia: appears days 5-14; Gonorrhea: appears days 2-5 (earlier) — both treated with antibiotics"],
    ]
    for row in mem_data:
        t = Table([[
            Paragraph(row[0], S("mk", fontSize=9, fontName="Helvetica-Bold", textColor=DARK_BLUE, leading=12)),
            Paragraph(row[1].replace("\n", "<br/>"), S("mv", fontSize=9, fontName="Helvetica", textColor=BLACK, leading=13))
        ]], colWidths=[4*cm, 12.5*cm])
        t.setStyle(TableStyle([
            ("BACKGROUND",  (0,0), (0,0), LIGHT_BLUE),
            ("BACKGROUND",  (1,0), (1,0), WHITE),
            ("BOX",         (0,0), (-1,-1), 0.5, colors.HexColor("#aaaaaa")),
            ("TOPPADDING",  (0,0), (-1,-1), 5),
            ("BOTTOMPADDING",(0,0),(-1,-1), 5),
            ("LEFTPADDING", (0,0), (-1,-1), 6),
        ]))
        story.append(t)
        story.append(Spacer(1, 1.5*mm))

    story.append(Spacer(1, 8*mm))
    story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
    story.append(Spacer(1, 3*mm))
    story.append(Paragraph(
        "Sources: Sherris & Ryan's Medical Microbiology 8e | Robbins & Kumar Basic Pathology | "
        "Robbins Cotran & Kumar Pathologic Basis of Disease | Tietz Textbook of Laboratory Medicine 7e | "
        "Goldman-Cecil Medicine | Harrison's Principles of Internal Medicine 22e",
        source_style))

    doc.build(story)
    print(f"PDF created: {OUTPUT}")

if __name__ == "__main__":
    build()
Running Command

cd /tmp/workspace/genital-tract-infections && python3 build_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/genital-tract-infections/Genital_Tract_Infections_Apurba_Sastri.pdf

Your PDF is ready (525 KB, 9 sections, fully illustrated):

Genital Tract Infections Apurba Sastri

PDF Document · PDF

What's inside the PDF:
SectionContent
Cover pageTopic list + all 7 subjects covered
Overview tableAll pathogens, diseases, categories
1. VaginitisBV vs Candida vs Trichomonas comparison table + BV/clue cells photo
2. Bacterial VaginosisAmsel criteria, Nugent score, whiff test, biofilm concept
3. CervicitisGC vs Chlamydia, NAAT, PID pathway
4. BartholinitisAnatomy, Word catheter, marsupialization, carcinoma
5. Genital Warts (HPV)Two clinical photos of condyloma + koilocytes, HPV types, vaccine
6. Molluscum ContagiosumTwo photos of dome-shaped papules + Henderson-Patterson bodies
7. NGU / ChlamydiaLife cycle diagram photo (EB → RB → EB) + neonatal, LGV, reactive arthritis
8. Lab Diagnosis TableAll 8 conditions: organism, smear finding, test, treatment
9. Memory Aids10 mnemonics + quick recall boxes
Every section has colour-coded Must Know, Good to Know, and Understanding the Concept boxes.

make pdf with the above same format

Let me first read the PDF skill and then extract the content from the uploaded PDF.
Reading File
Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages[:5]): print(f'\\n===PAGE {i+1}===') print(page.extract_text()[:1500] if page.extract_text() else '[no text]') "

Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: for i, page in enumerate(pdf.pages): txt = page.extract_text() if txt and len(txt.strip()) > 20: print(f'\\n===PAGE {i+1}===') print(txt[:2000]) " 2>&1 | head -400

Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: for i, page in enumerate(pdf.pages[32:]): txt = page.extract_text() if txt and len(txt.strip()) > 20: print(f'\\n===PAGE {i+33}===') print(txt[:2000]) " 2>&1 | head -500

Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: for i, page in enumerate(pdf.pages[65:]): txt = page.extract_text() if txt and len(txt.strip()) > 20: print(f'\\n===PAGE {i+66}===') print(txt[:1800]) " 2>&1

I now have all the content. Let me search for relevant images and then build the PDF.
Searching Images

syphilis primary chancre painless ulcer

This medical visual contains a comparison of primary syphilis lesions (hard chancres) through graphic illustrations and clinical photographs. Panel A illustrates an early eroded hard chancre, characterized by a rounded shape with a smooth, sloping edge and a shallow, clean base. Below the illustration, a clinical photograph shows a corresponding single, well-defined erythematous ulcer on the shaft of a penis. Panel B illustrates a hard chancre with significant infiltration, depicted with an elevated, thickened, and indurated border that rises above the surrounding skin level. The corresponding clinical photograph shows a larger, raised, and firm-appearing lesion on the inner leaflet of the prepuce or coronal sulcus. These visuals are used to teach the morphological progression of Treponema pallidum infection, specifically the classical appearance of a painless, indurated genital ulcer. The educational focus is on the diagnostic distinction between simple erosion and infiltrated borders in syphilis presentations.

This medical visual contains a comparison of primary syphilis lesions (hard chancres) through graphic illustrations and clinical photographs. Panel A illustrates an early eroded hard chancre, characterized by a rounded shape with a smooth, sloping edge and a shallow, clean base. Below the illustration, a clinical photograph shows a corresponding single, well-defined erythematous ulcer on the shaft of a penis. Panel B illustrates a hard chancre with significant infiltration, depicted with an elevated, thickened, and indurated border that rises above the surrounding skin level. The corresponding clinical photograph shows a larger, raised, and firm-appearing lesion on the inner leaflet of the prepuce or coronal sulcus. These visuals are used to teach the morphological progression of Treponema pallidum infection, specifically the classical appearance of a painless, indurated genital ulcer. The educational focus is on the diagnostic distinction between simple erosion and infiltrated borders in syphilis presentations.

Clinical photograph consisting of two panels (A and B) showing primary syphilis manifestations (hard chancres) in the male genital region. Panel A displays a single, well-defined, round ulcer on the scrotal skin. The lesion features a characteristic 'clear' reddish base and smooth sloping edges. The surrounding scrotal and penile skin also exhibits depigmented patches consistent with comorbid vitiligo. Panel B shows a larger, cupuliform lesion located on the pubis near the base of the penis. This lesion demonstrates significant induration (infiltration) at the base, resulting in a raised, crater-like morphology. These visuals serve as educational examples of Treponema pallidum infection sites, highlighting the classic morphology of the hard chancre: a generally painless, indurated ulcer with a clean base. The clinical context notes that such primary syphilitic lesions are often accompanied by regional lymphadenopathy, representing the initial stage of systemic infection.

Clinical photograph consisting of two panels (A and B) showing primary syphilis manifestations (hard chancres) in the male genital region. Panel A displays a single, well-defined, round ulcer on the scrotal skin. The lesion features a characteristic 'clear' reddish base and smooth sloping edges. The surrounding scrotal and penile skin also exhibits depigmented patches consistent with comorbid vitiligo. Panel B shows a larger, cupuliform lesion located on the pubis near the base of the penis. This lesion demonstrates significant induration (infiltration) at the base, resulting in a raised, crater-like morphology. These visuals serve as educational examples of Treponema pallidum infection sites, highlighting the classic morphology of the hard chancre: a generally painless, indurated ulcer with a clean base. The clinical context notes that such primary syphilitic lesions are often accompanied by regional lymphadenopathy, representing the initial stage of systemic infection.

Searching Images

syphilis secondary maculopapular rash palms soles

Clinical photograph showing a maculopapular rash involving the palms and soles, a hallmark presentation of secondary syphilis. The upper panel displays the bilateral palms with scattered, small (approx. 2-5 mm), well-demarcated reddish-brown macules and papules, primarily concentrated on the thenar and hypothenar eminences. The lower panel shows the plantar and lateral surfaces of a foot, featuring numerous similar hyperpigmented, erythematous lesions with a fairly even distribution across the sole and extending toward the heel and malleolar region. This classic palmoplantar distribution is a key diagnostic indicator for Treponema pallidum infection, often referred to as 'syphilitic roseola' or copper-colored spots. These lesions are typically non-pruritic but occur during the disseminated stage of the disease, often accompanied by systemic symptoms such as lymphadenopathy or jaundice, as suggested by the patient's associated laboratory findings of transaminitis and reactive RPR/FTA-ABS tests.

Clinical photograph showing a maculopapular rash involving the palms and soles, a hallmark presentation of secondary syphilis. The upper panel displays the bilateral palms with scattered, small (approx. 2-5 mm), well-demarcated reddish-brown macules and papules, primarily concentrated on the thenar and hypothenar eminences. The lower panel shows the plantar and lateral surfaces of a foot, featuring numerous similar hyperpigmented, erythematous lesions with a fairly even distribution across the sole and extending toward the heel and malleolar region. This classic palmoplantar distribution is a key diagnostic indicator for Treponema pallidum infection, often referred to as 'syphilitic roseola' or copper-colored spots. These lesions are typically non-pruritic but occur during the disseminated stage of the disease, often accompanied by systemic symptoms such as lymphadenopathy or jaundice, as suggested by the patient's associated laboratory findings of transaminitis and reactive RPR/FTA-ABS tests.

A clinical photograph series illustrating dermatological manifestations of secondary syphilis across three anatomical regions. Panel A shows the posterior trunk displaying a diffuse, symmetric, erythematous maculopapular rash. Panel B and C depict the bilateral palms and soles, respectively, featuring characteristic well-demarcated, rounded, erythematous to reddish-brown macules and papules. Some acral lesions exhibit subtle peripheral scaling, consistent with Biett's collarette. This classic 'copper-colored' rash distribution, specifically involving the palms and soles, is a pathognomonic clinical sign for secondary syphilis. The presentation highlights the generalized nature of the Treponema pallidum infection during the disseminated stage. This visual resource is intended for medical education regarding sexually transmitted infections and differential diagnosis of palmoplantar eruptions.

A clinical photograph series illustrating dermatological manifestations of secondary syphilis across three anatomical regions. Panel A shows the posterior trunk displaying a diffuse, symmetric, erythematous maculopapular rash. Panel B and C depict the bilateral palms and soles, respectively, featuring characteristic well-demarcated, rounded, erythematous to reddish-brown macules and papules. Some acral lesions exhibit subtle peripheral scaling, consistent with Biett's collarette. This classic 'copper-colored' rash distribution, specifically involving the palms and soles, is a pathognomonic clinical sign for secondary syphilis. The presentation highlights the generalized nature of the Treponema pallidum infection during the disseminated stage. This visual resource is intended for medical education regarding sexually transmitted infections and differential diagnosis of palmoplantar eruptions.

Searching Images

Treponema pallidum dark field microscopy spirochete

This histology image depicts a lymph node section stained with Steiner silver stain, visualizing Treponema pallidum organisms within the node. Light microscopy reveals numerous dark, corkscrew-shaped spirochetes aligned along walls of capsular vessels and scattered through the interstitial stroma, consistent with syphilitic lymphadenitis. The tissue architecture shows preserved lymphoid elements with areas of mild follicular hyperplasia and perivascular inflammation, overlaid by slender, hyaline backgrounds produced by the stain. Steiner silver staining yields high-contrast, fine filaments that stand out against the pale counterstain, enabling direct visualization of spirochetes in situ. Although histology can be variable in syphilis, the detection of multiple organisms strongly supports infection and guides confirmation with serology. This image exemplifies the complementary roles of histopathology, immunohistochemistry, and molecular methods (PCR on lymph node biopsy or fine-needle aspirate) in diagnosing syphilitic lymphadenitis. Clinically, the diagnosis is most reliably established by serologic tests (treponemal and non-treponemal assays) alongside clinical context and patient history. The image is part of the CDC educational collection (Skip Van Orden), serving as a teaching resource for infectious disease pathology, dermatopathology, and surgical pathology workflows in recognizing T. pallidum. This description emphasizes spirochete visualization as a diagnostic clue.

This histology image depicts a lymph node section stained with Steiner silver stain, visualizing Treponema pallidum organisms within the node. Light microscopy reveals numerous dark, corkscrew-shaped spirochetes aligned along walls of capsular vessels and scattered through the interstitial stroma, consistent with syphilitic lymphadenitis. The tissue architecture shows preserved lymphoid elements with areas of mild follicular hyperplasia and perivascular inflammation, overlaid by slender, hyaline backgrounds produced by the stain. Steiner silver staining yields high-contrast, fine filaments that stand out against the pale counterstain, enabling direct visualization of spirochetes in situ. Although histology can be variable in syphilis, the detection of multiple organisms strongly supports infection and guides confirmation with serology. This image exemplifies the complementary roles of histopathology, immunohistochemistry, and molecular methods (PCR on lymph node biopsy or fine-needle aspirate) in diagnosing syphilitic lymphadenitis. Clinically, the diagnosis is most reliably established by serologic tests (treponemal and non-treponemal assays) alongside clinical context and patient history. The image is part of the CDC educational collection (Skip Van Orden), serving as a teaching resource for infectious disease pathology, dermatopathology, and surgical pathology workflows in recognizing T. pallidum. This description emphasizes spirochete visualization as a diagnostic clue.

This darkfield video microscopy time series (1000x magnification) illustrates the dynamic interaction between the spirochete Treponema pallidum and a human platelet over a period of 43.21 seconds. The imagery displays a single treponeme, characterized by its distinctive helical morphology, interacting with a fully activated, spread platelet. The sequence captures various behavioral states: at 1.68 s, a cyan curved arrow indicates coiling and vigorous axial rotation against the platelet membrane. In subsequent frames (15.15 s – 34.40 s), the spirochete is seen extending away from or above the platelet surface. The final frame at 43.21 s highlights tip-mediated adhesion, where green arrows point to both distal ends of the treponeme anchored to the platelet membrane. This visual evidence demonstrates the ability of T. pallidum to recognize and physically engage with activated components of the human hemostatic system. A 10 μm scale bar is provided for reference in the final frame.

This darkfield video microscopy time series (1000x magnification) illustrates the dynamic interaction between the spirochete Treponema pallidum and a human platelet over a period of 43.21 seconds. The imagery displays a single treponeme, characterized by its distinctive helical morphology, interacting with a fully activated, spread platelet. The sequence captures various behavioral states: at 1.68 s, a cyan curved arrow indicates coiling and vigorous axial rotation against the platelet membrane. In subsequent frames (15.15 s – 34.40 s), the spirochete is seen extending away from or above the platelet surface. The final frame at 43.21 s highlights tip-mediated adhesion, where green arrows point to both distal ends of the treponeme anchored to the platelet membrane. This visual evidence demonstrates the ability of T. pallidum to recognize and physically engage with activated components of the human hemostatic system. A 10 μm scale bar is provided for reference in the final frame.

Searching Images

chancroid soft chancre painful ulcer Haemophilus ducreyi

This clinical photograph displays two panels (A and B) illustrating the clinical manifestations of chancroid (Haemophilus ducreyi) in the male genital region. Panel A demonstrates a characteristic non-infiltrating primary ulcer located on the coronal sulcus and glans penis. The ulcer exhibits irregular, serpiginous, and undermined edges with a necrotic, 'dirty' base containing pyonecrotic exudate. Significant unilateral inflammatory inguinal lymphadenopathy (bubo) is visible as a prominent, erythematous swelling in the right groin area. Panel B illustrates the concept of reinoculation (autoinoculation), showing multiple smaller, satellite ulcers on the penile shaft. These lesions appear as superficial erosions that occur when the pathogen is spread from the primary site to adjacent skin. The images provide a comparison between primary infection with regional lymphatic involvement and the secondary spread of lesions. Key educational features include the morphology of soft chancre ulcers and the presentation of associated suppurative lymphadenitis characteristic of sexually transmitted infections (STIs).

This clinical photograph displays two panels (A and B) illustrating the clinical manifestations of chancroid (Haemophilus ducreyi) in the male genital region. Panel A demonstrates a characteristic non-infiltrating primary ulcer located on the coronal sulcus and glans penis. The ulcer exhibits irregular, serpiginous, and undermined edges with a necrotic, 'dirty' base containing pyonecrotic exudate. Significant unilateral inflammatory inguinal lymphadenopathy (bubo) is visible as a prominent, erythematous swelling in the right groin area. Panel B illustrates the concept of reinoculation (autoinoculation), showing multiple smaller, satellite ulcers on the penile shaft. These lesions appear as superficial erosions that occur when the pathogen is spread from the primary site to adjacent skin. The images provide a comparison between primary infection with regional lymphatic involvement and the secondary spread of lesions. Key educational features include the morphology of soft chancre ulcers and the presentation of associated suppurative lymphadenitis characteristic of sexually transmitted infections (STIs).

Imaging modality: Clinical photography of the external genitalia. The lesion is a solitary, superficial genital ulcer on perigenital skin with surrounding erythema and a moist, friable base. The ulcer margins are irregular and ragged, with partial undermining and shallow depth. Surrounding tissue appears inflamed and there may be mild edema; crust or exudate can be present at the lesion edge. No visible deep tissue involvement is evident in this surface photograph. The appearance is compatible with an infectious genital ulcer such as chancroid, though herpes simplex and other sexually transmitted infections can present with similar ulcerative lesions. This image emphasizes surface features rather than histology and should be interpreted in the clinical context, including sexual history and concurrent symptoms. Clinically, chancroid typically presents as a painful lesion with soft borders and exudate, often accompanied by tender inguinal lymphadenopathy; differential diagnosis includes syphilitic chancre (painless), genital herpes (painful vesicles), donovanosis, and LGV. The image is valuable for dermatology and infectious disease education, telemedicine assessments, and case-based learning. It aids recognition of external genital ulcers, informs preliminary diagnostic testing (PCR or culture for Haemophilus ducreyi), and supports empiric management decisions in suspected chancroid.

Imaging modality: Clinical photography of the external genitalia. The lesion is a solitary, superficial genital ulcer on perigenital skin with surrounding erythema and a moist, friable base. The ulcer margins are irregular and ragged, with partial undermining and shallow depth. Surrounding tissue appears inflamed and there may be mild edema; crust or exudate can be present at the lesion edge. No visible deep tissue involvement is evident in this surface photograph. The appearance is compatible with an infectious genital ulcer such as chancroid, though herpes simplex and other sexually transmitted infections can present with similar ulcerative lesions. This image emphasizes surface features rather than histology and should be interpreted in the clinical context, including sexual history and concurrent symptoms. Clinically, chancroid typically presents as a painful lesion with soft borders and exudate, often accompanied by tender inguinal lymphadenopathy; differential diagnosis includes syphilitic chancre (painless), genital herpes (painful vesicles), donovanosis, and LGV. The image is valuable for dermatology and infectious disease education, telemedicine assessments, and case-based learning. It aids recognition of external genital ulcers, informs preliminary diagnostic testing (PCR or culture for Haemophilus ducreyi), and supports empiric management decisions in suspected chancroid.

Searching Images

Donovan bodies granuloma inguinale Giemsa stain macrophages

Clinical photography of a solitary facial skin ulcer. The image represents an in vivo dermal lesion with a beefy red, well-circumscribed ulcer bordered by raised erythematous rims and a central shallow crater containing pink granulation tissue. The appearance is classic for granuloma inguinale (donovanosis), a sexually transmitted infection caused by Klebsiella granulomatis, characterized by exuberant granulation tissue and painless ulcers with indurated margins. Surrounding skin shows mild inflammation without extensive necrosis. While not confirming diagnosis, the lesion's morphology, regional prevalence, and lack of pain favor Donovanosis over chancroid or syphilis. Histopathology would reveal Donovan bodies within macrophages and granulomatous inflammation; differential diagnoses include chancroid, syphilitic chancre, tuberculous ulcer, cutaneous leishmaniasis, or malignant ulcers in older patients. Diagnostic workup may include tissue smear for Donovan bodies, PCR for Klebsiella granulomatis, and culture where available. Management relies on appropriate antibiotics and public health measures to prevent transmission. This image is valuable for dermatology and tropical medicine education, differential diagnosis practice, and clinical case discussions.

Clinical photography of a solitary facial skin ulcer. The image represents an in vivo dermal lesion with a beefy red, well-circumscribed ulcer bordered by raised erythematous rims and a central shallow crater containing pink granulation tissue. The appearance is classic for granuloma inguinale (donovanosis), a sexually transmitted infection caused by Klebsiella granulomatis, characterized by exuberant granulation tissue and painless ulcers with indurated margins. Surrounding skin shows mild inflammation without extensive necrosis. While not confirming diagnosis, the lesion's morphology, regional prevalence, and lack of pain favor Donovanosis over chancroid or syphilis. Histopathology would reveal Donovan bodies within macrophages and granulomatous inflammation; differential diagnoses include chancroid, syphilitic chancre, tuberculous ulcer, cutaneous leishmaniasis, or malignant ulcers in older patients. Diagnostic workup may include tissue smear for Donovan bodies, PCR for Klebsiella granulomatis, and culture where available. Management relies on appropriate antibiotics and public health measures to prevent transmission. This image is valuable for dermatology and tropical medicine education, differential diagnosis practice, and clinical case discussions.

Imaging modality: clinical photography. The primary subject is bilateral genital skin ulcers on the scrotum and adjacent penile base, captured in a close-up frontal view. This dermatologic image documents beefy-red, well-circumscribed ulcers with friable, granular bases and proliferative granulation tissue. The lesions show undermined, rolled edges with surrounding erythema and mild edema of the adjacent skin; there is crusting and shallow epidermal loss. The appearance is characteristic of granuloma inguinale (donovanosis) caused by Calymmatobacterium granulomatis (Klebsiella granulomatis). In clinical practice these ulcers are typically painless, slowly progressive, and bleed easily on contact. Histopathology would classically reveal granulomatous inflammation with Donovan bodies within macrophages on Wright-Giemsa or Giemsa-stained smears; PCR and culture can aid confirmation though culture is not routinely available. The diagnostic significance lies in recognizing a chronic, non-tender ulcerative genital lesion in at-risk populations, guiding antibiotic therapy such as doxycycline or azithromycin, and avoiding misdiagnosis as chancroid or syphilis. Differential diagnoses include chancroid, syphilitic chancre, lymphogranuloma venereum, tuberculous ulcers, and neoplastic processes. Clinically correlated findings include sexual history, regional prevalence, lesion distribution, and response to antimicrobial therapy. This image is suited for dermatology teaching, infectious disease reference, and accuracy-focused search indexing. This guide supports clinical decision making and education.

Imaging modality: clinical photography. The primary subject is bilateral genital skin ulcers on the scrotum and adjacent penile base, captured in a close-up frontal view. This dermatologic image documents beefy-red, well-circumscribed ulcers with friable, granular bases and proliferative granulation tissue. The lesions show undermined, rolled edges with surrounding erythema and mild edema of the adjacent skin; there is crusting and shallow epidermal loss. The appearance is characteristic of granuloma inguinale (donovanosis) caused by Calymmatobacterium granulomatis (Klebsiella granulomatis). In clinical practice these ulcers are typically painless, slowly progressive, and bleed easily on contact. Histopathology would classically reveal granulomatous inflammation with Donovan bodies within macrophages on Wright-Giemsa or Giemsa-stained smears; PCR and culture can aid confirmation though culture is not routinely available. The diagnostic significance lies in recognizing a chronic, non-tender ulcerative genital lesion in at-risk populations, guiding antibiotic therapy such as doxycycline or azithromycin, and avoiding misdiagnosis as chancroid or syphilis. Differential diagnoses include chancroid, syphilitic chancre, lymphogranuloma venereum, tuberculous ulcers, and neoplastic processes. Clinically correlated findings include sexual history, regional prevalence, lesion distribution, and response to antimicrobial therapy. This image is suited for dermatology teaching, infectious disease reference, and accuracy-focused search indexing. This guide supports clinical decision making and education.

Searching Images

VDRL RPR non-treponemal syphilis serology test flocculation

Clinical photograph of the neck showing a circumferential, necklace-like plaque around the posterior and lateral cervical region. The lesion exhibits well-defined borders with thick desquamating scales along the edge and mild erythema, producing a coppery-brown to tan coloration. This Casal necklace sign is a classic cutaneous manifestation described in secondary syphilis and should prompt serologic evaluation for syphilis (non-treponemal tests such as RPR or VDRL, followed by treponemal confirmation). The distribution is circumferential around the neck, forming a collar-like ring with subtle surface scale and no obvious purulence. Surrounding skin appears otherwise normal, and there is no visible edema or multi-lobar involvement; jewelry is present for scale but not implicated in the eruption. The image is a dermatology clinical photograph; no histopathology or contrast imaging is performed. Differential diagnoses include tinea corporis with neck involvement, pityriasis circinata et marginata, granuloma annulare, discoid eczema, and contact dermatitis from jewelry; however, the characteristic ringed, collarette scaling around the neck in this clinical setting strongly supports secondary syphilis. This finding has diagnostic significance for infectious disease and dermatology and emphasizes the need for comprehensive sexual health assessment and potential HIV testing. Clinical correlation with history and serology is essential for management and public health.

Clinical photograph of the neck showing a circumferential, necklace-like plaque around the posterior and lateral cervical region. The lesion exhibits well-defined borders with thick desquamating scales along the edge and mild erythema, producing a coppery-brown to tan coloration. This Casal necklace sign is a classic cutaneous manifestation described in secondary syphilis and should prompt serologic evaluation for syphilis (non-treponemal tests such as RPR or VDRL, followed by treponemal confirmation). The distribution is circumferential around the neck, forming a collar-like ring with subtle surface scale and no obvious purulence. Surrounding skin appears otherwise normal, and there is no visible edema or multi-lobar involvement; jewelry is present for scale but not implicated in the eruption. The image is a dermatology clinical photograph; no histopathology or contrast imaging is performed. Differential diagnoses include tinea corporis with neck involvement, pityriasis circinata et marginata, granuloma annulare, discoid eczema, and contact dermatitis from jewelry; however, the characteristic ringed, collarette scaling around the neck in this clinical setting strongly supports secondary syphilis. This finding has diagnostic significance for infectious disease and dermatology and emphasizes the need for comprehensive sexual health assessment and potential HIV testing. Clinical correlation with history and serology is essential for management and public health.

Summary : This figure compares two diagnostic algorithms for syphilis serologic testing: the traditional algorithm and the reverse sequence algorithm, outlining the stepwise decision-making process for each.

flowchart:
# Traditional Algorithm :
Nodes :
  • Nontreponemal (lipoidal antigen) serologic test Qualitative RPR or VDRL (rectangle)
  • Reactive Quantitate RPR or VDRL titer (rectangle)
  • Nonreactive (rectangle)
  • Treponemal serologic test (rectangle)
  • Reactive treponemal serologic test (rectangle)
  • Nonreactive treponemal serologic test (rectangle)
  • Previously treated or untreated syphilis (rectangle)
  • Syphilis is unlikely (rectangle)

Connectors :
  • Nontreponemal test splits into two branches: Reactive and Nonreactive.
  • Reactive branch leads to quantitation, then to treponemal serologic test.
  • Treponemal test splits into Reactive (leading to diagnosis of syphilis) and Nonreactive (syphilis is unlikely).
  • Nonreactive nontreponemal test leads directly to "Syphilis is unlikely".

Layout :
  • Linear top-down flow with a single major branch after the first test.

# Reverse Sequence Algorithm :
Nodes :
  • Treponemal serologic test (e.g., EIA or CIA) (rectangle)
  • Reactive treponemal serologic test (rectangle)
  • Nonreactive treponemal serologic test (rectangle)
  • Nontreponemal (lipoidal antigen) serologic test Quantitate RPR or VDRL titer (rectangle)
  • Reactive (rectangle)
  • Nonreactive (rectangle)
  • Previously treated or untreated syphilis (rectangle)
  • Reactive second treponemal serologic test (rectangle)
  • Nonreactive second treponemal serologic test (rectangle)
  • Syphilis is unlikely. If patient is at risk for syphilis, repeat RPR or VDRL in several weeks. Prozone and biologic false positive should be ruled out. (rectangle)
  • Syphilis is unlikely (rectangle)

Connectors :
  • Treponemal test splits into Reactive and Nonreactive.
  • Reactive leads to nontreponemal test, which splits into Reactive (syphilis diagnosis) and Nonreactive.
  • Nonreactive nontreponemal test leads to a second treponemal test, which splits into Reactive (syphilis diagnosis) and Nonreactive (syphilis unlikely, with further recommendations).
  • Nonreactive initial treponemal test leads directly to "Syphilis is unlikely".

Layout :
  • Top-down flow with multiple branches and a feedback loop for ambiguous results.

# Abbreviations :
  • CIA = chemiluminescence immunoassay
  • EIA = enzyme immunoassay
  • RPR = rapid plasma reagin
  • TPPA = Treponoma pallidum particle agglutination
  • VDRL = Venereal Disease Research Laboratory

# Analysis :
  • Both algorithms use a sequence of serologic tests to diagnose syphilis, but the order of treponemal and nontreponemal tests is reversed.
  • The traditional algorithm starts with a nontreponemal test, while the reverse sequence algorithm starts with a treponemal test.
  • Each algorithm includes steps to rule out syphilis or confirm diagnosis based on reactivity patterns, with additional recommendations for ambiguous or discordant results in the reverse sequence algorithm.
  • The reverse sequence algorithm includes a contingency for possible false positives and recommends repeat testing if clinical suspicion remains.

Summary : This figure compares two diagnostic algorithms for syphilis serologic testing: the traditional algorithm and the reverse sequence algorithm, outlining the stepwise decision-making process for each. flowchart: # Traditional Algorithm : Nodes : • Nontreponemal (lipoidal antigen) serologic test Qualitative RPR or VDRL (rectangle) • Reactive Quantitate RPR or VDRL titer (rectangle) • Nonreactive (rectangle) • Treponemal serologic test (rectangle) • Reactive treponemal serologic test (rectangle) • Nonreactive treponemal serologic test (rectangle) • Previously treated or untreated syphilis (rectangle) • Syphilis is unlikely (rectangle) Connectors : • Nontreponemal test splits into two branches: Reactive and Nonreactive. • Reactive branch leads to quantitation, then to treponemal serologic test. • Treponemal test splits into Reactive (leading to diagnosis of syphilis) and Nonreactive (syphilis is unlikely). • Nonreactive nontreponemal test leads directly to "Syphilis is unlikely". Layout : • Linear top-down flow with a single major branch after the first test. # Reverse Sequence Algorithm : Nodes : • Treponemal serologic test (e.g., EIA or CIA) (rectangle) • Reactive treponemal serologic test (rectangle) • Nonreactive treponemal serologic test (rectangle) • Nontreponemal (lipoidal antigen) serologic test Quantitate RPR or VDRL titer (rectangle) • Reactive (rectangle) • Nonreactive (rectangle) • Previously treated or untreated syphilis (rectangle) • Reactive second treponemal serologic test (rectangle) • Nonreactive second treponemal serologic test (rectangle) • Syphilis is unlikely. If patient is at risk for syphilis, repeat RPR or VDRL in several weeks. Prozone and biologic false positive should be ruled out. (rectangle) • Syphilis is unlikely (rectangle) Connectors : • Treponemal test splits into Reactive and Nonreactive. • Reactive leads to nontreponemal test, which splits into Reactive (syphilis diagnosis) and Nonreactive. • Nonreactive nontreponemal test leads to a second treponemal test, which splits into Reactive (syphilis diagnosis) and Nonreactive (syphilis unlikely, with further recommendations). • Nonreactive initial treponemal test leads directly to "Syphilis is unlikely". Layout : • Top-down flow with multiple branches and a feedback loop for ambiguous results. # Abbreviations : • CIA = chemiluminescence immunoassay • EIA = enzyme immunoassay • RPR = rapid plasma reagin • TPPA = Treponoma pallidum particle agglutination • VDRL = Venereal Disease Research Laboratory # Analysis : • Both algorithms use a sequence of serologic tests to diagnose syphilis, but the order of treponemal and nontreponemal tests is reversed. • The traditional algorithm starts with a nontreponemal test, while the reverse sequence algorithm starts with a treponemal test. • Each algorithm includes steps to rule out syphilis or confirm diagnosis based on reactivity patterns, with additional recommendations for ambiguous or discordant results in the reverse sequence algorithm. • The reverse sequence algorithm includes a contingency for possible false positives and recommends repeat testing if clinical suspicion remains.

I have all I need. Now let me build the full PDF:
Writing File

~/genital-tract-infections/build_stis_pdf.py


import requests, os
from io import BytesIO
from PIL import Image as PILImage

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    Image, HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import Flowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY

OUTPUT = "/tmp/workspace/genital-tract-infections/STIs_MBBS_Apurba_Sastri.pdf"

# ── colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a3a5c")
MID_BLUE    = colors.HexColor("#2563a8")
LIGHT_BLUE  = colors.HexColor("#dbeafe")
ACCENT_RED  = colors.HexColor("#c0392b")
GOLD        = colors.HexColor("#d4a017")
GREEN       = colors.HexColor("#1e8449")
LIGHT_GREEN = colors.HexColor("#d5f5e3")
PURPLE      = colors.HexColor("#6c3483")
LIGHT_GREY  = colors.HexColor("#f0f4f8")
WHITE       = colors.white
BLACK       = colors.HexColor("#1a1a1a")
TABLE_HEAD  = DARK_BLUE
TABLE_ALT   = colors.HexColor("#eaf0fb")
ORANGE      = colors.HexColor("#ca6f1e")

W, H = A4

# ── styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, parent=styles["Normal"], **kw)

title_style   = S("DocTitle",  fontSize=24, textColor=WHITE,      alignment=TA_CENTER, fontName="Helvetica-Bold", spaceAfter=4, leading=28)
sub_style     = S("DocSub",    fontSize=11, textColor=LIGHT_BLUE, alignment=TA_CENTER, fontName="Helvetica",      spaceAfter=2)
body_style    = S("Body",      fontSize=9.5, textColor=BLACK,     fontName="Helvetica",   spaceAfter=3, leading=14, alignment=TA_JUSTIFY)
bullet_style  = S("Bullet",    fontSize=9.5, textColor=BLACK,     fontName="Helvetica",   spaceAfter=2, leading=13, leftIndent=14, bulletIndent=4)
caption_style = S("Caption",   fontSize=7.5, textColor=colors.HexColor("#555555"), fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=4)
source_style  = S("Source",    fontSize=7.5, textColor=colors.HexColor("#777777"), fontName="Helvetica-Oblique", alignment=TA_CENTER)
must_hdr      = S("MustHdr",   fontSize=9,   textColor=colors.HexColor("#7b2000"), fontName="Helvetica-Bold", spaceAfter=2, leading=13)
gtk_hdr       = S("GtkHdr",    fontSize=9,   textColor=GREEN, fontName="Helvetica-Bold", spaceAfter=2, leading=13)
con_hdr       = S("ConHdr",    fontSize=9,   textColor=MID_BLUE, fontName="Helvetica-Bold", spaceAfter=2, leading=13)
note_style    = S("Note",      fontSize=9,   textColor=colors.HexColor("#1a5276"), fontName="Helvetica-Oblique", spaceAfter=2, leading=13)
mem_key       = S("MemKey",    fontSize=9,   textColor=DARK_BLUE, fontName="Helvetica-Bold", leading=12)
mem_val       = S("MemVal",    fontSize=9,   textColor=BLACK, fontName="Helvetica", leading=13)

# ── helpers ──────────────────────────────────────────────────────────────────
CACHE = "/tmp/workspace/genital-tract-infections/img_cache2"
os.makedirs(CACHE, exist_ok=True)

def fetch_img(url, max_w, max_h):
    fname = os.path.join(CACHE, url.split("/")[-1][:60] + ".jpg")
    if not os.path.exists(fname):
        try:
            r = requests.get(url, timeout=25)
            img = PILImage.open(BytesIO(r.content)).convert("RGB")
            img.save(fname, "JPEG", quality=85)
        except Exception as e:
            print(f"  [WARN] {url}: {e}")
            return None
    try:
        img = PILImage.open(fname)
        iw, ih = img.size
        scale = min(max_w/iw, max_h/ih, 1.0)
        return Image(fname, width=iw*scale, height=ih*scale)
    except:
        return None

class ColorBanner(Flowable):
    def __init__(self, text, bg=DARK_BLUE, text_color=WHITE, height=28, font_size=13):
        super().__init__()
        self.text, self.bg, self.text_color = text, bg, text_color
        self.height, self.font_size = height, font_size
        self.width = W - 4*cm
    def draw(self):
        self.canv.setFillColor(self.bg)
        self.canv.roundRect(0, 0, self.width, self.height, 6, fill=1, stroke=0)
        self.canv.setFillColor(self.text_color)
        self.canv.setFont("Helvetica-Bold", self.font_size)
        self.canv.drawString(10, 8, self.text)

def banner(text, bg=DARK_BLUE, font_size=13):
    return [Spacer(1,4*mm), ColorBanner(text, bg=bg, font_size=font_size), Spacer(1,3*mm)]

def colored_box(paragraphs, bg=LIGHT_BLUE, border=MID_BLUE):
    data = [[p] for p in paragraphs]
    t = Table(data, colWidths=[W-4*cm-10])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0),(-1,-1), bg),
        ("BOX",           (0,0),(-1,-1), 0.8, border),
        ("TOPPADDING",    (0,0),(-1,-1), 5),
        ("BOTTOMPADDING", (0,0),(-1,-1), 5),
        ("LEFTPADDING",   (0,0),(-1,-1), 8),
        ("RIGHTPADDING",  (0,0),(-1,-1), 8),
    ]))
    return [t, Spacer(1,3*mm)]

def must_box(items):
    paras = [Paragraph("<b>MUST KNOW</b>", must_hdr)] + [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=colors.HexColor("#fff5f5"), border=ACCENT_RED)

def gtk_box(items):
    paras = [Paragraph("<b>GOOD TO KNOW</b>", gtk_hdr)] + [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=LIGHT_GREEN, border=GREEN)

def concept_box(text):
    paras = [Paragraph("<b>UNDERSTANDING THE CONCEPT</b>", con_hdr), Paragraph(text, note_style)]
    return colored_box(paras, bg=colors.HexColor("#eaf4fb"), border=MID_BLUE)

def data_table(headers, rows, col_widths=None):
    if col_widths is None:
        col_widths = [(W-4*cm)/len(headers)]*len(headers)
    hdr_cells = [Paragraph(str(h), S(f"th{i}", fontSize=8, fontName="Helvetica-Bold", textColor=WHITE, leading=11)) for i,h in enumerate(headers)]
    data = [hdr_cells]
    for row in rows:
        data.append([Paragraph(str(c), S(f"td", fontSize=7.5, fontName="Helvetica", leading=11)) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0),(-1,0),  TABLE_HEAD),
        ("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, TABLE_ALT]),
        ("GRID",          (0,0),(-1,-1), 0.4, colors.HexColor("#bbbbbb")),
        ("TOPPADDING",    (0,0),(-1,-1), 4),
        ("BOTTOMPADDING", (0,0),(-1,-1), 4),
        ("LEFTPADDING",   (0,0),(-1,-1), 5),
        ("RIGHTPADDING",  (0,0),(-1,-1), 5),
        ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ]))
    return [t, Spacer(1,4*mm)]

def side_by_side(img1, cap1, img2, cap2):
    elems = []
    if img1 and img2:
        row = Table([[img1, img2]], colWidths=[8*cm, 8.5*cm])
        row.setStyle(TableStyle([("ALIGN",(0,0),(-1,-1),"CENTER")]))
        elems.append(row)
        elems.append(Paragraph(f"Left: {cap1}  |  Right: {cap2}", caption_style))
        elems.append(Spacer(1,3*mm))
    elif img1:
        elems.append(img1)
        elems.append(Paragraph(cap1, caption_style))
        elems.append(Spacer(1,3*mm))
    return elems

# ════════════════════════════════════════════════════════════════════════════
# IMAGE URLs
# ════════════════════════════════════════════════════════════════════════════
IMG_CHANCRE1   = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_32b31933e2b04be834a4476c626fdb28783aeb1c95ade888f05b3969755910a9.jpg"
IMG_CHANCRE2   = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_27ffa503437a3b17d37398c75d1500303ff0a95b098abd536409d9a8b6869aa5.jpg"
IMG_RASH1      = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_b414cdaa2de7cfb8c01eabc22bf097a2d18d6b1665d307dc5e0e7d22eae889cd.jpg"
IMG_RASH2      = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_2c0adc9332d9bcdba93c9f31b0eae1d3210c30ede89c838f41bdd86382cfec15.jpg"
IMG_TREPONEMA  = "https://cdn.orris.care/cdss_images/Pathology_1760048027458_338fee95-cf87-4bb4-b218-ece4813ab740.jpg"
IMG_VDRL       = "https://cdn.orris.care/cdss_images/GLGCA_3493578_1763906705003_b13faf2a-3f0e-4779-ba10-ec66c35e5325.png"
IMG_CHANCROID1 = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_df3f09a6a13e1c4f20e8a8f7c5f8354aa91f5b53124991b22887c758e992cf37.jpg"
IMG_CHANCROID2 = "https://cdn.orris.care/cdss_images/DermNetNZ_1760029706543_277a09f6-0bbe-4efd-a029-3562a9dd39f2.jpg"
IMG_DONOVAN1   = "https://cdn.orris.care/cdss_images/DermNetNZ_1760029751083_216e97e6-e198-4fb2-a7a9-10031d41a54e.jpg"
IMG_DONOVAN2   = "https://cdn.orris.care/cdss_images/DermNetNZ_1760029743144_b21771b5-a1ad-4c3a-9195-cfbf62885565.jpg"
IMG_CHLAM      = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_edfdac49febd0d5695812492031d93f3ff249227bf971234304df196a5d3e572.jpg"

# ════════════════════════════════════════════════════════════════════════════
# BUILD
# ════════════════════════════════════════════════════════════════════════════
def build():
    doc = SimpleDocTemplate(OUTPUT, pagesize=A4,
                            leftMargin=2*cm, rightMargin=2*cm,
                            topMargin=2*cm, bottomMargin=2*cm)
    story = []

    # ── COVER PAGE ──────────────────────────────────────────────────────────
    story.append(Spacer(1, 2.5*cm))
    title_block = Table([
        [Paragraph("SEXUALLY TRANSMITTED", title_style)],
        [Paragraph("INFECTIONS (STIs)", title_style)],
        [Spacer(1, 5*mm)],
        [Paragraph("Apurba Sastri Microbiology | MBBS Study Notes", sub_style)],
        [Paragraph("Must Know  •  Good to Know  •  Understanding Concepts", sub_style)],
    ], colWidths=[W-4*cm])
    title_block.setStyle(TableStyle([
        ("BACKGROUND",   (0,0),(-1,-1), DARK_BLUE),
        ("TOPPADDING",   (0,0),(-1,-1), 10),
        ("BOTTOMPADDING",(0,0),(-1,-1), 10),
        ("LEFTPADDING",  (0,0),(-1,-1), 15),
        ("RIGHTPADDING", (0,0),(-1,-1), 15),
    ]))
    story.append(title_block)
    story.append(Spacer(1, 8*mm))

    topics = [
        "1. Treponema pallidum — Syphilis (Morphology, Pathogenesis, Clinical Stages)",
        "2. Laboratory Diagnosis of Syphilis (VDRL, RPR, FTA-ABS, TPHA)",
        "3. Congenital Syphilis",
        "4. Treatment & Control of Syphilis",
        "5. Granuloma Inguinale (Donovanosis) — Klebsiella granulomatis",
        "6. Chancroid (Soft Chancre) — Haemophilus ducreyi",
        "7. Chlamydia trachomatis — NGU, LGV, Neonatal Infections",
        "8. Comparative Table: Genito-Ulcerative Diseases",
        "9. Memory Aids & Quick Review",
    ]
    cover_items = [Paragraph("<b>TOPICS COVERED</b>", S("cth", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=4))] + \
                  [Paragraph(t, bullet_style) for t in topics]
    story += colored_box(cover_items, bg=LIGHT_BLUE, border=DARK_BLUE)
    story.append(Spacer(1,8*mm))
    story.append(Paragraph("Source: 3-4. STIs-mbbs.pdf | Apurba Sastri Microbiology Curriculum", source_style))
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 1 — TREPONEMA PALLIDUM / SYPHILIS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("1. TREPONEMA PALLIDUM — SYPHILIS", bg=DARK_BLUE)

    story.append(Paragraph("<b>Organism Profile</b>", S("h2", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += must_box([
        "Treponema pallidum subsp pallidum — causes venereal syphilis (most invasive)",
        "Morphology: Extremely thin (6–12 µm × 0.2 µm), flexible, spirally coiled, tapering ends",
        "Motility: Flexion-extension, translatory and corkscrew motility — due to 3–4 endoflagella in periplasmic space",
        "Staining: Stains POORLY with aniline dyes; visible by DARK-FIELD MICROSCOPY (live) or SILVER IMPREGNATION (Levaditi for tissue sections; Fontana for smears)",
        "Culture: CANNOT be grown in artificial culture media — maintained in rabbit testes (Nichols strain since 1912)",
        "Microaerophilic; optimal pH 7.2–7.4; temperature 30–37°C; in vivo generation time: 30 hours",
        "Lacks classical LPS (endotoxin) but has abundant LIPOPROTEINS — induces inflammatory processes",
        "Cardiolipin is the non-specific antigen detected by non-treponemal tests (VDRL, RPR)",
    ])

    # Treponema image
    img_t = fetch_img(IMG_TREPONEMA, max_w=13*cm, max_h=6*cm)
    if img_t:
        story.append(KeepTogether([img_t,
            Paragraph("T. pallidum spirochetes in lymph node (Steiner silver stain) — corkscrew-shaped organisms along vessel walls", caption_style),
            Spacer(1,3*mm)]))

    story += gtk_box([
        "4 trepanomatoses: Venereal syphilis (subsp pallidum), Yaws (subsp pertenue), Endemic syphilis (subsp endemicum), Pinta (T. carateum — least invasive)",
        "Endoflagella are HIGHLY ANTIGENIC — important for immune evasion and diagnosis",
        "High complex lipid content including cardiolipin (phospholipid) — cross-reacts with beef heart antigen in VDRL",
        "Blood from incubating syphilis may be INFECTIOUS before chancre appears",
        "CNS invasion occurs EARLY even before neurological symptoms (CSF abnormalities in early syphilis)",
    ])
    story += concept_box(
        "Why can't Treponema be cultured? T. pallidum has extremely few biosynthetic capabilities — it lacks enzymes "
        "for de novo synthesis of purines, most amino acids, and fatty acids. It is totally dependent on host cells "
        "for metabolic intermediates. This extreme auxotrophy makes it impossible to grow on artificial media. "
        "The Nichols strain has been maintained since 1912 in rabbit testes — the only lab model. "
        "This is why SEROLOGY remains the mainstay of diagnosis."
    )

    story.append(Spacer(1,4*mm))
    story.append(Paragraph("<b>Pathogenesis & IP</b>", S("h2a", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += must_box([
        "Infectious dose: <10 organisms can produce infection",
        "MOT: Sexual contact with infectious lesions (venereal); direct contact / blood transfusion / transplacental (non-venereal)",
        "IP: Variable 9–90 days (mean 21 days); inversely proportional to inoculum size",
        "Rapidly penetrates through skin/mucosa abrasions → enters lymphatics + blood WITHIN HOURS → systemic infection before primary lesion appears",
        "Tissue damage = HOST inflammatory response (not bacterial toxins directly) — T. pallidum lipoproteins activate macrophages + endothelial cells",
    ])
    story.append(PageBreak())

    # ── CLINICAL STAGES ──────────────────────────────────────────────────────
    story += banner("1B. CLINICAL STAGES OF SYPHILIS", bg=MID_BLUE)

    story += data_table(
        ["Stage", "Timing", "Key Features", "Contagious?"],
        [
            ["Primary", "9–90 days after exposure", "Hard chancre — painless, indurated ulcer with clean base + regional painless B/L lymphadenopathy; heals in 2–6 weeks", "YES (highly)"],
            ["Secondary", "4–8 weeks after healing of chancre", "Maculopapular rash on PALMS & SOLES; generalised lymphadenopathy; condylomata lata; mucocutaneous sores; slight fever", "YES (highly)"],
            ["Latent", "After secondary; may last years", "No clinical manifestations; positive serology; normal CSF; Early latent <1 yr; Late latent >1 yr", "Low"],
            ["Tertiary", "25% of untreated, up to 30+ yrs", "Neurosyphilis (tabes dorsalis, general paresis); Cardiovascular (aortitis, aneurysm); Gummatous lesions", "Rarely"],
        ],
        col_widths=[2.5*cm, 3.5*cm, 7.5*cm, 3*cm]
    )

    # Primary chancre images
    img_c1 = fetch_img(IMG_CHANCRE1, max_w=8*cm, max_h=6*cm)
    img_c2 = fetch_img(IMG_RASH1, max_w=8*cm, max_h=6*cm)
    story += side_by_side(img_c1, "PRIMARY syphilis — hard chancre: painless, indurated ulcer, clean base",
                          img_c2, "SECONDARY syphilis — palmoplantar maculopapular rash (copper-colored)")

    story += must_box([
        "Primary chancre: painless, indurated (hard), single ulcer with clean base — on penis (M), cervix/labia (F), anal canal/mouth (homosexuals)",
        "Primary chancre may be EXTRA-GENITAL (e.g. finger) if acquired by direct contact",
        "If transmitted by blood transfusion → NO primary chancre",
        "Secondary syphilis: condylomata LATA = FLAT, broad-based warty lesions in moist areas (contrast with HPV condylomata ACUMINATA = pointed)",
        "Jarisch-Herxheimer reaction: 2–12 hrs after treatment → fever, chills, malaise, worsening lesions → caused by rapid treponeme death; benign, resolves <12 hrs",
        "Neurosyphilis subtypes: Meningovascular (early), Tabes dorsalis (posterior column demyelination), General paresis of the insane (GPI, 20–30 yrs later)",
        "Tabes dorsalis features: lightning pain, ataxia, Argyll-Robertson pupils, Charcot joints, trophic ulcers, loss of proprioception/reflexes",
        "Gummas: necrotising granulomas with lymphocytes + giant cells + epithelioid cells — skin + bones most common",
    ])
    story += gtk_box([
        "Condylomata lata teem with treponemes — highly contagious",
        "Secondary syphilis: immune complex deposition → nephrotic syndrome (glomerular basement membrane)",
        "~25% of untreated secondary syphilis patients experience RELAPSES in first several years",
        "Cardiovascular syphilis: aortitis → aneurysms (usually ascending aorta) + coronary artery stenosis",
        "GPI (General Paresis of the Insane): fronto-temporal meningoencephalitis; insidious psychiatric symptoms → schizophrenia-like → presenile dementia",
        "Approx. 25% of untreated patients develop tertiary syphilis — only if untreated",
    ])
    story += concept_box(
        "The STAGES of syphilis reflect the host-pathogen interaction. In PRIMARY syphilis, local multiplication "
        "of T. pallidum causes erythema → induration → painless ulcer (chancre). The PAINLESSNESS is because "
        "T. pallidum evades early innate immune recognition. In SECONDARY syphilis, haematogenous dissemination "
        "spreads treponemes to skin, lymph nodes, liver, spleen — the widespread rash reflects immune complex "
        "deposition and inflammatory response. In LATENCY, host defenses suppress (but don't eliminate) the "
        "organism. In TERTIARY, delayed hypersensitivity to treponemes drives granuloma formation (gummas) and "
        "progressive tissue destruction — the organisms are actually FEW in gummas, but the immune response is "
        "destructive. The Argyll-Robertson pupil (accommodates but does NOT react to light) reflects dorsal "
        "midbrain damage in neurosyphilis."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 2 — LAB DIAGNOSIS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("2. LABORATORY DIAGNOSIS OF SYPHILIS", bg=DARK_BLUE)
    story.append(Paragraph("Three approaches: (1) Direct demonstration of treponemes; (2) Non-treponemal tests; (3) Treponemal tests.", body_style))

    story += must_box([
        "DIRECT METHODS:",
        "  Dark-field microscopy (DGM): live treponemes showing corkscrew motility — from primary/secondary lesion exudate; PERFORM IMMEDIATELY after collection",
        "  DFA-TP (Direct Fluorescent Antibody for T. pallidum): smear + fluorescent-labelled monoclonal Ab → apple green fluorescence",
        "  Silver impregnation: Levaditi stain (tissue sections); Fontana stain (smears from exudates)",
        "  NAAT/PCR: directly detects T. pallidum DNA from any lesion/body fluid",
        "",
        "NON-TREPONEMAL TESTS (detect antibody against CARDIOLIPIN = non-specific reagin Ab):",
        "  VDRL: slide flocculation; Ag = cardiolipin + cholesterol + lecithin; pre-heating of serum required; reactive 1–2 wks after chancre",
        "  RPR: similar to VDRL but carbon-coated/dyed Ag for macroscopic reading; NO pre-heating needed",
        "  VDRL reactive: 50–75% primary; 100% secondary; decreases to 75% thereafter",
        "  4-fold change in titre = significant (e.g. 1:8 → 1:32 = active infection; 1:16 → 1:4 = responding to Rx)",
        "",
        "TREPONEMAL TESTS (detect antibody against T. pallidum proteins — SPECIFIC):",
        "  FTA-ABS: indirect fluorescence; 1st serological test to become positive; sorbent = Reiter strain; IgM FTA-ABS for congenital syphilis",
        "  TPHA: bird RBCs sensitised with T. pallidum Ag (Nichols strain); standard confirmatory test worldwide",
        "  TPPA: gelatin particles instead of RBCs",
        "  TPI test (historical): immobilises live T. pallidum — not in use anymore",
        "  Treponemal tests remain positive for LIFETIME (85%) — cannot distinguish active from treated infection",
    ])

    # VDRL algorithm image
    img_vdrl = fetch_img(IMG_VDRL, max_w=14*cm, max_h=8*cm)
    if img_vdrl:
        story.append(KeepTogether([img_vdrl,
            Paragraph("Traditional vs Reverse Sequence Algorithms for syphilis serology diagnosis", caption_style),
            Spacer(1,3*mm)]))

    story += gtk_box([
        "BIOLOGICAL FALSE POSITIVE (BFP) non-treponemal tests: Leprosy, TB, Malaria, Infectious mononucleosis, SLE, Rheumatoid arthritis, Pregnancy, Drug abuse",
        "FALSE NEGATIVE non-treponemal tests: Within 4 weeks of primary lesion; late latent syphilis; PROZONE REACTION (high Ab concentration causing false negative — dilute and retest)",
        "Traditional algorithm: Screen with RPR/VDRL → confirm positive with treponemal test (TPHA/FTA-ABS)",
        "Reverse algorithm: Screen with treponemal EIA/CIA → confirm with RPR/VDRL → if discordant, use second treponemal test",
        "VDRL on CSF: used to diagnose NEUROSYPHILIS (VDRL-CSF is specific for neurosyphilis when positive)",
        "Rapid diagnostic tests (RDTs): treponemal Ab results in 10–15 minutes; positive does not distinguish active from treated",
        "Cure monitoring: use quantitative non-treponemal titres; primary syphilis non-reactive within 6–12 months; secondary within 12–18 months",
    ])
    story += concept_box(
        "Why two types of tests? NON-TREPONEMAL tests (VDRL/RPR) detect antibodies against CARDIOLIPIN — "
        "a phospholipid released from damaged host cells during infection. These are NOT specific to T. pallidum "
        "(hence false positives) but their TITRES correlate with disease activity and treatment response. "
        "TREPONEMAL tests detect antibodies directed against actual T. pallidum PROTEINS — they are highly specific, "
        "appear first (FTA-ABS), and persist for life. This is why a reactive treponemal test cannot tell you "
        "if the patient has ACTIVE disease or has been previously TREATED — you always need the non-treponemal "
        "titre to judge activity. The PROZONE phenomenon occurs when excess antibodies block flocculation — "
        "always dilute samples in high-suspicion cases with negative non-treponemal results."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 3 — CONGENITAL SYPHILIS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("3. CONGENITAL SYPHILIS", bg=ACCENT_RED)
    story += must_box([
        "Transmission: Haematogenous dissemination from infected pregnant mother to foetus transplacentally",
        "EARLY CONGENITAL SYPHILIS (presents at birth / first 2 yrs):",
        "  • Mucocutaneous lesions",
        "  • Rhinitis — SNUFFLES (persistent bloody nasal discharge; nasal secretions highly infectious)",
        "  • Osteochondritis (especially long bones — saddle nose, sabre tibia)",
        "  • Anaemia, Hepatosplenomegaly",
        "LATE CONGENITAL SYPHILIS — HUTCHINSON'S TRIAD (3 classic features):",
        "  1. Interstitial keratitis (eye — can cause blindness)",
        "  2. Notched incisors (Hutchinson's teeth) + Moon molars",
        "  3. 8th nerve deafness (sensorineural)",
        "Other late features: Neurosyphilis, Rhagades, Cardiovascular lesions, Clutton's joints, bone deformation",
        "Diagnosis: All infants of seropositive mothers examined; IgM FTA-ABS / IgM ELISA specific for congenital (maternal IgG crosses placenta, not IgM)",
        "Maternal antibodies (IgG) disappear by 8 months — VDRL/RPR monthly; if titre increases/stabilises → treat",
        "Treatment: Aqueous benzyl penicillin 100,000–150,000 U/kg/day IV x 10–15 days",
    ])
    story += gtk_box([
        "Foetus can be EASILY CURED with treatment; risk of adverse outcome is minimal if mother treated BEFORE 2nd trimester",
        "Penicillin treatment eradicates all stages — penicillin remains DOC for syphilis in ALL forms",
        "Definitive diagnosis: DGM of umbilical cord, placenta, nasal discharge or skin lesion",
        "Congenital syphilis is PREVENTABLE — screening and treating all pregnant women is key public health strategy",
        "Why use IgM for congenital diagnosis? Maternal IgG crosses placenta passively → positive IgG in newborn does NOT mean congenital infection. But IgM CANNOT cross placenta → positive IgM = newborn's own response = infection",
    ])
    story += concept_box(
        "The timing of congenital syphilis manifestations relates to the immune system development of the foetus. "
        "EARLY features (snuffles, osteochondritis) result from active foetal inflammation during bacteraemia. "
        "LATE features (Hutchinson's triad) result from hypersensitivity reactions to persistent treponemes. "
        "Hutchinson's triad represents the immune system's own destructive response to treponemes in the cornea, "
        "teeth, and cochlea. Saddle nose results from osteochondritis of the nasal septum. Sabre tibia from "
        "periostitis of the tibia. Rhagades are radiating scars around the mouth from mucosal healing of early lesions."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 4 — TREATMENT
    # ════════════════════════════════════════════════════════════════════════
    story += banner("4. TREATMENT & CONTROL OF SYPHILIS", bg=GREEN)
    story += data_table(
        ["Stage", "First Line", "Penicillin Allergy / Alternatives", "Notes"],
        [
            ["Early syphilis\n(Primary, Secondary, Early Latent)", "Benzathine penicillin G\n2.4 million units IM — SINGLE DOSE", "Doxycycline 100 mg BD PO x 14 days\nOR Ceftriaxone 1 g IM OD x 10–14 days\nOR Azithromycin 2 g OD PO", "In pregnancy: Erythromycin 500 mg QID x 14 days or Ceftriaxone"],
            ["Late syphilis / Unknown duration", "Benzathine penicillin G\n2.4 MU IM weekly x 3 doses\n(interval ≤14 days)", "Doxycycline 100 mg BD PO x 30 days", "In pregnancy: Erythromycin x 30 days"],
            ["Congenital syphilis", "Aqueous benzyl penicillin\n100,000–150,000 U/kg/day IV x 10–15 days", "Procaine penicillin 50,000 U/kg/day IM x 10–15 days", "Monitor all infants of seropositive mothers"],
            ["Neurosyphilis", "Aqueous crystalline penicillin G IV x 10–14 days", "Ceftriaxone (in penicillin allergy after desensitisation)", "Lumbar puncture to confirm; CSF VDRL monitoring"],
        ],
        col_widths=[3.5*cm, 5*cm, 5*cm, 3*cm]
    )
    story += must_box([
        "Penicillin is the DOC for ALL stages of syphilis — no resistance has been documented",
        "Jarisch-Herxheimer reaction: fever/chills/worsening of lesions 2–12 hrs after Rx → from rapid treponeme death → BENIGN, resolves <12 hrs",
        "Cure monitoring: quantitative non-treponemal titres (VDRL/RPR) — 4-fold drop = adequate response",
        "Primary syphilis: non-treponemal tests non-reactive within 6–12 months post-Rx",
        "Secondary syphilis: non-reactive within 12–18 months post-Rx",
    ])
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 5 — GRANULOMA INGUINALE
    # ════════════════════════════════════════════════════════════════════════
    story += banner("5. GRANULOMA INGUINALE (DONOVANOSIS)", bg=ORANGE)
    story.append(Paragraph("Causative organism: <b>Klebsiella granulomatis</b> (formerly Donovania granulomatis, Calymmatobacterium granulomatis)", body_style))

    img_d1 = fetch_img(IMG_DONOVAN1, max_w=7.5*cm, max_h=5.5*cm)
    img_d2 = fetch_img(IMG_DONOVAN2, max_w=7.5*cm, max_h=5.5*cm)
    story += side_by_side(img_d1, "Granuloma inguinale — beefy red ulcer with raised erythematous rim and granulation tissue (facial/non-genital)",
                          img_d2, "Bilateral scrotal beefy-red ulcers — painless, slowly progressive, friable/bleeds on contact")

    story += must_box([
        "Organism: Small, capsulated, Gram-negative coccobacilli; BIPOLAR STAINING → safety pin appearance",
        "Staining: Wright-Giemsa — body blue, capsule pink",
        "Donovan bodies: Organisms contained within cytoplasmic vacuoles (phagosomes) of large MACROPHAGES",
        "Lesion: Starts as painless papule → BEEFY RED ULCER that bleeds readily on touch",
        "IP: 1–4 weeks (may be up to 6 months)",
        "Most common sites: Genitals (90%); Lymph nodes rarely involved; Pseudobuboes (subcutaneous abscess in inguinal region) in 10%",
        "LAB: Demonstration of Donovan bodies in Giemsa-stained smears from lesion",
        "Culture: Can grow in egg yolk medium and modified Levinthal agar (not routine)",
    ])
    story += gtk_box([
        "Granuloma inguinale is a CHRONIC granulomatous disease — lesions are painless and slowly progressive",
        "Pseudobuboes: NOT true lymph node enlargement — subcutaneous abscess in inguinal region mimicking bubo",
        "Comparison: Chancroid = PAINFUL ulcer + true bubo; Granuloma inguinale = PAINLESS ulcer + pseudobuboes",
        "Donovan bodies on Giemsa: large cyst-like macrophages filled with deeply stained capsulated coccobacilli (1–2 µm safety pin appearance)",
        "Treatment: Azithromycin 1 g weekly OR doxycycline 100 mg BD — for at least 3 weeks until lesions heal",
    ])
    story += concept_box(
        "Klebsiella granulomatis survives by living INSIDE macrophage phagosomes (Donovan bodies) — the bacteria "
        "evade intracellular killing and cause the macrophage to appear as a large 'cyst' filled with organisms. "
        "This intracellular survival drives the CHRONIC GRANULOMATOUS nature of the disease. The beefy-red "
        "appearance results from exuberant granulation tissue formation as the host attempts to wall off the "
        "organisms. Unlike chancroid, the lesion is painless because the organisms do not produce significant "
        "cytotoxins or recruit neutrophils in large numbers — the dominant response is macrophage-mediated."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 6 — CHANCROID
    # ════════════════════════════════════════════════════════════════════════
    story += banner("6. CHANCROID (SOFT CHANCRE) — Haemophilus ducreyi", bg=PURPLE)
    story.append(Paragraph("Discovered by Ducrey; requires factor X (haematin) for growth — fastidious; rapidly dies outside human host.", body_style))

    img_ch1 = fetch_img(IMG_CHANCROID1, max_w=8*cm, max_h=5.5*cm)
    img_ch2 = fetch_img(IMG_CHANCROID2, max_w=7.5*cm, max_h=5.5*cm)
    story += side_by_side(img_ch1, "Chancroid: irregular painful ulcer + inguinal bubo (right groin) + autoinoculation kissing ulcers",
                          img_ch2, "Soft chancre: irregular, ragged, undermined margins, friable exudate — NOT indurated")

    story += must_box([
        "Organism: Gram-negative coccobacilli (1–1.5 µm × 0.6 µm); Gram stain — 'SCHOOL OF FISH' / 'RAIL ROAD TRACK' appearance",
        "Bipolar staining; NON-motile, NON-sporing",
        "Culture: Requires ONLY factor X; Iso Vitalex medium (Mueller Hinton-based chocolate agar + Vancomycin); 35°C, high humidity, 10% CO₂ for up to 10 days",
        "BA colonies: small greyish glistening (24 hrs) + small zone of beta-haemolysis",
        "IP: 1 day – 2 weeks (avg. 5–7 days)",
        "Lesion: EXTREMELY PAINFUL, necrotising, suppurative ulcer — SOFT (not indurated) = 'soft chancre'",
        "Ulcer base: friable granulation tissue + malodorous YELLOW-GRAY exudate; 1–20 mm size",
        "KISSING ULCERS: autoinoculation to opposite skin surface",
        "Bubo: tender, fluctuant inguinal lymphadenopathy — TRUE bubo (suppress and rupture); aspirate if fluctuant",
        "Pathogenesis: cytocidal DISTENDING TOXIN → cell cycle arrest + apoptosis/necrosis → ulcer formation",
        "DIAGNOSIS: No test immediately confirms — definitive = culture on special media (not readily available); NAAT (multiplex PCR) high detection; Gram stain: school of fish",
        "TREATMENT: Azithromycin 1 g PO single dose OR Ceftriaxone 250 mg IM single dose OR Erythromycin base 500 mg TDS x 7 days OR Ciprofloxacin 500 mg BD x 3 days",
    ])
    story += gtk_box([
        "ASYMPTOMATIC CARRIER state is common among women — important reservoir",
        "Chancroid DOES NOT cause systemic infection — not lethal",
        "Previous infection does NOT confer immunity — reinfection is possible",
        "Phagedenic chancroid: superinfection → widespread disfiguring necrosis → may need surgical excision",
        "H. ducreyi also causes: chronic limb ulcers in endemic areas; non-genital cutaneous ulcers in children (tropical areas, especially South Pacific)",
        "Chancroid dramatically increases HIV transmission risk by 3–5 fold — always test for HIV and other STIs concurrently",
        "Treat SEXUAL PARTNERS regardless of whether they have symptoms",
    ])
    story += concept_box(
        "The KEY DIFFERENCE between chancroid and syphilis ulcer: Chancroid = SOFT (not indurated), PAINFUL, "
        "MULTIPLE, dirty base with yellow-gray exudate. Syphilis chancre = HARD (indurated), PAINLESS, SINGLE, "
        "clean base. The DISTENDING TOXIN produced by H. ducreyi is a cytolethal distending toxin (CDT) that "
        "causes cell cycle arrest at G2/M checkpoint and apoptosis of epithelial cells — this directly drives "
        "the necrotising ulceration. Phagocytosis by macrophages is IMPAIRED (unlike in normal infection), "
        "allowing the organism to persist and cause progressive tissue damage. 'Kissing ulcers' result from "
        "autoinoculation of the organism from one surface to the directly opposing skin surface."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 7 — CHLAMYDIA TRACHOMATIS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("7. CHLAMYDIA TRACHOMATIS", bg=DARK_BLUE)
    story.append(Paragraph(
        "Family: Chlamydiaceae | Obligate intracellular bacteria | Filterable | Produce intracytoplasmic inclusions | "
        "Cannot grow on artificial media — grows in embryonated egg (yolk sac), animals, or cell lines (McCoy, HeLa229)", body_style))

    img_cl = fetch_img(IMG_CHLAM, max_w=13*cm, max_h=7*cm)
    if img_cl:
        story.append(KeepTogether([img_cl,
            Paragraph("Chlamydia trachomatis biphasic life cycle: EB (Elementary Body) = infectious extracellular; RB (Reticulate Body) = replicating intracellular", caption_style),
            Spacer(1,3*mm)]))

    story += must_box([
        "LIFE CYCLE — BIPHASIC (MUST MEMORISE):",
        "  Elementary Body (EB): Small, dense, extracellular, INFECTIOUS, metabolically INERT; enters cell via receptor-mediated endocytosis",
        "  Reticulate Body (RB): Large, intracellular, NON-INFECTIOUS, metabolically ACTIVE — replicates by binary fission using HOST ATP ('energy parasite')",
        "  EB → RB (inside phagosome) → binary fission → RB → EB → cell lysis/extrusion → new infection",
        "  Escape lysosomal fusion — virulence mechanism",
        "CLASSIFICATION — 19 SEROVARS:",
        "  A, B, Ba, C → Trachoma (leading cause of preventable blindness)",
        "  D–K → Oculogenital disease (NGU, cervicitis, PID, ophthalmia neonatorum, neonatal pneumonia)",
        "  L1, L2, L3 → Lymphogranuloma venereum (LGV) — invasive systemic STI",
        "SEROVARS D–K DISEASES:",
        "  NGU: IP 7–10 days; mucopurulent discharge + dysuria + urethral irritation",
        "  PGU (Postgonococcal urethritis): urethritis 2–3 wks after GU Rx with penicillin/cephalosporin alone (no antichlamydial added)",
        "  Epididymitis, proctitis",
        "  Reactive arthritis (Reiter's): conjunctivitis + urethritis/cervicitis + arthritis + mucocutaneous lesions; 1–2% of NGU cases",
        "  Ophthalmia neonatorum: IP 6–21 days; mucopurulent discharge",
        "  Neonatal pneumonia: interstitial pneumonia 3 weeks–3 months after birth; afebrile, staccato cough",
    ])
    story += must_box([
        "LGV (Serovars L1, L2, L3):",
        "  Stage 1: Painless papule/vesicle/ulcer on penis or vulva after IP 3 days–6 weeks",
        "  Stage 2: Inguinal LN enlarged, tender, soft = BUBO; systemic fever, headache, myalgia; chronic fistulae",
        "  Stage 3 (untreated): Rectal stricture; rectovaginal fistulae; Esthiomene (oedematous granulomatous hypertrophy); elephantiasis of vulva/scrotum",
        "  Frei test (historical): intradermal test for type IV hypersensitivity — no longer used",
        "LAB DIAGNOSIS:",
        "  Specimens: Urethral swab (NGU), endocervical swab (cervicitis), conjunctival swabs, 1st catch urine (morning), bubo aspirate (LGV)",
        "  Gram stain: poorly Gram-negative",
        "  Lugol's iodine: stains inclusion bodies of C. trachomatis",
        "  Gimenez / Castaneda / Machiavello stains: inclusion bodies in cytoplasm",
        "  DIF (Direct Immunofluorescence): inclusion bodies in clinical material",
        "  EIA: detects Chlamydial group-specific Ags (LPS)",
        "  NAAT (PCR): GOLD STANDARD",
        "  Serology (CFT, ELISA, MIF): useful for LGV",
        "TREATMENT: Azithromycin DOC; Alternatives: Doxycycline, Tetracycline, Erythromycin, Ofloxacin; Add Ceftriaxone for GC co-infection; treat BOTH partners",
    ])
    story += gtk_box([
        "Adult inclusion conjunctivitis (swimming pool conjunctivitis): C. trachomatis serovars D-K",
        "Neonatal pneumonia spreads: conjunctiva → pharynx via nasolacrimal duct → eustachian tube → otitis media",
        "Reactive arthritis: occurs in 1–2% of NGU cases after 1–4 weeks — remember 'Can't pee, can't see, can't climb a tree'",
        "Frei test: Intradermal Ag (Frei Ag) → induration/erythema in LGV (type IV hypersensitivity) — historical, no longer used",
        "Lugol's iodine stains ONLY C. trachomatis inclusions (contain glycogen) — C. pneumoniae inclusions do NOT stain with Lugol's",
        "McCoy cells are most commonly used for C. trachomatis culture",
    ])
    story += concept_box(
        "Why is Chlamydia an 'energy parasite'? C. trachomatis cannot synthesise ATP — it lacks the enzymes of "
        "the electron transport chain and ATP synthase. It must import ATP from the host cell via ADP/ATP translocases. "
        "This is why it is an OBLIGATE INTRACELLULAR pathogen — it literally cannot survive or replicate without "
        "being inside a living cell. The EB is metabolically inert (like a spore) — it can survive extracellularly "
        "but does not replicate. The PHAGOSOME ESCAPE (escape from lysosomal fusion) is the key virulence mechanism "
        "allowing Chlamydia to survive inside cells. Why does Lugol's iodine stain C. trachomatis inclusions? "
        "Because C. trachomatis inclusions contain GLYCOGEN — Lugol's stains glycogen brown/dark."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 8 — COMPARATIVE TABLE
    # ════════════════════════════════════════════════════════════════════════
    story += banner("8. COMPARATIVE TABLE — GENITO-ULCERATIVE STIs", bg=DARK_BLUE)
    story += data_table(
        ["Feature", "Syphilis\n(T. pallidum)", "Chancroid\n(H. ducreyi)", "Granuloma Inguinale\n(K. granulomatis)", "LGV\n(C. trachomatis L1-3)"],
        [
            ["Ulcer character", "PAINLESS, indurated, clean base, single", "PAINFUL, soft (not indurated), dirty exudate, multiple", "PAINLESS, beefy red, bleeds on touch, progressive", "Painless papule/ulcer (heals quickly)"],
            ["Lymph nodes", "Painless, firm, non-suppurative B/L lymphadenopathy", "TENDER, fluctuant BUBO — may rupture", "PSEUDOBUBOES (subcutaneous abscess, NOT true LN)", "TENDER bubo — may rupture and fistulate"],
            ["Key organism feature", "Spirochaete; cannot culture in vitro", "School of fish on Gram stain; requires factor X", "Safety pin appearance; Donovan bodies in macrophages", "Obligate intracellular; serovars L1, L2, L3"],
            ["Diagnostic test", "DGM + serology (VDRL/RPR + FTA-ABS/TPHA)", "Culture on special media; NAAT; Gram stain", "Giemsa smear — Donovan bodies", "NAAT (PCR); Serology (CFT, MIF); Bubo aspirate"],
            ["Treatment", "Benzathine penicillin G", "Azithromycin 1g single dose OR Ceftriaxone 250 mg IM", "Azithromycin/Doxycycline ≥3 weeks", "Doxycycline 100 mg BD x 21 days"],
        ],
        col_widths=[3*cm, 4*cm, 4*cm, 4*cm, 3.5*cm]
    )

    story += data_table(
        ["Feature", "Syphilis", "Chancroid", "Granuloma Inguinale", "LGV"],
        [
            ["Pain", "PAINLESS", "VERY PAINFUL", "PAINLESS", "Painless"],
            ["Induration", "HARD (indurated)", "SOFT (not indurated)", "Soft", "Soft"],
            ["Number", "Usually single", "Multiple (kissing ulcers)", "Can be multiple", "Single/multiple"],
            ["Base", "Clean, smooth", "Dirty yellow-gray exudate", "Beefy red, bleeds", "Clean"],
            ["STI?", "Yes", "Yes", "Yes (low contagiousness)", "Yes"],
        ],
        col_widths=[3.5*cm, 4*cm, 4*cm, 4*cm, 3*cm]
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION 9 — MEMORY AIDS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("9. MEMORY AIDS & QUICK REVIEW", bg=GOLD, font_size=12)

    mems = [
        ("Syphilis stages", "Primary → Secondary → Latent → Tertiary\n'1 chancre → 2 rash → silence → 3 organ damage'"),
        ("Hutchinson's Triad", "Interstitial keratitis + Notched incisors + 8th nerve deafness\n(congenital syphilis — late)"),
        ("Argyll-Robertson pupil", "Accommodates BUT does NOT react to light\n'Prostitute's pupil — accommodates but doesn't react' (mnemonic for neurosyphilis)"),
        ("VDRL vs RPR", "VDRL: needs pre-heating; microscopic reading; can test CSF\nRPR: no pre-heating; macroscopic (carbon); only serum"),
        ("Non-treponemal BFP", "LEPROSY TB Malaria Mono SLE RA Pregnancy Drugs\n(Let The Man Make Some Reliable Penicillin Daily)"),
        ("Prozone reaction", "High Ab concentration → FALSE NEGATIVE non-treponemal test\nFix: Dilute the serum and re-test"),
        ("Chlamydia serovars", "A–C: trachoma | D–K: oculogenital (NGU) | L1–3: LGV\n'ABC (eyes blind), D to K (down below), L (lymph nodes)'"),
        ("EB vs RB", "EB = Extracellular, infectious, inErt (metabolically)\nRB = intRacellular, Replicating, active (uses host ATP)"),
        ("Lugol's iodine stain", "Stains C. trachomatis inclusions ONLY (contain glycogen)\nC. pneumoniae inclusions = glycogen negative = no staining"),
        ("Ulcer comparison", "Syphilis: PAINLESS + HARD | Chancroid: PAINFUL + SOFT\nGranuloma inguinale: PAINLESS + BEEFY RED\nLGV: painless papule → bubo → fistula"),
        ("Reactive arthritis", "'Can't pee + Can't see + Can't climb a tree'\nUrethritis + Conjunctivitis + Arthritis = Reiter's syndrome"),
        ("Jarisch-Herxheimer", "Fever/chills 2–12 hrs after Rx of syphilis = rapid treponeme death\nBENIGN — no prophylaxis needed; resolves in <12 hrs"),
        ("Donovan bodies", "Klebsiella granulomatis inside macrophage phagosomes\nGiemsa: 1–2 µm coccobacilli with safety pin appearance"),
        ("School of fish", "Haemophilus ducreyi on Gram stain from ulcer\n= short plump Gram-negative rods arranged in school of fish pattern"),
    ]

    for key, val in mems:
        row = Table([[
            Paragraph(key, mem_key),
            Paragraph(val.replace("\n", "<br/>"), mem_val)
        ]], colWidths=[4*cm, 12.5*cm])
        row.setStyle(TableStyle([
            ("BACKGROUND",   (0,0),(0,0), LIGHT_BLUE),
            ("BACKGROUND",   (1,0),(1,0), WHITE),
            ("BOX",          (0,0),(-1,-1), 0.5, colors.HexColor("#aaaaaa")),
            ("TOPPADDING",   (0,0),(-1,-1), 5),
            ("BOTTOMPADDING",(0,0),(-1,-1), 5),
            ("LEFTPADDING",  (0,0),(-1,-1), 6),
            ("RIGHTPADDING", (0,0),(-1,-1), 6),
            ("VALIGN",       (0,0),(-1,-1), "TOP"),
        ]))
        story.append(row)
        story.append(Spacer(1,1.5*mm))

    story.append(Spacer(1,8*mm))
    story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
    story.append(Spacer(1,3*mm))
    story.append(Paragraph(
        "Source: 3-4. STIs-mbbs.pdf | Apurba Sastri Microbiology | MBBS Curriculum | "
        "Cross-referenced with Sherris & Ryan Medical Microbiology 8e and Robbins Basic Pathology",
        source_style))

    doc.build(story)
    print(f"PDF created: {OUTPUT}")

if __name__ == "__main__":
    build()
Running Command

cd /tmp/workspace/genital-tract-infections && python3 build_stis_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/genital-tract-infections/STIs_MBBS_Apurba_Sastri.pdf

Your PDF is ready (846 KB):

STIs MBBS Apurba Sastri

PDF Document · PDF


What's inside (same format as the previous PDF):
SectionContentPhotos
Cover pageAll 9 topics listed-
1A. Treponema pallidumMorphology, culture, antigens, pathogenesisT. pallidum silver stain spirochetes
1B. Clinical StagesPrimary → Secondary → Latent → Tertiary tableHard chancre + Palmoplantar rash
2. Lab DiagnosisVDRL, RPR, FTA-ABS, TPHA, algorithms, BFP causesVDRL/RPR traditional vs reverse algorithm
3. Congenital SyphilisHutchinson's triad, snuffles, early vs late features-
4. TreatmentFull drug table for all stages-
5. Granuloma InguinaleDonovan bodies, beefy ulcer, pseudobuboes2 clinical photos of donovanosis
6. ChancroidSchool of fish, soft chancre, kissing ulcers, bubo2 clinical photos of H. ducreyi ulcers
7. Chlamydia trachomatisLife cycle, serovars, NGU, LGV, neonatal, labEB-RB life cycle diagram
8. Comparative TableAll 4 genito-ulcerative STIs side by side-
9. Memory Aids14 mnemonics (Hutchinson's, Reiter's, prozone, serovars, etc.)-
Every section uses the same Must Know / Good to Know / Understanding the Concept colour-coded boxes as your previous PDF.

clntinuethe work

Let me check what content remains in the PDF that wasn't covered yet.
Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages[3:10]): txt = page.extract_text() print(f'\\n===PAGE {i+4}===') print(txt[:800] if txt else '[no text/image slide]') " 2>&1

Running Command

python3 -c " import pdfplumber path = '/tmp/workspace/attachments/89abc09a-ee1b-4ecf-b0a2-8dd71e50ab36/3-4. STIs-mbbs.pdf' with pdfplumber.open(path) as pdf: # Check pages 107-112 (end of file - what's left after Chlamydia) for i, page in enumerate(pdf.pages[105:]): txt = page.extract_text() print(f'\\n===PAGE {i+106}===') print(txt[:2000] if txt else '[no text/image slide]') " 2>&1

The PDF has image-only slides at pages 4-5 and 108-112 (the genito-ulcerative disease comparison slide and scabies/crabs slides are image-only). The previous PDF already covered all text content from the STIs PDF. The user wants me to continue the work - meaning extend the PDF to also include:
  1. Phthiriasis pubis (Crabs) & Scabies (pages 4-5 — image slides)
  2. The Gonorrhoea/N. gonorrhoeae topic (which was in the earlier lecture but not in this PDF — it was referenced in the previous genital tract PDF)
  3. A more complete Gonorrhoea section and the remaining STI topics from Apurba Sastri
Let me check if there's more content I missed and add Gonorrhoea + Scabies/Crabs to complete the STIs topic fully.
Finding Sources
Finding Sources
Searching Images

Neisseria gonorrhoeae gram stain intracellular diplococci neutrophils urethral discharge

This composite educational image illustrates the clinical and laboratory findings of gonococcal vaginitis. Figure A is a clinical photograph of the vulvar region during a venereological examination. It demonstrates significant vulvar erythema (redness) and a prominent, greenish-yellow purulent discharge emanating from the vaginal introitus. Figure B is a high-power light microscopy image of a Gram-stained vaginal secretion. The smear reveals a dense inflammatory infiltrate composed primarily of polymorphonuclear (PMN) leukocytes. Within the cytoplasm of several PMN cells, characteristic Gram-negative (pink-stained), bean-shaped diplococci are clearly visible, representing Neisseria gonorrhoeae. Some diplococci are also observed in the extracellular space. This comparison demonstrates the correlation between gross clinical symptoms (purulent discharge and inflammation) and the diagnostic microbiological evidence (intracellular Gram-negative diplococci) used to confirm a diagnosis of gonorrhea.

This composite educational image illustrates the clinical and laboratory findings of gonococcal vaginitis. Figure A is a clinical photograph of the vulvar region during a venereological examination. It demonstrates significant vulvar erythema (redness) and a prominent, greenish-yellow purulent discharge emanating from the vaginal introitus. Figure B is a high-power light microscopy image of a Gram-stained vaginal secretion. The smear reveals a dense inflammatory infiltrate composed primarily of polymorphonuclear (PMN) leukocytes. Within the cytoplasm of several PMN cells, characteristic Gram-negative (pink-stained), bean-shaped diplococci are clearly visible, representing Neisseria gonorrhoeae. Some diplococci are also observed in the extracellular space. This comparison demonstrates the correlation between gross clinical symptoms (purulent discharge and inflammation) and the diagnostic microbiological evidence (intracellular Gram-negative diplococci) used to confirm a diagnosis of gonorrhea.

A pathophysiology diagram illustrating the immune response to Neisseria gonorrhoeae in the human urethral mucosa. The visual is divided into the urethral lumen, the mucous layer, the epithelial lining, and the underlying urethral tissue. In the lumen, non-tolerant N. gonorrhoeae diplococci are shown alongside a sparse commensal microbiome and active phagocytic cells (PMNs and PMLs) engaging in bacterial engulfment. The urethral lining contains Toll-like receptors (TLRs) that interact with Pathogen-Associated Molecular Patterns (PAMPs) of N. gonorrhoeae. This interaction is depicted as a signaling trigger for the recruitment and activation of immune cells in the underlying tissue. The tissue layer shows a complex inflammatory environment featuring macrophages, Th1, Th2, Th17, and Treg cells. Specific signaling molecules are mapped to these cells, including pro-inflammatory cytokines (TNFͱ, IL-6, IL-1̲), interferons (IFNͱ, IFN̲), and interleukins (IL-4, IL-10, IL-17). The diagram emphasizes a robust, localized immune response characterized by high cytokine activity and phagocytosis, which is hypothesized to limit the development of antibiotic tolerance in urethral gonococcal infections.

A pathophysiology diagram illustrating the immune response to Neisseria gonorrhoeae in the human urethral mucosa. The visual is divided into the urethral lumen, the mucous layer, the epithelial lining, and the underlying urethral tissue. In the lumen, non-tolerant N. gonorrhoeae diplococci are shown alongside a sparse commensal microbiome and active phagocytic cells (PMNs and PMLs) engaging in bacterial engulfment. The urethral lining contains Toll-like receptors (TLRs) that interact with Pathogen-Associated Molecular Patterns (PAMPs) of N. gonorrhoeae. This interaction is depicted as a signaling trigger for the recruitment and activation of immune cells in the underlying tissue. The tissue layer shows a complex inflammatory environment featuring macrophages, Th1, Th2, Th17, and Treg cells. Specific signaling molecules are mapped to these cells, including pro-inflammatory cytokines (TNFͱ, IL-6, IL-1̲), interferons (IFNͱ, IFN̲), and interleukins (IL-4, IL-10, IL-17). The diagram emphasizes a robust, localized immune response characterized by high cytokine activity and phagocytosis, which is hypothesized to limit the development of antibiotic tolerance in urethral gonococcal infections.

<table><thead><tr><th>Summary of evidence</th><th>LE</th></tr></thead><tbody><tr><td>A Gram stain of urethral discharge or a urethral smear that shows ≥ 5 leukocytes per high power field (× 1,000) and gonococci located intracellularly as Gram-negative diplococci, indicates gonococcal urethritis.</td><td>3b</td></tr><tr><td>Validated NAATs of first-void urine samples have better sensitivity and specificity than any of the other tests available for the diagnosis of chlamydial and gonococcal infections.</td><td>2a</td></tr><tr><td>For GU, dual treatment with ceftriaxone and azithromycin is the most effective combination.</td><td>2a</td></tr><tr><td>In case of urogenital <i>C. trachomatis</i> infection in men, azithromycin is probably less effective than doxycycline for microbiological failure.</td><td>1a</td></tr><tr><td>In case of <i>U. urealyticum</i> infection the efficacy of doxycycline 100 mg twice for seven days is similar to azithromycin 1 g single dose treatment.</td><td>2a</td></tr></tbody></table>

<table><thead><tr><th>Summary of evidence</th><th>LE</th></tr></thead><tbody><tr><td>A Gram stain of urethral discharge or a urethral smear that shows ≥ 5 leukocytes per high power field (× 1,000) and gonococci located intracellularly as Gram-negative diplococci, indicates gonococcal urethritis.</td><td>3b</td></tr><tr><td>Validated NAATs of first-void urine samples have better sensitivity and specificity than any of the other tests available for the diagnosis of chlamydial and gonococcal infections.</td><td>2a</td></tr><tr><td>For GU, dual treatment with ceftriaxone and azithromycin is the most effective combination.</td><td>2a</td></tr><tr><td>In case of urogenital <i>C. trachomatis</i> infection in men, azithromycin is probably less effective than doxycycline for microbiological failure.</td><td>1a</td></tr><tr><td>In case of <i>U. urealyticum</i> infection the efficacy of doxycycline 100 mg twice for seven days is similar to azithromycin 1 g single dose treatment.</td><td>2a</td></tr></tbody></table>

Reading File
Reading File
Searching Images

scabies mite burrow skin itching sarcoptes

Scanning electron microscopy (SEM) image at 300x magnification illustrating an adult female Sarcoptes scabiei mite within a cutaneous burrow, a hallmark finding of human scabies. The mite features a characteristic oval, dorsoventrally flattened body with a highly textured integument. Visible morphological details include transverse ridges (striations) on the anterior dorsal surface and numerous short, conical spines (protuberances) and long, hair-like setae extending from the posterior and lateral margins. The mite is partially embedded in an irregular tunnel composed of fragmented keratinocytes and skin debris. Adjacent to the mite within the burrow are several small, ovoid, hardened masses representing scybala (fecal pellets). This image serves as a high-resolution diagnostic demonstration of the pathophysiology of crusted scabies, highlighting the mite's burrowing behavior and the accumulation of metabolic waste within the stratum corneum.

Scanning electron microscopy (SEM) image at 300x magnification illustrating an adult female Sarcoptes scabiei mite within a cutaneous burrow, a hallmark finding of human scabies. The mite features a characteristic oval, dorsoventrally flattened body with a highly textured integument. Visible morphological details include transverse ridges (striations) on the anterior dorsal surface and numerous short, conical spines (protuberances) and long, hair-like setae extending from the posterior and lateral margins. The mite is partially embedded in an irregular tunnel composed of fragmented keratinocytes and skin debris. Adjacent to the mite within the burrow are several small, ovoid, hardened masses representing scybala (fecal pellets). This image serves as a high-resolution diagnostic demonstration of the pathophysiology of crusted scabies, highlighting the mite's burrowing behavior and the accumulation of metabolic waste within the stratum corneum.

This clinical image demonstrates an enhanced wet dermatoscopy view of a scabies Mite-Gallery Unit (MGU) on human skin. The image reveals the internal anatomical components of a Sarcoptes scabiei burrow, which is made visible by the transparency of the stratum corneum in wet modality. Key features include: 1) The 'Sarcoptes' mite located at the head of the gallery, appearing as a slightly opalescent, dark-pigmented structure. 2) A row of 'Eggs' following the mite, characterized by their oval morphology and arranged with their major axes perpendicular to the burrow's path. 3) Scybala or 'Feces', appearing as small, white-gray refractile spheres within the tunnel body. 4) An adjacent 'Exudate' in the lower-left quadrant, presenting as a semitransparent, yellowish-orange circular region with irregular borders, representing a spongiotic inflammatory response. This visual material is critical for understanding the diagnostic 'jet trail' sign and the lifecycle-based morphology of Sarcoptes scabiei during clinical dermatological examinations.

This clinical image demonstrates an enhanced wet dermatoscopy view of a scabies Mite-Gallery Unit (MGU) on human skin. The image reveals the internal anatomical components of a Sarcoptes scabiei burrow, which is made visible by the transparency of the stratum corneum in wet modality. Key features include: 1) The 'Sarcoptes' mite located at the head of the gallery, appearing as a slightly opalescent, dark-pigmented structure. 2) A row of 'Eggs' following the mite, characterized by their oval morphology and arranged with their major axes perpendicular to the burrow's path. 3) Scybala or 'Feces', appearing as small, white-gray refractile spheres within the tunnel body. 4) An adjacent 'Exudate' in the lower-left quadrant, presenting as a semitransparent, yellowish-orange circular region with irregular borders, representing a spongiotic inflammatory response. This visual material is critical for understanding the diagnostic 'jet trail' sign and the lifecycle-based morphology of Sarcoptes scabiei during clinical dermatological examinations.

Searching Images

pediculosis pubis pubic lice crab louse genital

This composite clinical diagnostic image displays dermatoscopic findings of pediculosis pubis (crab lice) on the human genital area. Image (a) shows a high-magnification view of two adult Pthirus pubis parasites firmly attached to pubic hair shafts. The organisms appear as brownish, translucent, multi-segmented crab-like bodies with visible appendages. Image (b) highlights the presence of nits at various stages. Ovoid, brownish, and convex structures indicated by yellow arrows represent full nits containing unhatched eggs. In contrast, the translucent, flat, and fissured structures marked by yellow arrowheads represent empty nit casings after hatching. The background shows characteristic pinkish, lobulated skin texture. These dermatoscopic features are critical for distinguishing active infestations from resolved ones, providing a rapid, non-invasive method for diagnosis and post-treatment follow-up in dermatology and sexual health settings.

This composite clinical diagnostic image displays dermatoscopic findings of pediculosis pubis (crab lice) on the human genital area. Image (a) shows a high-magnification view of two adult Pthirus pubis parasites firmly attached to pubic hair shafts. The organisms appear as brownish, translucent, multi-segmented crab-like bodies with visible appendages. Image (b) highlights the presence of nits at various stages. Ovoid, brownish, and convex structures indicated by yellow arrows represent full nits containing unhatched eggs. In contrast, the translucent, flat, and fissured structures marked by yellow arrowheads represent empty nit casings after hatching. The background shows characteristic pinkish, lobulated skin texture. These dermatoscopic features are critical for distinguishing active infestations from resolved ones, providing a rapid, non-invasive method for diagnosis and post-treatment follow-up in dermatology and sexual health settings.

Two high-magnification clinical photographs (a and b) demonstrating Phthiriasis palpebrarum, an infestation of the eyelashes by Phthirus pubis (crab lice). Image (a) depicts a single, translucent, crab-like louse firmly attached to the base of multiple eyelashes and partially embedded within the superficial layers of the eyelid skin. The louse body shows characteristic dark pigmentation and internal spotting, likely representing blood ingestion. Image (b) shows a more extensive involvement of the eyelid margin with multiple lice buried into the lid skin, accompanied by a macerated and edematous skin texture. The visual signs demonstrate the typical presentation of pubic lice in the periorbital region, including the presence of lice (pediculosis) and associated eyelid irritation. This case highlights a common diagnostic pitfall where infestations may mimic blepharitis or eczema. The images are relevant for ophthalmology and dermatology education, illustrating the importance of slit-lamp examination in identifying adult parasites and their nits in patients presenting with eyelid pruritus and hyperpigmentation.

Two high-magnification clinical photographs (a and b) demonstrating Phthiriasis palpebrarum, an infestation of the eyelashes by Phthirus pubis (crab lice). Image (a) depicts a single, translucent, crab-like louse firmly attached to the base of multiple eyelashes and partially embedded within the superficial layers of the eyelid skin. The louse body shows characteristic dark pigmentation and internal spotting, likely representing blood ingestion. Image (b) shows a more extensive involvement of the eyelid margin with multiple lice buried into the lid skin, accompanied by a macerated and edematous skin texture. The visual signs demonstrate the typical presentation of pubic lice in the periorbital region, including the presence of lice (pediculosis) and associated eyelid irritation. This case highlights a common diagnostic pitfall where infestations may mimic blepharitis or eczema. The images are relevant for ophthalmology and dermatology education, illustrating the importance of slit-lamp examination in identifying adult parasites and their nits in patients presenting with eyelid pruritus and hyperpigmentation.

Reading File
Reading File
Searching Images

gonorrhoea ophthalmia neonatorum purulent eye discharge newborn

This clinical photograph displays a close-up view of an eye presenting with severe ophthalmia neonatorum, specifically hyperacute purulent conjunctivitis. The eyelids exhibit significant erythema and marked periorbital edema, causing them to be nearly swollen shut. A copious, thick, yellowish-white purulent discharge (pus) is seen oozing from the palpebral fissure and coating the eyelid margins and eyelashes. Small air bubbles or droplets are visible within the viscous exudate. The clinical appearance is highly characteristic of Neisseria gonorrhoeae infection, demonstrating the hallmark symptom of rapid-onset, profuse discharge that poses a high risk for corneal ulceration and perforation if not treated emergently. The image serves as an educational tool for identifying neonatal infectious emergencies and differentiating hyperacute bacterial conjunctivitis from milder forms of neonatal eye infections.

This clinical photograph displays a close-up view of an eye presenting with severe ophthalmia neonatorum, specifically hyperacute purulent conjunctivitis. The eyelids exhibit significant erythema and marked periorbital edema, causing them to be nearly swollen shut. A copious, thick, yellowish-white purulent discharge (pus) is seen oozing from the palpebral fissure and coating the eyelid margins and eyelashes. Small air bubbles or droplets are visible within the viscous exudate. The clinical appearance is highly characteristic of Neisseria gonorrhoeae infection, demonstrating the hallmark symptom of rapid-onset, profuse discharge that poses a high risk for corneal ulceration and perforation if not treated emergently. The image serves as an educational tool for identifying neonatal infectious emergencies and differentiating hyperacute bacterial conjunctivitis from milder forms of neonatal eye infections.

This clinical photograph displays a close-up view of a neonatal eye exhibiting severe ophthalmia neonatorum, likely caused by Neisseria gonorrhoeae infection. The primary visual finding is a massive, hyperacute purulent discharge characterized by a thick, creamy, yellowish-white consistency that is so copious it obscures the underlying globe. The superior and inferior eyelids are markedly edematous (swollen) and erythematous, indicating significant periorbital inflammation. The surrounding skin appears irritated and macerated from contact with the abundant exudate. This presentation is a medical emergency due to the risk of rapid corneal perforation and permanent vision loss. The image serves as a critical educational tool for recognizing the signs of neonatal gonococcal conjunctivitis, emphasizing the urgency of immediate systemic antibiotic treatment and ocular irrigation.

This clinical photograph displays a close-up view of a neonatal eye exhibiting severe ophthalmia neonatorum, likely caused by Neisseria gonorrhoeae infection. The primary visual finding is a massive, hyperacute purulent discharge characterized by a thick, creamy, yellowish-white consistency that is so copious it obscures the underlying globe. The superior and inferior eyelids are markedly edematous (swollen) and erythematous, indicating significant periorbital inflammation. The surrounding skin appears irritated and macerated from contact with the abundant exudate. This presentation is a medical emergency due to the risk of rapid corneal perforation and permanent vision loss. The image serves as a critical educational tool for recognizing the signs of neonatal gonococcal conjunctivitis, emphasizing the urgency of immediate systemic antibiotic treatment and ocular irrigation.

Finding Sources
Finding Sources
Reading File
Reading File
I have all the content I need. Now let me build the continuation PDF with Gonorrhoea + Scabies + Pediculosis pubis sections, then merge it with the previous PDF.
Writing File

~/genital-tract-infections/build_stis_part2.py


import requests, os
from io import BytesIO
from PIL import Image as PILImage

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    Image, HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import Flowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from pypdf import PdfWriter, PdfReader

PART2_OUT  = "/tmp/workspace/genital-tract-infections/STIs_Part2_GC_Scabies.pdf"
PART1      = "/tmp/workspace/genital-tract-infections/STIs_MBBS_Apurba_Sastri.pdf"
FINAL_OUT  = "/tmp/workspace/genital-tract-infections/STIs_MBBS_Complete_Apurba_Sastri.pdf"

# ── colours (same palette as Part 1) ─────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a3a5c")
MID_BLUE    = colors.HexColor("#2563a8")
LIGHT_BLUE  = colors.HexColor("#dbeafe")
ACCENT_RED  = colors.HexColor("#c0392b")
GOLD        = colors.HexColor("#d4a017")
GREEN       = colors.HexColor("#1e8449")
LIGHT_GREEN = colors.HexColor("#d5f5e3")
PURPLE      = colors.HexColor("#6c3483")
WHITE       = colors.white
BLACK       = colors.HexColor("#1a1a1a")
TABLE_HEAD  = DARK_BLUE
TABLE_ALT   = colors.HexColor("#eaf0fb")
TEAL        = colors.HexColor("#117a65")
BROWN       = colors.HexColor("#784212")
W, H        = A4

styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, parent=styles["Normal"], **kw)

body_style    = S("Body",   fontSize=9.5, textColor=BLACK,   fontName="Helvetica",  spaceAfter=3, leading=14, alignment=TA_JUSTIFY)
bullet_style  = S("Bullet", fontSize=9.5, textColor=BLACK,   fontName="Helvetica",  spaceAfter=2, leading=13, leftIndent=14)
caption_style = S("Cap",    fontSize=7.5, textColor=colors.HexColor("#555555"), fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=4)
source_style  = S("Src",    fontSize=7.5, textColor=colors.HexColor("#777777"), fontName="Helvetica-Oblique", alignment=TA_CENTER)
must_hdr      = S("MH",     fontSize=9, textColor=colors.HexColor("#7b2000"), fontName="Helvetica-Bold", spaceAfter=2)
gtk_hdr       = S("GH",     fontSize=9, textColor=GREEN, fontName="Helvetica-Bold", spaceAfter=2)
con_hdr       = S("CH",     fontSize=9, textColor=MID_BLUE, fontName="Helvetica-Bold", spaceAfter=2)
note_style    = S("Note",   fontSize=9, textColor=colors.HexColor("#1a5276"), fontName="Helvetica-Oblique", spaceAfter=2, leading=13)
mem_key       = S("MK",     fontSize=9, textColor=DARK_BLUE, fontName="Helvetica-Bold", leading=12)
mem_val       = S("MV",     fontSize=9, textColor=BLACK, fontName="Helvetica", leading=13)

CACHE = "/tmp/workspace/genital-tract-infections/img_cache2"
os.makedirs(CACHE, exist_ok=True)

def fetch_img(url, max_w, max_h):
    fname = os.path.join(CACHE, url.split("/")[-1][:60] + ".jpg")
    if not os.path.exists(fname):
        try:
            r = requests.get(url, timeout=25)
            img = PILImage.open(BytesIO(r.content)).convert("RGB")
            img.save(fname, "JPEG", quality=85)
        except Exception as e:
            print(f"  [WARN] {e}")
            return None
    try:
        img = PILImage.open(fname)
        iw, ih = img.size
        scale = min(max_w/iw, max_h/ih, 1.0)
        return Image(fname, width=iw*scale, height=ih*scale)
    except:
        return None

class ColorBanner(Flowable):
    def __init__(self, text, bg=DARK_BLUE, text_color=WHITE, height=28, font_size=13):
        super().__init__()
        self.text, self.bg, self.text_color = text, bg, text_color
        self.height, self.font_size = height, font_size
        self.width = W - 4*cm
    def draw(self):
        self.canv.setFillColor(self.bg)
        self.canv.roundRect(0, 0, self.width, self.height, 6, fill=1, stroke=0)
        self.canv.setFillColor(self.text_color)
        self.canv.setFont("Helvetica-Bold", self.font_size)
        self.canv.drawString(10, 8, self.text)

def banner(text, bg=DARK_BLUE, font_size=13):
    return [Spacer(1,4*mm), ColorBanner(text, bg=bg, font_size=font_size), Spacer(1,3*mm)]

def colored_box(paragraphs, bg=LIGHT_BLUE, border=MID_BLUE):
    data = [[p] for p in paragraphs]
    t = Table(data, colWidths=[W-4*cm-10])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0),(-1,-1), bg),
        ("BOX",           (0,0),(-1,-1), 0.8, border),
        ("TOPPADDING",    (0,0),(-1,-1), 5),
        ("BOTTOMPADDING", (0,0),(-1,-1), 5),
        ("LEFTPADDING",   (0,0),(-1,-1), 8),
        ("RIGHTPADDING",  (0,0),(-1,-1), 8),
    ]))
    return [t, Spacer(1,3*mm)]

def must_box(items):
    paras = [Paragraph("<b>MUST KNOW</b>", must_hdr)] + [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=colors.HexColor("#fff5f5"), border=ACCENT_RED)

def gtk_box(items):
    paras = [Paragraph("<b>GOOD TO KNOW</b>", gtk_hdr)] + [Paragraph(f"• {i}", bullet_style) for i in items]
    return colored_box(paras, bg=LIGHT_GREEN, border=GREEN)

def concept_box(text):
    paras = [Paragraph("<b>UNDERSTANDING THE CONCEPT</b>", con_hdr), Paragraph(text, note_style)]
    return colored_box(paras, bg=colors.HexColor("#eaf4fb"), border=MID_BLUE)

def data_table(headers, rows, col_widths=None):
    if col_widths is None:
        col_widths = [(W-4*cm)/len(headers)]*len(headers)
    hdr_cells = [Paragraph(str(h), S(f"th{i}", fontSize=8, fontName="Helvetica-Bold", textColor=WHITE, leading=11)) for i,h in enumerate(headers)]
    data = [hdr_cells]
    for row in rows:
        data.append([Paragraph(str(c), S("td", fontSize=7.5, fontName="Helvetica", leading=11)) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0),(-1,0),  TABLE_HEAD),
        ("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, TABLE_ALT]),
        ("GRID",          (0,0),(-1,-1), 0.4, colors.HexColor("#bbbbbb")),
        ("TOPPADDING",    (0,0),(-1,-1), 4),
        ("BOTTOMPADDING", (0,0),(-1,-1), 4),
        ("LEFTPADDING",   (0,0),(-1,-1), 5),
        ("RIGHTPADDING",  (0,0),(-1,-1), 5),
        ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ]))
    return [t, Spacer(1,4*mm)]

def side_by_side(img1, cap1, img2, cap2):
    elems = []
    if img1 and img2:
        row = Table([[img1, img2]], colWidths=[8*cm, 8.5*cm])
        row.setStyle(TableStyle([("ALIGN",(0,0),(-1,-1),"CENTER")]))
        elems.append(row)
        elems.append(Paragraph(f"Left: {cap1}  |  Right: {cap2}", caption_style))
        elems.append(Spacer(1,3*mm))
    elif img1:
        elems += [img1, Paragraph(cap1, caption_style), Spacer(1,3*mm)]
    return elems

def mem_row(key, val):
    row = Table([[Paragraph(key, mem_key), Paragraph(val.replace("\n","<br/>"), mem_val)]],
                colWidths=[4*cm, 12.5*cm])
    row.setStyle(TableStyle([
        ("BACKGROUND",   (0,0),(0,0), LIGHT_BLUE),
        ("BACKGROUND",   (1,0),(1,0), WHITE),
        ("BOX",          (0,0),(-1,-1), 0.5, colors.HexColor("#aaaaaa")),
        ("TOPPADDING",   (0,0),(-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
        ("LEFTPADDING",  (0,0),(-1,-1), 6),
        ("RIGHTPADDING", (0,0),(-1,-1), 6),
        ("VALIGN",       (0,0),(-1,-1), "TOP"),
    ]))
    return [row, Spacer(1,1.5*mm)]

# ── IMAGE URLS ─────────────────────────────────────────────────────────────
IMG_GC_GRAM   = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_49c86effa4021e59657886e97ce58c349540b937d7b504ae3b119d03553d54cf.jpg"
IMG_GC_OPHTH1 = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_b4babec74020023e0b35fd767293e152071bf708f266a19a63b4358fa1b7fdbe.jpg"
IMG_GC_OPHTH2 = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_21bcc269771e5fac66a89655631c877651500721def919e96d0c2811bf49ab27.jpg"
IMG_SCABIES1  = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_26de21e2cc1e785dc2438c7884ac81ad0357a64e8178646696fba67eb1f82e84.jpg"
IMG_SCABIES2  = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_6f3bcfcd2ee15cf23777f761feee1e32b5a7f4fb098b7456cbfd32856cbbf03f.jpg"
IMG_LICE1     = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_10c853e24b8ff31c230b32da3612f8f817383a1f9292761710a6ea3ab9b7da20.jpg"
IMG_LICE2     = "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_4e36ce32c94242baf4345c7b66704db39bf155803d572d3f509b144db45f04f8.jpg"

# ════════════════════════════════════════════════════════════════════════════
def build_part2():
    doc = SimpleDocTemplate(PART2_OUT, pagesize=A4,
                            leftMargin=2*cm, rightMargin=2*cm,
                            topMargin=2*cm, bottomMargin=2*cm)
    story = []

    # ════════════════════════════════════════════════════════════════════════
    # SECTION A — NEISSERIA GONORRHOEAE / GONORRHOEA
    # ════════════════════════════════════════════════════════════════════════
    story += banner("SECTION A: NEISSERIA GONORRHOEAE — GONORRHOEA", bg=DARK_BLUE)
    story.append(Paragraph(
        "Gram-negative diplococci; fastidious growth requirements; the most common bacterial cause of cervicitis and urethritis alongside Chlamydia. "
        "N. gonorrhoeae is the SECOND most common bacterial STI globally.", body_style))

    story.append(Paragraph("<b>Morphology & Biology</b>", S("h2", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += must_box([
        "Gram-negative DIPLOCOCCI — kidney bean/coffee bean shaped, paired with flat adjacent sides",
        "Size: 0.6–1.0 µm in diameter",
        "Fastidious: Growth best at 35–37°C in humid atmosphere with 5–10% CO₂",
        "Oxidase POSITIVE, Catalase POSITIVE",
        "Acid produced from GLUCOSE ONLY (oxidatively, NOT fermentation) — used to differentiate from N. meningitidis (glucose + maltose)",
        "HUMANS are the only natural host — no animal reservoir",
        "Extracellular survival is poor — dies quickly outside host",
        "CULTURE MEDIA: Thayer-Martin (Modified) medium — chocolate agar + Vancomycin (inhibits gram+) + Colistin (inhibits gram-neg) + Nystatin (inhibits fungi)",
        "Incubation: CO₂ enriched atmosphere (candle-jar or CO₂ incubator)",
    ])

    story.append(Paragraph("<b>Virulence Factors</b>", S("h2b", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += data_table(
        ["Virulence Factor", "Function", "Clinical Significance"],
        [
            ["PILI (Fimbriae)", "Attachment to columnar epithelial cells; anti-phagocytic", "Critical for initial colonisation; undergo antigenic variation → evade immunity"],
            ["Opa proteins (Opacity proteins)", "Mediate tight adherence to host cells and between gonococci", "Opacity of colonies on culture; promote invasion"],
            ["Por proteins (Porin, PorB)", "Forms pores in outer membrane; prevents phagolysosome fusion", "Promotes intracellular survival; serovar-based typing"],
            ["Rmp (Reduction modifiable protein)", "Stimulates blocking antibodies that protect other Ag from killing", "Reduces bactericidal effect of host antibodies"],
            ["LOS (Lipooligosaccharide)", "Endotoxin activity; mimics host lacto-N-neotetraose (molecular mimicry)", "Causes local inflammation; evades complement"],
            ["IgA protease", "Cleaves secretory IgA1 on mucosal surfaces", "Destroys first line of mucosal immunity"],
            ["Transferrin/Lactoferrin receptors", "Scavenge iron from host proteins", "Enable survival in iron-poor mucosal environment"],
            ["Beta-lactamase (PPNG strains)", "Destroys penicillin ring", "Penicillinase-producing N. gonorrhoeae = penicillin resistance"],
        ],
        col_widths=[4*cm, 5.5*cm, 7*cm]
    )

    story += gtk_box([
        "ANTIGENIC VARIATION: Pili and Opa proteins undergo phase variation (on/off switching) and antigenic variation (structural changes) — this is WHY effective GC vaccine is extremely difficult to develop",
        "MOLECULAR MIMICRY: LOS mimics human cell surface carbohydrates (lacto-N-neotetraose) — this helps N. gonorrhoeae evade complement-mediated killing",
        "Patients with COMPLEMENT DEFICIENCY (C5–C9, terminal pathway) have higher risk of DISSEMINATED gonococcal infection (bacteraemia, arthritis)",
        "PPNG = Penicillinase-producing N. gonorrhoeae — plasmid-encoded beta-lactamase; first reported 1976",
        "Thayer-Martin medium VCNT: Vancomycin (V) + Colistin (C) + Nystatin (N) + Trimethoprim (T) — selects for only gonococci/meningococci",
    ])
    story += concept_box(
        "Why is N. gonorrhoeae so good at evading the immune system? ANTIGENIC VARIATION of pili and Opa "
        "proteins means the organism can change its surface antigens WITHIN a single infection — antibodies "
        "made against one pili variant don't work against another variant expressed later. This is called "
        "phase variation (pili on/off) and antigenic variation (different pili types). MOLECULAR MIMICRY "
        "of LOS with host carbohydrates prevents complement activation. IgA protease destroys the mucosal "
        "antibody defence. Combined, these mechanisms explain why people can get gonorrhoea REPEATEDLY — "
        "natural infection does NOT confer lasting immunity, and no vaccine exists."
    )
    story.append(PageBreak())

    story += banner("A (continued): CLINICAL DISEASES OF GONORRHOEA", bg=MID_BLUE)

    # GC Gram stain image
    img_gc1 = fetch_img(IMG_GC_GRAM, max_w=13*cm, max_h=7*cm)
    if img_gc1:
        story.append(KeepTogether([img_gc1,
            Paragraph("Gram stain of vaginal discharge: intracellular Gram-negative diplococci (pink, bean-shaped) inside PMN neutrophils — diagnostic of gonorrhoea", caption_style),
            Spacer(1,3*mm)]))

    story += must_box([
        "IP (Incubation Period): 2–5 days (shorter than Chlamydia's 7–10 days)",
        "MALE: Purulent urethral discharge (yellow/green) + DYSURIA; virtually ALL infected men are symptomatic",
        "FEMALE: Primary site = ENDOCERVIX (columnar epithelial cells); vaginal squamous epithelium is RESISTANT post-puberty",
        "FEMALE symptoms: vaginal discharge + dysuria + abdominal pain; BUT many women are ASYMPTOMATIC carriers",
        "COMPLICATIONS (10–20% women): PID = salpingitis + tubo-ovarian abscess; ectopic pregnancy; infertility",
        "DISSEMINATED GC (DGI): 1–3% of infected women; lower % in men",
        "DGI features: fever + migratory polyarthralgia + SUPPURATIVE ARTHRITIS (wrists, knees, ankles) + PUSTULAR RASH on erythematous base over extremities",
        "OPHTHALMIA NEONATORUM (GC): purulent conjunctivitis appearing within 2–5 days of birth; risk of corneal perforation and blindness",
        "Prophylaxis for neonates: 1% SILVER NITRATE eye drops at birth (Credé's prophylaxis); OR erythromycin ointment",
        "RECTAL GONORRHOEA: proctitis; PHARYNGEAL GONORRHOEA: pharyngitis (from oro-genital contact)",
    ])

    # Ophthalmia neonatorum images
    img_oph1 = fetch_img(IMG_GC_OPHTH1, max_w=7.5*cm, max_h=6*cm)
    img_oph2 = fetch_img(IMG_GC_OPHTH2, max_w=7.5*cm, max_h=6*cm)
    story += side_by_side(img_oph1, "Gonococcal ophthalmia neonatorum: hyperacute purulent conjunctivitis with massive yellow-white discharge — MEDICAL EMERGENCY",
                          img_oph2, "Severe neonatal gonococcal eye infection: copious pus, marked eyelid oedema — risk of corneal perforation")

    story += gtk_box([
        "Fitz-Hugh-Curtis syndrome: perihepatitis — gonococcal (or chlamydial) infection spreads to liver capsule → RUQ pain, 'violin string' adhesions",
        "Bartholin's gland abscess: N. gonorrhoeae can infect Bartholin gland → bartholinitis (covered in genital tract infections section)",
        "Epididymitis (in men <35 yrs): CHLAMYDIA > GONORRHOEA; in men >35 yrs: coliforms (E. coli) predominate",
        "Periurethral abscesses and prostatitis can occur as complications in men",
        "GC arthritis vs Reactive arthritis: GC arthritis — CULTURE POSITIVE from joint or genitals; Reactive arthritis — CULTURE NEGATIVE from joint (immune-mediated), NAAT positive from genital site",
        "Newborn eye infection timing: GC appears DAY 2–5; Chlamydia appears DAY 5–14 (later onset)",
    ])

    story.append(Paragraph("<b>Laboratory Diagnosis</b>", S("h2c", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += must_box([
        "GRAM STAIN: Intracellular Gram-negative diplococci inside PMNs — DIAGNOSTIC in symptomatic MALES (sensitivity >95% in men with urethritis); LESS reliable in women (cervical flora confuses result)",
        "CULTURE: Thayer-Martin medium; CO₂ atmosphere; 35–37°C; 24–48 hrs; oxidase positive colonies; needed for antibiotic SENSITIVITY testing",
        "NAAT (PCR): GOLD STANDARD — most sensitive + specific; detects GC DNA in urine, genital swabs, rectal swabs, pharyngeal swabs; has replaced culture in most labs",
        "Biochemical ID: GC oxidises GLUCOSE ONLY (not maltose/lactose/sucrose) — differentiates from N. meningitidis (oxidises glucose + maltose)",
        "Immunological: Direct fluorescent antibody (DFA); coagglutination",
    ])

    story.append(Paragraph("<b>Treatment</b>", S("h2d", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE, spaceAfter=3)))
    story += data_table(
        ["Condition", "First-Line Treatment", "Notes"],
        [
            ["Uncomplicated GC urethritis/cervicitis", "Ceftriaxone 500 mg IM SINGLE DOSE + Azithromycin 1 g PO (dual therapy)", "ALWAYS add antichlamydial drug (dual therapy) — GC+Chlamydia co-infection is very common"],
            ["Disseminated GC (DGI)", "Ceftriaxone 1 g IV/IM daily x 7 days", "IV for arthritis; switch to oral when improving"],
            ["Ophthalmia neonatorum", "Ceftriaxone 25–50 mg/kg IV/IM (single dose) + saline eye wash", "Prophylaxis: 1% silver nitrate (Credé's) or erythromycin ointment at birth"],
            ["Penicillin allergy", "Spectinomycin 2 g IM single dose (NOT for pharyngeal GC)", "Or azithromycin 2 g (resistance increasing)"],
            ["PID (GC-related)", "Ceftriaxone + Doxycycline + Metronidazole", "Cover GC, Chlamydia, anaerobes"],
        ],
        col_widths=[4*cm, 6*cm, 6.5*cm]
    )
    story += must_box([
        "RESISTANCE patterns to remember:",
        "  • PPNG: Penicillinase-producing N. gonorrhoeae — β-lactamase mediated; PLASMID encoded",
        "  • CMRNG: Chromosomally mediated resistant N. gonorrhoeae — penicillin + tetracycline resistance",
        "  • QRNG: Quinolone-resistant N. gonorrhoeae — fluoroquinolones NO LONGER recommended for GC",
        "  • Cephalosporin resistance emerging — high-level cephalosporin resistance is a global public health concern",
        "DUAL THERAPY: Always treat both GC AND Chlamydia simultaneously — co-infection rate is 20-40%; treating GC alone with penicillin/cephalosporin causes POSTGONOCOCCAL URETHRITIS (PGU) due to residual Chlamydia",
    ])
    story += concept_box(
        "Why does N. gonorrhoeae infect COLUMNAR epithelium but NOT vaginal squamous epithelium? "
        "Pili and Opa proteins mediate attachment to columnar epithelial cells (cervical endocervix, fallopian tube, "
        "urethra, rectum, conjunctiva). Squamous cells lack the specific surface receptors for gonococcal adhesins. "
        "This is why: (1) Pre-pubertal girls with thinner, less keratinised vaginal epithelium CAN develop vaginal "
        "gonococcal infection; (2) Post-pubertal women develop CERVICITIS not vaginitis. "
        "POSTGONOCOCCAL URETHRITIS (PGU): When GC is treated with penicillin alone (without antichlamydial), "
        "the incubating Chlamydia (IP 7-10 days, slower than GC's 2-5 days) emerges 2-3 weeks later as 'new' "
        "urethritis — in reality it was already present as co-infection."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION B — SCABIES
    # ════════════════════════════════════════════════════════════════════════
    story += banner("SECTION B: SCABIES — Sarcoptes scabiei", bg=TEAL)
    story.append(Paragraph(
        "Scabies is a parasitic skin infestation caused by the <b>female itch mite Sarcoptes scabiei var hominis</b>. "
        "It causes intensely pruritic eruptions and is classified as an STI because genital/close body contact is the main transmission route in adults.", body_style))

    img_s1 = fetch_img(IMG_SCABIES1, max_w=7.5*cm, max_h=5.5*cm)
    img_s2 = fetch_img(IMG_SCABIES2, max_w=7.5*cm, max_h=5.5*cm)
    story += side_by_side(img_s1, "SEM: Female Sarcoptes scabiei mite in burrow — oval, flattened body, transverse ridges, spines; scybala (fecal pellets) visible in tunnel",
                          img_s2, "Dermatoscopy: Mite-gallery unit — mite at head of burrow, row of eggs, fecal pellets; 'jet trail' sign")

    story += must_box([
        "Causative agent: Sarcoptes scabiei var. hominis — female itch mite (Arachnida class; 8 legs as adult)",
        "Mite size: Female ~0.4 mm; Male smaller; CANNOT be seen with naked eye (barely visible as tiny white dot)",
        "LIFE CYCLE: Female burrows into stratum corneum → lays 2–3 eggs/day → larvae hatch in 3–4 days → nymphs → adults; entire cycle 10–14 days",
        "BURROW: Pathognomonic — short (1–10 mm), thin, grayish-white wavy lines in stratum corneum; found at finger webs, wrists, genitals, axillae, areola",
        "IP: 4–6 weeks for PRIMARY infestation (sensitisation period); 1–4 days for REINFESTATION (already sensitised)",
        "Transmission: Close physical/skin-to-skin contact; sexual contact in adults; shared clothing/bedding (less common); mites survive 24–36 hrs off host",
        "Number of mites: Usually <10–15 mites in normal scabies; HUNDREDS-THOUSANDS in Norwegian/Crusted scabies (immunocompromised)",
        "Classic lesion distribution: FINGER WEBS, wrists, genitals (penis/scrotum in males), breasts/areola (females), axillae, umbilicus, buttocks; SPARES face/scalp in adults (involved in infants and elderly)",
        "KEY SYMPTOM: INTENSE PRURITUS — WORSE AT NIGHT and after hot bath (when mites are more active)",
        "DIAGNOSIS: Clinical (history + distribution + nocturnal itch); SCRAPING of burrow under mineral oil → Sarcoptes mite/eggs/faeces under microscope; Dermatoscopy (jet-with-wake sign)",
    ])
    story += must_box([
        "TREATMENT (first line):",
        "  • Permethrin 5% cream — apply from NECK DOWN (include scalp/face in infants); leave 8–12 hrs; REPEAT after 1 week; Drug of choice",
        "  • Benzyl benzoate 25% lotion — applied 2 consecutive nights; cheaper alternative",
        "  • Oral IVERMECTIN 200 µg/kg single dose — for Norwegian/crusted scabies; severe cases; treatment failures; repeat in 2 weeks",
        "  • LINDANE (gamma-BHC) — 1% cream; NOT used in children <2 yrs, pregnant women, breastfeeding; neurotoxic; resistance increasing",
        "  • Treat ALL household/sexual contacts SIMULTANEOUSLY — even if asymptomatic",
        "  • Wash all clothes, bedding, towels in HOT WATER (>60°C) or seal in bag for 72 hrs",
        "PRURITUS may continue for 2–4 weeks after successful treatment (due to residual mite antigen) — use antihistamines",
    ])
    story += gtk_box([
        "NORWEGIAN/CRUSTED SCABIES: seen in immunocompromised (HIV, organ transplant, elderly in care homes); thousands of mites → hyperkeratotic crusted plaques; highly contagious; pruritus may be absent; treat with IVERMECTIN + permethrin",
        "Secondary bacterial infection (Group A Streptococcus, S. aureus) is a common complication → impetigo, cellulitis, post-streptococcal glomerulonephritis",
        "Nodular scabies: persistent pruritic nodules even after mite eradication — hypersensitivity reaction to mite antigens; treat with topical steroids",
        "Pubic area scabies is closely associated with other STIs — ALWAYS screen for gonorrhoea, chlamydia, syphilis concurrently",
        "Scabies is endemic in tropical countries and areas of overcrowding; outbreaks in hospitals/care homes",
        "Dermatoscopy 'JET WITH WAKE' sign: the dark triangular mite head (jet) at the end of a white burrow (wake)",
        "Maculae ceruleae: bluish-gray spots from mite feeding — classic sign of PUBIC LICE (NOT scabies)",
    ])
    story += concept_box(
        "Why does scabies itch so severely at NIGHT? The pruritus in scabies is NOT caused directly by the mite "
        "burrowing — it is a TYPE IV (delayed) HYPERSENSITIVITY REACTION to mite proteins, eggs, and faeces. "
        "During the day, clothing pressure keeps mites less active. At night (warmth under blankets), mites "
        "become more active, increasing exposure to antigens → intensified T-cell mediated response → worse itch. "
        "This is why the FIRST infestation has a 4–6 week lag (sensitisation required) while REINFESTATION "
        "causes symptoms within 1–4 days (already sensitised). NORWEGIAN SCABIES occurs in immunocompromised "
        "patients because the T-cell response fails — without T-cell killing of mite antigen, the number of mites "
        "multiplies to thousands (normal = <15 mites), causing crusted, hyperkeratotic plaques."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION C — PEDICULOSIS PUBIS (Crabs)
    # ════════════════════════════════════════════════════════════════════════
    story += banner("SECTION C: PEDICULOSIS PUBIS — Phthiriasis pubis (CRABS)", bg=BROWN)
    story.append(Paragraph(
        "Pediculosis pubis is infestation with <b>Phthirus pubis (Pthirus pubis)</b> — the pubic or crab louse. "
        "It causes pruritus of the anogenital region and is transmitted primarily by sexual contact in adults.", body_style))

    img_l1 = fetch_img(IMG_LICE1, max_w=8*cm, max_h=5.5*cm)
    img_l2 = fetch_img(IMG_LICE2, max_w=7.5*cm, max_h=5.5*cm)
    story += side_by_side(img_l1, "Dermatoscopy of pubic lice: adult crab lice attached to hair shafts; nits (full, brown) and empty white nit casings visible",
                          img_l2, "Phthiriasis palpebrarum: crab lice on eyelashes — translucent louse body with dark pigmentation from blood ingestion")

    story += must_box([
        "Causative organism: Phthirus pubis (Pthirus pubis) = CRAB LOUSE (family Pthiridae; Insecta class)",
        "Appearance: 1–2 mm, dorsoventrally flattened, tan to grayish-white; 4 of 6 legs end in CRAB-LIKE CLAWS (adapted to grip coarse pubic hair)",
        "DISTINGUISHES from head/body louse (Pediculus humanus): P. pubis is WIDER than long (crab-shaped); P. humanus is longer than wide",
        "Both nymphs and adults FEED ON HUMAN BLOOD — haematophagous ectoparasite",
        "Transmission: Primarily SEXUAL CONTACT in adults; also contaminated bedding/towels (mites survive 24–48 hrs off host); NOT animals",
        "Location: Primarily PUBIC REGION; also other coarse body hair — axilla, legs, perianal area, eyelashes, eyebrows, beard (NOT scalp — hair too fine)",
        "EYELASH INFESTATION in CHILDREN (Phthiriasis palpebrarum): may be a sign of SEXUAL ABUSE — must investigate",
        "IP (Egg-to-nymph): 6–10 days; adult lice reproductive maturity: 2–3 weeks after hatching",
        "KEY SYMPTOMS: PRURITUS of anogenital area; excoriation marks; MACULAE CERULEAE (bluish-gray skin spots) from louse feeding — classic sign",
        "DIAGNOSIS: Naked eye identification of adult lice or nits on pubic hair; confirm with hand lens/microscope/dermatoscope",
        "Nits = eggs attached to hair; Full nit = brown/opaque; Empty nit casing = white/translucent",
        "TREATMENT:",
        "  • Permethrin 1% cream rinse OR Pyrethrins + piperonyl butoxide — apply to affected areas, wash off after 10 minutes; REPEAT after 1 week",
        "  • Oral Ivermectin 250 µg/kg — for eyelash involvement OR treatment failures",
        "  • Malathion 0.5% lotion — 8–12 hrs application; for permethrin/pyrethrin resistant cases",
        "  • For eyelash infestation: mechanical removal with nit comb + petrolatum (Vaseline) smothering; OR oral ivermectin",
        "  • Wash ALL clothing, bedding, towels in hot water; treat ALL sexual contacts concurrently",
    ])
    story += gtk_box([
        "Pubic lice are NOT responsible for transmitting any infectious disease (unlike body lice which transmit typhus, relapsing fever)",
        "Pubic lice infestation is a MARKER for other STIs — patients with crabs have >2x higher risk of concurrent gonorrhoea or chlamydia",
        "INCIDENCE is declining in industrialised countries due to widespread adoption of pubic hair removal ('Brazilian waxing') — removing the habitat!",
        "Maculae ceruleae: 3–5 mm bluish-gray spots on trunk, abdomen, thighs — caused by louse injecting anticoagulant saliva; specific for PUBIC LICE (not scabies)",
        "Resistance to permethrin and pyrethrins is increasing globally",
        "Body lice (Pediculus humanus corporis) — unlike pubic lice — are VECTORS for Epidemic typhus (Rickettsia prowazekii), Relapsing fever (Borrelia recurrentis), Trench fever (Bartonella quintana)",
        "Head lice (Pediculus humanus capitis) are NOT STIs; spread by head-to-head contact; manage with permethrin, malathion, wet combing",
    ])
    story += concept_box(
        "Why do crab lice specifically prefer the PUBIC region? Phthirus pubis has specially adapted CRAB-LIKE "
        "CLAWS on 4 of its 6 legs that are sized to grip the WIDER-SPACED COARSE hairs of the pubic region "
        "(and axilla, eyebrows, beard). Head louse claws are adapted for the closer-spaced finer hairs of the "
        "scalp — so each louse species occupies a specific ecological niche based on hair diameter and spacing. "
        "MACULAE CERULEAE (azure spots) result from the louse's salivary anticoagulant (prevents blood from "
        "clotting during feeding) — this anticoagulant causes a localised tissue reaction with haemoglobin "
        "degradation to a bluish pigment (biliverdin). This distinguishes pubic lice from scabies clinically."
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION D — UPDATED MASTER COMPARISON TABLE
    # ════════════════════════════════════════════════════════════════════════
    story += banner("SECTION D: MASTER COMPARISON — ALL STIs", bg=DARK_BLUE)
    story += data_table(
        ["Feature", "N. gonorrhoeae", "C. trachomatis (D-K)", "T. pallidum", "H. ducreyi", "K. granulomatis"],
        [
            ["Type", "Gram-neg diplococcus", "Obligate intracellular", "Spirochaete", "Gram-neg coccobacillus", "Gram-neg coccobacillus"],
            ["Culture", "Thayer-Martin medium; CO₂", "Cell lines (McCoy); NOT routine", "CANNOT culture in vitro (rabbit testes)", "Iso Vitalex medium; factor X only", "Egg yolk / Levinthal agar"],
            ["Key test", "NAAT + Gram stain (symptomatic males)", "NAAT (gold standard)", "Dark-field microscopy + VDRL/RPR + FTA-ABS", "NAAT; culture; Gram stain (school of fish)", "Giemsa smear (Donovan bodies)"],
            ["Ulcer", "No ulcer (discharge)", "No ulcer (discharge)", "PAINLESS, hard chancre", "PAINFUL, soft", "PAINLESS, beefy red"],
            ["Treatment", "Ceftriaxone + Azithromycin", "Azithromycin / Doxycycline", "Benzathine penicillin G", "Azithromycin / Ceftriaxone", "Azithromycin / Doxycycline"],
        ],
        col_widths=[2.5*cm, 3.3*cm, 3.3*cm, 3.3*cm, 3.3*cm, 3.3*cm]
    )
    story += data_table(
        ["Feature", "Scabies (Sarcoptes scabiei)", "Pediculosis pubis (Phthirus pubis)", "Molluscum (Poxvirus)", "HSV (Herpes simplex)"],
        [
            ["Type", "Mite (Arachnida)", "Louse/insect (Insecta)", "Poxvirus (DNA)", "Herpesvirus (DNA)"],
            ["Key feature", "Burrow in stratum corneum; NOCTURNAL itch", "Crab-like lice on coarse hair; maculae ceruleae", "Pearly umbilicated papule; Henderson-Patterson bodies", "Painful vesicles → ulcers; recurrent (latent ganglia)"],
            ["Diagnosis", "Scraping: mite/eggs; dermatoscopy", "Naked eye / hand lens: lice + nits", "Clinical; histology", "Clinical; Tzanck smear; NAAT; viral culture"],
            ["Treatment", "Permethrin 5% cream; Ivermectin", "Permethrin 1%; Pyrethrins; Ivermectin", "Curettage, cryotherapy, cantharidin", "Acyclovir / Valacyclovir (suppressive)"],
        ],
        col_widths=[3*cm, 4*cm, 4*cm, 4*cm, 4.5*cm]
    )
    story.append(PageBreak())

    # ════════════════════════════════════════════════════════════════════════
    # SECTION E — ADDITIONAL MEMORY AIDS
    # ════════════════════════════════════════════════════════════════════════
    story += banner("SECTION E: ADDITIONAL MEMORY AIDS", bg=GOLD, font_size=12)

    mems = [
        ("GC vs Chlamydia — discharge", "GC: PROFUSE yellow-green PURULENT discharge; onset 2–5 days\nChlamydia: MILD watery/mucoid discharge; onset 7–10 days"),
        ("GC Gram stain rule", "Gram stain RELIABLE only in SYMPTOMATIC MALES (>95% sensitivity)\nIn females: use NAAT — normal cervical flora = confusing results"),
        ("Thayer-Martin medium", "VCNT: Vancomycin (GP) + Colistin (GN) + Nystatin (fungi) + Trimethoprim\nSelects specifically for Neisseria (GC + Meningococcus)"),
        ("GC sugar oxidation", "GC = Glucose ONLY\nN. meningitidis = Glucose + Maltose\n(Mnemonic: 'GO = GC Only oxidises Glucose')"),
        ("Complement deficiency + GC", "Terminal complement deficiency (C5–C9) → RECURRENT DISSEMINATED GC\n'No MAC = No defence against Neisseria'"),
        ("Scabies itch timing", "NOCTURNAL itch + 4–6 week IP (primary) = SCABIES\n1–4 days IP (reinfestation — already sensitised)"),
        ("Norwegian scabies", "Immunocompromised + hyperkeratotic crusted plaques = Norwegian scabies\nThousands of mites; treat with IVERMECTIN + Permethrin"),
        ("Scabies treatment", "Permethrin 5% NECK DOWN x 8–12 hrs; REPEAT in 1 wk\nInfants: include face/scalp; NO lindane in children"),
        ("Maculae ceruleae", "BLUISH-GRAY SPOTS on trunk/thighs = PUBIC LICE (NOT scabies)\nCaused by louse salivary anticoagulant → haemoglobin → biliverdin"),
        ("Pubic lice on eyelashes in child", "CONSIDER SEXUAL ABUSE — investigate appropriately\nPhthiriasis palpebrarum = eyelash infestation"),
        ("Lice disease vectors", "BODY LICE only: Typhus (Rickettsia), Relapsing fever (Borrelia), Trench fever (Bartonella)\nPubic lice and head lice: NO disease transmission"),
        ("GC ophthalmia vs Chlamydia", "GC: DAY 2–5 (EARLY, PROFUSE pus, HYPERACUTE)\nChlamydia: DAY 5–14 (later, less severe)\nProphylaxis: 1% silver nitrate (Credé's) / erythromycin ointment at birth"),
        ("Dual therapy for GC", "ALWAYS add antichlamydial drug with GC treatment\nReason: 20–40% co-infection; avoid PGU (postgonococcal urethritis)"),
        ("Penicillin resistance GC", "PPNG = Penicillinase-producing (plasmid; β-lactamase)\nCMRNG = Chromosomally mediated\nQRNG = Quinolone-resistant → fluoroquinolones CONTRAINDICATED for GC"),
    ]
    for key, val in mems:
        story += mem_row(key, val)

    story.append(Spacer(1,8*mm))
    story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
    story.append(Spacer(1,3*mm))
    story.append(Paragraph(
        "Continued from: STIs_MBBS_Apurba_Sastri.pdf | Sources: Medical Microbiology 9e (Murray et al.), "
        "Sherris & Ryan Medical Microbiology 8e, Campbell Walsh Wein Urology, Red Book 2021, "
        "Tintinalli Emergency Medicine, Robbins & Kumar Basic Pathology",
        source_style))

    doc.build(story)
    print(f"Part 2 PDF created: {PART2_OUT}")

# ════════════════════════════════════════════════════════════════════════════
# MERGE Part 1 + Part 2
# ════════════════════════════════════════════════════════════════════════════
def merge():
    writer = PdfWriter()
    for path in [PART1, PART2_OUT]:
        reader = PdfReader(path)
        for page in reader.pages:
            writer.add_page(page)
    with open(FINAL_OUT, "wb") as f:
        writer.write(f)
    print(f"Merged PDF: {FINAL_OUT}")

if __name__ == "__main__":
    build_part2()
    merge()
Running Command

cd /tmp/workspace/genital-tract-infections && python3 build_stis_part2.py 2>&1

Running Command

python3 -c " from pypdf import PdfReader r = PdfReader('/tmp/workspace/genital-tract-infections/STIs_MBBS_Complete_Apurba_Sastri.pdf') print(f'Total pages in merged PDF: {len(r.pages)}') import os size = os.path.getsize('/tmp/workspace/genital-tract-infections/STIs_MBBS_Complete_Apurba_Sastri.pdf') print(f'File size: {size/1024:.0f} KB') "

The complete merged PDF is ready — 31 pages, 1.3 MB:

STIs MBBS Complete Apurba Sastri

PDF Document · PDF


What was added (continuation from the STIs PDF):
SectionContentPhotos
A. Neisseria gonorrhoeaeMorphology, virulence factors table (Pili, Opa, Por, Rmp, LOS, IgA protease, Transferrin receptor, Beta-lactamase), diseases (urethritis, cervicitis, DGI, PID), resistance patterns (PPNG, CMRNG, QRNG)Gram stain with intracellular diplococci + 2 ophthalmia neonatorum photos
B. ScabiesSarcoptes scabiei life cycle, burrow, nocturnal itch, Norwegian scabies, treatment (permethrin 5%, ivermectin, lindane), treat all contactsSEM mite in burrow + dermatoscopy jet-trail sign
C. Pediculosis pubis (Crabs)Phthirus pubis morphology, maculae ceruleae, crab claws, eyelash infestation in children (sexual abuse marker), treatment (permethrin 1%, ivermectin), declining incidence due to Brazilian waxingDermatoscopy of lice + nits on pubic hair + eyelash infestation
D. Master Comparison TableAll 9 STIs compared across two tables (GC/Chlamydia/Syphilis/Chancroid/Donovanosis AND Scabies/Lice/Molluscum/HSV)-
E. Additional Memory Aids14 more mnemonics (GC vs Chlamydia, dual therapy rule, Norwegian scabies, maculae ceruleae, lice disease vectors, complement + GC, etc.)-
The complete PDF now covers every topic from the STIs-mbbs.pdf — Syphilis, Chlamydia (NGU/LGV), Granuloma inguinale, Chancroid, Gonorrhoea, Scabies, and Pediculosis pubis — all in the same Must Know / Good to Know / Understanding the Concept format with clinical photos.
This is a shared conversation. Sign in to Orris to start your own chat.