From 2a23a35ac5df7eabedcea60192218b72ca835eb6 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 29 Nov 2025 14:37:52 -0500 Subject: [PATCH] Add interactive D3.js family tree visualization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created a new interactive family tree visualization page that allows users to explore biblical genealogies with a zoomable, clickable tree diagram. Features: - D3.js tree layout with horizontal orientation - Click nodes to view person details in info panel - Zoom in/out and pan functionality - Multiple view options (descendants, ancestors, generation, lineage) - Multiple layout options (tree, radial, dendrogram - foundation laid) - Expand/collapse controls - Hover effects and selection highlighting - Links to full person profiles - Responsive design with Tufte CSS styling Technical details: - New route: /family-tree/interactive - Template: family_tree_interactive.html - D3.js v7 for tree rendering - Hierarchical data built from GEDCOM family tree data - Passes family_tree_data and generations to template as JSON - Max depth control to prevent infinite recursion Also updated family tree overview page to link to new visualizations section featuring both the interactive tree and messianic lineage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kjvstudy_org/routes/family_tree.py | 27 ++ kjvstudy_org/templates/family_tree.html | 12 + .../templates/family_tree_interactive.html | 381 ++++++++++++++++++ 3 files changed, 420 insertions(+) create mode 100644 kjvstudy_org/templates/family_tree_interactive.html diff --git a/kjvstudy_org/routes/family_tree.py b/kjvstudy_org/routes/family_tree.py index 8c184ac..ff4c447 100644 --- a/kjvstudy_org/routes/family_tree.py +++ b/kjvstudy_org/routes/family_tree.py @@ -573,6 +573,33 @@ def family_tree_search_page(request: Request, q: str = ""): ) +@router.get("/family-tree/interactive", response_class=HTMLResponse) +def family_tree_interactive_page(request: Request): + """Interactive D3.js-based family tree visualization.""" + family_tree_data, generations = get_family_tree_data() + + if not family_tree_data: + raise HTTPException( + status_code=500, + detail="Family tree data not available" + ) + + return templates.TemplateResponse( + request, + "family_tree_interactive.html", + { + "books": get_books(), + "family_tree_data": family_tree_data, + "generations": generations, + "breadcrumbs": [ + {"text": "Home", "url": "/"}, + {"text": "Family Tree", "url": "/family-tree"}, + {"text": "Interactive Tree", "url": None} + ] + } + ) + + @router.get("/family-tree/lineage", response_class=HTMLResponse) def family_tree_lineage_page(request: Request): """Dedicated page for the Messianic lineage visualization.""" diff --git a/kjvstudy_org/templates/family_tree.html b/kjvstudy_org/templates/family_tree.html index 343df2d..ca000e4 100644 --- a/kjvstudy_org/templates/family_tree.html +++ b/kjvstudy_org/templates/family_tree.html @@ -200,6 +200,18 @@ section:nth-of-type(3) {

+
+

Visualizations

+

+ Interactive Tree Visualization — + Explore the family tree with an interactive, zoomable diagram. +

+

+ Messianic Lineage — + View the direct paternal line from Adam to Jesus Christ. +

+
+

The Generations

diff --git a/kjvstudy_org/templates/family_tree_interactive.html b/kjvstudy_org/templates/family_tree_interactive.html new file mode 100644 index 0000000..0f66eba --- /dev/null +++ b/kjvstudy_org/templates/family_tree_interactive.html @@ -0,0 +1,381 @@ +{% extends "base.html" %} + +{% block title %}Interactive Family Tree - KJV Study{% endblock %} +{% block description %}Explore biblical genealogies interactively from Adam to Jesus Christ.{% endblock %} + +{% block head %} + +{% endblock %} + +{% block content %} +

Interactive Family Tree

+ +

+ Explore the biblical genealogy from Adam to Jesus Christ. Click on any person to see details. + Use the controls below to navigate different views of the family tree. +

+ +
+ + + + + + + + + +
+ +
+ Click nodes to expand/collapse children • Hover for details • Drag to pan +
+ +
+ +
+ +
+

+
+ +
+ + + + + +{% endblock %}