Schematex

Genogram

Multi-generation family trees following the McGoldrick standard. Gender-specific shapes, medical condition fills, emotional relationship lines, index-person markers. Used in family therapy, social work, and clinical medicine.

genogram·§ McGoldrick
↘ preview
100%
Genogram: The Potter Family Genogram diagram with 10 individuals across 3 generations The Potter Family Fleamont (1909-1979) 70 Euphemia (1920-1979) 59 Mr_evans (1925) Mrs_evans (1928) James (1960-1981) 21 Lily (1960-1981) 21 Vernon (1951) Petunia (1958) Harry (1980) Dudley (1980) Fleamont (1909–1979) Euphemia (1920–1979) Mr_evans (b. 1925) Mrs_evans (b. 1928) James (1960–1981) Lily (1960–1981) Vernon (b. 1951) Petunia (b. 1958) Harry (b. 1980) Dudley (b. 1980) m. 1978
UTF-8 · LF · 17 lines · 486 chars✓ parsed·9.0 ms·12.0 KB SVG

McGoldrick et al. (2020) symbol system + GenoPro emotional taxonomy + Bennett 2022 gender inclusivity + clinical medical condition system + Cultural Heritage genogram support.

Primary References:

  • McGoldrick, M., Gerson, R., & Petry, S. (2020). Genograms: Assessment and Treatment. 4th ed.
  • Bennett, R.L. et al. (2022). Standardized human pedigree nomenclature: Update and assessment of the recommendations of the National Society of Genetic Counselors. J Genet Couns.
  • Hardy, K.V. & Laszloffy, T.A. (1995). The cultural genogram: Key to training culturally competent family therapists. J Marital Fam Ther, 21(3), 227-237.
  • GenoPro symbol reference: https://genopro.com/genogram/
  • GenogramAI symbol catalog (~150 symbols): https://genogramai.com

1. Individual Symbols

1.1 Core Shapes

SymbolShapeSVG ElementMeaning
Square (40×40)<rect>Male
Circle (r=20)<circle>Female
Diamond (40×40)<polygon>Unknown sex / Nonbinary (Bennett 2022)
Triangle (small, 20×20)<polygon>Pregnancy (current)
Concentric shapeDouble outline (gap=3px)Two shapes, inner + outerIndex Person (IP) / Identified Patient

1.2 Status Modifiers

StatusVisualSVG Implementation
DeceasedX through shape, corner to cornerTwo <line> elements crossing shape
Stillborn50% size shape + SB labelScaled shape with text
MiscarriageSmall triangle (△, 12×12)<polygon> small
Spontaneous abortionSmall × (12×12)Two short <line> elements
Induced abortionSmall × with horizontal line through<line> elements + cross bar
PregnancyDashed outlinestroke-dasharray="4,3" on shape

1.3 Bennett 2022 Gender/Sex Inclusivity Update

Bennett 2022 introduced a symbol system that separates sex from gender identity. Schematex must support this:

NotationMeaningVisual
AMABAssigned Male at BirthSquare (traditional male symbol)
AFABAssigned Female at BirthCircle (traditional female symbol)
UAABUnknown/Ambiguous at Birth / IntersexDiamond
NonbinaryGender identity = nonbinaryDiamond + optional gender label
TransgenderGender ≠ assigned sexShape = assigned sex, label indicates gender identity

DSL syntax:

alex [nonbinary, 1995]           # → diamond
sam [male, transgender, 1988]    # → square (AMAB) + transgender marker
jordan [intersex, 1990]          # → diamond (UAAB)

Implementation rules:

  • sex property controls the shape (male→□, female→○, unknown/nonbinary/intersex→◇)
  • transgender property adds a small triangle marker at the corner of the shape
  • gender property is optional, used for label display

1.4 Multiple Births

TypeVisualDSL
Identical twinsV-shape: two child lines meet at single point on sibship line[twin-identical]
Fraternal twinsInverted-V with horizontal bar connecting at top[twin-fraternal]
Triplets+Same pattern, 3+ lines from single point or bar[triplet-identical] / [triplet-fraternal]

1.5 SVG Implementation Notes

  • All shapes: stroke-width: 2, fill: white (default), stroke: #333
  • CSS classes: schematex-node, schematex-male, schematex-female, schematex-unknown, schematex-nonbinary
  • Deceased overlay: class="schematex-deceased-marker"
  • Index person: outer shape stroke-width: 1, inner shape stroke-width: 2, gap 3px
  • Data attributes: data-individual-id, data-sex, data-status, data-generation

2. Medical/Psychological Condition System

2.1 Condition Display: Quadrant Fill System

Conditions are represented by filling different regions of the individual shape. Up to 4 conditions can be displayed simultaneously (quadrant system); when more than 4 conditions are present, the display switches to a radial pie display or legend system.

Fill PositionQuadrantSVG Implementation
Full fillEntire shapefill: {color}
Top-left quarterTop-left 1/4<clipPath> top-left quadrant
Top-right quarterTop-right 1/4<clipPath> top-right quadrant
Bottom-left quarterBottom-left 1/4<clipPath> bottom-left quadrant
Bottom-right quarterBottom-right 1/4<clipPath> bottom-right quadrant
Half-leftLeft half<clipPath> left half
Half-rightRight half<clipPath> right half
Half-topTop half<clipPath> top half
Half-bottomBottom half<clipPath> bottom half
Striped/hatchedDiagonal stripe fill<pattern> diagonal lines
DottedDot fill<pattern> dots

Multiple condition stacking rules:

  1. 1 condition → full fill or half fill
  2. 2 conditions → left half + right half
  3. 3 conditions → top-left + top-right + bottom half
  4. 4 conditions → four quadrants
  5. 5+ conditions → radial pie (equal sectors) or numbered legend
  6. Carrier (asymptomatic) → striped/hatched pattern, does not occupy a quadrant

2.2 Standard Medical Condition Categories (22 Categories)

A standard color-coding system based on GenogramAI and clinical practice. Each category has a recommended color that users can customize.

CategoryDefault ColorHexCommon conditions
CardiovascularRed#E53935Heart disease, hypertension, stroke, CHF
CancerDark Blue#1E88E5All malignancies (can be subdivided by type)
DiabetesOrange#FB8C00Type 1, Type 2, gestational
Mental Health (General)Purple#8E24AASchizophrenia, psychosis, other
DepressionIndigo#5C6BC0Major depressive disorder, dysthymia
AnxietyTeal#26A69AGAD, panic disorder, phobias, OCD
BipolarViolet#AB47BCBipolar I, Bipolar II
PTSDDark Teal#00897BPost-traumatic stress disorder
Substance Abuse (Alcohol)Amber#FFB300Alcohol use disorder
Substance Abuse (Drugs)Deep Orange#F4511EDrug use disorder (opioids, stimulants, etc.)
Substance Abuse (Tobacco)Brown#795548Nicotine dependence
NeurologicalGray-Blue#546E7AAlzheimer's, Parkinson's, epilepsy, MS
RespiratoryLight Blue#42A5F5Asthma, COPD, cystic fibrosis
AutoimmunePink#EC407ALupus, rheumatoid arthritis, Crohn's
Genetic/ChromosomalDark Green#2E7D32Down syndrome, sickle cell, Huntington's
ReproductiveRose#F48FB1Infertility, PCOS, endometriosis
Eating DisordersLight Purple#CE93D8Anorexia, bulimia, BED
Learning/DevelopmentalLime#9CCC65ADHD, autism spectrum, dyslexia
Kidney/UrologicalOlive#827717CKD, kidney stones
Liver/GIYellow-Green#C0CA33Hepatitis, cirrhosis, IBD
ObesityDark Amber#FF8F00BMI ≥ 30
Other/CustomGray#757575Any unlisted condition

2.3 Condition SVG Defs

Each condition used must define the corresponding <clipPath> and optional <pattern> in <defs>:

<defs>
  <!-- Quadrant clip paths for squares (40×40) -->
  <clipPath id="quad-tl-rect"><rect x="0" y="0" width="20" height="20"/></clipPath>
  <clipPath id="quad-tr-rect"><rect x="20" y="0" width="20" height="20"/></clipPath>
  <clipPath id="quad-bl-rect"><rect x="0" y="20" width="20" height="20"/></clipPath>
  <clipPath id="quad-br-rect"><rect x="20" y="20" width="20" height="20"/></clipPath>
  <clipPath id="half-left-rect"><rect x="0" y="0" width="20" height="40"/></clipPath>
  <clipPath id="half-right-rect"><rect x="20" y="0" width="20" height="40"/></clipPath>
  <clipPath id="half-top-rect"><rect x="0" y="0" width="40" height="20"/></clipPath>
  <clipPath id="half-bottom-rect"><rect x="0" y="20" width="40" height="20"/></clipPath>

  <!-- Quadrant clip paths for circles (r=20) -->
  <!-- Use rect clips centered at circle center, intersected with circle -->

  <!-- Carrier pattern (diagonal stripes) -->
  <pattern id="carrier-stripe" patternUnits="userSpaceOnUse" width="6" height="6">
    <path d="M-1,1 l2,-2 M0,6 l6,-6 M5,7 l2,-2" stroke="#333" stroke-width="1"/>
  </pattern>

  <!-- Dotted pattern -->
  <pattern id="dotted" patternUnits="userSpaceOnUse" width="6" height="6">
    <circle cx="3" cy="3" r="1" fill="#333"/>
  </pattern>
</defs>

2.4 DSL Syntax for Conditions

# Single condition
father [male, 1945, conditions: heart-disease(full, #E53935)]

# Multiple conditions (quadrant auto-assigned)
mother [female, 1948, conditions: diabetes + cancer + anxiety]

# Specify fill position + color
uncle [male, 1950, conditions: heart-disease(half-left, #E53935) + diabetes(half-right, #FB8C00)]

# Carrier (asymptomatic)
son [male, 1975, conditions: diabetes(carrier)]

# Using category shorthand
daughter [female, 1978, conditions: cardiovascular + mental-health]

Parsing rules:

  • When no fill position is specified, quadrants are auto-assigned based on condition count (see stacking rules in 2.1)
  • When no color is specified, the category default color is used
  • carrier fill → striped pattern
  • Category shorthand (e.g. cardiovascular) maps to the default color
  • Custom condition names (not in standard categories) use gray as the default color

2B. Cultural/Heritage Genogram (Ethnicity Color System)

The cultural genogram (Hardy & Laszloffy, 1995) uses the same shape + fill mechanism as the medical genogram, but the color meanings differ — they represent ethnic/cultural/heritage background rather than medical conditions.

This is an important variant in social work, used for multicultural assessments.

2B.1 Heritage Color Coding

Each cultural background corresponds to a color. Users define the mapping via legend (there is no fixed standard, as cultural backgrounds vary by region):

genogram "Anna Maria's Heritage"
  legend: colombian = "Colombian" (#9C27B0)
  legend: dominican = "Dominican Republic" (#FFEB3B)
  legend: french = "French" (#1565C0)
  legend: greek = "Greek" (#80DEEA)
  legend: irish = "Irish" (#4CAF50)
  legend: italian = "Italian" (#E91E63)
  legend: puerto-rican = "Puerto Rican" (#FF9800)

2B.2 Mixed Heritage Display

When a person has multiple cultural backgrounds, the same quadrant/half fill system as medical conditions is used:

# Single background → full fill
jose [male, heritage: colombian]

# Dual background → half-left + half-right
anna-maria [female, heritage: puerto-rican + italian]

# Triple background → quadrant fill
child [male, heritage: irish + italian + french]

The rendering mechanism fully reuses the quadrant fill system from Section 2.1, with the only difference being the color source (heritage legend vs. medical category).

2B.3 Heritage vs. Medical Conditions

A genogram can display both heritage and medical conditions, but they cannot be mixed on the same shape (which would cause visual conflict). Solutions:

  1. Layered display: heritage uses shape fill color; medical conditions use small markers (dots/icons) on the shape border
  2. Mode switching: the DSL header declares genogram [mode: heritage] or genogram [mode: medical], and the renderer determines fill meaning accordingly
  3. Recommendation: default mode=medical (most common); heritage mode must be explicitly declared

2B.4 DSL Syntax

genogram "Heritage Example" [mode: heritage]
  legend: colombian = "Colombian" (#9C27B0)
  legend: irish = "Irish" (#4CAF50)
  
  father [male, 1960, heritage: colombian]
  mother [female, 1962, heritage: irish]
  father -- mother
    child [female, 1990, heritage: colombian + irish]

2C. Label & Annotation System

Based on real genogram use cases (clinical assessment, teaching cases, case presentations), individual nodes require a rich annotation system.

2C.1 In-Shape Display

Age number displayed inside the shape (common in clinical presentation genograms):

DisplayPositionDSLMeaning
Age numberShape center[age: 57] or auto-calculated from birth yearCurrent age or age at death
InitialsShape center[initials: "JG"]Name initials

Implementation:

  • Age/initials are rendered as <text> at the center of the shape
  • Font: bold, 12-14px, class="schematex-in-shape-text"
  • When condition fill is present, text color automatically adjusts to white (on dark fill) or black (on light/no fill)
  • age can be omitted in DSL — if birth year is present, the renderer can calculate it automatically

2C.2 Below-Shape Labels

Standard label position (below shape), supports multiple lines:

LineContentExample
Line 1Name (required)"Ross"
Line 2Birth/death years"(1966)" or "(1930-2020)"
Line 3+Annotations"Paleontologist", "Smoking", "Diabetes"

2C.3 Rich Annotations

Individuals can have multi-line text annotations for clinical assessment records:

ross [male, 1966, label: "Ross"]
  @occupation: "Paleontologist, College Professor"
  @traits: "Geeky, Quirky"  
  @notes: "Golden Child/Favorite"

Or inline shorthand syntax:

ross [male, 1966, occupation: "Professor", notes: "Golden Child"]

Rendering:

  • Annotations are displayed below the name and year
  • Font: italic, 10px, class="schematex-annotation"
  • Maximum 3 annotation lines displayed; excess lines are truncated + shown in tooltip
  • Whether to display annotations can be controlled via render config

2C.4 Relationship Labels on Lines

Couple and emotional relationship lines can have text labels attached:

jack -- judy [label: "Married 35 yrs"]
ross -close- monica [label: "Competitive"]
ross -hostile- rachel [label: "On and off"]

Rendering:

  • Label is displayed above the midpoint of the line (couple lines) or along the line (emotional lines)
  • Font: 10px, class="schematex-edge-label"
  • Background: white with slight opacity, to avoid visual confusion with the line

2D. In-Law & Extended Family Notation

2D.1 In-Law Relationships

In-law relationships are automatically inferred from marriage and do not require a separate relationship type. However, they should be noted in label display:

RelationshipHow to annotateNotes
Father-in-law / Mother-in-lawAutomatically inferred from spouse's parentsNo extra DSL needed
Brother-in-law / Sister-in-lawAutomatically inferred from spouse's siblingsNo extra DSL needed
Son-in-law / Daughter-in-lawAutomatically inferred from child's spouseNo extra DSL needed

Optional display: The renderer can show in-law relationship labels (e.g. "Brother-in-law") via the render config showInLawLabels: true.

2D.2 Non-Family Members in Genogram

Some genograms include non-family members (e.g. therapist, friend, mentor). These individuals typically have a dashed border on their shape:

therapist [other, label: "Dr. Smith", external: true]
ross -close- therapist
  • external: true → dashed border on shape
  • Does not participate in generation alignment (floats near the related individual)

2E. Legend Box

Complex genograms must include a legend box explaining the meaning of colors and symbols.

2E.1 Auto-Generated Legend

The renderer automatically generates a legend containing all elements actually used in the diagram:

  • Condition categories + corresponding colors
  • Heritage colors (if heritage mode)
  • Emotional relationship line styles
  • Special symbols (adopted, foster, deceased, etc.)

2E.2 Legend Positioning

PositionWhen to use
Bottom-right (default)Most cases
Right sideWhen the diagram is wide
Bottom centerWhen the diagram is tall
External (separate SVG group)Can be positioned independently when embedded in a webpage

2E.3 DSL

genogram "Family Study" [legend: bottom-right]
  # ... individuals and relationships ...

Legend content is automatically derived from conditions/heritage/relationships used in the diagram and does not need to be manually specified. However, legend: definitions (see 2B.1) can override auto-derived colors/labels.


3. Relationship Lines

3.1 Couple/Partnership Relationships

RelationshipLine StyleDSL SyntaxSVG
MarriageSolid horizontal lineA -- B<line> stroke-width: 2
Cohabitation/LTRDashed lineA ~ Bstroke-dasharray="6,4"
EngagementSolid + small diamond midpointA -o- Bline + small diamond marker
SeparationSolid + single slashA -/- Bline + one diagonal slash
DivorceSolid + double slashA -x- Bline + two diagonal slashes
ConsanguinityDouble horizontal lineA == BTwo parallel lines, gap 4px
RemarriageNew marriage line from same personSecond A -- CAdditional horizontal line
Same-sex marriageSame as marriageA -- B (both same sex)Same rendering, positioning by age
Domestic partnershipDashed + DP labelA ~dp~ Bstroke-dasharray + text label

3.2 Emotional Relationship Types (GenoPro 34-Type Taxonomy)

This is the most important extension in clinical genogram use. GenoPro defines 34 emotional relationship types in 7 major categories:

Category 1: Positive/Close Relationships

TypeLine StyleDSLMeaning
HarmonySingle green solid lineA -harmony- BHarmonious relationship
CloseTwo parallel green linesA -close- BClose/intimate
Best friendsThree parallel green linesA -bestfriends- BBest friends
LoveHeart symbol on lineA -love- BLove
In loveDouble heart on lineA -inlove- BDeeply in love
FriendshipSingle blue lineA -friendship- BFriendship

Category 2: Negative/Hostile Relationships

TypeLine StyleDSLMeaning
HostileZigzag red lineA -hostile- BHostile
ConflictZigzag line + hash marksA -conflict- BConflict
EnmityThick zigzag red lineA -enmity- BEnmity/hatred
Distant-hostileDotted zigzag lineA -distant-hostile- BDistant + hostile
CutoffBroken line with gapA -cutoff- BEstranged/cut off

Category 3: Ambivalent/Complex Relationships

TypeLine StyleDSLMeaning
Close-hostileTwo parallel + zigzagA -close-hostile- BClose but hostile
FusedThree parallel lines (intense)A -fused- BFused (over-involved)
Fused-hostileThree parallel + zigzagA -fused-hostile- BFused + hostile

Category 4: Distance Relationships

TypeLine StyleDSLMeaning
DistantDotted thin lineA -distant- BDistant
Plain/NormalSingle solid line (default)A -normal- BNormal relationship
Never metNo line (gap symbol)A -nevermet- BNever met

Category 5: Abuse Relationships

TypeLine StyleDSLMeaning
Abuse (general)Arrow + red zigzagA -abuse-> BAbuse (directional)
Physical abuseArrow + thick red zigzagA -physical-abuse-> BPhysical abuse
Emotional abuseArrow + wavy red lineA -emotional-abuse-> BEmotional abuse
Sexual abuseArrow + red zigzag + dotA -sexual-abuse-> BSexual abuse
NeglectArrow + thin dotted redA -neglect-> BNeglect

Note: Abuse relationships are directional (-> indicates A abuses B).

Category 6: Control/Power Relationships

TypeLine StyleDSLMeaning
ManipulativeArrow + curved lineA -manipulative-> BManipulation
ControllingArrow + thick line + barA -controlling-> BControl
JealousArrow + green zigzagA -jealous-> BJealousy

Category 7: Special Relationships

TypeLine StyleDSLMeaning
Focused onArrow + magnifying symbolA -focused-> BFocused on (positive)
Focused on negativelyArrow + negative magnifyingA -focused-neg-> BFocused on (negative)
DistrustDotted line + XA -distrust- BDistrust
Fan/AdmirerArrow + starA -admirer-> BAdmiration/fan
LimerenceArrow + heart + questionA -limerence-> BUnrequited love/obsession

3.3 Emotional Relationship SVG Implementation

Line rendering priority:

  1. Base line shape: straight / zigzag / wavy / dotted / dashed
  2. Color coding: green (positive), red (negative/abuse), blue (neutral), orange (control)
  3. Multiplicity: 1 line (normal), 2 lines (close), 3 lines (fused/best friends)
  4. Directional markers: arrowhead for abuse/control/focused relationships
  5. Special symbols: heart, X, star (rendered as small SVG markers at line midpoint)

SVG markers in <defs>:

<defs>
  <marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="6" markerHeight="6" orient="auto">
    <path d="M 0 0 L 10 5 L 0 10 z" fill="#333"/>
  </marker>
  <marker id="heart" viewBox="0 0 12 12" refX="6" refY="6" markerWidth="8" markerHeight="8">
    <path d="M6,10 C2,6 0,4 2,2 C4,0 6,2 6,4 C6,2 8,0 10,2 C12,4 10,6 6,10z" fill="#E53935"/>
  </marker>
</defs>

Zigzag path generation (for hostile/conflict):

M x1,y1 L x1+10,y1-5 L x1+20,y1+5 L x1+30,y1-5 ... L x2,y2

3.4 Parent-Child Relationships

RelationshipLine StyleDSL PropertyMeaning
Biological childSolid vertical line(default)Biological
Adopted childDashed line + brackets[adopted]Adopted
Foster childDotted vertical line[foster]Foster
Identical twinsLines meet at single point (V)[twin-identical]Identical twins
Fraternal twinsLines connect with bar[twin-fraternal]Fraternal twins
Triplets+3+ lines from single point/bar[triplet-identical]Triplets+
SurrogacyDotted line + S label[surrogate]Surrogacy
Donor gameteDotted line + D label[donor]Donor gamete
Step-childStep-shaped line (two right angles)[step]Stepchild

3.5 Modern Family Structures

Schematex must support modern non-traditional family structures:

StructureHow to handle
Same-sex parentsTwo same-sex partners, standard couple line, children connect the same way
Single parent by choiceOnly one parent node, direct vertical line to children
Donor conceptionDotted line from donor node (donor can optionally be shown/hidden)
SurrogacySurrogate connected to child with dotted line, biological parents with solid line
Co-parenting (non-couple)Two individuals connected to children but no couple line between them
Blended familyStep-children connections + multiple marriage lines
Polyamorous familyMultiple concurrent couple lines from same individual (no divorce markers)

Children connection structure (standard):

Father ────── Mother       (couple line)

       ├──── Child 1        (sibship line + drop lines)
       ├──── Child 2
       └──── Child 3

4. Layout Rules

4.1 Generation Alignment

  • Individuals of the same generation must share the same Y coordinate — the most important layout constraint
  • Generation 0 (oldest generation) is at the top
  • Y coordinates increase downward (SVG coordinate system)
  • Generation spacing: default 120px

4.2 Couple Positioning

  • Male left, female right (McGoldrick standard hard rule)
  • Same-sex partners: ordered by age (older on left, younger on right)
  • Nonbinary partners: ordered by appearance in DSL (first on left)
  • Couple line is horizontal, connecting the center height of both shapes

4.3 Children Ordering

  • Children are ordered left to right by birth year (oldest to youngest)
  • Children group is centered below the couple line
  • Sibship line is directly below the couple line

4.4 Multiple Marriages

  • Arranged left to right in chronological order
  • First spouse is innermost, subsequent spouses extend outward
  • Children from each marriage hang below their respective couple line

4.5 Edge Crossing Minimization

  • Barycenter heuristic method
  • Priority: no parent-child crossings > no couple crossings > no emotional relationship crossings

4.6 Spacing Rules

ParameterDefaultMeaning
Node width40pxIndividual shape width
Node height40pxIndividual shape height
Sibling spacing60pxHorizontal between siblings
Family unit spacing80pxHorizontal between family units
Generation spacing120pxVertical between generations
Couple line length60pxBetween partners
Drop line length40pxCouple to sibship line
Emotional line offset20pxOffset from structural lines (avoid overlap)

4.7 Emotional Relationship Line Routing

  • Emotional relationship lines are rendered above structural lines (couple/parent-child)
  • If A and B are in different generations, the line routes around intermediate nodes (avoiding passing through shapes)
  • Emotional lines within the same generation are drawn below the nodes (curved path)
  • Emotional lines between different generations are drawn to the right (avoiding the parent-child area)

5. DSL Grammar (Genogram — Expanded)

document       = header? legend_def* statement*
header         = "genogram" quoted_string? header_props? NEWLINE
header_props   = "[" header_prop ("," header_prop)* "]"
header_prop    = "mode:" MODE | "legend:" POSITION
MODE           = "medical" | "heritage"    # default: medical
POSITION       = "bottom-right" | "right" | "bottom-center" | "none"

legend_def     = "legend:" IDENTIFIER "=" quoted_string ( "(" color ")" )? NEWLINE

statement      = comment | individual_def | relationship_def
               | emotional_rel_def | annotation_def

comment        = "#" [^\n]* NEWLINE

individual_def = ID properties? NEWLINE
properties     = "[" property ("," property)* "]"
property       = sex_prop | gender_prop | status_prop | year_prop
               | condition_prop | heritage_prop | child_prop | kv_prop

sex_prop       = "male" | "female" | "unknown" | "nonbinary" | "intersex"
gender_prop    = "transgender"
status_prop    = "deceased" | "stillborn" | "miscarriage" | "abortion" | "pregnancy"
year_prop      = /[0-9]{4}/
condition_prop = "conditions:" condition ("+" condition)*
condition      = IDENTIFIER ( "(" fill_spec ")" )?
fill_spec      = (fill_position ("," color)?) | "carrier"
fill_position  = "full" | "half-left" | "half-right" | "half-top" | "half-bottom"
               | "quad-tl" | "quad-tr" | "quad-bl" | "quad-br"
heritage_prop  = "heritage:" IDENTIFIER ("+" IDENTIFIER)*
color          = "#" HEX{6} | NAMED_COLOR
child_prop     = "adopted" | "foster" | "surrogate" | "donor" | "step"
               | "twin-identical" | "twin-fraternal"
               | "triplet-identical" | "triplet-fraternal"
kv_prop        = IDENTIFIER ":" VALUE

annotation_def = INDENT "@" IDENTIFIER ":" quoted_string NEWLINE  # follows individual_def

relationship_def       = couple_rel | couple_with_children
couple_rel             = ID couple_op ID rel_label? NEWLINE
couple_with_children   = ID couple_op ID rel_label? NEWLINE INDENT child+ DEDENT
couple_op              = "--" | "-x-" | "-/-" | "~" | "==" | "-o-" | "~dp~"
rel_label              = "[" "label:" quoted_string "]"
child                  = individual_def

emotional_rel_def      = ID emotional_op ID rel_label? NEWLINE
emotional_op           = "-" EMOTIONAL_TYPE "-" ID
                       | "-" EMOTIONAL_TYPE "->" ID    # directional (abuse, control, focused)

EMOTIONAL_TYPE = "harmony" | "close" | "bestfriends" | "love" | "inlove"
               | "friendship" | "hostile" | "conflict" | "enmity"
               | "distant-hostile" | "cutoff" | "close-hostile"
               | "fused" | "fused-hostile" | "distant" | "normal" | "nevermet"
               | "abuse" | "physical-abuse" | "emotional-abuse"
               | "sexual-abuse" | "neglect"
               | "manipulative" | "controlling" | "jealous"
               | "focused" | "focused-neg" | "distrust"
               | "admirer" | "limerence"

ID             = /[a-zA-Z][a-zA-Z0-9_-]*/
IDENTIFIER     = /[a-zA-Z][a-zA-Z0-9_-]*/
VALUE          = /[^\],\n]+/
quoted_string  = '"' /[^"]*/ '"'
INDENT         = increase in leading whitespace (2+ spaces)
DEDENT         = decrease in leading whitespace
NEWLINE        = /\n/

Parser notes:

  • Indentation-sensitive (similar to Python/YAML), used to express parent-child relationships
  • Lines starting with # are line comments
  • Properties are comma-separated and order-independent
  • IDs are case-insensitive for matching, but original case is preserved for display
  • The same ID can appear multiple times: first occurrence defines properties, subsequent occurrences are references
  • Blank lines are ignored
  • Emotional relationship definitions are independent from couple/parent-child definitions
  • Lenient parsing: extra spaces, missing commas, etc. should be tolerated with friendly error messages

6. Test Cases

Case 1: Nuclear Family (Basic)

genogram
  john [male, 1950]
  mary [female, 1955]
  john -- mary
    alice [female, 1980]
    bob [male, 1983]

Verify: john is to the left of mary, alice is to the left of bob (older), generation 0 / generation 1.

Case 2: Three Generations

genogram "Smith Family"
  grandpa [male, 1930, deceased]
  grandma [female, 1932]
  grandpa -- grandma
    dad [male, 1955]
    aunt [female, 1958]
  dad -- mom [female, 1957]
    me [male, 1985]
    sister [female, 1988]

Case 3: Divorce + Remarriage

genogram
  tom [male, 1950]
  jane [female, 1952]
  tom -x- jane
    child1 [male, 1975]
  tom -- susan [female, 1960]
    child2 [female, 1985]

Verify: jane and susan appear on opposite sides of tom, divorce marker on the tom-jane line.

Case 4: Medical Conditions (Color-coded)

genogram
  father [male, 1945, conditions: heart-disease(half-left, #E53935) + diabetes(half-right, #FB8C00)]
  mother [female, 1948, conditions: depression(full, #5C6BC0)]
  father -- mother
    son [male, 1970, conditions: diabetes(carrier)]
    daughter [female, 1973, conditions: anxiety(full, #26A69A) + heart-disease(carrier)]

Verify: father has two-color half fill, mother has full indigo fill, son has striped pattern, daughter has teal fill + stripe.

Case 5: Single Individual

genogram
  solo [female, 1990]

Verify: single person renders without crash, displayed centered.

Case 6: Childless Couple

genogram
  husband [male, 1960]
  wife [female, 1962]
  husband -- wife

Verify: only a couple line, no children lines.

Case 7: Emotional Relationships

genogram
  mom [female, 1955]
  dad [male, 1953]
  son [male, 1980]
  daughter [female, 1983]
  mom -- dad
    son
    daughter
  mom -close- daughter
  dad -hostile- son
  mom -fused- son
  dad -distant- daughter

Verify: 4 emotional relationship lines overlaid on structural lines, each with the correct line style and color.

Case 8: Modern Family (LGBTQ+ / Donor)

genogram "Modern Family"
  alex [female, 1985]
  sam [female, 1987]
  alex -- sam
    child [male, 2015, donor]
  donor-d [male, 1980]

Verify: same-sex couple (ordered by age), child has donor marker, donor-d optionally displayed.

Case 9: Abuse + Control Relationships

genogram
  father [male, 1950]
  mother [female, 1955]
  child [female, 1978]
  father -- mother
    child
  father -physical-abuse-> mother
  father -emotional-abuse-> child

Verify: abuse lines have directional arrows, red zigzag style, overlaid on structural connections.

Case 10: Nonbinary / Transgender

genogram
  parent1 [male, 1960]
  parent2 [female, 1962]
  child1 [nonbinary, 1990]
  child2 [male, transgender, 1992]
  parent1 -- parent2
    child1
    child2

Verify: child1 renders as diamond, child2 renders as square + transgender marker.

Case 11: Cultural Heritage Genogram

genogram "Anna Maria's Heritage" [mode: heritage]
  legend: colombian = "Colombian" (#9C27B0)
  legend: dominican = "Dominican Republic" (#FFEB3B)
  legend: french = "French" (#1565C0)
  legend: irish = "Irish" (#4CAF50)
  legend: puerto-rican = "Puerto Rican" (#FF9800)

  jose [male, 1940, heritage: colombian]
  benita [female, 1942, heritage: dominican]
  jose -- benita
    felipa [female, 1965, heritage: colombian + dominican]
  patrick [male, 1938, heritage: irish]
  marie [female, 1940, heritage: french]
  patrick -- marie
    michael [male, 1966, heritage: irish + french]
  felipa -- michael
    anna-maria [female, 1990, heritage: colombian + dominican + irish + french]

Verify: heritage mode activated, legend box shows 5 colors, anna-maria's shape has 4-quadrant fill with each quadrant color corresponding to a different heritage.

Case 12: Rich Annotations + In-Shape Age

genogram "Clinical Assessment"
  jack [male, 1968, age: 57, occupation: "Veteran, Businessman"]
    @traits: "Tone Deaf Dad"
    @medical: "Smoking, Diabetes"
  judy [female, 1970, age: 55, occupation: "Homemaker"]
    @notes: "Good Wife, Good Mother"
  jack -- judy [label: "Married 35 yrs"]
    ross [male, 1989, age: 36, occupation: "Professor"]
    monica [female, 1991, age: 34, occupation: "Chef"]
      @traits: "Hardworking, Type A, Neat Freak"
  jack -close- ross [label: "Favoritism"]
  judy -close- monica [label: "Favoritism"]
  ross -hostile- monica [label: "Competitive"]

Verify: age numbers (57, 55, 36, 34) displayed inside shapes, annotations displayed below names, relationship labels displayed on lines.

Case 13: Extended Family with In-Laws

genogram "Extended Family"
  # Paternal side
  gf1 [male, 1940]
  gm1 [female, 1942]
  gf1 -- gm1
    uncle1 [male, 1965]
    father [male, 1968]
  uncle1 -- aunt1 [female, 1967]
    cousin [male, 1992]

  # Maternal side
  gf2 [male, 1938]
  gm2 [female, 1940]
  gf2 -- gm2
    mother [female, 1970]
    uncle2 [male, 1972]
  uncle2 -- aunt2 [female, 1974]

  # Nuclear family
  father -- mother
    me [male, 1995]
    brother [male, 1997]
    sister [female, 2000]
  sister -- bro-in-law [male, 1998]
  brother -- sis-in-law [female, 1999]

Verify: two grandparent couples in generation 0, parents + uncles/aunts in generation 1, me/siblings + in-laws in generation 2.


7. Implementation Priority

The Phase 1 parser/layout/renderer has implemented basic functionality (Cases 1-6). The following are extension priorities:

PriorityFeatureComplexityUser value
P0 (Phase 1 ✅)Basic symbols + couple + parent-child + conditions (simple fills)DoneCore
P1Color-coded condition categories (22 categories)MediumHigh — core need for medical professionals
P1Emotional relationships (at least top 10 types)MediumHigh — core need for social workers/therapists
P1In-shape age/text displayLowHigh — present in nearly all clinical genograms
P1Relationship labels on linesLowHigh — standard in clinical genograms
P1Legend box auto-generationMediumHigh — required for complex genograms
P2Full 34 emotional relationship typesMediumMedium — professional-grade genograms
P2Bennett 2022 gender inclusivityLowMedium — required for modernization
P2Abuse/control directional relationshipsMediumHigh — core for clinical assessment
P2Modern family structures (donor, surrogate, step)MediumMedium — modern families
P2Cultural Heritage genogram modeMediumMedium — social work/multicultural assessment
P2Rich annotations (@occupation, @traits, @notes)MediumMedium — clinical documentation
P3Quadrant fill → radial pie for 5+ conditionsHighLow — edge case
P3Emotional line routing (avoid overlap)HighMedium — visual quality
P3External/non-family members (dashed border)LowLow — niche use case

On this page

1. Individual Symbols1.1 Core Shapes1.2 Status Modifiers1.3 Bennett 2022 Gender/Sex Inclusivity Update1.4 Multiple Births1.5 SVG Implementation Notes2. Medical/Psychological Condition System2.1 Condition Display: Quadrant Fill System2.2 Standard Medical Condition Categories (22 Categories)2.3 Condition SVG Defs2.4 DSL Syntax for Conditions2B. Cultural/Heritage Genogram (Ethnicity Color System)2B.1 Heritage Color Coding2B.2 Mixed Heritage Display2B.3 Heritage vs. Medical Conditions2B.4 DSL Syntax2C. Label & Annotation System2C.1 In-Shape Display2C.2 Below-Shape Labels2C.3 Rich Annotations2C.4 Relationship Labels on Lines2D. In-Law & Extended Family Notation2D.1 In-Law Relationships2D.2 Non-Family Members in Genogram2E. Legend Box2E.1 Auto-Generated Legend2E.2 Legend Positioning2E.3 DSL3. Relationship Lines3.1 Couple/Partnership Relationships3.2 Emotional Relationship Types (GenoPro 34-Type Taxonomy)Category 1: Positive/Close RelationshipsCategory 2: Negative/Hostile RelationshipsCategory 3: Ambivalent/Complex RelationshipsCategory 4: Distance RelationshipsCategory 5: Abuse RelationshipsCategory 6: Control/Power RelationshipsCategory 7: Special Relationships3.3 Emotional Relationship SVG Implementation3.4 Parent-Child Relationships3.5 Modern Family Structures4. Layout Rules4.1 Generation Alignment4.2 Couple Positioning4.3 Children Ordering4.4 Multiple Marriages4.5 Edge Crossing Minimization4.6 Spacing Rules4.7 Emotional Relationship Line Routing5. DSL Grammar (Genogram — Expanded)6. Test CasesCase 1: Nuclear Family (Basic)Case 2: Three GenerationsCase 3: Divorce + RemarriageCase 4: Medical Conditions (Color-coded)Case 5: Single IndividualCase 6: Childless CoupleCase 7: Emotional RelationshipsCase 8: Modern Family (LGBTQ+ / Donor)Case 9: Abuse + Control RelationshipsCase 10: Nonbinary / TransgenderCase 11: Cultural Heritage GenogramCase 12: Rich Annotations + In-Shape AgeCase 13: Extended Family with In-Laws7. Implementation Priority