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.
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
| Symbol | Shape | SVG Element | Meaning |
|---|---|---|---|
| □ | 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 shape | Double outline (gap=3px) | Two shapes, inner + outer | Index Person (IP) / Identified Patient |
1.2 Status Modifiers
| Status | Visual | SVG Implementation |
|---|---|---|
| Deceased | X through shape, corner to corner | Two <line> elements crossing shape |
| Stillborn | 50% size shape + SB label | Scaled shape with text |
| Miscarriage | Small triangle (△, 12×12) | <polygon> small |
| Spontaneous abortion | Small × (12×12) | Two short <line> elements |
| Induced abortion | Small × with horizontal line through | <line> elements + cross bar |
| Pregnancy | Dashed outline | stroke-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:
| Notation | Meaning | Visual |
|---|---|---|
| AMAB | Assigned Male at Birth | Square (traditional male symbol) |
| AFAB | Assigned Female at Birth | Circle (traditional female symbol) |
| UAAB | Unknown/Ambiguous at Birth / Intersex | Diamond |
| Nonbinary | Gender identity = nonbinary | Diamond + optional gender label |
| Transgender | Gender ≠ assigned sex | Shape = 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:
sexproperty controls the shape (male→□, female→○, unknown/nonbinary/intersex→◇)transgenderproperty adds a small triangle marker at the corner of the shapegenderproperty is optional, used for label display
1.4 Multiple Births
| Type | Visual | DSL |
|---|---|---|
| Identical twins | V-shape: two child lines meet at single point on sibship line | [twin-identical] |
| Fraternal twins | Inverted-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 shapestroke-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 Position | Quadrant | SVG Implementation |
|---|---|---|
| Full fill | Entire shape | fill: {color} |
| Top-left quarter | Top-left 1/4 | <clipPath> top-left quadrant |
| Top-right quarter | Top-right 1/4 | <clipPath> top-right quadrant |
| Bottom-left quarter | Bottom-left 1/4 | <clipPath> bottom-left quadrant |
| Bottom-right quarter | Bottom-right 1/4 | <clipPath> bottom-right quadrant |
| Half-left | Left half | <clipPath> left half |
| Half-right | Right half | <clipPath> right half |
| Half-top | Top half | <clipPath> top half |
| Half-bottom | Bottom half | <clipPath> bottom half |
| Striped/hatched | Diagonal stripe fill | <pattern> diagonal lines |
| Dotted | Dot fill | <pattern> dots |
Multiple condition stacking rules:
- 1 condition → full fill or half fill
- 2 conditions → left half + right half
- 3 conditions → top-left + top-right + bottom half
- 4 conditions → four quadrants
- 5+ conditions → radial pie (equal sectors) or numbered legend
- 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.
| Category | Default Color | Hex | Common conditions |
|---|---|---|---|
| Cardiovascular | Red | #E53935 | Heart disease, hypertension, stroke, CHF |
| Cancer | Dark Blue | #1E88E5 | All malignancies (can be subdivided by type) |
| Diabetes | Orange | #FB8C00 | Type 1, Type 2, gestational |
| Mental Health (General) | Purple | #8E24AA | Schizophrenia, psychosis, other |
| Depression | Indigo | #5C6BC0 | Major depressive disorder, dysthymia |
| Anxiety | Teal | #26A69A | GAD, panic disorder, phobias, OCD |
| Bipolar | Violet | #AB47BC | Bipolar I, Bipolar II |
| PTSD | Dark Teal | #00897B | Post-traumatic stress disorder |
| Substance Abuse (Alcohol) | Amber | #FFB300 | Alcohol use disorder |
| Substance Abuse (Drugs) | Deep Orange | #F4511E | Drug use disorder (opioids, stimulants, etc.) |
| Substance Abuse (Tobacco) | Brown | #795548 | Nicotine dependence |
| Neurological | Gray-Blue | #546E7A | Alzheimer's, Parkinson's, epilepsy, MS |
| Respiratory | Light Blue | #42A5F5 | Asthma, COPD, cystic fibrosis |
| Autoimmune | Pink | #EC407A | Lupus, rheumatoid arthritis, Crohn's |
| Genetic/Chromosomal | Dark Green | #2E7D32 | Down syndrome, sickle cell, Huntington's |
| Reproductive | Rose | #F48FB1 | Infertility, PCOS, endometriosis |
| Eating Disorders | Light Purple | #CE93D8 | Anorexia, bulimia, BED |
| Learning/Developmental | Lime | #9CCC65 | ADHD, autism spectrum, dyslexia |
| Kidney/Urological | Olive | #827717 | CKD, kidney stones |
| Liver/GI | Yellow-Green | #C0CA33 | Hepatitis, cirrhosis, IBD |
| Obesity | Dark Amber | #FF8F00 | BMI ≥ 30 |
| Other/Custom | Gray | #757575 | Any 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
carrierfill → 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:
- Layered display: heritage uses shape fill color; medical conditions use small markers (dots/icons) on the shape border
- Mode switching: the DSL header declares
genogram [mode: heritage]orgenogram [mode: medical], and the renderer determines fill meaning accordingly - 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):
| Display | Position | DSL | Meaning |
|---|---|---|---|
| Age number | Shape center | [age: 57] or auto-calculated from birth year | Current age or age at death |
| Initials | Shape 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)
agecan 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:
| Line | Content | Example |
|---|---|---|
| Line 1 | Name (required) | "Ross" |
| Line 2 | Birth/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:
| Relationship | How to annotate | Notes |
|---|---|---|
| Father-in-law / Mother-in-law | Automatically inferred from spouse's parents | No extra DSL needed |
| Brother-in-law / Sister-in-law | Automatically inferred from spouse's siblings | No extra DSL needed |
| Son-in-law / Daughter-in-law | Automatically inferred from child's spouse | No 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- therapistexternal: 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
| Position | When to use |
|---|---|
| Bottom-right (default) | Most cases |
| Right side | When the diagram is wide |
| Bottom center | When 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
| Relationship | Line Style | DSL Syntax | SVG |
|---|---|---|---|
| Marriage | Solid horizontal line | A -- B | <line> stroke-width: 2 |
| Cohabitation/LTR | Dashed line | A ~ B | stroke-dasharray="6,4" |
| Engagement | Solid + small diamond midpoint | A -o- B | line + small diamond marker |
| Separation | Solid + single slash | A -/- B | line + one diagonal slash |
| Divorce | Solid + double slash | A -x- B | line + two diagonal slashes |
| Consanguinity | Double horizontal line | A == B | Two parallel lines, gap 4px |
| Remarriage | New marriage line from same person | Second A -- C | Additional horizontal line |
| Same-sex marriage | Same as marriage | A -- B (both same sex) | Same rendering, positioning by age |
| Domestic partnership | Dashed + DP label | A ~dp~ B | stroke-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
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Harmony | Single green solid line | A -harmony- B | Harmonious relationship |
| Close | Two parallel green lines | A -close- B | Close/intimate |
| Best friends | Three parallel green lines | A -bestfriends- B | Best friends |
| Love | Heart symbol on line | A -love- B | Love |
| In love | Double heart on line | A -inlove- B | Deeply in love |
| Friendship | Single blue line | A -friendship- B | Friendship |
Category 2: Negative/Hostile Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Hostile | Zigzag red line | A -hostile- B | Hostile |
| Conflict | Zigzag line + hash marks | A -conflict- B | Conflict |
| Enmity | Thick zigzag red line | A -enmity- B | Enmity/hatred |
| Distant-hostile | Dotted zigzag line | A -distant-hostile- B | Distant + hostile |
| Cutoff | Broken line with gap | A -cutoff- B | Estranged/cut off |
Category 3: Ambivalent/Complex Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Close-hostile | Two parallel + zigzag | A -close-hostile- B | Close but hostile |
| Fused | Three parallel lines (intense) | A -fused- B | Fused (over-involved) |
| Fused-hostile | Three parallel + zigzag | A -fused-hostile- B | Fused + hostile |
Category 4: Distance Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Distant | Dotted thin line | A -distant- B | Distant |
| Plain/Normal | Single solid line (default) | A -normal- B | Normal relationship |
| Never met | No line (gap symbol) | A -nevermet- B | Never met |
Category 5: Abuse Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Abuse (general) | Arrow + red zigzag | A -abuse-> B | Abuse (directional) |
| Physical abuse | Arrow + thick red zigzag | A -physical-abuse-> B | Physical abuse |
| Emotional abuse | Arrow + wavy red line | A -emotional-abuse-> B | Emotional abuse |
| Sexual abuse | Arrow + red zigzag + dot | A -sexual-abuse-> B | Sexual abuse |
| Neglect | Arrow + thin dotted red | A -neglect-> B | Neglect |
Note: Abuse relationships are directional (-> indicates A abuses B).
Category 6: Control/Power Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Manipulative | Arrow + curved line | A -manipulative-> B | Manipulation |
| Controlling | Arrow + thick line + bar | A -controlling-> B | Control |
| Jealous | Arrow + green zigzag | A -jealous-> B | Jealousy |
Category 7: Special Relationships
| Type | Line Style | DSL | Meaning |
|---|---|---|---|
| Focused on | Arrow + magnifying symbol | A -focused-> B | Focused on (positive) |
| Focused on negatively | Arrow + negative magnifying | A -focused-neg-> B | Focused on (negative) |
| Distrust | Dotted line + X | A -distrust- B | Distrust |
| Fan/Admirer | Arrow + star | A -admirer-> B | Admiration/fan |
| Limerence | Arrow + heart + question | A -limerence-> B | Unrequited love/obsession |
3.3 Emotional Relationship SVG Implementation
Line rendering priority:
- Base line shape: straight / zigzag / wavy / dotted / dashed
- Color coding: green (positive), red (negative/abuse), blue (neutral), orange (control)
- Multiplicity: 1 line (normal), 2 lines (close), 3 lines (fused/best friends)
- Directional markers: arrowhead for abuse/control/focused relationships
- 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,y23.4 Parent-Child Relationships
| Relationship | Line Style | DSL Property | Meaning |
|---|---|---|---|
| Biological child | Solid vertical line | (default) | Biological |
| Adopted child | Dashed line + brackets | [adopted] | Adopted |
| Foster child | Dotted vertical line | [foster] | Foster |
| Identical twins | Lines meet at single point (V) | [twin-identical] | Identical twins |
| Fraternal twins | Lines connect with bar | [twin-fraternal] | Fraternal twins |
| Triplets+ | 3+ lines from single point/bar | [triplet-identical] | Triplets+ |
| Surrogacy | Dotted line + S label | [surrogate] | Surrogacy |
| Donor gamete | Dotted line + D label | [donor] | Donor gamete |
| Step-child | Step-shaped line (two right angles) | [step] | Stepchild |
3.5 Modern Family Structures
Schematex must support modern non-traditional family structures:
| Structure | How to handle |
|---|---|
| Same-sex parents | Two same-sex partners, standard couple line, children connect the same way |
| Single parent by choice | Only one parent node, direct vertical line to children |
| Donor conception | Dotted line from donor node (donor can optionally be shown/hidden) |
| Surrogacy | Surrogate 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 family | Step-children connections + multiple marriage lines |
| Polyamorous family | Multiple 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 34. 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
| Parameter | Default | Meaning |
|---|---|---|
| Node width | 40px | Individual shape width |
| Node height | 40px | Individual shape height |
| Sibling spacing | 60px | Horizontal between siblings |
| Family unit spacing | 80px | Horizontal between family units |
| Generation spacing | 120px | Vertical between generations |
| Couple line length | 60px | Between partners |
| Drop line length | 40px | Couple to sibship line |
| Emotional line offset | 20px | Offset 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 -- wifeVerify: 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- daughterVerify: 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-> childVerify: 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
child2Verify: 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:
| Priority | Feature | Complexity | User value |
|---|---|---|---|
| P0 (Phase 1 ✅) | Basic symbols + couple + parent-child + conditions (simple fills) | Done | Core |
| P1 | Color-coded condition categories (22 categories) | Medium | High — core need for medical professionals |
| P1 | Emotional relationships (at least top 10 types) | Medium | High — core need for social workers/therapists |
| P1 | In-shape age/text display | Low | High — present in nearly all clinical genograms |
| P1 | Relationship labels on lines | Low | High — standard in clinical genograms |
| P1 | Legend box auto-generation | Medium | High — required for complex genograms |
| P2 | Full 34 emotional relationship types | Medium | Medium — professional-grade genograms |
| P2 | Bennett 2022 gender inclusivity | Low | Medium — required for modernization |
| P2 | Abuse/control directional relationships | Medium | High — core for clinical assessment |
| P2 | Modern family structures (donor, surrogate, step) | Medium | Medium — modern families |
| P2 | Cultural Heritage genogram mode | Medium | Medium — social work/multicultural assessment |
| P2 | Rich annotations (@occupation, @traits, @notes) | Medium | Medium — clinical documentation |
| P3 | Quadrant fill → radial pie for 5+ conditions | High | Low — edge case |
| P3 | Emotional line routing (avoid overlap) | High | Medium — visual quality |
| P3 | External/non-family members (dashed border) | Low | Low — niche use case |