Addon Filter Rule requests

  • expand Filter Gramplet for Notes : Primary object types (e.g., use existing type “To Do” notes for “Associations” or “Media”
  • People in a person’s families (returns Parents, self, siblings, spouses, offspring in a single step)
  • Events in a Person’s families (returns Personal Events and Family events of Parents, self, siblings, spouses, offspring
  • Places in a Person’s families (returns Places of Personal Events and Family events of Parents, self, siblings, spouses, offspring
  • Ancestor/Descendant families of a Person or Person filter

See also:

  • the FilterRules addon packs
  • 0012555 Order of filters changing (keep the order the same after edit) 2022-05-22
  • Feature request 0012988: Add Enclosing Place option to the Person view Filter gramplet fields
    People Rule “People with the personal/family <event>
  • Feature request 0012443 Add blended families to “Siblings of <filter> match” filter 2023-08-03
  • Feature request 0012924, 0006141 & 0012227 option to include or exclude each rule 2023-07-15
  • 0010667 Expand “Family filters” to allow <filter> to be “Default person” 2022-09-16
  • 0010961 Filter: People with records containing <substring> 2022-09-16
  • 0011434 Create a new addon Role filter rules for Events to supplement the People/Families addon rule for Roles 2022-09-16
  • 0011567 filter rules for <attribute> would be more useful with ability to search for empty values & all values 2022-09-16
  • 0008321 Events cannot be filtered against a named Citation filter 2022-09-16
  • 0003105 Filters attached to special Events or Persons for all objects (also for source or place or media object) 2022-09-16
  • 0008651 Allow anonymous sub-filters
  • 0012291 Add ability to filter Sources or Citations for Attributes 2022-09-16
  • 0012412 filter rule that leverages OS file search capability 2022-09-16
  • 0012036 Find Call Names that are not within the Given Name
  • 0002446 New filter: by grouped-as name 2022-09-16
  • 0011449 Add person filter “related to <filter>” 2022-09-16
  • 0012524 Make filtering or search by location possible 2022-09-16
    People Rule “People with the personal/family <event>
  • 0012597 Add filter to find the families that have marriages that match an event filter. 2022-05-22
  • 0012591 Additional filter options for creating a family 2022-05-22
  • 0010779 Additional flexibility in custom filters 2022-05-01
  • 0012281 Filter: Ancestor of not more than generations ago has a cap of 32 generations 2021-04-05
  • 0012112 Charts Filtering for age stats 2021-02-04
  • 0012081 New filter: Objects (persons, events, etc) with notes matching the <note filter> 2020-12-23
  • 0012037 Dynamic (=auto-refresh) probably alive filter 2020-11-13
    0009402 Allow regexp in date field filter 2020-10-31
  • 0011971 Make custom filters with tree-specific rules hidden where not valid 2020-10-16
  • 0004627 Use of custom filters from command line 2020-08-09
  • 0004620 date rule filters (before 1234, etc.) don’t work across LANG switch 2020-01-08
  • 0010960 Documentation - Filter: People with records containing <substring> 2019-01-08
  • 0010778 Custom event filter on families is missing 2018-10-01
  • 0010770 Start Gramps from the command line against an existing filter 2018-08-30
  • 0010469 Add an “all citations” filter 2018-03-13
  • 0001676 refactor filter code to extract namespaces to central place 2017-05-05
  • 0006217 Search/Filtering feature confirmed 2017-04-25 Filter events based on place/location
  • 0009112 Add ability to Filter for both latitude/longitude at same time 2017-04-25
  • 0008202 Save the filter gramplet choices as a custom filter 2016-12-29 (0002071 duplicate)
    Filter+ addon
  • 0008078 Create one filter rule for media attributes. [was: media reference editor.- analysis] 2016-12-18
  • 0003303 interactive Filter for selection of Persons not possible/difficult with cascaded filters 2016-11-30
  • 0001676 refactor filter code to extract namespaces to central place 2017-05-05
  • 0004600 Extended User Filter for Sources 2016-07-28
  • 0006846 Create reports from filters 2016-05-11
  • 0008174 Add “Name Filter sidebar” options to “Exclude spouses” & “exclude husbands” 2016-04-26
  • 0009369 Filter for repositories should have the possibility to filter for referenced sources 2016-04-09
  • 0000714 Filters for selecting people in Witness Editor 2016-04-03
  • 0004474 Add a method of re-ordering custom filters 2016-04-02
  • 0006675 “Filter Person” dialog (in Reports) only shows one or two people to choose from by default 2016-03-19
  • 0006141 Define Custom Filter: ‘do not match filter’ also per rule 2015-09-19
  • 0007602 filter to find only events with (or without) exact dates 2015-09-16
  • 0005896 Create a Note Report which prints out all Notes types matching a filter 2015-09-16
  • 0007635 Filter Rule for Title Field 2015-09-03
  • 0003675 Filter now persistent, does Gramps should warn users ? 2015-07-26
  • 0006676 Dialog “Filter Person” should allow to quickly filter/search a certain person (Usability) 2015-07-25
    Use clipboard context menu
  • 0003648 Marking items as defined by a filter 2015-07-16
  • 0005798 New Person Filter for events: filter for “event type” AND “event role” related to a person 2015-07-16
  • 0012830 Filter Rules are missing basic rules for inter object working

How would you prompt for the location or person? It would be nice if custom filters could do that somehow. (If they can, then it’s something I’ve been missing out on.)

Some of the custom filters I use as building blocks for others include these:

Active person [uses the Active person rule]
Bookmarked people [uses the Bookmarked people rule]
Default person (or home person) [uses the Home person rule]

It would also be nice if it were easy to see which custom filters use a given filter rule or other custom filter (without having to go into the xml file to figure it out).

One of the nice extras in the Plugin Manager Enhanced V2 is the (debug mode) Edit button that opens the plugin’s source file in a whatever editor is tied to .py extensions. This simplifies inspecting the code.

Also very nice feature is in Kari’s prototype Filter2 gramplets. They scrape all the settings in the Filter gramplet to build a custom filter.

Also, his experimental FilterParams tool makes inspection in the GUI easy. (Particularly since it isn’t like the Gramps Filter Editor that doesn’t let you switch the category silos for the filters.

0012830 Filter Rules are missing basic rules for inter object working

You missed this one. The whole idea behind filters appears to be “To obtain a list of People”.
But if you want to start with a list of people and end with a list of events or citations, then you start hitting obstacles very quickly.

I realise that having a filter rule for every occasion would result in a very long list in deed.

Thanks @GBaynes . Added it to the list.

Yes. Eventually, we’ll need some sort of codex/grimoire/formulary/Rulebook GUI for finding, instruction & sharing of Filter Rules.

Hopefully, there will be competing systems of organization.

Like the OCLC’s Query Collection, when the database grows too complex (they have 856 bibliographical fields describing WorldCat holdings) it becomes difficult to grok organizational potential.

I’m not a developer but as stated there is no limit to the number of filters that users may want. I think a longer term strategy might be to put the effort into moving gramps to a full sql based system, then users can develop any sql query they need.
The work could be divided up into chunks. As I understand it, a lot of work has been done defining the schema already.

You can already design any query you want with SuperTool and it lets you use the Gramps database pre-defined methods too.

The idea of listing the requested filters is so we might begin a discussion of how to do the requested filters without creating a glut of addon rules.

And so that some of these MantisBT requests can be closed with workaround. Although we might determine that some are foundation rules that actually DO need to be added.

Sorry, I forgot about the Super Tool. It isn’t loaded on my system so I have never used it. Out of sight out of mind. I’m a guy that just likes to go to the menu and find the tools that I can use.

2 Likes

I have tried the “Supertool” and failed to design the filter of my choice. Its lack of any instructions, hints or tips deters me and, no doubt, many others, from using it.

I’ve done an example of making a Filter with SuperTool:


Also, using the Filter+ replacements for the various Filter Gramplets can be used as a template. While the Define filter scrapes the parameters entered for the various fields… so exploring the new (as yet unnamed) Custom Filter also exposes the pertinent rules (and the combination of rules) needed to search for a particular item.

In the following request, a user wanted a rule to find Events with a precise date.

I ended up creating 3 rules:

  • find Events with precise date
  • find Events with approximated dates
  • find Events with no/blank/null dates

Before SuperTool:

sharing a new rule required creating an addon. A new addon meant figuring out how to code a “Rule” addon and its plugin registration file. When I experimented with that to build 3 Event date rules, that meant about 20 lines of code and 16 lines of registration per additional Rule. Then, it had to be submitted for approval in the Addon Manager distribution system.

Experimenting with SuperTool:

But each of my experimental filters only takes 3 lines in SuperTool. And one of those is multiline comment.

The hardest part was finding the feature that checks the Date object in the Gramps developer documentation in Sphinx. In this case, I was looking for functions related to the date object. The 2 functions that were relevant were is_regular() and is_empty()

“Menu → Save as a filter” in SuperTool makes a Custom Filter based on ‘generic rule’:

3 working fields also means just 3 fields using the SuperTool rule addon: Generic Rule.

Here’s the ‘generic rule’. In “Statements”, it sets a variable to be the Date object from the Event. Then in “Rule”, it checks if that Date object variable contains a ‘regular’ date. (A ‘regular’ date is a single exact date, i.e. not text-only, not a range or a span, not estimated/calculated, not a special calendar, not dual-dated, no special new year day, not about/before/after date. And by exact, it has a non-zero year, month, AND day.)

As a custom filter using the SuperTool Generic addon rule:

Here’s a custom_filters.xml (from the Gramps User Directory) that contains all 3 “Event” category filter rules:

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Event">
    <filter name="SuperTool_RegularDates" function="and">
      <rule class="GenericFilterRule_Event" use_regex="False">
        <arg value="dateobject.is_regular()"/>
        <arg value="#  Return &quot;True&quot; if the date is a regular date.&lt;br&gt;#  The regular date is a single exact date, i.e. not text-only, not a range or a span, &lt;br&gt;#    not estimated/calculated, not about/before/after date, and having  a year, &lt;br&gt;#    month, and day all non-zero.&lt;br&gt;# see   https://gramps-project.org/docs/gen/gen_lib.html#gramps.gen.lib.date.Date.is_regular"/>
        <arg value="dateobject=self.event.get_date_object()"/>
      </rule>
    </filter>
    <filter name="SuperTool_IrregularDates" function="and">
      <rule class="GenericFilterRule_Event" use_regex="False">
        <arg value="not (event.get_date_object().is_regular() or event.get_date_object().is_empty())"/>
        <arg value="# Return True if matches events having a irregular date but not a blank date)<br># see https://gramps-project.org/docs/gen/gen_lib.html#gramps.gen.lib.date.Date.is_regular"/>
        <arg value="dateobject=self.event.get_date_object()"/>
      </rule>
    </filter>
    <filter name="SuperTool_Blank_Dates" function="and">
      <rule class="GenericFilterRule_Event" use_regex="False">
        <arg value="event.get_date_object().is_empty()"/>
        <arg value="#  Return &quot;True&quot; if the date is a blank date."/>
        <arg value="dateobject=self.event.get_date_object()"/>
      </rule>
    </filter>
  </object>
</filters>
1 Like

I added them to my 5.2 install.

The irregular rule threw an error. In the second line there are two semicolons (;) together that it did not like. Made it a single semicolon and it ran just fine.

Is the irregular rule supposed to include the null date entries?

1 Like

Thanks @DaveSch , I just updated the previous posting to eliminate the error. (It had been a tweaked version that dropped the null tests. I needed to revert.)

1 Like