Bespoke websites for real business impact, true responsive architecture, zero bloatware, WordPress FSE & Next.js 15, 100/100 Core Web Vitals.
DEVPIXEL
Back to all articles

Applying ChatGPT to Genealogical Data Processing: Constructing Family Trees and Tracing Ancestral Lineages

October 14, 2026DevPixel EngineeringDevPixel Engineering6 min read0 views
AI & Workflow Automation

A methodical approach to leveraging ChatGPT and structured prompt engineering to normalize and digitize family lineage data from Sino-Vietnamese (Hán Nôm) historical records and oral histories.

DEVPIXEL / MEDIA LIBRARY
Applying ChatGPT to Genealogical Data Processing: Constructing Family Trees and Tracing Ancestral Lineages

Processing and standardizing genealogical data is a complex problem, as lineage records in Vietnam are often scattered across stele inscriptions, rough translations of family books, or unstructured oral traditions. This article demonstrates how to leverage ChatGPT and structured prompting techniques to convert raw historical text into standardized family trees formatted as JSON Graph, Mermaid diagrams, and international GEDCOM files.

Digitizing family genealogy with ChatGPT
Workflow for converting raw genealogical records into a digitized, visual family tree

1. Challenges in Processing Traditional Genealogy Data

Traditional Vietnamese family records often face three major technical barriers when brought into the digital environment:

  • Complex hierarchical relationships: Generational naming and addressing conventions (sexagenary cycle, generation number, sub-branches, senior and junior lines) are extremely difficult to map automatically without standardized relational logic.
  • Missing data: Many lineage branches have lost records of birth years, death dates, or ancient geographic names due to war and migration.
  • Unstructured format: Records are written in a free-form narrative style, interspersed with historical anecdotes and archaic language, lacking any tabular structure.
DIGITIZATION OBJECTIVE

The goal of the pipeline is to transform all scattered narratives and records into a graph database (Graph Database) where nodes represent individual members and edges represent kinship relationships.

2. Step 1: Extract Person Entities and Chronology (NER)

The first stage is Named Entity Recognition (NER). We instruct the AI to scan the raw text to extract all individuals, their generation numbers, and key chronological milestones:

Character Extraction
You are an expert in Vietnamese history and genealogy.
Below is a raw historical excerpt from a family branch:
[PASTE GENEALOGY RECORD TEXT HERE]

TASK:
Extract a list of all individuals appearing in the text above and format it as a Markdown table with the following columns:
1. ID: Unique identifier (P01, P02...)
2. Full Name: Full name along with courtesy name, pseudonym (if available)
3. Generation: Generation number within the clan
4. Birth / Death Year: Explicit Gregorian calendar years (if sexagenary cycle information is present, convert it approximately)
5. Family Relation: Eldest/younger son of whom, spouse of whom
6. Hometown / Burial Place: Specific geographical locations

Once the AI outputs the consolidated table, run a quick cross-check to ensure that archaic names and feudal era reign titles have been converted accurately.

3. Step 2: Set Up Parent-Child and Spousal Relationship Matrices

The entity data needs to be linked into a relationship network. We instruct the AI to clearly define two core types of relationships: Parent-Child relationships and Spousal relationships:

JSON Graph Structure
Based on the list of individuals extracted in step 1, convert all information into a standard JSON Graph data structure:
{
  "nodes": [
    {
      "id": "P01",
      "name": "Nguyen Van To",
      "generation": 1,
      "gender": "male",
      "birth": 1820,
      "death": 1895
    }
  ],
  "links": [
    {
      "source": "P01",
      "target": "P02",
      "relationship": "parent-child"
    }
  ]
}

Requirements:
- Strictly prevent any illogical relationship loops (e.g., a child born before a parent).
- Export clean JSON data, ready to be ingested into graph visualization libraries.
INTEGRITY CHECK

This JSON structure serves as the foundation for importing directly into genealogy management software or online private clan portals.

4. Step 3: Visualizing the Family Tree with a Mermaid JS Diagram

To allow family members to view the diagram intuitively without installing complex software, we convert the data into Mermaid JS syntax. This syntax is natively supported on GitHub, Notion, and modern websites:

Generate Mermaid Diagram
Based on the established family relationship structure, generate the Mermaid JS (graph TD) source code to display the family tree:
- Use the graph TD syntax (Top-Down from top to bottom).
- 1st generation members are placed on the top row, branching down to the 2nd and 3rd generations.
- Format each block to include: Full name along with year of birth - year of death.
- Apply a prominent background color to the main/eldest branch.

Sample Diagram Code Generated by AI

Sample Diagram Code
graph TD
    classDef truong fill:#fde047,stroke:#000,stroke-width:2px;
    classDef thu fill:#FDF8EC,stroke:#000,stroke-width:1.5px;

    P01["Cụ Khởi Tổ: Nguyễn Quý Công (1820 - 1895)"]:::truong
    P02["Đời 2 (Trưởng): Nguyễn Văn Giáp (1850 - 1920)"]:::truong
    P03["Đời 2 (Thứ): Nguyễn Văn Ất (1855 - 1930)"]:::thu

    P01 sang P02
    P01 sang P03

    P04["Đời 3: Nguyễn Văn Bính (1880 - 1950)"]:::truong
    P02 sang P04

5. Step 4: Export to Internationally Standardized GEDCOM Format

GEDCOM (Genealogical Data Communication) is the globally recognized standard for exchanging genealogical data. After standardizing with ChatGPT, you can export to a .ged file to import into professional software such as Gramps, MyHeritage, or Ancestry:

Sample GEDCOM File
0 HEAD
1 SOUR CHATGPT_GENEALOGY
1 GEDC
2 VERS 5.5.1
2 FORM LINEAGE-LINKED
1 CHAR UTF-8
0 @I1@ INDI
1 NAME Nguyễn Quý /Công/
1 SEX M
1 BIRT
2 DATE 1820
1 DEAT
2 DATE 1895
0 @F1@ FAM
1 HUSB @I1@
1 CHIL @I2@
0 TRLR
LONG-TERM ARCHIVING

The GEDCOM format is plain text independent of any single software company, ensuring your family lineage data can be opened and read for decades to come.

6. Common Errors and Troubleshooting

A compilation of solutions for technical issues during the clan family tree digitization process:

Can AI read blurry photos of ancient Han-Nom genealogy records?
▼

If the photograph is blurry, current OCR models are very prone to misidentifying ancient strokes. It is best to have someone proficient in Han-Nom transliterate it into the Latin-based Vietnamese alphabet (Quốc ngữ) first, then input that transliterated text into ChatGPT to standardize the structure.

What if the AI confuses sons of the senior branch with sons of a junior branch?
▼

Solution: Assign hierarchical numbering using the d’Aboville or Henry system (for example: Progenitor is 1, firstborn son is 1.1, second son is 1.2, eldest grandson is 1.1.1). This hierarchical numbering ensures the AI will never confuse generations.

How to handle a lineage with too many generations (over 15 generations)?
▼

Avoid cramming all 15 generations into a single prompt, as this will exceed logical reasoning limits. Instead, break it down by branch or into clusters of 3 to 4 generations, standardize each branch individually, and merge them in the final step.

How can I display a Mermaid diagram on a clan website?
▼

Simply embed the Mermaid JS library via a CDN script tag into the webpage; the library will automatically render text-based code blocks into an interactive visual tree diagram that can be zoomed and panned on mobile devices.

Is there a risk of data leakage when uploading genealogy records to ChatGPT?
▼

For private information regarding living individuals (such as phone numbers and home addresses), proactively redact or replace them with abbreviations before submitting them to AI tools.

7. Frequently Asked Questions (FAQ)

Answers to common questions about applying technology to preserve family history:

Which AI model is best for processing family genealogies?
▼

Claude 3.5 Sonnet or ChatGPT-4o are the two best choices due to their deep understanding of ancient Vietnamese phrasing and strong JSON data structuring capabilities.

Is there any free open-source software to manage GEDCOM files?
▼

Gramps (available for Windows, macOS, and Linux) is a powerful and completely free open-source tool for in-depth genealogy management.

How do I convert feudal sexagenary cycle (Can Chi) years to Gregorian calendar years?
▼

You can simply prompt ChatGPT: ‘Please look up and convert the royal reign eras and sexagenary cycle (Can Chi) years in the following document to their corresponding Gregorian calendar years’.

Can ancestor portrait photos be integrated into the family tree?
▼

When using the GEDCOM format or building an internal clan website using JSON Graph, you can completely assign a photo_url field to each individual to visually display ancestral portraits.

Read next: A Comprehensive 9-Step Roadmap to Mastering Claude in 2 Days

#ChatGPT#Data Structuring#Prompt Engineering#Xử lý dữ liệu
Share articleFacebook X
CỘNG ĐỒNG KỸ THUẬT

Thảo Luận (0)

DEVPIXEL FORUM

Chưa có bình luận nào. Hãy là người đầu tiên chia sẻ góc nhìn!

Để lại bình luận của bạn