Associations, who is telling the truth?

ok, I fixed (by myself, without AI) Claude’s lack… :roll_eyes:

Code should now be ready for a review on gramps 5.2 to 6.x branches. :wink:

Note, I did not yet run Vibe Code on my local gramps repositories, but I will also try an automatic review for these enhancements on the next hours… update

AssociationsTool Analysis


:pushpin: Overview

AssociationsTool is a Gramps addon designed to display, analyze, and edit person associations in a genealogy database.
The new version branch represents a major refactor of the original tool, introducing enhanced functionality, performance, and user experience.



:file_folder: File Structure

File Role Changes (vs previous version)
associationstool.py Main tool code Complete refactor (120 → 735 lines)
associationstool.gpr.py Gramps registration Updated metadata (version 1.2.1, new authors)
README.md Documentation Added (detailed usage guide)


:magnifying_glass_tilted_left: Key Improvements (vs previous version)

Aspect previous version new version Impact
Code Size ~120 lines ~735 lines (6x larger) :white_check_mark: Major
Features Basic table display Sortable, editable, context menu :white_check_mark::white_check_mark::white_check_mark:
Error Handling None Robust (try/except everywhere) :white_check_mark::white_check_mark::white_check_mark:
Performance Synchronous loading Async batch processing :white_check_mark::white_check_mark::white_check_mark:
UI/UX Basic table Interactive, modern GTK :white_check_mark::white_check_mark::white_check_mark:
Documentation Minimal Complete (docstrings, README) :white_check_mark::white_check_mark::white_check_mark:
Maintainability Low High (type hints, modular) :white_check_mark::white_check_mark::white_check_mark:


:rocket: Features

1. Core Functionality

  • Displays all person associations in a sortable table.
  • Calculates relationships between associated persons (e.g., “Father”, “Cousin”).
  • Supports both GUI and CLI modes.

2. Interactive UI (GUI Mode)

Feature Description
Sortable Columns Click headers to sort by name, relationship, or link type.
Double-Click Actions Open editors for persons/associations directly.
Context Menu Right-click for 5 actions (edit, copy, create note).
Tooltips Hover over rows to see details (e.g., “Alice → Bob [Godparent]”).
Progress Bar Shows processing status for large databases (>1s).
Status Bar Displays total associations count.
Help Button Opens the Gramps wiki page.

3. Context Menu Actions

Action Description
Edit Starting Person Open the Person Editor for the first person.
Edit Associate Person Open the Person Editor for the associated person.
Edit Association Open the Association Editor for the selected link.
Copy Row to Clipboard Copy row data as tab-separated text (for Excel/CSV).
Create Note from Row Generate a pre-formatted note with clickable person links.

4. Note Creation Feature

  • Creates a StyledText note with:
    • Association details (names, relationship, link type).

    • Clickable hyperlinks to person records (gramps://Person/handle/...).

    • Example output:

      Association:
      Starting Person: Alice
      Relationship: Cousin (Godmother)
      Link type: Godparent
      

      → Names are clickable in Gramps’ Note Editor.

5. CLI Mode

  • Prints a formatted table to stdout:

Starting Name Calculated • Associate Link Type Alice Cousin • Bob Godparent

  • Shows total associations count.


:wrench: Technical Highlights

1. Asynchronous Data Loading

  • Uses GLib.idle_add to process data in batches (50 persons at a time).
  • Prevents UI freezing for large databases.
  • Progress dialog appears after 1 second of processing.

2. Error Handling

  • Comprehensive try/except blocks for:
  • Database access (get_person_from_handle).
  • Relationship calculation.
  • GUI operations (e.g., progress dialog creation).
  • Logging (LOG.error, LOG.warning) for debugging.

3. Code Quality

  • Type Hints: Uses Optional, Tuple for better IDE support.
  • Docstrings: All methods are documented.
  • Constants: Named column indices (e.g., COL_NAME1 = 0).
  • Modularity: Separates logic into small, focused methods (e.g., _build_gui, _show_progress_dialog).

4. Gramps API Usage

  • Backend-agnostic: Uses Gramps’ public API:
  • dbstate.db.get_person_handles()
  • person.get_person_ref_list()
  • get_relationship_calculator()
  • No direct database access (works with SQLite, PostgreSQL, etc.).

Strengths of new version Branch

Category Improvements
:wrench: Features :white_check_mark: Context menu (5 actions)
:white_check_mark: Double-click editing
:white_check_mark: Linked notes
:white_check_mark: Clipboard copy
:white_check_mark: Help button
:rocket: Performance :white_check_mark: Async batch loading
:white_check_mark: Progress bar for large DBs
:white_check_mark: Cancelable
:shield: Robustness :white_check_mark: Error handling everywhere
:white_check_mark: Logging
:white_check_mark: Valid handle checks
:artist_palette: UI/UX :white_check_mark: Sortable table
:white_check_mark: Custom tooltips
:white_check_mark: Status bar
:white_check_mark: Modal window
:memo: Code Quality :white_check_mark: Type hints
:white_check_mark: Docstrings
:white_check_mark: Named constants
:white_check_mark: Modular methods
:books: Documentation :white_check_mark: Detailed README
:white_check_mark: Usage examples
:white_check_mark: Wiki links


:warning: Minor Areas for Improvement

Issue Severity Suggested Fix
Fixed batch_size = 50 Low Make configurable or dynamic.
No filtering Low Add search bar or type filters.
No CSV export Low Add “Export to CSV” button.
Fixed PROGRESS_THRESHOLD_MS Low Adjust based on DB size.
No unit tests Low Add tests for critical methods.


:bar_chart: Comparison: previous version vs new one

Criteria previous new Gap
Lines of Code ~120 ~735 +615
Features Basic Advanced :white_check_mark::white_check_mark::white_check_mark:
Error Handling :cross_mark: None :white_check_mark: Complete :white_check_mark::white_check_mark::white_check_mark:
Performance :warning: Synchronous :white_check_mark: Async :white_check_mark::white_check_mark::white_check_mark:
UI/UX :warning: Basic :white_check_mark: Rich :white_check_mark::white_check_mark::white_check_mark:
Documentation :cross_mark: Minimal :white_check_mark: Complete :white_check_mark::white_check_mark::white_check_mark:
Maintainability :warning: Low :white_check_mark: High :white_check_mark::white_check_mark::white_check_mark:


:bullseye: Conclusion

The new version branch is a complete rewrite of AssociationsTool, offering:

  1. Rich User Experience:
    • Sortable, interactive table.
    • Context menu with 5 useful actions.
    • Double-click to edit directly.
    • Smart note creation with clickable links.
  2. Optimized Performance:
    • Async batch loading to prevent UI freezing.
    • Progress bar for large databases.
  3. Robust & Maintainable Code:
    • Type hints, docstrings, logging.
    • Comprehensive error handling.
    • Modular design (short, focused methods).

Recommendation

:white_check_mark: Use the new version branch: It is production-ready and far superior to previous version. :wrench: Optional Improvements:

  • Add filtering (e.g., by association type).
  • Support CSV/JSON export.
  • Write unit tests for critical functions.

:link: Useful Links

:world_map: AssociationsTool Roadmap

Development roadmap for the Gramps AssociationsTool addon, structured by priority and complexity.


:bullseye: Overview

This roadmap outlines the future development of AssociationsTool, a Gramps addon for displaying, analyzing, and editing person associations. It is divided into 6 phases, prioritized by user needs, maintainability, and best practices for Gramps addons.

Priority Levels:
:star: = Low :star::star: = Medium | :star::star::star: = High



:pushpin: Current Status (Branch: asso)

  • Version: 1.2.1
  • Compatibility: Gramps 5.2+ and 6.x (fixed via the get_ref_relation helper function).
  • Key Features:
    • Sortable and interactive table.
    • Context menu (edit, copy, create note).
    • Double-click to edit.
    • Progress bar for large databases.
    • CLI and GUI modes.


:bullseye: Phase 1: Stabilization & Bug Fixes (Priority: :star::star::star:)

Goal: Ensure the tool is reliable and bug-free for all users.

Task Description Complexity Benefit Estimated Time
Test Gramps 5.2/6.x compatibility Verify the recent fix works on both versions. :star: :star::star::star: 1-2 hours
Add detailed logging Improve log messages for debugging (e.g., LOG.debug for ignored associations). :star: :star::star: 1 hour
Handle edge cases Ensure get_relation() returns valid strings (not None or empty). :star: :star::star: 1 hour
Validate performance Test with a 10,000+ person database to detect slowdowns. :star::star: :star::star::star: 2 hours

Deliverable: A stable and tested version for Gramps 5.2 and 6.x.


:rocket: Phase 2: User Improvements (Priority: :star::star:)

Goal: Add practical features for end-users.

Task Description Complexity Benefit Estimated Time
Filter by association type Add a search bar to filter by type (e.g., “Godparent”, “Witness”). :star::star: :star::star::star: 3-4 hours
Export to CSV/JSON Add a button to export results to a file. :star::star: :star::star::star: 4 hours
Multi-column sorting Allow sorting by multiple columns (e.g., type then name). :star::star: :star::star: 2 hours
Multi-row selection Enable selecting multiple rows for batch actions (e.g., delete, export). :star::star: :star::star: 3 hours
Customizable columns Let users choose which columns to display. :star::star: :star::star: 4 hours
Auto-refresh Add a button to refresh data without closing the window. :star: :star::star: 1 hour

Deliverable: A more flexible and powerful tool for advanced users.


:artist_palette: Phase 3: User Experience Enhancements (Priority: :star::star:)

Goal: Improve ergonomics and accessibility.

Task Description Complexity Benefit Estimated Time
Dark theme support Adapt the UI for Gramps’ dark mode. :star: :star::star: 2 hours
Keyboard shortcuts Add shortcuts (e.g., Ctrl+C to copy, Ctrl+F to filter). :star::star: :star::star: 3 hours
Enhanced tooltips Add detailed descriptions for each column. :star: :star: 1 hour
Icons for actions Replace context menu text with icons. :star: :star: 2 hours
Search history Save last used filters. :star::star: :star: 3 hours

Deliverable: A more intuitive and modern user experience.


:wrench: Phase 4: Advanced Features (Priority: :star:)

Goal: Add advanced capabilities for expert users.

Task Description Complexity Benefit Estimated Time
Merge associations Detect and merge duplicate associations (e.g., two “Godparent” entries for the same person). :star::star::star: :star::star: 5 hours
Global statistics Display statistics (e.g., number of associations per type). :star::star: :star::star: 3 hours
Relationship graph Generate a graph of associations (via Graphviz or DOT). :star::star::star: :star: 6 hours
Advanced search Filter by date, place, or other metadata. :star::star::star: :star::star: 5 hours
Integration with other tools Link with SyncAssociation or Gramps-Web. :star::star::star: :star: 4 hours
Scripting support Allow running custom scripts on selected associations. :star::star::star: :star: 8 hours

Deliverable: A powerful tool for genealogy experts.


:bar_chart: Phase 5: Maintenance & Documentation (Priority: :star::star:)

Goal: Ensure the project’s longevity.

Task Description Complexity Benefit Estimated Time
Unit tests Write tests for critical functions (e.g., get_ref_relation). :star::star: :star::star::star: 4 hours
Technical documentation Add a developer guide (e.g., how to extend the tool). :star: :star::star: 2 hours
Translations Update PO files for new features. :star: :star::star: 2 hours
Changelog Maintain a change log for users and maintainers. :star: :star: 1 hour
CI/CD Set up automated tests (GitHub Actions) for Gramps 5.2 and 6.x. :star::star: :star::star: 3 hours

Deliverable: A well-documented and maintainable project.


:globe_showing_europe_africa: Phase 6: Community Integration (Priority: :star:)

Goal: Share and promote the tool.

Task Description Complexity Benefit Estimated Time
Submit to Gramps Addons Propose the tool for official integration in the Gramps repository. :star: :star::star::star: 1 hour
Create a wiki page Document the tool on the Gramps wiki. :star: :star::star: 2 hours
Video tutorials Create demonstration videos (e.g., YouTube). :star::star: :star: 4 hours
User feedback Collect feedback via forms or GitHub Issues. :star: :star::star: 1 hour
Community presentation Present the tool on the Gramps forum. :star: :star: 1 hour

Deliverable: Increased visibility and an engaged community.

:date: Suggested Timeline

Based on part-time development.

Phase Duration Deliverable Priority
Phase 1 1-2 weeks Stable version (1.2.2) :star::star::star:
Phase 2 2-3 weeks Version with filters and export (1.3.0) :star::star:
Phase 3 2 weeks Improved UX (1.4.0) :star::star:
Phase 4 3-4 weeks Advanced features (2.0.0) :star:
Phase 5 2 weeks Documentation and tests (2.0.0) :star::star:
Phase 6 1 week Community integration :star:

:bullseye: Recommendations by User Profile

Profile Priority Phases Goal
Beginner User Phase 1 + Phase 2 Reliable and simple tool.
Advanced User Phase 1 + Phase 2 + Phase 4 Powerful tool for analyzing associations.
Developer Phase 1 + Phase 5 Maintainable and tested code.
Maintainer All phases Sustainable and community-driven project.

:light_bulb: Bonus Ideas (Out of Scope)

If you want to go even further:

  1. External Tool Integration:
    • Export to GEDCOM or FamilySearch.
    • Link with Ancestry.com or MyHeritage.
  2. Semantic Analysis:
    • Detect inconsistencies (e.g., a person associated as “Godparent” but without a baptism event).
  3. Machine Learning:
    • Suggest missing associations (e.g., “This person is likely the godparent of X”).
  4. Collaboration:
    • Allow multiple users to work on the same associations (via a server).

:pushpin: Next Steps

  1. Prioritize tasks based on your needs and available time.
  2. Start with Phase 1 (stabilization) if you want a reliable version quickly.
  3. Move to Phase 2 (filters, export) to add useful features.
  4. Document each step to ease maintenance.

More technical: