Genogram(家系圖)

關於 genogram

Genogram(家系圖)是一種超越傳統家譜「名字與日期」的家庭圖表:它記錄了一個家庭跨越三代以上的情感醫療脈絡。治療師、社工和遺傳諮詢師使用它來找出難以從文字個案記錄中看到的模式——疏離、過度介入、反覆出現的疾病等。

Schematex 遵循臨床訓練中使用的 McGoldrick、Gerson & Petry(2020)標準,以及廣泛採用的 GenoPro 32 種情感關係分類法。理論與歷史背景請參考 Wikipedia: Genogram。本頁文件說明目前解析器所接受的語法。

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 SYMBOLS Deceased RELATIONSHIPS Close Hostile Cutoff MARKERS Index person (focal subject)
UTF-8 · LF · 17 lines · 486 chars✓ parsed·2.1 ms·15.4 KB SVG

1. 你的第一張 genogram

最小的臨床實用 genogram:兩位家長、一個孩子。

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 3 individuals across 2 generations Bob (1978) Alice (1980) Carol (2008) Bob (b. 1978) Alice (b. 1980) Carol (b. 2008) m. 2005
UTF-8 · LF · 5 lines · 92 chars✓ parsed·0.5 ms·5.3 KB SVG

四條規則涵蓋 80% 的使用情境:

  1. 以關鍵字 genogram 開頭,後面可選擇性地加上引號括住的標題。
  2. 每個人各佔一行:id [屬性]。屬性放在方括號中,以逗號分隔。
  3. 配偶運算子連接兩人——這裡使用 --(婚姻);§4.1 列出全部六種。末尾的引號字串為關係標籤。
  4. 在配偶行下方縮排以新增他們的孩子。

註解必須單獨一行,以 #// 或 Mermaid 風格的 %% 開頭。不支援行內尾端註解(bob [male, 1978] # ...),這樣會讓解析器出錯——請參閱 §8。


2. 個人

個人行的格式為 id [attr1, attr2, …]。屬性以逗號分隔,順序不限,均為可選。

ID 規則: 必須符合 [a-zA-Z][a-zA-Z0-9_-]*。ID 在內部不區分大小寫,但原始大小寫會作為顯示標籤保留(可用 label:"…" 覆寫)。

解析器目前接受的屬性:

屬性效果
性別malefemaleunknownother形狀:方形、圓形、菱形、菱形
狀態deceasedstillbornmiscarriageabortion視覺修飾(打叉、縮小形狀等)
出生年份四位數字,例如 1980第一個四位數字符記 = 出生年份
死亡年份出生年份後的四位數字,例如 1980, 2055第二個四位數字符記 = 死亡年份
index旗標同心形狀 = 識別個案
unknown-siblings旗標? 的菱形——代表一個或多個身份不明的手足
age:N例如 age:42年齡顯示在形狀內
death:YYYY例如 death:2020明確指定死亡年份
label:"…"例如 label:"Dr. Smith"覆寫顯示標籤
sibling-of:<id>例如 sibling-of:monica固定在被參照手足的同一世代,並繪製虛線括號——用於已知但祖先不明的親屬。
conditions:…參見 §5醫療或心理狀況
key:value任何自訂內容儲存為元資料
genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 4 individuals across 1 generations Grandma (1920-2002) 82 Dad (1950) 74 Me (1985) Em (2012) Grandma (1920–2002) Dad (b. 1950) Me (b. 1985) Em (b. 2012) SYMBOLS Deceased MARKERS Index person (focal subject)
UTF-8 · LF · 5 lines · 131 chars✓ parsed·4.4 ms·6.9 KB SVG

3. 形狀

視覺性別值含義
☐ 方形male男性
○ 圓形female女性
◇ 菱形unknownother省略屬性未知 / 未指定

狀態修飾符疊加在基本形狀上:

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 4 individuals across 1 generations Passed (1930-2010) 80 Alive (1960) Stillborn_child Lost Passed (1930–2010) Alive (b. 1960) Stillborn_child Lost SYMBOLS Unknown Deceased Stillborn Miscarriage
UTF-8 · LF · 5 lines · 128 chars✓ parsed·0.8 ms·7.1 KB SVG

4. 連線

4.1 配偶運算子

解析器依序嘗試以下運算子,第一個符合的即為採用——因此 -x- 優先於 --

運算子類型範例含義
-x-離婚a -x- b離婚
-/-分居a -/- b分居(已婚)
-//分居a -// b分居(-/- 的別名)
-o-訂婚a -o- b訂婚
==近親a == b血親配偶
--已婚a -- b婚姻
~同居a ~ b同居 / 長期關係(現在進行中)
~/~同居已結束a ~/~ b同居關係已結束(未曾結婚)。常見於拉丁美洲兒童保護個案,生父母曾非婚同居但關係已結束——有別於 -x- 離婚(無婚姻)和 -/- 分居(仍已婚)。

末尾的引號字串會成為關係標籤(a -- b "m. 2005")。

4.2 右側行內宣告個人

如果右側的人尚未宣告,可以就地宣告:

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 3 individuals across 2 generations Ben (1968) Ann (1970) Kim (1997) Ben (b. 1968) Ann (b. 1970) Kim (b. 1997) m. 1995
UTF-8 · LF · 4 lines · 82 chars✓ parsed·0.6 ms·5.3 KB SVG

4.3 孩子(在配偶行下方縮排)

在配偶行下方縮排 = 「這些是此配偶的孩子」。任何大於配偶縮排的縮排均有效;慣例是多縮排 2 個空格。孩子依宣告順序排列(若有出生年份,算圖時也會依出生年份排序)。

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 6 individuals across 2 generations Dad (1950) Mom (1952) Eldest (1975) Middle (1978) Twin_a (1985) Twin_b (1985) Dad (b. 1950) Mom (b. 1952) Eldest (b. 1975) Middle (b. 1978) Twin_a (b. 1985) Twin_b (b. 1985) STRUCTURAL Adopted Twin Identical
UTF-8 · LF · 8 lines · 186 chars✓ parsed·0.8 ms·7.9 KB SVG

孩子的特殊屬性:

屬性效果
adopted收養連線樣式
foster寄養關係
guardian非親生親屬的監護(例如祖父母監護)。與 foster 使用相同基礎元素——當親生父母也已宣告時,以次要「現任照顧者」連線繪製。
twin-identical與同一配偶的其他 twin-identical 孩子成組
twin-fraternal與其他 twin-fraternal 孩子成組
unknown-siblings? 字符的單一菱形——「一個或多個手足,人數及身份不明」(系譜慣例)。

4.3.1 雙親家庭(寄養、收養、監護)

若孩子被安置在非親生照顧者處,但親生父母仍是案件的一部分,可以在兩對配偶下方都宣告該孩子。第一次宣告時使用完整屬性(在親生配偶下方),然後在現任照顧者下方僅用 [foster] / [adopted] / [guardian] 重新宣告。第一次宣告決定版面位置;第二次則繪製為次要虛線「現任照顧者」連線,不會將孩子從其親生位置拉走。

genogram·§ McGoldrick
↘ preview
100%
Genogram: Foster placement Genogram diagram with 6 individuals across 2 generations Foster placement Bio dad Bio mom Foster dad Foster mom Own (2010) Child (2018) Bio dad Bio mom Foster dad Foster mom Own (b. 2010) Child (b. 2018) STRUCTURAL Cohabiting (ended) Foster MARKERS Index person (focal subject)
UTF-8 · LF · 10 lines · 240 chars✓ parsed·1.2 ms·8.9 KB SVG

相同的基礎元素可用於收養(封閉/開放)、寄養安置,以及親屬監護——只有關鍵字不同。重新宣告會將不衝突的屬性(性別、出生年份、標籤、index 標記)合併到原始宣告中;若宣告了衝突的 malefemale,會產生解析錯誤,而不是靜默覆寫。

4.3.2 手足人數不明

當個案檔案提到「這個孩子有手足」但沒有具體姓名時,可在獨立行使用 ? 簡寫,或在一般 id 上使用 [unknown-siblings]。兩者都會渲染為帶「?」字符的單一菱形——這是系譜中標準的「一個或多個手足,身份不明」符號。

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 4 individuals across 2 generations Dad Mom Known_kid (2018) ? ? Dad Mom Known_kid (b. 2018) ? SYMBOLS Unknown MARKERS Sibling(s) — unknown count
UTF-8 · LF · 6 lines · 72 chars✓ parsed·0.6 ms·7.1 KB SVG

4.3.3 sibling-of(已知親屬,祖先不明)

若要表達「X 是 Y 的手足」而不需要虛構父母,請使用 sibling-of: <id> 屬性。算圖器會將 X 固定在 Y 的世代,並在兩者上方繪製虛線括號——這是系譜的標準慣例,表示已知親屬但其祖先不在案件中。

genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 2 individuals across 1 generations Monica (1990) Tío materno Monica (b. 1990) Tío materno
UTF-8 · LF · 3 lines · 85 chars✓ parsed·0.3 ms·4.4 KB SVG

4.4 情感關係

獨立行,解析器模式為 A -TYPE- B(無方向性)或 A -TYPE-> B(有方向性)。末尾可加上選擇性的引號標籤。兩個人都必須在情感連線之前已宣告。

harry -cutoff- petunia           # non-directional
harry -hostile- dudley "since 1991"
uncle -abuse-> nephew             # directional (arrow)

解析器目前接受的全部 32 種類型:

類別類型
正面 / 親近harmonyclosebestfriendsloveinlovefriendship
負面 / 敵意hostileconflictenmitydistant-hostilecutoff
矛盾close-hostilefusedfused-hostile
距離distantnormalnevermet
虐待 (有方向性)abusephysical-abuseemotional-abusesexual-abuseneglect
控制 (有方向性)manipulativecontrollingjealous
特殊focusedfocused-negdistrustadmirerlimerence
genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 3 individuals across 1 generations since 2010 Dad (1950) Son (1985) Daughter (1988) Dad (b. 1950) Son (b. 1985) Daughter (b. 1988) RELATIONSHIPS Close Conflict Cutoff
UTF-8 · LF · 7 lines · 136 chars✓ parsed·0.6 ms·6.8 KB SVG

5. 醫療狀況

語法:conditions: name(fill) [+ name(fill, #color)]…

father [male, 1945, conditions: heart(full, #E53935)]
mother [female, 1948, conditions: diabetes(half-left) + anxiety(half-right, #26A69A)]
  • name — 任何你選擇的識別符(顯示在圖例/提示中)。
  • fill — 必填,控制形狀的哪個區域著色。見下方表格。
  • color — 可選的十六進位色碼。預設值取決於算圖器主題。
  • 多個狀況以 + 連接。每個狀況需有自己的 (fill)

填色位置:

fill區域
full整個形狀
half-left / half-right左 / 右半部
half-top / half-bottom上 / 下半部
quad-tl / quad-tr / quad-bl / quad-br一個象限
striped對角條紋圖案(無症狀攜帶者)
dotted點狀圖案
genogram·§ McGoldrick
↘ preview
100%
Genogram Genogram diagram with 3 individuals across 2 generations Dad (1950) Mom (1952) Son (1980) Dad (b. 1950) Mom (b. 1952) Son (b. 1980) CONDITIONS Heart Diabetes Depression Carrier
UTF-8 · LF · 5 lines · 205 chars✓ parsed·1.1 ms·8.5 KB SVG

6. 標籤與註解

  • 標題: genogram "Smith Family" — 僅限第一行。
  • 個人標籤覆寫: alice [female, label:"Dr. Alice Smith"]
  • 關係標籤: 配偶行或情感連線末尾的引號字串——alice -- bob "m. 2005"
  • 註解: #//%% 置於行首(前導空白之後)。不支援行內註解。
genogram "Smith Family"
  # this line is a comment — fine
  %% Mermaid-style comment — also fine
  alice [female, 1980]   # ← THIS trailing comment breaks the parser

7. 保留字與跳脫

行首保留字: genogram(標頭關鍵字)。

行內保留運算子符記——避免在 ID 中使用以下序列: --~~/~==-x--/--//-o-,以及任何符合情感關係類型的 -<type>- / -<type>->

保留 id ? — 在孩子行上的單獨 ? 會自動產生帶有 unknown-siblings 標記的合成佔位符。請勿將 ? 作為真實 id 使用。

含有空格的字串必須用雙引號括起來:標題、標籤、label:"…"。單引號和反引號不被識別。


8. 常見錯誤

實際發生的解析器錯誤、觸發原因,以及修正方式。

你寫的解析器的回應修正方式
alex [nonbinary, 1995]Unknown property 'nonbinary'使用 unknownother(nonbinary 在 §13 路線圖中)
alice [female, transgender]Unknown property 'transgender'尚無法解析(§13 路線圖)
dad -- mom ← 後接 同縮排child [male, 2010]孩子被解析為新的頂層個人,而非其孩子將孩子行縮排得比配偶行更深(多 2 個空格即可)
A -- BA 從未宣告Unknown individual 'A'在上方行宣告 A [sex, year]
father -- mother "married" 在第 1 行(無 genogram 標頭)Expected "genogram" header檔案以 genogramgenogram "Title" 開頭
conditions: diabetes + cancer(無括號)Invalid condition format 'diabetes'加上填色:conditions: diabetes(half-left) + cancer(half-right)
[triplet-identical]Unknown property 'triplet-identical'三胞胎尚無法解析(§13 路線圖)
dad -- mom # first marriage尾端的行內 # 註解被當作標籤的一部分 / 產生錯誤將註解移到獨立行
同一 id 宣告兩次且性別不同(x [male] 後接 x [female]Conflicting sex for 'x': previously 'male', now 'female'擇一使用,或重新命名其中一個 id
child [foster] 重新宣告但親生父母從未宣告child 成為寄養配偶的正規孩子(不繪製次要連線)這是有意設計——次要連線需要先前宣告中已存在的親生親子關係

9. 語法(EBNF)

document       = header (blank | comment | individual | couple-block | emotional)*

header         = "genogram" ( WS quoted-string )? NEWLINE
quoted-string  = '"' any-char-but-quote* '"'

individual     = INDENT id ( "[" attrs "]" )? NEWLINE
couple-block   = INDENT id WS coupleOp WS right-side ( WS quoted-string )? NEWLINE
                   ( deeper-indent child )*
child          = INDENT id ( "[" attrs "]" )? NEWLINE
               | INDENT "?" NEWLINE                              // unknown-count sibling shorthand
right-side     = id ( "[" attrs "]" )?

emotional      = INDENT id WS "-" type "-"  id ( WS quoted-string )? NEWLINE
               | INDENT id WS "-" type "->" id ( WS quoted-string )? NEWLINE

coupleOp       = "~/~" | "-//" | "-x-" | "-/-" | "-o-" | "==" | "--" | "~"
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_-]*
attrs          = attr ("," attr)*
attr           = "male" | "female" | "unknown" | "other"
               | "deceased" | "stillborn" | "miscarriage" | "abortion"
               | "adopted" | "foster" | "guardian"
               | "twin-identical" | "twin-fraternal"
               | "index" | "unknown-siblings"
               | digit digit digit digit                         // year
               | "age" ":" digits
               | "death" ":" digit digit digit digit
               | "label" ":" quoted-string
               | "sibling-of" ":" id
               | "conditions" ":" condition ("+" condition)*
               | key ":" value                                    // custom
condition      = name "(" fill ("," "#" hex)? ")"
fill           = "full" | "half-left" | "half-right" | "half-top" | "half-bottom"
               | "quad-tl" | "quad-tr" | "quad-bl" | "quad-br"
               | "striped" | "dotted"

comment        = INDENT ( "#" | "//" | "%%" ) any NEWLINE

權威來源:src/diagrams/genogram/parser.ts。若本頁與解析器有出入,以解析器為準——請開立 issue 回報。


10. 標準合規性

Schematex genogram 遵循 McGoldrick、Gerson & Petry(2020),《Genograms: Assessment and Treatment》第 4 版的結構符號、配偶運算子及世代對齊方式。情感關係分類法遵循 GenoPro 的 32 種分類(我們並未完整實作 GenoPro 的 34 種分類;focused-admirer 及一個重複項目已合併至 focusedadmirer)。

目前實作狀態與標準的對照:

  • ✅ 核心結構符號(男性/女性/未知、已故、死產、流產、人工流產)
  • ✅ McGoldrick 6 種配偶運算子系統
  • ✅ GenoPro 32 種情感類型,有方向性處按臨床規定實作
  • ✅ 醫療狀況象限填色系統(4 種位置 + 條紋/點狀圖案)
  • ✅ 識別個案(同心形狀)
  • ✅ 雙胞胎分組(同卵 / 異卵)
  • ⏳ Bennett 2022 性別包容性新增——參見 §13
  • ⏳ 捐贈者 / 代孕 / 繼子女連線類型——參見 §13

參考資料:

  • McGoldrick, M., Gerson, R., & Petry, S. (2020). Genograms: Assessment and Treatment (4th ed.).
  • Hardy, K.V. & Laszloffy, T.A. (1995). The cultural genogram. J Marital Fam Ther, 21(3), 227–237.
  • GenoPro 符號參考 — https://genopro.com/genogram/

11. 相關範例

範例庫中的現成情境:

genogram·§ McGoldrick 2020
Genogram: Smith Family Genogram diagram with 3 individuals across 2 generations Smith Family John (1975) Mary (1977) Alice (2005) John (b. 1975) Mary (b. 1977) Alice (b. 2005) m. 2002 MARKERS Index person (focal subject)
Nuclear family (minimal template)
Minimal nuclear family genogram — married couple, one child, marriage date — the clinical intake starting template per McGoldrick 2020 notation.
healthcare & social
genogram·§ McGoldrick 2020
Genogram: Medical History Genogram diagram with 7 individuals across 3 generations Medical History Grandfather (1930-1990) 60 Grandmother (1935) Father (1960) Mother (1962) Uncle (1963) Patient (1988) Sister (1991) Grandfather (1930–1990) Grandmother (b. 1935) Father (b. 1960) Mother (b. 1962) Uncle (b. 1963) Patient (b. 1988) Sister (b. 1991) SYMBOLS Deceased CONDITIONS Heart Disease Diabetes Cancer Hypertension MARKERS Index person (focal subject)
Multi-generation medical history
Three-generation family medical history genogram with multi-condition color annotations using fill zones — heart disease, diabetes, cancer, hypertension.
healthcare & social
genogram·§ McGoldrick 2020
Genogram: BRCA1 Family Genogram diagram with 8 individuals across 3 generations BRCA1 Family I_1 (1930-1995) 65 I_2 (1932-1990) 58 II_4 (1954) II_1 (1955) II_2 (1958) II_3 (1960) III_1 (1985) III_2 (1988) I_1 (1930–1995) I_2 (1932–1990) II_4 (b. 1954) II_1 (b. 1955) II_2 (b. 1958) II_3 (b. 1960) III_1 (b. 1985) III_2 (b. 1988) SYMBOLS Deceased CONDITIONS Ovarian Cancer Breast Cancer MARKERS Index person (focal subject)
Hereditary cancer (BRCA1) family
Three-generation BRCA1 family genogram with hereditary breast/ovarian cancer conditions — captured at intake before formal clinical pedigree analysis.
healthcare & social
genogram·§ McGoldrick 2020
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 SYMBOLS Deceased RELATIONSHIPS Close Hostile Cutoff MARKERS Index person (focal subject)
The Potter family
Three-generation Potter family genogram with emotional relationship lines — cutoff, hostile, and close — illustrating McGoldrick relational notation.
education
genogram·§ McGoldrick 2020 + Bennett 2022 (adopted-out / dual-parent convention)
Genogram: Familia Isaías Genogram diagram with 9 individuals across 2 generations Familia Isaías Víctor Seguel Mónica Barrientos Tío materno Don Pablo Doña Priscila Isaías (2020) 6 ? ? Pablo (jr) Alanis Víctor Seguel Mónica Barrientos Tío materno Don Pablo Doña Priscila Isaías (b. 2020) ? Pablo (jr) Alanis SYMBOLS Unknown STRUCTURAL Cohabiting (ended) Foster RELATIONSHIPS Nevermet Physical Abuse MARKERS Index person (focal subject) Sibling(s) — unknown count
Foster care / child protection
Foster-care genogram for a real LATAM child-protection case — biological parents (cohabitation ended), abuse, current foster placement (dotted secondary link), unknown-count siblings, and a maternal uncle as known-relative-with-unknown-ancestry.
social-work

13. 路線圖

計畫中——目前尚無法解析。 請勿在今天生成的 DSL 中使用;解析器會拒絕它們。

  • Bennett 2022 性別包容性 — 將 nonbinaryintersex 作為性別值;transgender 作為標記。目前已在 src/core/types.ts 中定義型別,但解析器的 VALID_SEX 集合尚未包含它們。
  • 三胞胎及更高階多胞胎triplet-identicaltriplet-fraternal
  • 現代家庭結構surrogatedonorstep 作為孩子類型屬性。
  • 狀況類別簡寫conditions: cardiovascular + depression 不需要 (fill),自動分配象限和預設顏色。
  • 同居伴侶運算子~dp~ / 明確的 DP 標籤。
  • 血統註記 — 個人的文化家系圖血統識別符。
  • 戶籍邊界框 — 將共同居住的節點分組(寄養安置、多代同堂家庭)。

如果你需要其中任何功能,請在 GitHub issues 中追蹤進度。

Found this useful?

Schematex is free, fully open source, and zero-dependency. A star helps other developers discover it.