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:
- First select the grandparents of the source person.
- The result set as input for the grandparentsâ children.
- 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.
- Instead of active person filter, you can add a Bookmarked people filter. person you are looking for cousins
- Add a Parents of <filter> match filter #1 its parents
- Add a Parents of <filter> match filter #2 its grand-parents
- Add a Children of <filter> match filter #3 its aunts and uncles (and parents)
- Add a Children of <filter> match filter #4 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:
- A two rules filter:
- Siblings of <filter> match #1
- Bookmarked people.
- Select At least one rule must apply.
- And another two rules filter:
- People matching the <filter> #5
- People matching the <filter> #6.
- Select Only one rule must apply.
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
- Create a Tag called âFilterPersonâ
- Create a custom filter to locate the tagged person or people:
âTaggedFilterPersonâ with the rule: âPeople with the <tag>â where the filter = âFilterPersonâ - 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
Is there a more efficient way to write custom filters to find cousins? The one below uses the âHome Personâ as the foundation to find 1st cousins of the Home Person. It is awkward but works.
The most awkward part is the ancestor section. The Grandparents
custom filter finds all the ancestors a certain number of generations away and subtracts the ancestors one generation nearer.
The Pedigree Gramplet compiles a list of Generations. (The lists default to ahnentafel number order.) The Pedigree generates lists of ancestor generations a lot faster than the custom filter.
But even though slow, the process cannot be extended to select a set of Nth cousins. The rule set lacks the necessary âDescendants of <filter> not more than <N> generations awayâ rule.
<?xml version="1.0" encoding="UTF-8"?>
<filters>
<object type="Person">
<filter name="Grandparents" function="one" comment="of Home Person">
<rule class="IsLessThanNthGenerationAncestorOfDefaultPerson" use_regex="False">
<arg value="3" />
</rule>
<rule class="IsLessThanNthGenerationAncestorOfDefaultPerson" use_regex="False">
<arg value="2" />
</rule>
</filter>
<filter name="Piblings" function="and" comment="of Home Person">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Grandparents" />
</rule>
</filter>
<filter name="Cousins" function="and" comment="of Home Person">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Piblings" />
</rule>
</filter>
</object>
</filters>
Here are the filters I use to find cousins of bookmarked people. Itâs a lot of filters, but all you have to do is copy and paste if you want them.
Be aware that the IsSiblingOfFilterMatch rule includes only children of the âmain parentsâ of a person. (See feature request 12443.)
<filter name="Bookmarked people" function="and">
<rule class="IsBookmarked" use_regex="False">
</rule>
</filter>
<filter name="Cousins of bookmarked people" function="or">
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins once removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins once removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins thrice removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins thrice removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins twice removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="First cousins twice removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins once removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins once removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins thrice removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins twice removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Second cousins twice removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Third cousins of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Third cousins once removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Third cousins once removed (up) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Third cousins thrice removed (down) of bookmarked people"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="Third cousins twice removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins of bookmarked people" function="and" comment="children of aunts and uncles">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Aunts and uncles of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins once removed (down) of bookmarked people" function="and" comment="children of first cousins">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins once removed (up) of bookmarked people" function="and" comment="children of great-aunts and great-uncles">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Great-aunts and great-uncles of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins thrice removed (down) of bookmarked people" function="and" comment="children of first cousins twice removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins twice removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins thrice removed (up) of bookmarked people" function="and" comment="children of great-great-great-aunts and great-great-great-uncles">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Great-great-great-aunts and great-great-great-uncles of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins twice removed (down) of bookmarked people" function="and" comment="children of first cousins once removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins once removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="First cousins twice removed (up) of bookmarked people" function="and" comment="children of great-great-aunts and great-great-uncles">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Great-great-aunts and great-great-uncles of bookmarked people"/>
</rule>
</filter>
<filter name="fourth cousins of bookmarked people" function="and" comment="children of third cousins once removed (up)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Third cousins once removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Grandparents of bookmarked people" function="and" comment="parents of parents">
<rule class="IsParentOfFilterMatch" use_regex="False">
<arg value="Parents of bookmarked people"/>
</rule>
</filter>
<filter name="Great-aunts and great-uncles of bookmarked people" function="and" comment="siblings of grandparents">
<rule class="IsSiblingOfFilterMatch" use_regex="False">
<arg value="Grandparents of bookmarked people"/>
</rule>
</filter>
<filter name="Great-grandparents of bookmarked people" function="and" comment="parents of grandparents">
<rule class="IsParentOfFilterMatch" use_regex="False">
<arg value="Grandparents of bookmarked people"/>
</rule>
</filter>
<filter name="Great-great-aunts and great-great-uncles of bookmarked people" function="and" comment="siblings of great-grandparents">
<rule class="IsSiblingOfFilterMatch" use_regex="False">
<arg value="Great-grandparents of bookmarked people"/>
</rule>
</filter>
<filter name="Great-great-grandparents of bookmarked people" function="and" comment="parents of great-grandparents">
<rule class="IsParentOfFilterMatch" use_regex="False">
<arg value="Great-grandparents of bookmarked people"/>
</rule>
</filter>
<filter name="Great-great-great-aunts and great-great-great-uncles of bookmarked people" function="and" comment="siblings of great-great-grandparents">
<rule class="IsSiblingOfFilterMatch" use_regex="False">
<arg value="Great-great-grandparents of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins of bookmarked people" function="and" comment="children of parents' cousins">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins once removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins once removed (down) of bookmarked people" function="and" comment="children of second cousins">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Second cousins of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins once removed (up) of bookmarked people" function="and" comment="children of first cousins twice removed (up)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins twice removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins thrice removed (down) of bookmarked people" function="and" comment="children second cousins twice removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Second cousins twice removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins twice removed (down) of bookmarked people" function="and" comment="children of second cousins once removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Second cousins once removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="Second cousins twice removed (up) of bookmarked people" function="and" comment="children of first cousins thrice removed (up)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="First cousins thrice removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Siblings of active person" function="and">
<rule class="IsSiblingOfFilterMatch" use_regex="False">
<arg value="Active person"/>
</rule>
</filter>
<filter name="Siblings of my direct ancestors" function="and">
<rule class="IsSiblingOfFilterMatch" use_regex="False">
<arg value="My direct ancestors"/>
</rule>
</filter>
<filter name="Third cousins of bookmarked people" function="and" comment="children of second cousins once removed (up)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Second cousins once removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Third cousins once removed (down) of bookmarked people" function="and" comment="children of third cousins">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Third cousins of bookmarked people"/>
</rule>
</filter>
<filter name="Third cousins once removed (up) of bookmarked people" function="and" comment="children of second cousins twice removed (up)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Second cousins twice removed (up) of bookmarked people"/>
</rule>
</filter>
<filter name="Third cousins thrice removed (down) of bookmarked people" function="and" comment="children of third cousins twice removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Third cousins twice removed (down) of bookmarked people"/>
</rule>
</filter>
<filter name="Third cousins twice removed (down) of bookmarked people" function="and" comment="children of third cousins once removed (down)">
<rule class="IsChildOfFilterMatch" use_regex="False">
<arg value="Third cousins once removed (down) of bookmarked people"/>
</rule>
</filter>
Thanks for this filter âemyoulationâ!
However, Iâm still not fit in using Gramps properlyâŚ
Where and how do I have to create and use this xml file? (Where) is there a step by step guide in the help?
Thanks for this filter George.
However, Iâm still not fit in using Gramps properlyâŚ
Where and how do I have to create and use this xml file? (Where) is there a step by step guide in the help?