How to create a Cousin Report

In my legacy application I have a report that shows all cousins (and siblings) for a source person. Beside the blood related persons also their (marriage) partners are found optionally. Additionally, a restriction according to living persons is possible.
The report outputs names, birth and death dates as well as (optionally) the ID.
(How) is something like this realizable in Gramps?

There is no cousin report available as far as I know. The closest is probably the kinship report, but this report lists all related persons and not only siblings, cousins and partners.

You could create a multi-step custom filter and export the filtered person view as CSV if you need a list of only siblings, cousins and partners.

You have to do it with a double filter:

Step1: create a filter with the generation whose descendants you want

  • Ancestors of person not more than N generations away
  • Ancestors of person at least N generations away

Step2: Create a filter with their Descendants:

  • Descendant family members of filter match (here you put as value the name of the filter in step1

Hi Markus,
Thanks for your tips, I am only very short time with Gramps trying out.

I actually needed a triple filter:

  1. First select the grandparents of the source person.
  2. The result set as input for the grandparents’ children.
  3. And the second partial result as input for their children.

Unfortunately, the whole thing is very statically related to the person stored in the filter and I could not find a filter for ‘only living persons’ either. The ‘alive’ option in the export dialog just works the wrong way around for this case.

I suppose the solution could be a plugin and I am familiar with the programming, but I don’t have any direct Python experience. But it doesn’t look much different than SQL and VB…

Do you have a tip, what existing *.py I could take as a template?
And what is necessary around it to bring a new plugin to run (first only locally on the PC)?

There is the Active Person filter rule. It is an addon rule and is not installed with the core Gramps code.

First create a filter Active Person using the Active Person rule.
Instead of looking for the Grandparents of a set person, set it to Ancestors of <filter> match.

The problem with this rule, it only works from within the People/Grouped People list views. It does not work as a filter for reports/etc.

There is the People Probably Alive rule where you set a date. This rule will use the Maximum age probably alive: setting in Preferences.

Combine this rule with your final cousin filter with the option “All Rules must apply” option.

  1. Instead of active person filter, you can add a Bookmarked people filter. :arrow_right: person you are looking for cousins
  2. Add a Parents of <filter> match filter #1 :arrow_right: its parents
  3. Add a Parents of <filter> match filter #2 :arrow_right: its grand-parents
  4. Add a Children of <filter> match filter #3 :arrow_right: its aunts and uncles (and parents)
  5. Add a Children of <filter> match filter #4 :arrow_right: its cousins (and him or herself, and siblings)

Bookmark the person you want to obtain the cousins report (remove any other bookmarked persons)

Run the filter #5 or select it to run the report you want.

If you don’t want the person and its siblings, you have to create two more filters:

  1. A two rules filter:
  2. And another two rules filter:

Run filter #7

(I hope I didn’t make a mistake, I did that on my mind)

In addition to the Active Person filter and the Book Marked people filter, there is also a Home Person filter rule.

Sure but I generally don’t change my home person (me) so I prefer using bookmarks

This 7-step selection works as described, thanks for the help.

But I didn’t find a report (with such a simple layout as in the kindship report) that can be run with a filter as input.

Yes, the kinship report has exactly the data and the form I would see in the cousin report. And as you correctly pointed out, much, much more…

The ideal solution would be a clone of the report from which everything else is deleted. But that will probably not be so easy.

And what I also noticed: The report is created very quickly, while the multi-level filter solutions take much longer.

Another method

  1. Create a Tag called “FilterPerson
  2. Create a custom filter to locate the tagged person or people:
    TaggedFilterPerson” with the rule: “People with the <tag>” where the filter = “FilterPerson
  3. Create a full set of immediate relations custom filter rules:
    a) “Parents” with the rule: “Parents of <filter> match” where the filter = “TaggedFilterPerson”
    b) “Piblings” (Aunts and Uncles) with the rule: “Siblings of <filter> match” where the filter = “Parents”
    c) “1st cousins” with the rule: “Children of <filter> match” where the filter = “Piblings”
    d) “Siblings” with the rule: “Siblings of <filter> match” where the filter = “TaggedFilterPerson”
    e) “Niblings” (nieces and nephews) with the rule:: “Children of <filter> match” where the filter = “Siblings”

So all you have to do is apply a “FilterPerson” to one person or a set of People and run the appropriate Filter Rule. (You might want to add Spouses at some levels. But be careful of how that might unintentionally include blended family step-children as Cousins or Niblings.)

Hint: If you’re going to do a bunch of manipulations on the same set of relatives, Use the Add/Remove Tag tool Addon Tool to set Tags for that group of people. (You need to create the Tag BEFORE running the tool.) Then use the Filter gramplet’s tag filter instead of the Custom Filter. It reduces the filtering down to one pass.

I prefer to use tags to filter out exceptions: to filter out objects that I don’t want the filters to pop up.

For example in this case of cousins, if I didn’t want a cousin who was adopted (this is an example, I don’t see why I would do that), I would tag this person and filter this tag so as not to not take it into account in the results.

Adding and removing tags can be quite time consuming, so now I prefer to use them for exceptions

Not to hijack the thread, but this reminded me: what does the tick box “include Cousins”
in the options of the Kinship report supposed to do? Doesn’t work for me, the output is identical ticked or not- no cousins show up but they are in the DB.

I reserve 1 tag for Filter targeting.

Adding a Tag via a filter in the Add/Remove Tags tool seems to be a little faster than filtering in a View.

And Using the “Edit → Tag → Organize Tags…” for deleting and recreating that Tag is far quicker than using the tool.

Be aware that the Siblings filter rule doesn’t include half-siblings. See this feature request.

Using this tool takes so long, I use it only when I really need it

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.