I really need a Citations filter which gives the Citations belonging to a Subset of people

(Please include your Gramps version and Operating System)
Gramps v5.1.5
OS: Linux
Desktop: Cinnamon 5.4.12 tk: GTK 3.24.24 wm: Mutter dm: LightDM Distro: LMDE 5 Elsie base: Debian 11.2 bullseye

Citations of people matching the

we currently have
Active Person
Descendants of
I need the next step to give the Citations of those people.

Can anyone help ?

If you filter on those people in the People category view, then you can use the Citations gramplet to view their citations.

Sorry George, that is no good. I need it to feed a Report.

Are those ALL the citations you want to find?

Donā€™t you also want the Citations for :

  • any Primary Role Event under those people
  • any non-primary Role Event under those people
  • any secondary object under those people
  • any Family where any of those people are a spouse
  • any secondary object under those Spousal Families
  • any Family where any of those people are a child
  • any secondary object under those Offspring Families

I think you are right, I need the events of the people first. Plus the events of the Families where those people are in the Primary Role.
Then the citations of all those events. Parents and children would be included in the original People list if required.
Iā€™m trying to get to the list of Citations as given in the Detailed Descendant Report.

If you are looking at this from a coding point of view, the export module might be the best example of what data to gather.

For the Selected set of people, it exports EVERYTHING related to those people, including secondary objects and the Family containers where they were a member. (Although it correctly omits the spouses, parents, siblings and offspring if those people were not part of the filter.)

You just need the subset of Citations and Sources within the tree cutting that the Export grabs. (I had not considered the Place and Enclosing Place citations in my previous posting. Or the Repositories. But this would include those too.)

Iā€™ve wrote a SuperTool script which find events with a specific role in persons or families records (STF_participant_role). But Iā€™m not sure it cover all types @emyoulation enumerates.

@kku if itā€™s easy to call a Citation filter from SuperTool running in Citations, do you think it is possible from SuperTool running in Citations to call an Event filter to obtain citations from events it finds? Some kind of filter proxy.

If itā€™s possible it could be easy to call my first filter from a Citations SuperTool filter to find Citations used in events with a specific role in persons or families records.

The export builds a comprehensive set of objects & recursive secondary objects for a filter of persons.

Maybe there could be a generalized filter that gathers that leverages the code already done for export and delivers just the active categoryā€™s objects from that subset?

Did an experiment with @cdhorn 's Relationships category CardView and discovered its citations panel doesnā€™t delve as deeply as Iā€™d anticipated.

@PLegoux, I hope I understood correctly. This was not possible until now - but now SuperTool is updated to support accessing custom filters from another namespace. The syntax is like

f1 = filter(ā€œevent-filternameā€, namespace=ā€œEventā€)

This change is in SuperTool version 1.2.5.

Thanks for the suggestion.

2 Likes

Active Person
Descendants of

Iā€™ve found the next step

Events of persons matching the filter with option to include Family events
That will give me all Person and Family events for a subset of Persons.

I suspect that the Isotammi Supertool is the way to go but I have just downloaded it and shall have to learn how to use it.

Thanks to everyone who answered my call.

Hi @kku
I have been able to get a filter in another namespace to work, but I cannot get it to work when that filter calls another filter. Is it me or is this a problem.?

Now I really need a concrete example :grin:

1 Like

You could post the SuperTool script here along with the custom_filters.xml file from your Gramps User Directory. (Use the ā€˜codeā€™ markup control. (An example capture and filter below. @kku these are NOT examples of his issue. They are examples of what kind of data would be provided.)

Or if youā€™ve installed his experimental FilterParams addon, you could post a visualization of how one filter calls the other(s):

in comparison to the custom_filters.xml raw XML:

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="Some Event in place x" function="and" comment="People filter : who has the events">
      <rule class="MatchesEventFilter" use_regex="False">
        <arg value="Event in place x"/>
      </rule>
    </filter>
  </object>
  <object type="Event">
    <filter name="Event in place x" function="and" comment="Event filter : occurred in a place">
      <rule class="MatchesPlaceFilter" use_regex="False">
        <arg value="In place X"/>
      </rule>
    </filter>
  </object>
  <object type="Place">
    <filter name="In place X" function="and" comment="Place filter : enclosed by a place">
      <rule class="IsEnclosedBy" use_regex="False">
        <arg value="P0003"/>
        <arg value="1"/>
      </rule>
    </filter>
  </object>
</filters>

My Script is as follows

[Gramps SuperTool script file]
version=1

[title]
SuperTool-CitationsforActivePersonDesc

[category]
Citations

[initial_statements]
# takes Event filter eventsofactivedescent as its input and outputs a list of Citations used in those Events
# George Baynes
events_list = filter("eventsofactivedescent", namespace = "Event")

[statements]

[filter]

[expressions]
citation

[scope]
filtered

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False

and my custom_filters.xml is here - only the relevant bits (I hope)

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="ActivePerson" function="and">
      <rule class="IsActivePerson" use_regex="False">
      </rule>
    </filter>
    <filter name="activepersondescendants" function="and">
      <rule class="IsDescendantFamilyOfFilterMatch" use_regex="False">
        <arg value="ActivePerson"/>
      </rule>
    </filter>
  </object>
  <object type="Event">
    <filter name="eventsofactivedescent" function="and">
      <rule class="MatchesPersonFilter" use_regex="False">
        <arg value="activepersondescendants"/>
        <arg value="1"/>
      </rule>
    </filter>
  </object>
</filters>

Iā€™m still trying to get it to work in display mode but I just get the full set of Citations. The Events filter works in Gramps. And Iā€™ve tried using a simple Events filter with Supertool and that works fine.
Thanks for your time.

So it is running from the SuperTool Citations namespace, calling a filter in the Events namespace that calls 2 stage filter in the Person namespace?

1 Like

Iā€™m guessing that ST is running the filter itself rather than letting Gramps do it.
Like I said, Iā€™m guessing.

Iā€™ve always run the filter in the Filter Gramplet of the Category view. Then applied the SuperTool script on the ā€œFiltered Objectsā€. But since youā€™re using this to mock up finding the Citation List for to add to a Report, you wonā€™t have that SuperTool shell simplifying things.

a try:

  • 4 persons in Persons bookmarks
  • Persons filter: persons in bookmarks (4)
  • Events filter: events of Persons filter (212)
  • Citations SuperTool filter : Citations matching citations in events from Events filter results (240)
  • print source title and citation page of found citations

[Gramps SuperTool script file]
version=1

[title]
SuperTool-Citations - Citations matching citations in events from Events filter results

[category]
Citations

[initial_statements]
sel_events = filter("90. Individus(Signets).EvFamiliaux(Inclus) - 046p", namespace="Event")

[statements]
found = False
for c in citators:
	if type(c).__name__ == "EventProxy":
		if sel_events(c):
			found = True
			break

[filter]
found

[expressions]
source.title, page

[scope]
all

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False


Another try to match initial question:

  • Person filter: Descendants of my grand-father
  • Citations SuperTool filter : Citations matching citations in Person filter results

Script V2 (Iā€™ve made some changes to make it working with every filters where citations exist):

[Gramps SuperTool script file]
version=1

[title]
SuperTool-Citations - Citations matching citations in another namespace filter results

[category]
Citations

[initial_statements]
filter_ns = "Person" # Valid values: Person, Event, ...
filter_name = "Descendants d'AndrƩ Legoux" # Any filter name defined in previous namespace

ns_proxy = filter_ns + "Proxy"
ns_with_citations = ["Person", "Event", "Place", "Media", "Family"]
authorized = True if filter_ns in ns_with_citations else False
if authorized:
    try:
        sel_objects = filter(filter_name, namespace=filter_ns)
    except:
        authorized = False

[statements]
found = False
if authorized and filter_ns != namespace:
    for c in citators:
        if type(c).__name__ == ns_proxy:
            if sel_objects(c):
                found = True
                break

[filter]
found

[expressions]
source.title, page

[scope]
all

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False

PS: @kku Could you make namespace property available in Initial statements? If so it could be possible to test it there (In my case I could set my authorized variable to false there without need to test it every time in Statements)