Skip to main content

decentriq_platform.media.rule_based_builder

Classes

AudienceCombinator

AudienceCombinator(
*,
operator: decentriq_platform.media.rule_based_builder.CombineOperator,
source_audience: Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience],
filters: Optional[decentriq_platform.media.rule_based_builder.AudienceFilters] = None,
)

Initialize an AudienceCombinator instance.

Parameters:

  • operator: The operator used to combine audiences
  • source_audience: The source audience to combine
  • filters: Optional filters to apply to the source audience

as_dict

def as_dict(
self,
)> Dict[str, Any]

Convert the audience combinator to a dictionary.

Returns:

  • The dictionary representation of the audience combinator

AudienceCombinatorBuilder

AudienceCombinatorBuilder(
*,
operator: decentriq_platform.media.rule_based_builder.CombineOperator,
source_audience: Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience],
)

Builder for constructing an AudienceCombinator.

Initialise the audience combinator builder.

Parameters:

  • operator: The operator used to combine audiences.
  • source_audience: The source audience to combine with.

build

def build(
self,
)> decentriq_platform.media.rule_based_builder.AudienceCombinator

Build the audience combinator.

Returns:

  • The audience combinator

with_filters

def with_filters(
self,
filters: decentriq_platform.media.rule_based_builder.AudienceFilters,
)> typing_extensions.Self

Set the filters to be applied to the source audience.

Parameters:

  • filters: Filters to be applied to the source audience.

Returns:

  • The updated audience combinator builder

AudienceFilters

AudienceFilters(
*,
filters: List[decentriq_platform.media.rule_based_builder.Filter],
operator: decentriq_platform.media.rule_based_builder.MatchOperator,
)

Class representing the filters for an audience.

Initialize an AudienceFilters instance.

Parameters:

  • filters: The list of filters to apply
  • operator: The operator to use for the filters

as_dict

def as_dict(
self,
)> Dict[str, Any]

Convert the filters to a dictionary.

Returns:

  • The dictionary representation of the filters

CombineOperator

CombineOperator(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)

Enum representing the operations for combining audiences.

Members:

- INTERSECT: Users in both audiences.
- UNION: All users.
- DIFF: Users in first audience only.

Ancestors (in MRO)

  • builtins.str
  • enum.Enum

Filter

Filter(
*,
attribute: str,
values: List[str],
operator: decentriq_platform.media.rule_based_builder.FilterOperator,
)

Class representing a filter.

Initialize a filter.

Parameters:

  • attribute: The attribute to filter on
  • values: The values to filter on
  • operator: The operator to use for the filter

as_dict

def as_dict(
self,
)> Dict[str, Any]

Convert the filter to a dictionary.

Returns:

  • The dictionary representation of the filter

FilterOperator

FilterOperator(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)

Enum representing the filter operations.

Members:

- CONTAINS_ANY: At least one of the values must be present.
- CONTAINS_NONE: None of the values can be present.
- CONTAINS_ALL: All of the values must be present.
- EMPTY: The attribute must be empty.
- NOT_EMPTY: The attribute must not be empty.

Ancestors (in MRO)

  • builtins.str
  • enum.Enum

MatchOperator

MatchOperator(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)

Enum representing the match operations.

Members:

- MATCH_ALL: All filter criteria must be satisfied.
- MATCH_ANY: Any filter criteria may be satisfied.

Ancestors (in MRO)

  • builtins.str
  • enum.Enum

RuleBasedAudienceBuilder

RuleBasedAudienceBuilder(
*,
name: str,
source_audience: Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience],
)

Builder for constructing rule-based audience definitions.

Initialise the rule-based audience builder.

Parameters:

  • name: Name of the rule-based audience.
  • source_audience: The source audience that the rule-based audience will be built from.

build

def build(
self,
)> decentriq_platform.media.rule_based_builder.RuleBasedAudienceDefinition

Build the rule-based audience definition.

Returns:

  • The rule-based audience definition

with_combinator

def with_combinator(
self,
combinators: List[decentriq_platform.media.rule_based_builder.AudienceCombinator],
)> typing_extensions.Self

Set the combinators to be applied to the audiences. This defines how multiple audiences can be combined.

Parameters:

  • combinators: The list of combinators used to combine audiences.

Returns:

  • The updated rule-based audience builder

with_filters

def with_filters(
self,
filters: decentriq_platform.media.rule_based_builder.AudienceFilters,
)> typing_extensions.Self

Set the filters to be applied to the source audience.

Parameters:

  • filters: Filters to be applied to the source audience.

Returns:

  • The updated rule-based audience builder

with_share_with_participants

def with_share_with_participants(
self,
participants: List[decentriq_platform.media.participant.Participant],
)> typing_extensions.Self

Make the rule-based audience available to the given participants.

Parameters:

  • participants: The participants to share the rule-based audience with

Returns:

  • The updated rule-based audience builder

RuleBasedAudienceDefinition

RuleBasedAudienceDefinition(
*,
name: str,
source_audience: Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience],
filters: Optional[decentriq_platform.media.rule_based_builder.AudienceFilters] = None,
combinators: Optional[List[decentriq_platform.media.rule_based_builder.AudienceCombinator]] = None,
shared_with: Optional[List[decentriq_platform.media.participant.Participant]] = None,
)

Class representing the definition of a rule-based audience.

Initialize a rule-based audience definition.

Parameters:

  • name: Name of the rule-based audience
  • source_audience: The source audience to build from
  • filters: Optional filters to apply to the audience
  • combinators: Optional combinators for combining multiple audiences
  • shared_with: Optional list of participant groups to share with