Smartgroup criteria are stored using the SavedSearch api. Use the API explorer (
/civicrm/api#explorer) and select entity:
In each of the
values returned, there is a
form_values key with a list of components that define the search. The list varies depending on how the search was created.
If you look at one created from an include/exclude search, then it contains components like:
Without checking the details of each of those parameters, it's very likely that group_id 4 is involved in this query.
Likewise for an example created from Advanced Search:
So group_id 5 is involved in this.
A smart group is linked to a SavedSearch by the
saved_search_id attribute - in API Explorer, set entity to
Group, action to
get and look for
If you just want to understand which groups depend on others, then visual inspection of the
SavedSearch.get output might be enough.
Expanding this into an extension to show those dependencies would be nice, but tricky since the components of the
form_values list depends on how the search was created. You would need to experiment with the various ways of creating smart groups to identify all the syntaxes that relate to groups but even then, custom searches define their own definitions (as include/exclude does), so it would be easy to miss some giving incomplete results. In other words, it would be easier to say "This group does depend on this other group" rather then "This group does not depend on this other group".