Suppose that I'm a gyanec and obstetrics doctor working in a renowned hospital a patient came by jus looking into the sonography and other reports how would I diagnose that it's a male or female tell me utmost doctor level explanation explain me with more examples and images so to make my concept Crystal clear
fetal sex determination ultrasound male female genitalia sonography

This diagnostic ultrasound illustrates fetal clitoromegaly and labial hypertrophy at 25 weeks of gestation, a key finding in the evaluation of ambiguous genitalia and congenital adrenal hyperplasia. Image (a) provides a sagittal view, highlighting a significantly thickened and prominent clitoris (indicated by a red arrow) protruding from the genital region. Image (b) presents an axial view of the same anatomy, where the enlarged clitoris (red arrow) is flanked by two distinct, hypoechoic, and homogenous labial swellings (white arrows). These findings demonstrate a departure from the normal 'three-line sign' of female genitalia, with the outer labial lines appearing divergent and convex rather than parallel. The imaging modality is B-mode prenatal sonography. This case is educationally significant for distinguishing between female genital virilization and severe male hypospadias during prenatal screening, emphasizing the importance of multi-planar assessment (sagittal and axial) and the identification of internal pelvic organs like the uterus for accurate sex determination.

This diagnostic imaging set consists of two grayscale fetal ultrasound images in the transverse plane, focusing on the external genitalia during the second trimester (approximately 18–20 weeks). Image (a) displays the characteristic sonographic appearance of a female fetus. An arrowhead points to a series of parallel, hyperechoic linear structures representing the labia majora and labia minora, often referred to as the 'hamburger sign' in clinical practice. Image (b) displays the sonographic appearance of a male fetus. The arrowhead indicates a distinct dome-shaped structure representing the phallus and scrotum. A central, longitudinal echogenic line is visible at the base of the structure, which is a characteristic finding for male genital development at this gestational age. These images serve as educational examples for fetal sex determination during routine prenatal screening. Key visual indicators highlighted include the presence of parallel lines (female) versus a protruding, dome-shaped morphologic structure (male). The surrounding environment shows typical hypoechoic amniotic fluid and varying echogenicity of fetal soft tissue.

This diagnostic ultrasound image demonstrates the external genitalia of a female fetus at 30 weeks and 4 days of gestation. The primary sonographic finding is the 'multiple parallel linear echo pattern' (also known as the hamburger sign), which is characteristic of the developing labia majora and labia minora. This pattern consists of three or more hyperechoic, parallel lines representing the labial folds, often separated by a thin hypoechoic midline cleft. The image is captured in a transverse perineal plane, clearly showing the absence of a male phallus or scrotum. This visualization is a key educational marker used in prenatal imaging to confirm female fetal sex and assess normal urogenital development in the third trimester. The surrounding structures include the anechoic amniotic fluid and adjacent fetal limbs, providing context for the perineal orientation.

This composite diagnostic image displays a 20-week gestation level 2 ultrasound scan focusing on fetal perineal anatomy. The image is split into two views: a standard 2D grayscale sonogram on the left and a 3D/surface-rendered reconstruction on the right. In both views, the external male genitalia are clearly visualized and annotated with colored arrows. A blue arrow identifies the penis, which appears as an elongated, echogenic projection. A red arrow identifies the scrotum, seen as a rounded, more inferiorly positioned structure. The 3D view provides enhanced spatial perspective and surface topography of the genital phenotype. This imaging is used during routine second-trimester anatomy scans for sex determination and to screen for genital anomalies. In this clinical context, the visualization of a clear male phenotype is used to confirm fetal sex, particularly when investigating discrepancies with non-invasive prenatal testing (NIPT).

This diagnostic image is a gray-scale prenatal ultrasound from a midtrimester scan, specifically focusing on the fetal perineum to identify external genitalia. The scan displays a transverse view of the pelvic region. Key anatomical features include two parallel hyperechoic (bright) linear structures representing the labia majora. Centrally located between these lines is a smaller, distinct hyperechoic nodule corresponding to the clitoris, forming the characteristic 'hamburger sign' indicative of female fetal sex. The surrounding anechoic (dark) areas represent amniotic fluid, providing the necessary acoustic window for visualization. This image is clinically significant for routine obstetric screening, demonstrating the standard morphological markers used for sex determination and the assessment of external genital development during the second trimester of pregnancy.

This diagnostic ultrasound image shows a midline sagittal view of a human fetus at 13 weeks of gestation during the first trimester. The fetus is oriented horizontally with its caudal end positioned toward the left of the frame. The primary educational focus is fetal sex determination through the assessment of the genital tubercle. A white arrow points to the genital tubercle located at the caudal extremity of the fetal torso. The tubercle is oriented parallel (at an angle of less than 30 degrees) to the horizontal axis of the fetus, which is a sonographic marker indicative of female gender development. The image clearly demonstrates the relationship between the genital tubercle and the lumbosacral spine/rump contour. This technique is clinically significant in prenatal screening for early gender identification and the evaluation of normal external genitalia development.

Diagnostic ultrasound images (a and b) in grayscale, demonstrating fetal genital anatomy at the 27th week of pregnancy via an abdominal approach. The images focus on the perineal region of a male fetus to evaluate suspected penoscrotal hypospadias. In image (a), the scrotum is visible as a distinct hyperechoic, rounded structure, but the phallus (penis) is conspicuously absent or poorly visualized in its expected anatomical position. In image (b), an alternative cross-sectional view emphasizes the scrotal sac, which appears somewhat bifid or flattened, again without a clearly identifiable protruding penis. This lack of visualization of the penis in the presence of a scrotum on 2D ultrasound is a key diagnostic indicator for severe hypospadias or ambiguous genitalia. These images serve as a clinical example of the limitations of 2D ultrasound in characterizing complex urogenital malformations compared to 3D rendering, emphasizing the anatomical markers for male fetal sex determination and the detection of congenital penile abnormalities.

This diagnostic 2D ultrasound image captures a fetal perineum in a transverse-oblique plane, focusing on the external male genitalia to demonstrate signs of severe hypospadias. The image reveals a shortened penis with ventral angulation, positioned between two prominent scrotal folds—a configuration often referred to as the 'tulip sign' in prenatal sonography. Both testes are visible within the scrotal sacs. A white arrow indicates the anomalous, proximal localization of the urethral meatus, suggesting a third-degree (perineoscrotal) hypospadias. The clinical significance of this finding lies in the prenatal detection of genital malformations, which allows for early pediatric surgical consultation and planning for reconstruction. The visualization of the blunted, bulbous tip of the penis and its ventral orientation relative to the bifid scrotum are key diagnostic features shown here, characteristic of advanced-level obstetric and fetal morphology examinations.
genital tubercle angle 11 13 weeks first trimester sex determination sagittal

This diagnostic ultrasound image shows a midline sagittal view of a human fetus at 13 weeks of gestation during the first trimester. The fetus is oriented horizontally with its caudal end positioned toward the left of the frame. The primary educational focus is fetal sex determination through the assessment of the genital tubercle. A white arrow points to the genital tubercle located at the caudal extremity of the fetal torso. The tubercle is oriented parallel (at an angle of less than 30 degrees) to the horizontal axis of the fetus, which is a sonographic marker indicative of female gender development. The image clearly demonstrates the relationship between the genital tubercle and the lumbosacral spine/rump contour. This technique is clinically significant in prenatal screening for early gender identification and the evaluation of normal external genitalia development.

**Imaging Modality:** Obstetric Ultrasound (2D grayscale). **Anatomical Region:** Intrauterine environment showing a single fetus in a mid-sagittal plane. **Clinical Context:** First-trimester screening, approximately 12–13 weeks gestation. **Key Visual Features:** * **Fetal Anatomy:** The image captures the fetus in a profile view, demonstrating the head (cranium), thorax, and abdomen. The fetal spine is visible along the lower aspect of the trunk. * **Cranial Structures:** Early ossification of the skull is evident. The nasal bone and facial profile are distinguishable. * **Nuchal Region:** The nuchal translucency (NT) space—the sonographic appearance of subcutaneous fluid behind the fetal neck—is visible for assessment. * **Genitourinary Markers:** A prominent genital tubercle (phallus) is visualized at the caudal end of the torso. The cranial orientation of the tubercle (angle relative to the lumbosacral spine) is a sonographic marker used for early fetal sex determination, suggesting male development. * **Environment:** The fetus is surrounded by anechoic amniotic fluid, providing clear visualization of the fetal borders. **Diagnostic Significance:** This plane is critical for assessing crown-rump length (CRL), nuchal translucency thickness, and early anatomical surveys including the presence of the nasal bone and genital tubercle orientation.

Diagnostic ultrasound images showing two side-by-side midsagittal views (a and b) of a fetus at approximately 12 weeks of gestation. The fetus is positioned in a supine orientation within the amniotic sac, with visible anatomical landmarks including the head, spine, and caudal region. The images demonstrate specific sonographic markers used for fetal sex determination. Panel (a) illustrates the measurement of the anogenital distance (AGD), shown as a linear caliper measurement (7.40 mm) extending from the anterior edge of the anus to the tip of the genital tubercle. Panel (b) illustrates the genital tubercle angle (GTA), showing an angular measurement (36.47 degrees) formed between a horizontal reference line and the longitudinal axis of the genital tubercle. These sonographic markers are clinically relevant for early prenatal screening and gender identification, as larger AGD and higher GTA values are statistically associated with male fetal development during the first trimester.

This diagnostic ultrasound image shows a mid-sagittal section of a fetus at 13 weeks and 2 days of gestation. The primary educational focus is the measurement of the Maxilla-Nasion-Mandible (MNM) angle, a clinical marker used in first-trimester screening to evaluate facial profiles and detect potential anomalies like micrognathia or retrognathia. The image displays two intersecting dotted lines originating from the nasion (the junction of the frontal and nasal bones), with one line extending along the maxilla and the other along the mandible, resulting in a measured angle of 6.97 degrees. Additionally, a Nuchal Translucency (NT) measurement of 1.87 mm is visible in the lower left, indicating a normal range for this gestational age. Key anatomical landmarks visible include the fetal forehead, nasal bone, maxilla, mandible, and the fluid-filled space at the back of the neck. This image serves as a reference for normal fetal craniofacial development in obstetrics and prenatal diagnostics.
turtle sign male fetus penis scrotum second trimester ultrasound

This diagnostic image is a 3D surface rendering ultrasound of male fetal external genitalia at 20 weeks of gestation. The rendering provides a detailed view of the perineal region, showing the developing penis and scrotum. The penis is visible as an elongated, midline protuberance with a smooth surface contour. Posterior to the phallus, the scrotal sac appears as a distinct, bulbous structure. The image demonstrates the spatial relationship between the fetal limbs and the genital area, highlighting the 'snail sign' or 'turtle sign' characteristic of male fetal sex identification in the second trimester. Clinical significance includes the assessment of sexual development and screening for potential anatomical variations, such as hypospadias or ambiguous genitalia, particularly in cases where prenatal genetic screening suggests mosaicism or sex development disorders.

This diagnostic imaging set consists of two grayscale fetal ultrasound images in the transverse plane, focusing on the external genitalia during the second trimester (approximately 18–20 weeks). Image (a) displays the characteristic sonographic appearance of a female fetus. An arrowhead points to a series of parallel, hyperechoic linear structures representing the labia majora and labia minora, often referred to as the 'hamburger sign' in clinical practice. Image (b) displays the sonographic appearance of a male fetus. The arrowhead indicates a distinct dome-shaped structure representing the phallus and scrotum. A central, longitudinal echogenic line is visible at the base of the structure, which is a characteristic finding for male genital development at this gestational age. These images serve as educational examples for fetal sex determination during routine prenatal screening. Key visual indicators highlighted include the presence of parallel lines (female) versus a protruding, dome-shaped morphologic structure (male). The surrounding environment shows typical hypoechoic amniotic fluid and varying echogenicity of fetal soft tissue.

This diagnostic image is a 3D Realistic Vue ultrasound rendering of a male fetus's external genitalia at 30 weeks of gestation. The anatomical structures include the penis, positioned superiorly, and the scrotum, which appears as a distinct, bilobed sac-like structure located inferiorly. The rendering utilizes advanced light and shadow modeling, with a virtual light source at the 11 o'clock position and a 270-degree rotation to enhance the three-dimensional perception of depth and morphology. The image demonstrates normal fetal development in the third trimester, focusing on the clear identification of male anatomical landmarks. The clinical significance of this modality lies in its ability to provide high-definition anatomical details during prenatal screening, facilitating the confirmation of fetal sex and the assessment of structural development in the pelvic region.

This grayscale diagnostic ultrasound image captures the external fetal genitalia of a 20-week gestation fetus in the axial plane, demonstrating the 'tulip sign' associated with ambiguous genitalia. The key sonographic feature is the lateral displacement and splaying of the labioscrotal folds, which appear as two echogenic, curved structures flanking a central, smaller, hypoechoic genital tubercle (phallus). This configuration mimics the petals of a tulip enclosing a central bud, a classic marker for severe hypospadias or micropenis with bifid scrotum in a 46, XY fetus. The surrounding environment shows anechoic fluid, though the volume is reduced, consistent with oligohydramnios. This visual is significant for prenatal diagnosis of disorders of sexual development (DSD) and complex genetic conditions such as MIRAGE syndrome. The image illustrates fundamental fetal anomaly scanning techniques, focusing on urogenital morphology and the identification of atypical genital development in the second trimester.
3D ultrasound male female fetal genitalia surface rendering comparison

This diagnostic image presents a three-dimensional (3D) ultrasound surface rendering of male fetal external genitalia, illustrating severe congenital anomalies. The rendering is divided into two primary views (a and b) with associated insets and annotations. The images demonstrate a shortened penis with a characteristic ventral curvature known as chordee. A prominent surplus of prepucial tissue is visible at the distal end, forming a 'prepucial cap' or dorsal hood, a typical finding in hypospadias. Annotations highlight the suspected ectopic location of the urethral meatus at the base of the penis near the interscrotal fold, rather than at the glans tip. The scrotum appears bifid with two distinct scrotal folds, within which both testicles are visualized as descended. The transverse view (b) emphasizes the ventral angulation and the spatial relationship between the penis, scrotum, and perineum. This visual configuration is highly characteristic of a third-degree (severe) hypospadias. The image serves as an educational tool for prenatal diagnosis of genital malformations and demonstrates the utility of 3D ultrasound in mapping anatomical structural relations for surgical planning.

Two-panel 3D prenatal ultrasound in surface rendering mode showing the external genitalia of a male fetus at 33 weeks' gestation, demonstrating features of penoscrotal hypospadias. Image (a) provides a clear view of a bifid scrotum, characterized by a distinct central cleft dividing the scrotal sac into two separate halves. Image (b) shows the spatial relationship between the genitalia, where a short, micropenis-like structure is visible adjacent to the bifid scrotum. In both renderings, the presence of descended testicles within the scrotal halves is suggested by the internal contours of the bifid structure. These diagnostic images are used in maternal-fetal medicine to evaluate congenital urogenital anomalies, facilitating prenatal diagnosis and parental counseling regarding postnatal surgical management.

This diagnostic image is a 3D surface rendering ultrasound of male fetal external genitalia at 20 weeks of gestation. The rendering provides a detailed view of the perineal region, showing the developing penis and scrotum. The penis is visible as an elongated, midline protuberance with a smooth surface contour. Posterior to the phallus, the scrotal sac appears as a distinct, bulbous structure. The image demonstrates the spatial relationship between the fetal limbs and the genital area, highlighting the 'snail sign' or 'turtle sign' characteristic of male fetal sex identification in the second trimester. Clinical significance includes the assessment of sexual development and screening for potential anatomical variations, such as hypospadias or ambiguous genitalia, particularly in cases where prenatal genetic screening suggests mosaicism or sex development disorders.

This diagnostic image is a surface-rendered three-dimensional (3D) ultrasound of fetal external genitalia at 28 weeks of gestation, focusing on a ventral view of the penis. The visualization demonstrates a short penile shaft with a distinct structural abnormality. An arrow highlights a shallow, longitudinal groove running vertically along the ventral surface. This finding is characteristic of incomplete fusion of the urogenital folds, a key sonographic marker for fetal hypospadias. The image serves as a clinical example of prenatal diagnostic imaging in obstetrics and fetal medicine, illustrating how 3D ultrasound surface rendering can identify anatomical malformations of the male urethra and penile development. The educational focus is on the detection of urogenital anomalies during routine third-trimester screening.
ambiguous genitalia disorders sexual development prenatal ultrasound DSD

This grayscale diagnostic ultrasound image captures the external fetal genitalia of a 20-week gestation fetus in the axial plane, demonstrating the 'tulip sign' associated with ambiguous genitalia. The key sonographic feature is the lateral displacement and splaying of the labioscrotal folds, which appear as two echogenic, curved structures flanking a central, smaller, hypoechoic genital tubercle (phallus). This configuration mimics the petals of a tulip enclosing a central bud, a classic marker for severe hypospadias or micropenis with bifid scrotum in a 46, XY fetus. The surrounding environment shows anechoic fluid, though the volume is reduced, consistent with oligohydramnios. This visual is significant for prenatal diagnosis of disorders of sexual development (DSD) and complex genetic conditions such as MIRAGE syndrome. The image illustrates fundamental fetal anomaly scanning techniques, focusing on urogenital morphology and the identification of atypical genital development in the second trimester.

This figure presents a clinical case of ambiguous genitalia through prenatal ultrasound and postnatal photography. Panel (a) contains four frames of prenatal ultrasound (2D and 3D) from the second trimester. It highlights a labial/scrotum-like formation (indicated by blue arrows) and a prominent median phallus-like structure (indicated by red arrows), illustrating the diagnostic difficulty in fetal gender assignment. Panel (b) is a clinical photograph of the neonate at 24 hours of age. The image shows the perineal region with gloved hands retracting the skin to reveal a small phallus (1.4 cm) with a hyperpigmented base and a blind dimple on the glans. The visible morphology is consistent with Prader stage 4 virilization, showing significant clitoral enlargement or a microphallus with a ventrally opening urethra (hypospadias) at the base. The presentation is typical for Disorders of Sex Development (DSD), such as 45,X/46,XY mosaicism. This material serves as an educational resource for prenatal diagnosis, neonatal physical examination, and the classification of genital ambiguity.

This composite figure presents clinical and diagnostic imaging from a case of 46XY Disorder of Sexual Development (DSD). (a) Clinical photograph of ambiguous external genitalia showing a normal-sized phallus positioned superiorly and a female-like urethral opening in the perineum with an inserted catheter. (b, c) Clinical photographs of the torso demonstrating bilateral Grade II gynecomastia. (d) Axial and (e) sagittal CT scans of the pelvis identifying a solid tumor mass (red arrows) located posterior to the bladder and anterior to the rectum. (f, g) Ultrasound images of the mammary glands showing fibroglandular tissue measurements. (h) Ultrasound of the left scrotal testicle. (i, j) Transrectal or pelvic ultrasound images revealing internal structures including a prostate-like echo and bilateral seminal vesicles. The collection illustrates the phenotypic and internal anatomical hallmarks used in the differential diagnosis of DSD, specifically partial gonad dysgenesis associated with a pelvic seminoma mixed with yolk sac tumor.
fetal sex determination ultrasound sonography signs hamburger turtle sign accuracy gestational age gynecologist
Important Legal Note: In India, fetal sex determination and disclosure to patients is prohibited under the Pre-Conception and Pre-Natal Diagnostic Techniques (PC-PNDT) Act, 1994. The information below is strictly for academic, clinical training, and anomaly detection purposes (e.g., diagnosing disorders of sexual development).
| Angle | Sex Prediction |
|---|---|
| > 30° (cranial, pointing UP toward fetus's head) | MALE |
| < 10° (parallel or caudal, pointing DOWN) | FEMALE |
| 10-30° (intermediate) | Indeterminate - repeat later |
| CRL | Gestational Age | Accuracy |
|---|---|---|
| < 50 mm | < 11+4 weeks | ~40-50% (not reliable) |
| 50-55 mm | 11+4 to 12 weeks | ~75% |
| 55-60 mm | ~12 weeks | ~96% |
| ≥ 60 mm | 12+2 weeks | ~99-100% |
| ≥ 76 mm | ~13 weeks | 99-100% |









| Feature | MALE | FEMALE |
|---|---|---|
| First trimester sign | Genital tubercle > 30° cranially | Genital tubercle < 10°, parallel/caudal |
| Second trimester (transverse view) | Dome-shaped protrusion (turtle sign) | Three parallel lines (hamburger sign) |
| Scrotal structures | Two ovoid echogenic testes in scrotal sac | Absent |
| Sagittal view | Elongated echogenic phallus | Flat perineum |
| AGD | Longer anogenital distance | Shorter |
| 3D appearance | Penis + scrotum clearly distinct | Parallel labial folds |
| Gestational Age | Accuracy |
|---|---|
| 11 weeks (early nub) | 70-78% |
| 12 weeks | 90-99% |
| 13 weeks | ~100% |
| 18-22 weeks (anomaly scan) | 95-99% |
| 28-32 weeks | >99% |



| Test | What It Shows | When Used |
|---|---|---|
| NIPT (Cell-free fetal DNA) | Chromosomal sex (XX/XY) from maternal blood | From 10 weeks; very accurate for sex chromosomes |
| Chorionic Villus Sampling (CVS) | Full karyotype (46,XX or 46,XY) | 10-13 weeks; invasive; when DSD suspected |
| Amniocentesis | Full karyotype | 15-20 weeks; gold standard for chromosomal analysis |
| SRY gene PCR | Presence/absence of male-determining gene | When mosaicism suspected |
Create a clinical reference guide PDF with key measurements for fetal sex determination at each gestational age
ls -la /tmp/workspace/ 2>/dev/null || echo "workspace does not exist yet"
mkdir -p /tmp/workspace/fetal-sex-guide && python3 -c "import reportlab; print('reportlab OK')"
~/fetal-sex-guide/build_pdf.py
"""
Clinical Reference Guide: Fetal Sex Determination by Sonography
Built with ReportLab
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import BalancedColumns
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Circle, Polygon
from reportlab.graphics import renderPDF
from reportlab.graphics.charts.barcharts import VerticalBarChart
from copy import deepcopy
import os
# ─── Output path ───────────────────────────────────────────────────────────────
OUT_PATH = "/tmp/workspace/fetal-sex-guide/Fetal_Sex_Determination_Clinical_Reference.pdf"
# ─── Colour palette ────────────────────────────────────────────────────────────
TEAL = colors.HexColor("#0B6E6E")
TEAL_LIGHT = colors.HexColor("#E6F4F4")
TEAL_MID = colors.HexColor("#A8D5D5")
NAVY = colors.HexColor("#1A2E44")
GOLD = colors.HexColor("#C8A84B")
GOLD_LIGHT = colors.HexColor("#FDF6E3")
PINK = colors.HexColor("#D6336C")
PINK_LIGHT = colors.HexColor("#FDEEF4")
BLUE_MALE = colors.HexColor("#1565C0")
BLUE_LIGHT = colors.HexColor("#E3F2FD")
GREEN = colors.HexColor("#2E7D32")
GREEN_LIGHT = colors.HexColor("#E8F5E9")
ORANGE = colors.HexColor("#E65100")
ORANGE_LIGHT= colors.HexColor("#FFF3E0")
GREY_DARK = colors.HexColor("#37474F")
GREY_MID = colors.HexColor("#90A4AE")
GREY_LIGHT = colors.HexColor("#ECEFF1")
WHITE = colors.white
BLACK = colors.black
RED_WARN = colors.HexColor("#B71C1C")
RED_WARN_L = colors.HexColor("#FFEBEE")
W, H = A4 # 595.27 x 841.89 pts
# ─── Styles ────────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()
def style(name, **kwargs):
s = ParagraphStyle(name, **kwargs)
return s
TITLE_S = style("Title_S", fontName="Helvetica-Bold", fontSize=22,
textColor=WHITE, alignment=TA_CENTER, spaceAfter=2)
SUBTITLE_S = style("Subtitle_S", fontName="Helvetica", fontSize=11,
textColor=TEAL_MID, alignment=TA_CENTER, spaceAfter=2)
META_S = style("Meta_S", fontName="Helvetica", fontSize=8,
textColor=GOLD_LIGHT, alignment=TA_CENTER)
H1 = style("H1", fontName="Helvetica-Bold", fontSize=14,
textColor=WHITE, spaceBefore=0, spaceAfter=0)
H2 = style("H2", fontName="Helvetica-Bold", fontSize=11,
textColor=NAVY, spaceBefore=8, spaceAfter=4)
H3 = style("H3", fontName="Helvetica-Bold", fontSize=9.5,
textColor=TEAL, spaceBefore=6, spaceAfter=3)
BODY = style("Body", fontName="Helvetica", fontSize=8.5,
textColor=GREY_DARK, leading=13, spaceAfter=3)
BODY_SM = style("BodySm", fontName="Helvetica", fontSize=7.5,
textColor=GREY_DARK, leading=11)
BODY_B = style("BodyB", fontName="Helvetica-Bold", fontSize=8.5,
textColor=GREY_DARK)
NOTE = style("Note", fontName="Helvetica-Oblique", fontSize=7.5,
textColor=GREY_MID, leading=11)
WARN = style("Warn", fontName="Helvetica-Bold", fontSize=8,
textColor=RED_WARN)
CELL_HD = style("CellHd", fontName="Helvetica-Bold", fontSize=8,
textColor=WHITE, alignment=TA_CENTER)
CELL_BD = style("CellBd", fontName="Helvetica", fontSize=8,
textColor=GREY_DARK, alignment=TA_CENTER, leading=11)
CELL_BL = style("CellBl", fontName="Helvetica", fontSize=8,
textColor=GREY_DARK, alignment=TA_LEFT, leading=11)
CELL_BB = style("CellBb", fontName="Helvetica-Bold", fontSize=8,
textColor=NAVY, alignment=TA_LEFT, leading=11)
BADGE_M = style("BadgeM", fontName="Helvetica-Bold", fontSize=9,
textColor=BLUE_MALE, alignment=TA_CENTER)
BADGE_F = style("BadgeF", fontName="Helvetica-Bold", fontSize=9,
textColor=PINK, alignment=TA_CENTER)
FOOTER_S = style("Footer_S", fontName="Helvetica", fontSize=7,
textColor=GREY_MID, alignment=TA_CENTER)
# ─── Helper: coloured banner ────────────────────────────────────────────────────
def banner(text, bg=TEAL, fg=WHITE, fs=12, pad=6):
d = Drawing(W - 40*mm, fs + pad*2 + 4)
bw = W - 40*mm
bh = fs + pad*2 + 4
d.add(Rect(0, 0, bw, bh, fillColor=bg, strokeColor=None))
d.add(String(bw/2, pad + 2, text, fontName="Helvetica-Bold", fontSize=fs,
fillColor=fg, textAnchor="middle"))
return d
# ─── Helper: small coloured box ─────────────────────────────────────────────────
def tag(text, bg, fg=WHITE):
return f'<font color="{fg.hexval() if hasattr(fg,"hexval") else "#FFFFFF"}"><b>{text}</b></font>'
# ─── Helper: accuracy bar drawing ──────────────────────────────────────────────
def accuracy_bars():
data = [
("11 wk", 70, 78),
("12 wk", 90, 99),
("13 wk", 99, 100),
("18-20 wk", 95, 99),
("28+ wk", 99, 100),
]
bw = W - 44*mm
bh = 90
d = Drawing(bw, bh)
bar_w = 28
gap = 18
x_start = 40
y_base = 22
max_h = 55
step = (bw - x_start - 10) / len(data)
# grid lines
for pct in [25, 50, 75, 100]:
y = y_base + (pct / 100) * max_h
d.add(Line(x_start, y, bw - 10, y,
strokeColor=colors.HexColor("#CFD8DC"), strokeWidth=0.5,
strokeDashArray=[2, 3]))
d.add(String(x_start - 4, y - 3, f"{pct}%", fontName="Helvetica",
fontSize=6, fillColor=GREY_MID, textAnchor="end"))
for i, (label, lo, hi) in enumerate(data):
cx = x_start + i * step + step / 2
# range bar (lo to hi)
ylo = y_base + (lo / 100) * max_h
yhi = y_base + (hi / 100) * max_h
d.add(Rect(cx - bar_w/2, ylo, bar_w, yhi - ylo,
fillColor=TEAL_MID, strokeColor=None))
# hi marker
d.add(Rect(cx - bar_w/2, yhi - 3, bar_w, 3,
fillColor=TEAL, strokeColor=None))
# lo value label
d.add(String(cx, ylo - 9, f"{lo}%", fontName="Helvetica-Bold",
fontSize=6.5, fillColor=TEAL, textAnchor="middle"))
# hi value label
d.add(String(cx, yhi + 2, f"{hi}%", fontName="Helvetica-Bold",
fontSize=6.5, fillColor=TEAL, textAnchor="middle"))
# x label
d.add(String(cx, y_base - 10, label, fontName="Helvetica",
fontSize=6.5, fillColor=GREY_DARK, textAnchor="middle"))
# axis
d.add(Line(x_start, y_base, x_start, y_base + max_h + 5,
strokeColor=GREY_MID, strokeWidth=0.8))
d.add(Line(x_start, y_base, bw - 10, y_base,
strokeColor=GREY_MID, strokeWidth=0.8))
d.add(String(bw / 2, bh - 8, "Sonographic Sex Determination Accuracy by Gestational Age",
fontName="Helvetica-Bold", fontSize=7.5, fillColor=NAVY, textAnchor="middle"))
return d
# ─── Helper: nub angle diagram ─────────────────────────────────────────────────
def nub_diagram():
bw = W - 44*mm
bh = 110
d = Drawing(bw, bh)
d.add(Rect(0, 0, bw, bh, fillColor=GREY_LIGHT, strokeColor=None))
cx = bw / 2
half = bw * 0.38
# --- MALE side (left) ---
mx = cx - half
by = 60 # base y
# fetal body silhouette (oval)
d.add(Rect(mx - 40, by - 12, 80, 24, rx=12, ry=12,
fillColor=colors.HexColor("#B0BEC5"), strokeColor=None))
# spine line
d.add(Line(mx - 38, by, mx + 38, by, strokeColor=GREY_DARK, strokeWidth=1))
# nub - 45 deg cranial
import math
ang = math.radians(45)
nub_len = 22
nx_end = mx + nub_len * math.cos(ang)
ny_end = by + nub_len * math.sin(ang)
d.add(Line(mx, by, nx_end, ny_end, strokeColor=BLUE_MALE, strokeWidth=2.5))
d.add(Circle(nx_end, ny_end, 3, fillColor=BLUE_MALE, strokeColor=None))
# angle arc indicator
d.add(String(mx + 12, by + 8, ">30°", fontName="Helvetica-Bold",
fontSize=8, fillColor=BLUE_MALE))
d.add(String(mx, by - 22, "MALE", fontName="Helvetica-Bold",
fontSize=10, fillColor=BLUE_MALE, textAnchor="middle"))
d.add(String(mx, by - 32, "Tubercle cranially directed", fontName="Helvetica",
fontSize=7, fillColor=GREY_DARK, textAnchor="middle"))
# --- FEMALE side (right) ---
fx = cx + half
d.add(Rect(fx - 40, by - 12, 80, 24, rx=12, ry=12,
fillColor=colors.HexColor("#B0BEC5"), strokeColor=None))
d.add(Line(fx - 38, by, fx + 38, by, strokeColor=GREY_DARK, strokeWidth=1))
# nub - nearly horizontal / slight caudal
ang_f = math.radians(-5)
nx_ef = fx + nub_len * math.cos(ang_f)
ny_ef = by + nub_len * math.sin(ang_f)
d.add(Line(fx, by, nx_ef, ny_ef, strokeColor=PINK, strokeWidth=2.5))
d.add(Circle(nx_ef, ny_ef, 3, fillColor=PINK, strokeColor=None))
d.add(String(fx + 8, by + 5, "<10°", fontName="Helvetica-Bold",
fontSize=8, fillColor=PINK))
d.add(String(fx, by - 22, "FEMALE", fontName="Helvetica-Bold",
fontSize=10, fillColor=PINK, textAnchor="middle"))
d.add(String(fx, by - 32, "Tubercle parallel / caudal", fontName="Helvetica",
fontSize=7, fillColor=GREY_DARK, textAnchor="middle"))
# title
d.add(String(cx, bh - 8, "Genital Tubercle Angle — Mid-Sagittal View (11–13 Weeks)",
fontName="Helvetica-Bold", fontSize=8, fillColor=NAVY, textAnchor="middle"))
# reference line label
d.add(String(cx - half - 42, by + 2, "Lumbosacral\naxis", fontName="Helvetica",
fontSize=6, fillColor=GREY_MID))
return d
# ─── Helper: 2nd trimester sign diagram ────────────────────────────────────────
def trimester2_diagram():
bw = W - 44*mm
bh = 100
d = Drawing(bw, bh)
d.add(Rect(0, 0, bw, bh, fillColor=colors.HexColor("#E8EAF6"), strokeColor=None))
half = bw * 0.37
cx = bw / 2
by = 52
# === FEMALE - Hamburger sign (left) ===
fx = cx - half
# outer labia lines
for dy in [-10, 10]:
d.add(Rect(fx - 22, by + dy - 2, 44, 4, rx=2, ry=2,
fillColor=PINK, strokeColor=None))
# clitoris (central dot)
d.add(Circle(fx, by, 4, fillColor=PINK, strokeColor=None))
# label
d.add(String(fx, by - 22, "FEMALE", fontName="Helvetica-Bold",
fontSize=10, fillColor=PINK, textAnchor="middle"))
d.add(String(fx, by - 33, "\"Hamburger / Three-line sign\"", fontName="Helvetica-Oblique",
fontSize=7, fillColor=GREY_DARK, textAnchor="middle"))
d.add(String(fx, by + 20, "Labia majora (outer lines)", fontName="Helvetica",
fontSize=6.5, fillColor=GREY_DARK, textAnchor="middle"))
d.add(String(fx, by + 29, "Clitoris (central dot)", fontName="Helvetica",
fontSize=6.5, fillColor=GREY_DARK, textAnchor="middle"))
# === MALE - Turtle sign (right) ===
mx = cx + half
# scrotum (large oval base)
d.add(Rect(mx - 20, by - 8, 40, 20, rx=10, ry=10,
fillColor=BLUE_MALE, strokeColor=None))
# penis (protrusion)
d.add(Rect(mx - 6, by + 10, 12, 18, rx=3, ry=3,
fillColor=colors.HexColor("#1E88E5"), strokeColor=None))
d.add(Circle(mx, by + 29, 6, fillColor=colors.HexColor("#1565C0"), strokeColor=None))
# label
d.add(String(mx, by - 22, "MALE", fontName="Helvetica-Bold",
fontSize=10, fillColor=BLUE_MALE, textAnchor="middle"))
d.add(String(mx, by - 33, "\"Turtle / Dome sign\"", fontName="Helvetica-Oblique",
fontSize=7, fillColor=GREY_DARK, textAnchor="middle"))
d.add(String(mx, by + 42, "Phallus (protrusion) + Scrotum (base)", fontName="Helvetica",
fontSize=6.5, fillColor=GREY_DARK, textAnchor="middle"))
d.add(String(cx, bh - 5, "Transverse Perineal View — 2nd Trimester (18–22 Weeks)",
fontName="Helvetica-Bold", fontSize=8, fillColor=NAVY, textAnchor="middle"))
return d
# ─── Page templates ─────────────────────────────────────────────────────────────
def cover_header(canvas, doc):
canvas.saveState()
# Full-width teal header block
canvas.setFillColor(NAVY)
canvas.rect(0, H - 120*mm, W, 120*mm, fill=1, stroke=0)
# Gold accent stripe
canvas.setFillColor(GOLD)
canvas.rect(0, H - 122*mm, W, 4*mm, fill=1, stroke=0)
# Teal lower
canvas.setFillColor(TEAL)
canvas.rect(0, H - 128*mm, W, 6*mm, fill=1, stroke=0)
canvas.restoreState()
def inner_header(canvas, doc):
canvas.saveState()
# Narrow top bar
canvas.setFillColor(NAVY)
canvas.rect(0, H - 18*mm, W, 18*mm, fill=1, stroke=0)
canvas.setFillColor(GOLD)
canvas.rect(0, H - 19.5*mm, W, 1.5*mm, fill=1, stroke=0)
# Header text
canvas.setFont("Helvetica-Bold", 8)
canvas.setFillColor(WHITE)
canvas.drawString(20*mm, H - 12*mm, "CLINICAL REFERENCE: FETAL SEX DETERMINATION BY SONOGRAPHY")
canvas.setFont("Helvetica", 7)
canvas.setFillColor(GOLD)
canvas.drawRightString(W - 20*mm, H - 12*mm, f"Page {doc.page}")
# Footer
canvas.setFillColor(GREY_LIGHT)
canvas.rect(0, 0, W, 10*mm, fill=1, stroke=0)
canvas.setFont("Helvetica-Oblique", 6.5)
canvas.setFillColor(GREY_MID)
canvas.drawCentredString(W/2, 4*mm,
"For academic and clinical training use only • PC-PNDT Act 1994 prohibits fetal sex disclosure in India")
canvas.restoreState()
# ─── Build document ─────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUT_PATH,
pagesize=A4,
leftMargin=18*mm, rightMargin=18*mm,
topMargin=25*mm, bottomMargin=14*mm,
title="Fetal Sex Determination – Clinical Reference Guide",
author="Orris Medical AI",
subject="Obstetrics & Gynecology – Prenatal Sonography"
)
story = []
# ══════════════════════════════════════════════════════════════════
# PAGE 1 — COVER
# ══════════════════════════════════════════════════════════════════
# Spacer to clear the blue header block (≈120 mm from top)
story.append(Spacer(1, 95*mm))
story.append(Paragraph("FETAL SEX DETERMINATION", TITLE_S))
story.append(Paragraph("Clinical Reference Guide for Obstetric Sonography", SUBTITLE_S))
story.append(Spacer(1, 4*mm))
story.append(Paragraph("Key Measurements • Sonographic Signs • Accuracy Data • Clinical Pitfalls", META_S))
story.append(Spacer(1, 6*mm))
story.append(HRFlowable(width="100%", thickness=1, color=GOLD, spaceAfter=4))
# Cover summary boxes
cover_data = [
[
Paragraph("<b>PC-PNDT ACT 1994</b>\nSex disclosure prohibited\nin India by law.", BODY_SM),
Paragraph("<b>FIRST TRIMESTER</b>\nNub / Genital Tubercle\nAngle Method\n11–13 weeks", BODY_SM),
Paragraph("<b>SECOND TRIMESTER</b>\nHamburger Sign (♀)\nTurtle Sign (♂)\n18–22 weeks", BODY_SM),
Paragraph("<b>GOLD STANDARD</b>\nKaryotype / NIPT for\nambiguous cases", BODY_SM),
]
]
cover_tbl = Table(cover_data, colWidths=[(W - 36*mm)/4]*4)
cover_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(0,0), RED_WARN_L),
("BACKGROUND", (1,0),(1,0), BLUE_LIGHT),
("BACKGROUND", (2,0),(2,0), PINK_LIGHT),
("BACKGROUND", (3,0),(3,0), GREEN_LIGHT),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.5, GREY_MID),
("ALIGN", (0,0),(-1,-1), "CENTER"),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 8),
("BOTTOMPADDING",(0,0),(-1,-1), 8),
("LEFTPADDING",(0,0),(-1,-1), 6),
("RIGHTPADDING",(0,0),(-1,-1), 6),
]))
story.append(cover_tbl)
story.append(Spacer(1, 5*mm))
story.append(Paragraph(
"Version 1.0 | July 2026 | Compiled for Obstetrics & Gynecology Specialists",
NOTE
))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# PAGE 2 — EMBRYOLOGICAL BASIS + ACCURACY CHART
# ══════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2*mm))
# Section banner
story.append(Paragraph("1. EMBRYOLOGICAL BASIS & TIMELINE", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
timeline_data = [
[Paragraph("<b>Week</b>", CELL_HD),
Paragraph("<b>CRL (approx.)</b>", CELL_HD),
Paragraph("<b>Developmental Event</b>", CELL_HD),
Paragraph("<b>Sonographic Relevance</b>", CELL_HD)],
[Paragraph("5–6", CELL_BD), Paragraph("~8–10 mm", CELL_BD),
Paragraph("Genital tubercle forms — identical in both sexes (indifferent stage)", CELL_BL),
Paragraph("Sex CANNOT be determined", CELL_BL)],
[Paragraph("7–8", CELL_BD), Paragraph("~16–22 mm", CELL_BD),
Paragraph("SRY gene activates in XY; testicular differentiation begins", CELL_BL),
Paragraph("Still not visible on USG", CELL_BL)],
[Paragraph("9", CELL_BD), Paragraph("~30–33 mm", CELL_BD),
Paragraph("Male-female divergence begins — testosterone drives phallic growth", CELL_BL),
Paragraph("Earliest limit of sex prediction", CELL_BL)],
[Paragraph("11–13", CELL_BD), Paragraph("50–80 mm", CELL_BD),
Paragraph("External genitalia show sex-specific morphology; nub angle measurable", CELL_BL),
Paragraph("Nub theory applicable; accuracy rises sharply with CRL", CELL_BL)],
[Paragraph("16–18", CELL_BD), Paragraph("~120–160 mm", CELL_BD),
Paragraph("Labia fully developed; scrotum filling; penis elongated", CELL_BL),
Paragraph("2nd trimester signs emerging", CELL_BL)],
[Paragraph("18–22", CELL_BD), Paragraph("~160–220 mm", CELL_BD),
Paragraph("Genitalia well-differentiated; amniotic fluid optimal for visualisation", CELL_BL),
Paragraph("OPTIMAL WINDOW — hamburger/turtle signs reliable", CELL_BL)],
[Paragraph("28–36", CELL_BD), Paragraph("~250–330 mm", CELL_BD),
Paragraph("Testicular descent complete (~32 wk); labial fat deposition complete", CELL_BL),
Paragraph("3rd trimester confirmation; testes visible in scrotum", CELL_BL)],
]
tbl_timeline = Table(timeline_data,
colWidths=[18*mm, 28*mm, 82*mm, 58*mm])
tbl_timeline.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), TEAL),
("BACKGROUND", (0,1),(-1,1), GREY_LIGHT),
("BACKGROUND", (0,2),(-1,2), WHITE),
("BACKGROUND", (0,3),(-1,3), GREY_LIGHT),
("BACKGROUND", (0,4),(-1,4), WHITE),
("BACKGROUND", (0,5),(-1,5), GREY_LIGHT),
("BACKGROUND", (0,6),(-1,6), TEAL_LIGHT), # optimal window highlighted
("BACKGROUND", (0,7),(-1,7), WHITE),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_timeline)
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
"★ Row highlighted in teal = gold-standard window for routine anomaly scan sex assessment.",
NOTE
))
story.append(Spacer(1, 5*mm))
# Accuracy bar chart
story.append(Paragraph("2. ACCURACY BY GESTATIONAL AGE", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
story.append(accuracy_bars())
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
"Bars represent published range (low–high). Accuracy below 12 weeks is operator- and CRL-dependent. "
"Values from Efrat et al. (2006), Whitlow et al. (1999), and Stocker & Evens (1977).",
NOTE
))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# PAGE 3 — FIRST TRIMESTER: NUB THEORY
# ══════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2*mm))
story.append(Paragraph("3. FIRST TRIMESTER METHOD — NUB THEORY (11–13 Weeks)", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
story.append(Paragraph(
"The genital tubercle (\"nub\") is identifiable in all fetuses from ~11 weeks. "
"Its angle relative to the lumbosacral skin surface predicts sex. "
"Obtain a <b>strict mid-sagittal profile view</b> (same plane as NT measurement).",
BODY
))
story.append(Spacer(1, 3*mm))
story.append(nub_diagram())
story.append(Spacer(1, 3*mm))
# CRL table
story.append(Paragraph("3A. ACCURACY BY CRL", H3))
crl_data = [
[Paragraph("<b>CRL (mm)</b>", CELL_HD),
Paragraph("<b>Gest. Age (approx.)</b>", CELL_HD),
Paragraph("<b>Feasibility</b>", CELL_HD),
Paragraph("<b>Accuracy (if assigned)</b>", CELL_HD),
Paragraph("<b>Clinical Note</b>", CELL_HD)],
[Paragraph("< 50 mm", CELL_BD), Paragraph("< 11+4 wk", CELL_BD),
Paragraph("~40%", CELL_BD), Paragraph("Not recommended", CELL_BD),
Paragraph("Too early; indifferent stage still present", CELL_BL)],
[Paragraph("50–55 mm", CELL_BD), Paragraph("11+4 – 12 wk", CELL_BD),
Paragraph("~65%", CELL_BD), Paragraph("~75%", CELL_BD),
Paragraph("High indeterminate rate; use NT scan opportunity", CELL_BL)],
[Paragraph("55–60 mm", CELL_BD), Paragraph("~12 wk", CELL_BD),
Paragraph("~80%", CELL_BD), Paragraph("~96%", CELL_BD),
Paragraph("Good accuracy; combine with AGD for confidence", CELL_BL)],
[Paragraph("60–70 mm", CELL_BD), Paragraph("12+2 – 13 wk", CELL_BD),
Paragraph("~97%", CELL_BD), Paragraph("~99–100%", CELL_BD),
Paragraph("Excellent; reliable if position optimal", CELL_BL)],
[Paragraph("≥ 76 mm", CELL_BD), Paragraph("≥ 13 wk", CELL_BD),
Paragraph("~99%", CELL_BD), Paragraph("99–100%", CELL_BD),
Paragraph("Near-perfect accuracy; both sexes equally reliable", CELL_BL)],
]
tbl_crl = Table(crl_data, colWidths=[22*mm, 30*mm, 22*mm, 38*mm, 74*mm])
tbl_crl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), NAVY),
("ROWBACKGROUNDS", (0,1),(-1,-1), [WHITE, BLUE_LIGHT]),
("BACKGROUND", (0,4),(-1,4), TEAL_LIGHT), # best row
("BACKGROUND", (0,5),(-1,5), GREEN_LIGHT),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_crl)
story.append(Spacer(1, 3*mm))
# Angle interpretation
story.append(Paragraph("3B. GENITAL TUBERCLE ANGLE — INTERPRETATION TABLE", H3))
angle_data = [
[Paragraph("<b>Angle</b>", CELL_HD),
Paragraph("<b>Direction</b>", CELL_HD),
Paragraph("<b>Sex</b>", CELL_HD),
Paragraph("<b>Action</b>", CELL_HD)],
[Paragraph("> 30°", CELL_BD),
Paragraph("Cranially directed (toward fetal head)", CELL_BL),
Paragraph("♂ MALE", BADGE_M),
Paragraph("High confidence if CRL > 60 mm", CELL_BL)],
[Paragraph("10°–30°", CELL_BD),
Paragraph("Intermediate — neither cranial nor caudal", CELL_BL),
Paragraph("INDETERMINATE", style("Ind", fontName="Helvetica-Bold", fontSize=8, textColor=ORANGE, alignment=TA_CENTER)),
Paragraph("Report as indeterminate; rescan in 2–3 weeks", CELL_BL)],
[Paragraph("< 10°", CELL_BD),
Paragraph("Parallel to spine or caudally directed", CELL_BL),
Paragraph("♀ FEMALE", BADGE_F),
Paragraph("High confidence if CRL > 60 mm", CELL_BL)],
]
tbl_angle = Table(angle_data, colWidths=[20*mm, 68*mm, 30*mm, 68*mm])
tbl_angle.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), TEAL),
("BACKGROUND", (0,1),(-1,1), BLUE_LIGHT),
("BACKGROUND", (0,2),(-1,2), ORANGE_LIGHT),
("BACKGROUND", (0,3),(-1,3), PINK_LIGHT),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING",(0,0),(-1,-1), 5),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_angle)
story.append(Spacer(1, 3*mm))
# AGD box
agd_data = [[
Paragraph(
"<b>ANOGENITAL DISTANCE (AGD) — Adjunctive First-Trimester Marker</b><br/><br/>"
"• Measured from <b>anterior edge of anus</b> to the <b>tip of genital tubercle</b> (mid-sagittal view)<br/>"
"• Males have a <b>statistically significantly longer AGD</b> than females at 11–13 weeks<br/>"
"• Used alongside the genital tubercle angle to <b>improve confidence</b> when the angle is near the cut-off<br/>"
"• Reference: AGD > ~7–8 mm at CRL 60–70 mm tends to predict male",
BODY_SM
)
]]
tbl_agd = Table(agd_data, colWidths=[W - 36*mm])
tbl_agd.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), BLUE_LIGHT),
("BOX", (0,0),(-1,-1), 1.5, BLUE_MALE),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING",(0,0),(-1,-1), 8),
("RIGHTPADDING",(0,0),(-1,-1), 8),
]))
story.append(tbl_agd)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# PAGE 4 — SECOND TRIMESTER
# ══════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2*mm))
story.append(Paragraph("4. SECOND TRIMESTER — GOLD STANDARD (18–22 Weeks)", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
story.append(Paragraph(
"The anomaly scan at 18–20 weeks is the optimal window for sex determination. "
"Accuracy exceeds <b>95–99%</b> with optimal fetal position. "
"Scan the perineum in <b>three planes</b>: transverse (primary), sagittal (confirmatory), and coronal (supplementary).",
BODY
))
story.append(Spacer(1, 3*mm))
story.append(trimester2_diagram())
story.append(Spacer(1, 3*mm))
# Signs table
story.append(Paragraph("4A. SECOND TRIMESTER SONOGRAPHIC SIGNS", H3))
signs_data = [
[Paragraph("<b>Sign</b>", CELL_HD),
Paragraph("<b>Sex</b>", CELL_HD),
Paragraph("<b>Plane</b>", CELL_HD),
Paragraph("<b>Description</b>", CELL_HD),
Paragraph("<b>Pitfall</b>", CELL_HD)],
[Paragraph("Hamburger Sign\n(Three-Line Sign)", CELL_BB),
Paragraph("♀ Female", BADGE_F),
Paragraph("Transverse perineal", CELL_BD),
Paragraph("3 parallel echogenic lines: labia majora (outer) + clitoris (central). "
"Lines parallel, no protruding structure.", CELL_BL),
Paragraph("Hypertrophied labia minora can mimic a phallus", CELL_BL)],
[Paragraph("Turtle Sign\n(Dome Sign)", CELL_BB),
Paragraph("♂ Male", BADGE_M),
Paragraph("Transverse perineal", CELL_BD),
Paragraph("Dome-shaped echogenic protrusion (phallus) with rounded scrotum posteriorly. "
"Resembles turtle head emerging from shell.", CELL_BL),
Paragraph("Umbilical cord loop between legs can mimic penis", CELL_BL)],
[Paragraph("Sagittal Phallus Sign", CELL_BB),
Paragraph("♂ Male", BADGE_M),
Paragraph("Sagittal", CELL_BD),
Paragraph("Elongated echogenic structure projecting anteriorly from perineum. "
"Confirms transverse finding.", CELL_BL),
Paragraph("Prominent clitoris in early 2nd trimester", CELL_BL)],
[Paragraph("Scrotal Sign", CELL_BB),
Paragraph("♂ Male", BADGE_M),
Paragraph("Transverse / coronal", CELL_BD),
Paragraph("Bilateral echogenic ovoid structures in the scrotum. "
"Testes descend ~28–32 weeks and appear as moderate-echogenicity ovoids.", CELL_BL),
Paragraph("Empty scrotum with undescended testes (confirm perineal/inguinal region)", CELL_BL)],
[Paragraph("Flat Perineum Sign", CELL_BB),
Paragraph("♀ Female", BADGE_F),
Paragraph("Sagittal", CELL_BD),
Paragraph("Absence of any protruding structure. "
"Smooth, flat perineal contour in the sagittal plane.", CELL_BL),
Paragraph("Early 2nd trimester (<16 wk) — clitoris may appear prominent", CELL_BL)],
]
tbl_signs = Table(signs_data, colWidths=[28*mm, 18*mm, 24*mm, 68*mm, 48*mm])
tbl_signs.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), NAVY),
("ROWBACKGROUNDS", (0,1),(-1,-1), [PINK_LIGHT, BLUE_LIGHT, BLUE_LIGHT, BLUE_LIGHT, PINK_LIGHT]),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING",(0,0),(-1,-1), 5),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_signs)
story.append(Spacer(1, 3*mm))
# Scanning checklist
story.append(Paragraph("4B. PERINEAL SCANNING TECHNIQUE CHECKLIST", H3))
checklist_data = [
[Paragraph("□ Fetal position optimal — legs abducted, perineum facing probe", BODY_SM),
Paragraph("□ Transverse plane at level of fetal perineum (primary)", BODY_SM)],
[Paragraph("□ Sagittal plane to confirm phallus morphology", BODY_SM),
Paragraph("□ Coronal plane for labial/scrotal fold assessment", BODY_SM)],
[Paragraph("□ Adequate amniotic fluid — acts as acoustic window", BODY_SM),
Paragraph("□ If umbilical cord is suspected, trace to insertion point", BODY_SM)],
[Paragraph("□ 3D/4D mode when 2D findings are borderline", BODY_SM),
Paragraph("□ Document scan plane and finding in report", BODY_SM)],
]
tbl_check = Table(checklist_data, colWidths=[(W - 36*mm)/2]*2)
tbl_check.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), GREY_LIGHT),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 8),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_check)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# PAGE 5 — COMPARATIVE REFERENCE + 3RD TRIMESTER + PITFALLS
# ══════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2*mm))
story.append(Paragraph("5. FULL GESTATIONAL AGE COMPARISON TABLE", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
full_data = [
[Paragraph("<b>GA</b>", CELL_HD),
Paragraph("<b>CRL / FL</b>", CELL_HD),
Paragraph("<b>Method</b>", CELL_HD),
Paragraph("<b>Male Features</b>", CELL_HD),
Paragraph("<b>Female Features</b>", CELL_HD),
Paragraph("<b>Accuracy</b>", CELL_HD)],
[Paragraph("11 wk", CELL_BD), Paragraph("~50 mm", CELL_BD),
Paragraph("Genital tubercle angle\n(nub theory)", CELL_BL),
Paragraph("Nub > 30° cranially directed", CELL_BL),
Paragraph("Nub parallel to spine (<10°)", CELL_BL),
Paragraph("70–78%", CELL_BD)],
[Paragraph("12 wk", CELL_BD), Paragraph("55–65 mm", CELL_BD),
Paragraph("Nub angle + AGD", CELL_BL),
Paragraph("Nub > 30°; AGD longer", CELL_BL),
Paragraph("Nub <10°; AGD shorter", CELL_BL),
Paragraph("90–99%", CELL_BD)],
[Paragraph("13 wk", CELL_BD), Paragraph("65–80 mm", CELL_BD),
Paragraph("Nub angle (sagittal sign)", CELL_BL),
Paragraph("Distinct cranial direction", CELL_BL),
Paragraph("Caudal / parallel direction", CELL_BL),
Paragraph("~100%", CELL_BD)],
[Paragraph("14–17 wk", CELL_BD), Paragraph("80–130 mm", CELL_BD),
Paragraph("Early external genitalia\n(transitional window)", CELL_BL),
Paragraph("Phallus elongating; scrotal swelling", CELL_BL),
Paragraph("Labial development; flat perineum", CELL_BL),
Paragraph("85–92%\n(variable)", CELL_BD)],
[Paragraph("18–22 wk\n★ OPTIMAL", CELL_BB), Paragraph("~16–22 cm FL", CELL_BD),
Paragraph("Hamburger sign\nTurtle sign", CELL_BL),
Paragraph("Dome-shaped phallus + scrotum\n(turtle sign); elongated sagittal phallus", CELL_BL),
Paragraph("3 parallel lines (hamburger sign);\nflat perineum in sagittal", CELL_BL),
Paragraph("95–99%", CELL_BD)],
[Paragraph("23–27 wk", CELL_BD), Paragraph("~22–24 cm FL", CELL_BD),
Paragraph("External genitalia\n2D + 3D", CELL_BL),
Paragraph("Clear penis and scrotum; testes in inguinal region", CELL_BL),
Paragraph("Well-defined labia; small clitoris visible", CELL_BL),
Paragraph("97–99%", CELL_BD)],
[Paragraph("28–36 wk", CELL_BD), Paragraph("~25–33 cm FL", CELL_BD),
Paragraph("External genitalia;\ntesticular descent", CELL_BL),
Paragraph("Testes visible in scrotum (usually by 32 wk);\nscrotum echogenic", CELL_BL),
Paragraph("Labia majora fat deposition complete;\nclitoris small relative to labia", CELL_BL),
Paragraph(">99%", CELL_BD)],
[Paragraph("Term\n(37–40 wk)", CELL_BD), Paragraph("~33–36 cm FL", CELL_BD),
Paragraph("3D / 2D confirmation", CELL_BL),
Paragraph("Well-descended testes; prominent scrotum", CELL_BL),
Paragraph("Full labial fat pads; clitoris covered by labia majora", CELL_BL),
Paragraph(">99%", CELL_BD)],
]
tbl_full = Table(full_data, colWidths=[18*mm, 18*mm, 32*mm, 52*mm, 52*mm, 14*mm])
tbl_full.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), NAVY),
("ROWBACKGROUNDS", (0,1),(-1,-1), [WHITE, GREY_LIGHT, WHITE, GREY_LIGHT,
TEAL_LIGHT, WHITE, GREY_LIGHT, WHITE]),
("BACKGROUND", (0,5),(-1,5), TEAL_LIGHT),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 4),
("RIGHTPADDING",(0,0),(-1,-1), 4),
]))
story.append(tbl_full)
story.append(Spacer(1, 2*mm))
story.append(Paragraph("★ = optimal window. FL = femur length. GA = gestational age.", NOTE))
story.append(Spacer(1, 4*mm))
# Factors affecting accuracy
story.append(Paragraph("6. FACTORS AFFECTING ACCURACY", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
factors_data = [
[Paragraph("<b>Factor</b>", CELL_HD),
Paragraph("<b>Effect</b>", CELL_HD),
Paragraph("<b>Mitigation</b>", CELL_HD)],
[Paragraph("Fetal position (legs crossed/adducted)", CELL_BB),
Paragraph("Most common cause of sex being unassignable", CELL_BL),
Paragraph("Ask mother to walk, reposition; rescan in 15–30 min", CELL_BL)],
[Paragraph("Oligohydramnios", CELL_BB),
Paragraph("Reduced acoustic window; poor visualisation", CELL_BL),
Paragraph("Transvaginal approach; 3D mode", CELL_BL)],
[Paragraph("Gestational age < 11 weeks", CELL_BB),
Paragraph("Indifferent stage; genitalia not differentiable", CELL_BL),
Paragraph("Do not attempt; wait for CRL ≥ 55 mm", CELL_BL)],
[Paragraph("Maternal obesity (BMI > 35)", CELL_BB),
Paragraph("Poor transabdominal penetration", CELL_BL),
Paragraph("Higher frequency probe; transvaginal approach early", CELL_BL)],
[Paragraph("Umbilical cord between legs", CELL_BB),
Paragraph("Can be mistaken for male phallus", CELL_BL),
Paragraph("Trace cord to placental insertion; use colour Doppler", CELL_BL)],
[Paragraph("Early 2nd trimester clitoromegaly", CELL_BB),
Paragraph("Prominent clitoris may mimic phallus", CELL_BL),
Paragraph("Look for scrotal structures; confirm with NIPT if uncertain", CELL_BL)],
[Paragraph("Posterior or prone fetal position", CELL_BB),
Paragraph("Perineum not facing probe", CELL_BL),
Paragraph("Maternal position changes; defer to later scan", CELL_BL)],
]
tbl_factors = Table(factors_data, colWidths=[46*mm, 60*mm, 80*mm])
tbl_factors.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), ORANGE),
("ROWBACKGROUNDS", (0,1),(-1,-1), [ORANGE_LIGHT, WHITE, ORANGE_LIGHT, WHITE,
ORANGE_LIGHT, WHITE, ORANGE_LIGHT]),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_factors)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════
# PAGE 6 — DSD / PATHOLOGICAL + ADJUNCTIVE TESTS + LEGAL
# ══════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2*mm))
story.append(Paragraph("7. DISORDERS OF SEXUAL DEVELOPMENT (DSD) — RECOGNITION ON USG", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
story.append(Paragraph(
"When genitalia do not fit clearly into male or female morphology, report as <b>ambiguous</b> "
"and refer to a fetal medicine specialist. Do NOT guess. Karyotype is mandatory in these cases.",
BODY
))
story.append(Spacer(1, 3*mm))
dsd_data = [
[Paragraph("<b>Sign / Pattern</b>", CELL_HD),
Paragraph("<b>Sonographic Appearance</b>", CELL_HD),
Paragraph("<b>Possible Diagnosis</b>", CELL_HD),
Paragraph("<b>Next Step</b>", CELL_HD)],
[Paragraph("Tulip Sign", CELL_BB),
Paragraph("Two splayed echogenic folds flanking a small central phallus-like nub — resembles a tulip flower", CELL_BL),
Paragraph("Severe hypospadias; micropenis with bifid scrotum; 46,XY DSD", CELL_BL),
Paragraph("Karyotype; fetal medicine referral; 3D USG", CELL_BL)],
[Paragraph("Clitoromegaly\n(Virilised Female)", CELL_BB),
Paragraph("Prominent thick clitoris in sagittal view; divergent convex labial lines in axial view; "
"uterus/ovaries present internally", CELL_BL),
Paragraph("Congenital Adrenal Hyperplasia (CAH) — 46,XX virilised; maternal androgen exposure", CELL_BL),
Paragraph("Maternal 17-OHP; steroid assay; amniocentesis for karyotype", CELL_BL)],
[Paragraph("Scrotum without Penis", CELL_BB),
Paragraph("Scrotal sac visible but phallus absent or rudimentary", CELL_BL),
Paragraph("Severe hypospadias; cloacal exstrophy; 45,X/46,XY mosaicism", CELL_BL),
Paragraph("3D USG; detailed anomaly scan; NIPT / karyotype", CELL_BL)],
[Paragraph("Ambiguous — Neither\nHamburger nor Turtle", CELL_BB),
Paragraph("Cannot classify as 3-line or dome shape; intermediate morphology", CELL_BL),
Paragraph("Any DSD; suboptimal fetal position; very early GA", CELL_BL),
Paragraph("Rescan at later GA; 3D/4D; NIPT if > 10 weeks", CELL_BL)],
[Paragraph("Gonadal Dysgenesis Pattern", CELL_BB),
Paragraph("Ambiguous external genitalia + absent/hypoplastic gonads; "
"streak gonads may not be visible", CELL_BL),
Paragraph("Turner syndrome mosaicism; Swyer syndrome (46,XY gonadal dysgenesis)", CELL_BL),
Paragraph("Full karyotype; pelvic anatomy detail; MRI if USG inconclusive", CELL_BL)],
]
tbl_dsd = Table(dsd_data, colWidths=[28*mm, 58*mm, 52*mm, 48*mm])
tbl_dsd.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), colors.HexColor("#6A1B9A")),
("ROWBACKGROUNDS", (0,1),(-1,-1), [colors.HexColor("#F3E5F5"), WHITE,
colors.HexColor("#F3E5F5"), WHITE,
colors.HexColor("#F3E5F5")]),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING",(0,0),(-1,-1), 5),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_dsd)
story.append(Spacer(1, 4*mm))
# Adjunctive methods
story.append(Paragraph("8. ADJUNCTIVE / CONFIRMATORY METHODS", H2))
story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL, spaceAfter=4))
adj_data = [
[Paragraph("<b>Method</b>", CELL_HD),
Paragraph("<b>GA Window</b>", CELL_HD),
Paragraph("<b>What It Shows</b>", CELL_HD),
Paragraph("<b>Accuracy</b>", CELL_HD),
Paragraph("<b>Indication</b>", CELL_HD)],
[Paragraph("NIPT (cfDNA)", CELL_BB),
Paragraph("≥ 10 wk", CELL_BD),
Paragraph("Chromosomal sex (XX/XY) from maternal blood; non-invasive", CELL_BL),
Paragraph(">99%", CELL_BD),
Paragraph("Early sex determination (where legal); DSD screening; aneuploidy screen", CELL_BL)],
[Paragraph("CVS", CELL_BB),
Paragraph("10–13 wk", CELL_BD),
Paragraph("Full karyotype (46,XX or 46,XY); rapid FISH for sex chromosomes", CELL_BL),
Paragraph("99–100%", CELL_BD),
Paragraph("DSD suspected; sex-linked disorder; aneuploidy risk", CELL_BL)],
[Paragraph("Amniocentesis", CELL_BB),
Paragraph("15–20 wk", CELL_BD),
Paragraph("Full karyotype; gold standard for chromosomal analysis", CELL_BL),
Paragraph("99–100%", CELL_BD),
Paragraph("DSD; ambiguous genitalia on USG; chromosomal anomaly suspected", CELL_BL)],
[Paragraph("SRY Gene PCR", CELL_BB),
Paragraph("Any (via CVS/amn.)", CELL_BD),
Paragraph("Presence/absence of male-determining SRY gene on Y chromosome", CELL_BL),
Paragraph("Very high", CELL_BD),
Paragraph("Suspected gonadal dysgenesis; 46,XY DSD; sex reversal syndromes", CELL_BL)],
[Paragraph("3D / 4D USG", CELL_BB),
Paragraph("16 wk onwards", CELL_BD),
Paragraph("Surface rendering of genital morphology; better spatial anatomy", CELL_BL),
Paragraph("Enhances 2D", CELL_BD),
Paragraph("Borderline 2D findings; hypospadias characterisation; DSD", CELL_BL)],
]
tbl_adj = Table(adj_data, colWidths=[24*mm, 20*mm, 64*mm, 18*mm, 60*mm])
tbl_adj.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), GREEN),
("ROWBACKGROUNDS", (0,1),(-1,-1), [GREEN_LIGHT, WHITE, GREEN_LIGHT, WHITE, GREEN_LIGHT]),
("BOX", (0,0),(-1,-1), 0.5, GREY_MID),
("INNERGRID", (0,0),(-1,-1), 0.3, GREY_MID),
("VALIGN", (0,0),(-1,-1), "TOP"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING",(0,0),(-1,-1), 4),
("LEFTPADDING",(0,0),(-1,-1), 5),
("RIGHTPADDING",(0,0),(-1,-1), 5),
]))
story.append(tbl_adj)
story.append(Spacer(1, 4*mm))
# Legal notice
legal_data = [[
Paragraph(
"<b>⚠ LEGAL NOTICE — PC-PNDT ACT 1994 (India)</b><br/><br/>"
"The Pre-Conception and Pre-Natal Diagnostic Techniques Act, 1994 (as amended) <b>prohibits the "
"determination and disclosure of fetal sex</b> to any person by any means, including ultrasound, "
"for non-medical purposes. Violation is a criminal offence punishable by imprisonment and fine.<br/><br/>"
"<b>This guide is strictly for academic training, DSD diagnosis, and sex-linked disorder screening.</b> "
"Sex determination for selective abortion is illegal under Indian law.",
BODY_SM
)
]]
tbl_legal = Table(legal_data, colWidths=[W - 36*mm])
tbl_legal.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), RED_WARN_L),
("BOX", (0,0),(-1,-1), 2, RED_WARN),
("TOPPADDING", (0,0),(-1,-1), 8),
("BOTTOMPADDING",(0,0),(-1,-1), 8),
("LEFTPADDING",(0,0),(-1,-1), 10),
("RIGHTPADDING",(0,0),(-1,-1), 10),
]))
story.append(tbl_legal)
story.append(Spacer(1, 4*mm))
# References
story.append(Paragraph("KEY REFERENCES", H3))
refs = [
"Efrat Z et al. Fetal gender assignment by first-trimester ultrasound. Ultrasound Obstet Gynecol. 2006;27:619-21.",
"Whitlow BJ et al. The influence of fetal neck position on nuchal translucency measurement. Br J Obstet Gynaecol. 1999.",
"Odeh M et al. Fetal sex assignment by first-trimester ultrasound at 11-13+6 weeks. J Ultrasound Med. 2009.",
"Emerson DS et al. The sagittal sign: an early second trimester sonographic indicator of fetal gender. J Ultrasound Med. 1989.",
"Stocker J, Evens L. Fetal sex determination by ultrasound. Obstet Gynecol. 1977;50:462-6.",
"Creasy & Resnik's Maternal-Fetal Medicine: Principles and Practice, 8th ed. Elsevier.",
"PC-PNDT Act 1994, Government of India. Ministry of Health & Family Welfare.",
]
for r in refs:
story.append(Paragraph(f"• {r}", NOTE))
# ─── Build ──────────────────────────────────────────────────────────────────────
doc.build(
story,
onFirstPage=cover_header,
onLaterPages=inner_header,
)
print(f"PDF saved to: {OUT_PATH}")
cd /tmp/workspace/fetal-sex-guide && python3 build_pdf.py 2>&1
ls -lh /tmp/workspace/fetal-sex-guide/
Fetal Sex Determination Clinical Reference
PDF Document · PDF