ok, I fixed (by myself, without AI) Claude’s lack… ![]()
Code should now be ready for a review on gramps 5.2 to 6.x branches. ![]()
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
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 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) |
Key Improvements (vs previous version)
| Aspect | previous version |
new version |
Impact |
|---|---|---|---|
| Code Size | ~120 lines | ~735 lines (6x larger) | |
| Features | Basic table display | Sortable, editable, context menu | |
| Error Handling | None | Robust (try/except everywhere) |
|
| Performance | Synchronous loading | Async batch processing | |
| UI/UX | Basic table | Interactive, modern GTK | |
| Documentation | Minimal | Complete (docstrings, README) | |
| Maintainability | Low | High (type hints, modular) |
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.
Technical Highlights
1. Asynchronous Data Loading
- Uses
GLib.idle_addto 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/exceptblocks 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,Tuplefor 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 |
|---|---|
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. |
Comparison: previous version vs new one
| Criteria | previous |
new |
Gap |
|---|---|---|---|
| Lines of Code | ~120 | ~735 | +615 |
| Features | Basic | Advanced | |
| Error Handling | |||
| Performance | |||
| UI/UX | |||
| Documentation | |||
| Maintainability |
Conclusion
The new version branch is a complete rewrite of AssociationsTool, offering:
- Rich User Experience:
- Sortable, interactive table.
- Context menu with 5 useful actions.
- Double-click to edit directly.
- Smart note creation with clickable links.
- Optimized Performance:
- Async batch loading to prevent UI freezing.
- Progress bar for large databases.
- Robust & Maintainable Code:
- Type hints, docstrings, logging.
- Comprehensive error handling.
- Modular design (short, focused methods).
Recommendation
Use the new version branch: It is production-ready and far superior to previous version.
Optional Improvements:
- Add filtering (e.g., by association type).
- Support CSV/JSON export.
- Write unit tests for critical functions.
Useful Links
AssociationsTool Roadmap
Development roadmap for the Gramps AssociationsTool addon, structured by priority and complexity.
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:
= Low ![]()
= Medium | ![]()
![]()
= High
Current Status (Branch: asso)
- Version: 1.2.1
- Compatibility: Gramps 5.2+ and 6.x (fixed via the
get_ref_relationhelper 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.
Phase 1: Stabilization & Bug Fixes (Priority: 

)
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. | 1-2 hours | ||
| Add detailed logging | Improve log messages for debugging (e.g., LOG.debug for ignored associations). |
1 hour | ||
| Handle edge cases | Ensure get_relation() returns valid strings (not None or empty). |
1 hour | ||
| Validate performance | Test with a 10,000+ person database to detect slowdowns. | 2 hours |
Deliverable: A stable and tested version for Gramps 5.2 and 6.x.
Phase 2: User Improvements (Priority: 
)
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”). | 3-4 hours | ||
| Export to CSV/JSON | Add a button to export results to a file. | 4 hours | ||
| Multi-column sorting | Allow sorting by multiple columns (e.g., type then name). | 2 hours | ||
| Multi-row selection | Enable selecting multiple rows for batch actions (e.g., delete, export). | 3 hours | ||
| Customizable columns | Let users choose which columns to display. | 4 hours | ||
| Auto-refresh | Add a button to refresh data without closing the window. | 1 hour |
Deliverable: A more flexible and powerful tool for advanced users.
Phase 3: User Experience Enhancements (Priority: 
)
Goal: Improve ergonomics and accessibility.
| Task | Description | Complexity | Benefit | Estimated Time |
|---|---|---|---|---|
| Dark theme support | Adapt the UI for Gramps’ dark mode. | 2 hours | ||
| Keyboard shortcuts | Add shortcuts (e.g., Ctrl+C to copy, Ctrl+F to filter). |
3 hours | ||
| Enhanced tooltips | Add detailed descriptions for each column. | 1 hour | ||
| Icons for actions | Replace context menu text with icons. | 2 hours | ||
| Search history | Save last used filters. | 3 hours |
Deliverable: A more intuitive and modern user experience.
Phase 4: Advanced Features (Priority:
)
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). | 5 hours | ||
| Global statistics | Display statistics (e.g., number of associations per type). | 3 hours | ||
| Relationship graph | Generate a graph of associations (via Graphviz or DOT). | 6 hours | ||
| Advanced search | Filter by date, place, or other metadata. | 5 hours | ||
| Integration with other tools | Link with SyncAssociation or Gramps-Web. | 4 hours | ||
| Scripting support | Allow running custom scripts on selected associations. | 8 hours |
Deliverable: A powerful tool for genealogy experts.
Phase 5: Maintenance & Documentation (Priority: 
)
Goal: Ensure the project’s longevity.
| Task | Description | Complexity | Benefit | Estimated Time |
|---|---|---|---|---|
| Unit tests | Write tests for critical functions (e.g., get_ref_relation). |
4 hours | ||
| Technical documentation | Add a developer guide (e.g., how to extend the tool). | 2 hours | ||
| Translations | Update PO files for new features. | 2 hours | ||
| Changelog | Maintain a change log for users and maintainers. | 1 hour | ||
| CI/CD | Set up automated tests (GitHub Actions) for Gramps 5.2 and 6.x. | 3 hours |
Deliverable: A well-documented and maintainable project.
Phase 6: Community Integration (Priority:
)
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. | 1 hour | ||
| Create a wiki page | Document the tool on the Gramps wiki. | 2 hours | ||
| Video tutorials | Create demonstration videos (e.g., YouTube). | 4 hours | ||
| User feedback | Collect feedback via forms or GitHub Issues. | 1 hour | ||
| Community presentation | Present the tool on the Gramps forum. | 1 hour |
Deliverable: Increased visibility and an engaged community.
Suggested Timeline
Based on part-time development.
| Phase | Duration | Deliverable | Priority |
|---|---|---|---|
| Phase 1 | 1-2 weeks | Stable version (1.2.2) | |
| Phase 2 | 2-3 weeks | Version with filters and export (1.3.0) | |
| Phase 3 | 2 weeks | Improved UX (1.4.0) | |
| Phase 4 | 3-4 weeks | Advanced features (2.0.0) | |
| Phase 5 | 2 weeks | Documentation and tests (2.0.0) | |
| Phase 6 | 1 week | Community integration |
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. |
Bonus Ideas (Out of Scope)
If you want to go even further:
- External Tool Integration:
- Export to GEDCOM or FamilySearch.
- Link with Ancestry.com or MyHeritage.
- Semantic Analysis:
- Detect inconsistencies (e.g., a person associated as “Godparent” but without a baptism event).
- Machine Learning:
- Suggest missing associations (e.g., “This person is likely the godparent of X”).
- Collaboration:
- Allow multiple users to work on the same associations (via a server).
Next Steps
- Prioritize tasks based on your needs and available time.
- Start with Phase 1 (stabilization) if you want a reliable version quickly.
- Move to Phase 2 (filters, export) to add useful features.
- Document each step to ease maintenance.
More technical: