Filter persons with events

I try to find people who have events other than their own birth or death events

What should be the filters to find that?

Thanks

I added an Events filter (called ‘Birth and Death’) that found Birth & Death events, then set it to find events that do NOT match. (You might want to add Burial events.) Then a Person filter (called ‘Exempt’) to match person with that Event filter.

Here’s the custom_filters.xml (found in the User Directory ) if you want to cut&paste the Custom Filters:

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="Exempt" function="or">
      <rule class="MatchesEventFilter" use_regex="False">
        <arg value="Birth and Death"/>
      </rule>
    </filter>
  </object>
  <object type="Event">
    <filter name="Birth and Death" function="or" invert="1">
      <rule class="HasType" use_regex="False">
        <arg value="Birth"/>
      </rule>
      <rule class="HasType" use_regex="False">
        <arg value="Death"/>
      </rule>
    </filter>
  </object>
</filters>
1 Like

I think this works:

Create filter “People with events” and “People with birth or death events” and combine them using the option “Exactly one rule must apply”.

“People with events” = "People with events matching the " where = “Every event”. (“Every event” is a custom filter that simply selects “Every event”.)

“People with birth or death events” = a pair of filters for "People with the " for birth and death, with primary role only, using the option “at least one rule must apply”.

1 Like

I think if someone only event is to be a witness of a birth or death event, that filter will not be found it

The ‘Exempt’ people filter finds people with OTHER than Birth or Death events. If you needed it to find People that have Birth & Death but ALSO another type, that’s just a couple more ‘Event type match’ rules in the People filter where ALL rules have to match.

Another quick alternative is to sort the Event View on the Primary participants
 then filter out the Both & Death events. (You do the sort FIRST since sorting AFTER re-runs the filter.)

Let’s clarify the specification.

Are you looking for people with Birth or Death events where they do not have the ‘Primary’ role?

(I had read your specification to be: People with more/other events than Birth & Death)

If a person had only its birth and/or death event(s) this filter will match. But it’s probably better to find it than not founding what I want. I’ll try to rework this one.

What I’m looking for is this:

Event Role Exist Match
Birth Primary yes or no no if alone or only with death as primary
Birth Any other roles yes yes
Death Primary yes or no no if alone or only with birth as primary
Death Any other roles yes yes
Any other event type Any role type yes yes

That sound like a multiple pass set of searches. For instance, I might search for people with Atypical Roles using the HasPersonEventRole addon rule. (Typical roles being: Primary, Family & Unknown )

This finds the less-frequently-used built-ins plus a custom “Dependant” role.

I’d Tag the results then apply other criteria in combinations using other filters & separately tag those. Then find that filter for people that match both tags. Ugly but possible.

  <object type="Person">
    <filter name="Atypical Roles" function="or">
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Aide"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Bride"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Celebrant"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Clergy"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Groom"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Informant"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Witness"/>
        <arg value="0"/>
      </rule>
      <rule class="HasPersonEventRole" use_regex="False">
        <arg value="Dependant"/>
        <arg value="0"/>
      </rule>
    </filter>
  </object>

Apply the Atypical Roles filter to the (ungrouped) People View. Have the Gramplet bottombar enabled with the “Events” gramplet active and sort the Gramplet on role.

Then you can just move the Active Person focus down the view and see which have Role oddities. (The Grouped People view is much more painful with its collapsed groups.)

1 Like

Thanks everyone. I managed to do what I wanted by cheating a bit.

I made a source filter on what interested me, then an event filter that calls this source filter.

I also made person filters = ((event filter = (Type= “birth | death”) & person filter = (personal event=(“Birth | Death” & role <> “Principal”)))

And finally another person filter which calls the event filter and the previous person filters

1 Like

Would you be willing to open your custom_filters.xml file and share the filter objects that you created? (Add a description to the Filters before closing Gramps. I forgot to do that in the filters I shared.)

We can use this Discourse forum almost as a library of shareable filters.

1 Like

Yes, sure. I hope everybody will understand my own logical and I don’t forget anything.
I’ve translated filters name in comments end, i.e.:

<filter name=“37. Projet[Signatures] Manque Ă©vĂ©nement Niveau d’instruction - 481p” function=“and” comment=“481p - Filtre(&) == [E88.387p, I87.492p, I88.402i] - Trouver comment trouver cette info manquante; ajouter l’évĂ©nement Niveau d’instruction ou tagger les Ă©vĂ©nements avec “Filtre[Faux positif] I.481p” - Missing Education events records”>

Person filters:

<filter name="37. Projet[Signatures] Manque événement Niveau d'instruction - 481p" function="and" comment="481p - Filtre(&amp;) == [E88.387p, I87.492p, I88.402i] - Trouver comment trouver cette info manquante; ajouter l'événement Niveau d'instruction ou tagger les événements avec &quot;Filtre[Faux positif] I.481p&quot; - Missing Education records">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvénementPersonnel['Education'] == ['Lettré' | 'Illettré'] - 402i"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="87. EvĂ©nementPersonnel[['Naissance' | 'BaptĂȘme' | 'DĂ©cĂšs' | 'Inhumation'], {'RĂŽle': ^'Principal'}] - 492p"/>
  </rule>
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="88. Sources[Sources signées par les participants] &amp; ^Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 387p"/>
  </rule>
</filter>
<filter name="87. EvĂ©nementPersonnel[['Naissance' | 'BaptĂȘme' | 'DĂ©cĂšs' | 'Inhumation'], {'RĂŽle': ^'Principal'}] - 492p" function="or" comment="492p - Filtre(|) == [E88.486p, E88.489p, E88.490p, E88.491p]" - Personal events Birth, Batism... Role Principal>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvénementPersonnel['Naissance', {'RÎle': ^'Principal'}] - 486p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvĂ©nementPersonnel['BaptĂȘme', {'RĂŽle': ^'Principal'}] - 489p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvénementPersonnel['Inhumation', {'RÎle': ^'Principal'}] - 490p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvénementPersonnel['DécÚs', {'RÎle': ^'Principal'}] - 491p"/>
  </rule>
</filter>
<filter name="88. EvénementPersonnel['Education'] == ['Lettré' | 'Illettré'] - 402i" function="and" invert="1" comment="402i - Personal events Education, Can or Cannot read">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="88. EvénementPersonnel['Education'] == ['Lettré' | 'Illettré'] - 402p"/>
  </rule>
</filter>
<filter name="88. EvénementPersonnel['Education'] == ['Lettré' | 'Illettré'] - 402p" function="or" comment="402p - Filtre(|) == [I90.400p, I90.401p]">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Education', {'Description': Lettré}] - 400p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Education', {'Description': Illettré}] - 401p"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Education', {'Description': Illettré}] - 401p" function="and" comment="401p - Filtre(&amp;) == [E90.263p] - Education: Cannot read">
  <rule class="HasEvent" use_regex="False">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value="0"/>
  </rule>
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['Niveau d'instruction', {'Description': 'Illettré'}] - 263p"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Education', {'Description': Lettré}] - 400p" function="and" comment="400p - Filtre(&amp;) == [E90.262p] - Education: Can read/write">
  <rule class="HasEvent" use_regex="False">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value="0"/>
  </rule>
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['Niveau d'instruction', {Description': 'Lettré'}] - 262p"/>
  </rule>
</filter>
<filter name="88. EvénementPersonnel['Naissance', {'RÎle': ^'Principal'}] - 486p" function="and" comment="486p - Filtre(&amp;) == [E90.282p, I90.404i] - reverse of (Personal Event Birth, Role is not Principal)">
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['Naissance'] - 282p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Naissance', {'RÎle': 'Principal'}] - 404i"/>
  </rule>
</filter>
<filter name="88. EvĂ©nementPersonnel['BaptĂȘme', {'RĂŽle': ^'Principal'}] - 489p" function="and" comment="489p - Filtre(&amp;) == [E90.105p, I90.488i] - Personal Event Birth, Role is not Principal">
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['BaptĂȘme'] - 105p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvĂ©nementPersonnel['BaptĂȘme', {'RĂŽle': 'Principal'}] - 488i"/>
  </rule>
</filter>
<filter name="88. EvénementPersonnel['Inhumation', {'RÎle': ^'Principal'}] - 490p" function="and" comment="490p - Filtre(&amp;) == [E90.285p, I90.464i] - Burial, Role is not Principal">
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['Inhumation'] - 285p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Inhumation', {'RÎle': 'Principal'}] - 464i"/>
  </rule>
</filter>
<filter name="88. EvénementPersonnel['DécÚs', {'RÎle': ^'Principal'}] - 491p" function="and" comment="491p - Filtre(&amp;) == [E90.286p, I90.463i] - Death, Role is not principal">
  <rule class="MatchesEventFilter" use_regex="False">
    <arg value="90. Type['DĂ©cĂšs'] - 286p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['DécÚs', {'RÎle': 'Principal'}] - 463i"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Naissance', {'RÎle': 'Principal'}] - 404i" function="and" invert="1" comment="404i - reverse of (Birth, Role: Principal)">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Naissance', {'RÎle': 'Principal'}] - 404p"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Naissance', {'RÎle': 'Principal'}] - 404p" function="and" comment="404p - Birth, Role: Principal">
  <rule class="HasEvent" use_regex="False">
    <arg value="Birth"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value="1"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['DécÚs', {'RÎle': 'Principal'}] - 463i" function="and" invert="1" comment="463i - Reverse of (Death, Role: Principal)">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['DécÚs', {'RÎle': 'Principal'}] - 463p"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['DécÚs', {'RÎle': 'Principal'}] - 463p" function="and" comment="463p - Death, Role: Principal">
  <rule class="HasEvent" use_regex="False">
    <arg value="Death"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value="1"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Inhumation', {'RÎle': 'Principal'}] - 464i" function="and" invert="1" comment="464i - Reverse of (burial, role: principal)">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. EvénementPersonnel['Inhumation', {'RÎle': 'Principal'}] - 464p"/>
  </rule>
</filter>
<filter name="90. EvénementPersonnel['Inhumation', {'RÎle': 'Principal'}] - 464p" function="and" comment="464p - burial, role: principal">
  <rule class="HasEvent" use_regex="False">
    <arg value="Burial"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
    <arg value="1"/>
  </rule>
</filter>

Events

<filter name="88. Sources[Sources signées par les participants] &amp; ^Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 387p" function="and" comment="387p - Filtre(&amp;) == [E90.385p, E90.386i] - Signed sources by people noted in">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Sources[Sources signées par les participants] - 385p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 386i"/>
  </rule>
</filter>
<filter name="90. Type['Niveau d'instruction', {'Description': 'Illettré'}] - 263p" function="or" comment="263p - Education: cannot read">
  <rule class="HasData" use_regex="True">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value="^Ne sait pas"/>
  </rule>
  <rule class="HasData" use_regex="False">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value="Illettré"/>
  </rule>
</filter>
<filter name="90. Type['Niveau d'instruction', {Description': 'Lettré'}] - 262p" function="or" comment="262p - education: can read/write">
  <rule class="HasData" use_regex="True">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value="^Sait"/>
  </rule>
  <rule class="HasData" use_regex="True">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value="^[2345]"/>
  </rule>
  <rule class="HasData" use_regex="True">
    <arg value="Education"/>
    <arg value=""/>
    <arg value=""/>
    <arg value="(élÚve|elÚve|école|ecole|classe|université|baccalauréat)"/>
  </rule>
</filter>
<filter name="90. Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 386i" function="and" invert="1" comment="386i - false positive filter">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 386p"/>
  </rule>
</filter>
<filter name="90. Tag[{'Filtre': 'Faux positif'}, 'I.481p'] - 386p" function="and" comment="386p - false positive filter">
  <rule class="HasTag" use_regex="False">
    <arg value="Filtre[Faux positif] I.481p"/>
  </rule>
</filter>
<filter name="90. Type['Naissance'] - 282p" function="and" comment="282p - birth">
  <rule class="HasType" use_regex="False">
    <arg value="Birth"/>
  </rule>
</filter>
<filter name="90. Type['DĂ©cĂšs'] - 286p" function="and" comment="286p - death">
  <rule class="HasType" use_regex="False">
    <arg value="Death"/>
  </rule>
</filter>
<filter name="90. Type['Inhumation'] - 285p" function="and" comment="285p - burial">
  <rule class="HasType" use_regex="False">
    <arg value="Burial"/>
  </rule>
</filter>
<filter name="90. Sources[Sources signées par les participants] - 385p" function="and" comment="385p - Filtre(&amp;) == [S88.143p] - signed sources">
  <rule class="MatchesSourceFilter" use_regex="False">
    <arg value="88. Sources signées par les participants - 143p"/>
  </rule>
</filter>

Sources

<filter name="88. Sources signées par les participants - 143p" function="or" comment="143p - Filtre(|) == [S90.058p, S90.060p, S90.093p, S90.102p, S90.138p, S90.140p, S90.141p, S90.142p] - signed sources">
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Carte postale'] - 102p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Lettre'] - 138p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre[R'1er RĂ©giment-Franc de Paris,  (Cartes de RĂ©sistants|Fiches des membres)'] - 140p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre[&quot;PiÚce d'identité&quot;] - 141p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Registres de catholicité, Registres'] - 093p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Etat civil, Registres'] - 058p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Etat civil, Acte'] - 060p"/>
  </rule>
  <rule class="MatchesFilter" use_regex="False">
    <arg value="90. Titre['Actes notariés'] - 142p"/>
  </rule>
</filter>
<filter name="90. Titre['Etat civil, Registres'] - 058p" function="one" comment="058p - civil registers">
  <rule class="HasSourceParameter" use_regex="False">
    <arg value=". Etat civil, Registres."/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
  </rule>
</filter>
<filter name="90. Titre['Etat civil, Acte'] - 060p" function="and" comment="060p - another civil register">
  <rule class="HasSourceParameter" use_regex="False">
    <arg value=". Etat civil, Acte."/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
  </rule>
</filter>
<filter name="90. Titre['Registres de catholicité, Registres'] - 093p" function="one" comment="093p - catholic registers">
  <rule class="HasSourceParameter" use_regex="False">
    <arg value=". Registres de catholicité, Registres."/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
  </rule>
</filter>
<filter name="90. Titre['Carte postale'] - 102p" function="and" comment="102p - post card">
  <rule class="MatchesTitleSubstringOf" use_regex="False">
    <arg value="Carte postale"/>
  </rule>
</filter>
<filter name="90. Titre['Lettre'] - 138p" function="and" comment="138p - letter">
  <rule class="MatchesTitleSubstringOf" use_regex="False">
    <arg value="Lettre"/>
  </rule>
</filter>
<filter name="90. Titre[R'1er RĂ©giment-Franc de Paris,  (Cartes de RĂ©sistants|Fiches des membres)'] - 140p" function="and" comment="140p - military cards">
  <rule class="HasSourceParameter" use_regex="True">
    <arg value="^1er RĂ©giment-Franc de Paris, (Cartes de RĂ©sistants|Fiches des membres)\."/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
  </rule>
</filter>
<filter name="90. Titre[&quot;PiÚce d'identité&quot;] - 141p" function="and" comment="141p - identity cards ans passports">
  <rule class="MatchesTitleSubstringOf" use_regex="False">
    <arg value="PiÚce d'identité"/>
  </rule>
</filter>
<filter name="90. Titre['Actes notariés'] - 142p" function="and" comment="142p - notaries records">
  <rule class="HasSourceParameter" use_regex="False">
    <arg value="Actes notariés"/>
    <arg value=""/>
    <arg value=""/>
    <arg value=""/>
  </rule>
</filter>

What I’m trying to do with all this stuff? I’m looking for people wich have an event containing participants signature I don’t have recorded has Education “can/cannot sign” event record. So I search for sources containing signatures (civil records, military cards, notary records, post cards, 
), I then search for events related to these sources, then people. But i do not want them who have birth, batism, death or burial personal records (they can’t sign these records ^^) (this is what I was looking for with this post)

To do what? Complete thousands education records I already have registered and tag events, people and families like this: https://www.reddit.com/r/gramps/comments/nupsqw/how_should_i_indicate_literacy/
Then make statistics on pepple and families members education.

P.S: I name and number my filters as follows:

Name field: cc. name - nnnx
cc: filter category, the less is the number the more usable is the filter
nnn: sequential number unique for each filter type (person, 
)
x: I or P (P filters are searching for something, I filters are searching for the reverse of the same nnnP filter)
Comment field:
nnnx - Filtre(s) == [filters_list] - comments
nnnx: is the same I repeat from Name field
s: &/|/^ (& for All rules
, | for At least one rule
, ^ for Only one rule must match)

With this naming conventions I can retreive filters in filters editors:
In naming order (by category of filters):

In comment order (by unique nnnx number):

1 Like

You could store signatures as person attributes. A person may use several different signatures during their lifetime (for example, before vs. after marriage, or before vs. after attaining a degree or title), so a person could therefore have multiple “Signature” attributes with different values, each with its own source citations. The value of the attribute could be “X” in case of a mark rather than a signature; the same person might later have a signature after acquiring the ability to write.

1 Like

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