Associations, who is telling the truth?

Because it was completely empty and it was hiding the interesting part

Ah, ok, you did not generate “ghost families” for getting a relationships line between this uncle and his nephew. So, the relationship calculation returns an empty string.

Personally, I wish for an Associations gramplet, so that I don’t have to edit a person to look at their associations. It would be nice if such a gramplet showed all of the associations that a person is involved in, and showed the direction of each.

I guess that CheckAssociations addon was generated because there wasn’t a quick method to select people with associations data? That’s also why I was surprised you got it with few lines of code…

https://gramps.discourse.group/t/new-gram-py-script-for-6-0/7192/11?u=romjerome

Feel free to deprecate CheckAssociations addon. It still does the job: provide a way to check Associations into our database, but without advanced features, like a way for fixing some mistakes on seizure.

Please don’t eliminate that addon.

Once the hotlinking is implemented, it is similar to the “Type Cleanup” tool. It allows exposing all the Associations in the whole tree and allows sorting. Which make it simple to find Association types that need to be cleaned

Ah, yes, by deprecated, I should rather ask for a new maintainer after some improvements. As wrote before, it was one way for getting back some data not very accessible at a glance : all associations and linked/related people. So, feel free to improve the code or to generate a gramplet instead of an utility tool with possible performances issues on large database.

@Nick-Hall & @GaryGriffin
What is the preferred way to mark an Addon as open for adoption by a new Maintainer?

My feelings are similar about being the Maintainer for this tool. I’d like to share a day’s worth of wish-coded feature enhancements that make the Tool more than the current release’s Report-like functionality. (Tested with Gramps 5.2 version. Should be compatible with 5.2+ but needs testing.) Those enhancements are purely navigational in nature. The core function is unchanged.

But I do not want to become the Maintainer. Because a ‘recent’ Maintainer might discourage someone with good ideas for extending the core functionality. They should feel welcome to jump in with their own revision. A maintainer or recent copyright author may have connotations for Gary. Simple politeness demands that a private conversation be started to avoid stepping on their toes. And the Addon PRs feel as though they should be approved by the current Maintainer before publication.

Generally, I look at the author email in the GPR first. I try to send a review notice to any change the author did not do. I have not looked at the copyleft but that is a good idea too.

I know of no way to mark an Addon as ‘looking for a new owner’.

Tested with Gramps 5.2 version and python 3.10 (or +)?

+from typing import Optional, Tuple  # Add this import at the top of the file

-def _get_selected_row(self) -> tuple | None:
+def _get_selected_row(self) -> Optional[Tuple]:

or if you prefer to keep tuple (without generics):

+from typing import Optional

-def _get_selected_row(self) -> tuple | None:
+def _get_selected_row(self) -> Optional[tuple]:

-def __init__(self, name, person_id: str | None = None) -> None:
+def __init__(self, name, person_id: Optional[str] = None) -> None:

Above changes will work with python version < 3.10 (like 3.8 for gramps 5.2).

I do not understand. I was led to believe that Gramps 5.2.2 uses its own sandboxed version of Python provided by the Installer. It apparently comes with 3.11.6 version. How would I test for 3.8 version?

GRAMPS: 5.2.2 
Python: 3.11.6 
BSDDB: 6.2.9 (5, 3, 28) 
sqlite: 3.40.0 (2.6.0)
LANG: en_US.UTF-8
OS: Linux
Distribution: 6.5.12-100.fc37.x86_64  

I was trying to play with Mistral AI Vibe Code work - trying to include one github repository - when I saw your PR. I tested your new version.

Note, we can clearly see that switching between branches is not only a code issue, also need to check the environment (ressources, dependencies or versions). e.g., the AI pointed out a wrong cause of failure for this code on gramps 5.2 branch.

It was not a blocking issue but rather a method issue: the experimental ‘person.serialize()[-1]’, which could failed in the future… An improvement or clean-up, but it was not the cause of failure under Gramps 5.2 and python 3.8. I said to the AI to re-check the possible cause and saw that its gramps source code reference was oriented 5.1 branch. So, it makes sense for any upgrade process but it could be a problem by downgrading (or backporting) some “recent” code or method (like typing on python 3.10).

For Gramps 5.2.4

Under Windows OS, Mac OS and the snap package. You can also download some .deb packages for Ubuntu 20.04 or 22.04, as well as the source code (e.g., 5.2.4), then run it without any build into a python/Gtk3 environment…

$ python3 Gramps.py

Maybe:

$ python -m venv my_env_for_3_8

then I suppose some additional stuff and virtual installations (like a new python version)?

ooof! Your skills are well-suited for this PR… far more than mine.

And Il used the GitHub Web GUI to submitt the changes to the .gpr.py, the .py and add the README.md file. Which caused 3 PRs instead of 1. (That means extra work for @GaryGriffin )

Do you want to reject my PRs and resubmit the right way — as yours? I did nothing more than operate the wish-coding AI. You, Claude and Copilot did all the heavy-lifting.

I also have some problems with my local gramps-addons git repository.

Unable to create branch: Please address the rule violations and try again.Learn more about rulesets.

This branch must not contain merge commits.

The 3 PRs are on the gramps52 branch. My suggestion is to close these and create a new single PR on the gramps60 branch.

I am not a fan of the extra python code in the GPR, preferring the fixed version number like it is now. Let me know if you want me to create the PR.

That was intentional. I did the tests on the 5.2 version, for the release with the 5.2 version. I am not using the 6.0 or 6.1 as my production version yet. I just use those for occasional testing.

My personal preference is towards the opposite. Although a LOT of extra python code in the GPR is unpleasant. I see no reason for a such a high-maintenance systems of Gramps version distinction and hassle of multiple repositories when the plugins are cross-compatible with several versions of Gramps.

I suppose you could add the line maintainers = ["Unmaintained"] to the gpr file after trying to contact the author. My original intention was that every addon should have a maintainer and an empty list would indicate the lack of a maintainer, but this field is not widely used yet.

If this could help, I was able to create a new banch by disabling an old ruleset.

Added as a draft one for Gramps 52 (and python 3.8 support)

It was not a blocking issue but rather a method issue: the experimental ‘person.serialize()[-1]’, which could failed in the future… An improvement or clean-up, but it was not the cause of failure under Gramps 5.2 and python 3.8.

Ah, yes, already get a failure on gramps 6.1 beta 1 (the last one will be now the familysearch_sync)…

Traceback (most recent call last):
File "/Users/gary/Library/Application Support/gramps/gramps61/plugins/AssociationsTool/associationstool.py", line 199, in _build_with_progress
_, _, _, two, value = ref
^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 5)
File "/Users/gary/Library/Application Support/gramps/gramps61/plugins/AssociationsTool/associationstool.py", line 71, in init
(a, b, c, two, value) = ref
^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 5)
two = RefBase.serialize(self) (handle de la personne associée)
value = self.rel (type de relation)

As proposed by the AI, a proper method should be:

for ref in person.get_person_ref_list():
    two = ref.ref
    value = str(ref.relation)  # `relation` est un objet, convertissez-le en str si nécessaire

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: