decentriq_platform.media
Sub-modules
- decentriq_platform.media.audience_statistics_result
- decentriq_platform.media.audiences
- decentriq_platform.media.compute_job
- decentriq_platform.media.lookalike_audience_builder
- decentriq_platform.media.media
- decentriq_platform.media.participant
- decentriq_platform.media.remarketing_audience_builder
- decentriq_platform.media.rule_based_builder
- decentriq_platform.media.validation_reports
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 audiencessource_audience
: The source audience to combinefilters
: 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 applyoperator
: 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
Audiences
Audiences(
audiences: List[Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience]],
)
Class for managing and accessing different types of audiences.
Initialize an Audiences instance.
Parameters:
audiences
: List of audience objects to manage
get_custom_audience
def get_custom_audience(
self,
name: str,
) ‑> decentriq_platform.media.api.CustomAudience
Get a custom audience by name.
Parameters:
name
: Name of the custom audience to retrieve
Returns:
- Custom audience with the given name
Raises:
Exception
: If no custom audience is found or multiple custom audiences found with the given name
get_seed_audience
def get_seed_audience(
self,
audience_type: str,
) ‑> decentriq_platform.media.api.SeedAudience
Get a seed audience by type.
Parameters:
audience_type
: Type of the seed audience to retrieve
Returns:
- Seed audience with the given type
Raises:
Exception
: If no seed audience is found with the given type or multiple seed audiences found with the given type
is_lookalike_audience
def is_lookalike_audience(
audience: Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience],
) ‑> bool
Check if an audience is a lookalike audience.
Parameters:
audience
: The audience to check
Returns:
- True if the audience is a lookalike audience, False otherwise
Raises:
Exception
: If the audience type is not supported
list
def list(
self,
) ‑> List[Union[decentriq_platform.media.api.SeedAudience, decentriq_platform.media.api.CustomAudience]]
List all audiences.
Returns:
- List of all audiences
CollaborationType
CollaborationType(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)
Represents the features supported by a DCR.
Members:
- INSIGHTS
- LOOKALIKE
- REMARKETING
- RULE_BASED
Ancestors (in MRO)
- builtins.str
- enum.Enum
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
CreateLookalikeAudienceAction
CreateLookalikeAudienceAction(
dcr_id: str,
client: decentriq_platform.client.Client,
definition: decentriq_platform.media.lookalike_audience_builder.LookalikeAudienceDefinition,
)
Initialize a CreateLookalikeAudienceAction instance.
Parameters:
dcr_id
: The identifier for the DCRclient
: The client instance for API communicationdefinition
: The definition of the lookalike audience to create
Ancestors (in MRO)
- decentriq_platform.media.action.Action
create
def create(
self,
) ‑> Union[Dict[str, Union[Dict[str, JSONType], List[JSONType], str, int, float, bool, ForwardRef(None)]], List[Union[Dict[str, JSONType], List[JSONType], str, int, float, bool, ForwardRef(None)]], str, int, float, bool, ForwardRef(None)]
Create the lookalike audience.
Returns:
- The response from creating the lookalike audience
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 onvalues
: The values to filter onoperator
: 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
LalAudienceStatistics
LalAudienceStatistics(
auc: float,
fpr: List[float],
tpr: List[float],
)
Class representing the statistics of a given lookalike audience.
Initialize an instance of LalAudienceStatistics.
Parameters:
auc
: The area under the ROC curvefpr
: The list of false positive rates (in order of decreasing discrimination threshold)tpr
: The list of true positive rates (in order of decreasing discrimination threshold)
Static methods
from_dict
def from_dict(
d: Dict[str, Any],
) ‑> typing_extensions.Self
Create an instance from a dictionary.
Parameters:
d
: Dictionary containing the statistics data
Returns:
- New LalAudienceStatistics instance
model_dump
def model_dump(
self,
) ‑> Dict[str, Any]
Convert the instance to a dictionary following pydantic model_dump convention.
Returns:
- Dictionary representation of the statistics
model_dump_json
def model_dump_json(
self,
indent: int = None,
) ‑> str
Convert the instance to a JSON string following pydantic model_dump_json convention.
Parameters:
indent
: Number of spaces for indentation in the JSON output
Returns:
- JSON string representation of the statistics
LookalikeAudienceBuilder
LookalikeAudienceBuilder(
*,
name: str,
reach: int,
source_audience: AudienceType,
)
Builder for constructing lookalike audience definitions.
Initialise the lookalike audience builder.
Parameters:
name
: Name of the lookalike audience.reach
: The desired reach of the lookalike audience expressed as a percentage between 1-30.source_audience_name
: Name of the source audience that the lookalike audience will be built from.
build
def build(
self,
) ‑> decentriq_platform.media.lookalike_audience_builder.LookalikeAudienceDefinition
Build the lookalike audience definition.
Returns:
- The lookalike audience definition
with_exclude_seed_audience
def with_exclude_seed_audience(
self,
) ‑> typing_extensions.Self
Exclude the seed audience from the lookalike audience.
Returns:
- The updated lookalike audience builder
with_share_with_participants
def with_share_with_participants(
self,
participants: List[Participant],
) ‑> typing_extensions.Self
Make the lookalike audience available to the given participants.
Parameters:
participants
: The participants to share the lookalike audience with
Returns:
- The updated lookalike audience builder
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
MatchingId
MatchingId(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)
The type of Matching ID to use.
Members:
- STRING
- EMAIL
- HASHED_EMAIL
- PHONE_NUMBER
- HASHED_PHONE_NUMBER
Ancestors (in MRO)
- builtins.str
- enum.Enum
MediaDcr
MediaDcr(
client: Client,
*,
name: Optional[str] = None,
participants: Optional[List[Participant]] = None,
collaboration_types: Optional[List[CollaborationType]] = None,
matching_ids: Optional[List[MatchingId]] = None,
hide_absolute_values: bool = False,
)
Class for managing Media Data Clean Room (DCR) operations.
Initialize a MediaDCR instance.
Can be used either to create a new DCR (when dcr_id is None) or load an existing one.
Parameters:
client
: The client instance for API communicationname
: Name for new DCRparticipants
: Participants for new DCRcollaboration_types
: Collaboration types for new DCRmatching_ids
: Matching IDs for new DCRhide_absolute_values
: Whether to hide absolute values from outputs_existing_dcr_id
: Optional ID of existing DCR to load (for internal use only)
Static methods
from_existing
def from_existing(
dcr_id: str,
client: Client,
) ‑> Self
Construct a MediaDCR from an existing DCR with the given ID.
Parameters:
dcr_id
: The id of the DCRclient
: The client from which a session is created
Returns:
- The MediaDCR instance
are_seed_audiences_provisioned
def are_seed_audiences_provisioned(
self,
) ‑> bool
Check if the seed audiences are provisioned.
can_other_participants_export_audience
def can_other_participants_export_audience(
self,
) ‑> bool
Check if other participants can export audiences.
create_lookalike_audience
def create_lookalike_audience(
self,
definition: LookalikeAudienceDefinition,
) ‑> decentriq_platform.media.api.CustomAudience
Create a lookalike audience based on the provided definition.
Parameters:
definition
: Definition of the lookalike audience to create
Returns:
- The created lookalike audience
create_remarketing_audience
def create_remarketing_audience(
self,
definition: RemarketingAudienceDefinition,
) ‑> decentriq_platform.media.api.CustomAudience
Create a remarketing audience based on the provided definition.
Parameters:
definition
: Definition of the remarketing audience to create
Returns:
- The created remarketing audience
create_rule_based_audience
def create_rule_based_audience(
self,
definition: RuleBasedAudienceDefinition,
) ‑> decentriq_platform.media.api.CustomAudience
Create a rule-based audience based on the provided definition.
Parameters:
definition
: Definition of the rule-based audience to create
Returns:
- The created rule-based audience
delete_audiences
def delete_audiences(
self,
audiences: List[CustomAudience],
*,
delete_dependent_audiences: bool = False,
) ‑> None
Delete audiences.
Parameters:
audiences
: The audiences to deletedelete_dependent_audiences
: If true, the supplied audiences and all dependent audiences will be deleted. If false, the supplied audiences will only be deleted if they have no dependents.
deprovision_base_audience
def deprovision_base_audience(
self,
) ‑> None
Deprovision a base audience from the DCR.
Removes all datasets associated with the base audience from the DCR by deprovisioning each dataset type.
deprovision_seed_audiences
def deprovision_seed_audiences(
self,
) ‑> None
Deprovision seed audiences dataset from the DCR.
get_audience_size
def get_audience_size(
self,
audience: Union[SeedAudience, CustomAudience],
) ‑> decentriq_platform.media.compute_job.MediaEstimateAudienceSizeJob
Get the size of an audience.
Parameters:
audience
: The audience to estimate the size of
Returns:
- The job to get the size of the audience
get_audience_user_list
def get_audience_user_list(
self,
audience: Union[SeedAudience, CustomAudience],
) ‑> decentriq_platform.media.compute_job.MediaAudienceUserListJob
Get the user list for an audience.
Parameters:
audience
: The audience to get the user list for
Returns:
- The job to get the user list for the audience
get_audiences
def get_audiences(
self,
) ‑> decentriq_platform.media.compute_job.MediaGetAudiencesJob
Get audiences for a specific user.
Returns:
- The job to get the audiences for the specified user
get_audit_log
def get_audit_log(
self,
) ‑> List[decentriq_platform.archv2.client.DataRoomAuditLog]
Get the audit log for the data room.
Returns:
- Audit log
get_base_audience_validation_reports
def get_base_audience_validation_reports(
self,
) ‑> decentriq_platform.media.compute_job.MediaBaseAudienceValidationReportsJob
Get the validation reports for the DCR.
Returns:
- The job to compute the validation reports
get_configuration
def get_configuration(
self,
) ‑> decentriq_platform.media.media.DcrConfiguration
Get the configuration of the DCR.
Returns:
- The configuration of the DCR
get_data_attributes
def get_data_attributes(
self,
) ‑> decentriq_platform.media.compute_job.MediaDataAttributesJob
Get data attributes.
Returns:
- The job to get the data attributes
get_insights
def get_insights(
self,
) ‑> decentriq_platform.media.compute_job.MediaInsightsJob
Compute insights from the data room.
Returns:
- The job to compute insights
get_lookalike_audience_statistics
def get_lookalike_audience_statistics(
self,
audience: AudienceType,
) ‑> decentriq_platform.media.compute_job.MediaLookalikeAudienceStatisticsJob
Get statistics for lookalike audiences.
Returns:
- The job to get the lookalike audience statistics
get_overlap_statistics
def get_overlap_statistics(
self,
) ‑> decentriq_platform.media.compute_job.MediaOverlapStatisticsJob
Compute overlap statistics.
Returns:
- The job to compute the overlap statistics
get_owner_email
def get_owner_email(
self,
) ‑> str
Get the email of the owner of the DCR.
get_participants
def get_participants(
self,
) ‑> List[decentriq_platform.media.participant.Participant]
Get the participants of the DCR.
Returns:
- The list of participants in the DCR
get_seed_audiences_validation_report
def get_seed_audiences_validation_report(
self,
) ‑> decentriq_platform.media.compute_job.MediaAudiencesValidationReportJob
Get the validation report for seed audiences data.
Returns:
- The job to compute the seed audiences validation report
is_base_audience_provisioned
def is_base_audience_provisioned(
self,
) ‑> bool
Check if the base audience is provisioned.
provision_base_audience
def provision_base_audience(
self,
data_lab_id: str,
) ‑> None
Provision a base audience to the DCR.
Parameters:
data_lab_id
: The identifier of the DataLab from which to provision the base audience
Raises:
Exception
: If the DataLab is not validated or if provisioning fails
provision_seed_audiences
def provision_seed_audiences(
self,
manifest_hash: str,
) ‑> None
Provision seed audiences dataset to the DCR.
Parameters:
manifest_hash
: Hash of the seed audience dataset to provision
share_audiences
def share_audiences(
self,
audiences: List[CustomAudience],
participants: List[Participant],
)
Share the audiences with the participant group.
Parameters:
audiences
: The audiences to shareparticipants
: The participants to share the audiences with
Participant
Participant(
emails: List[str],
permissions: List[decentriq_dcr_compiler._schemas.create_media_dcr.Permission],
role: str,
id: Optional[str] = None,
organization_id: Optional[str] = None,
)
A participant in a Data Clean Room.
Initialize a participant.
Parameters:
emails
: The emails of the participantpermissions
: The permissions of the participantrole
: The role of the participantid
: The id of the participantorganization_id
: The organization id of the participant
as_dict
def as_dict(
self,
) ‑> Dict[str, Any]
Return the participant as a dictionary.
Returns:
- The participant as a dictionary
can_export_audience
def can_export_audience(
self,
) ‑> bool
Check if the participant has the export audience permission.
Returns:
- True if the participant has the export audience permission, False otherwise
Permission
Permission(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
)
An enumeration.
Ancestors (in MRO)
- enum.Enum
RemarketingAudienceBuilder
RemarketingAudienceBuilder(
*,
name: str,
source_audience_type: str,
)
Builder for constructing remarketing audience definitions.
Initialise the remarketing audience builder.
Parameters:
name
: Name of the remarketing audience.source_audience_type
: The audience type of the seed audience that the remarketing audience will be built from.
build
def build(
self,
) ‑> decentriq_platform.media.remarketing_audience_builder.RemarketingAudienceDefinition
Build the remarketing audience definition.
Returns:
- The remarketing audience definition
with_share_with_participants
def with_share_with_participants(
self,
participants: List[Participant],
) ‑> typing_extensions.Self
Make the remarketing audience available to the given participants.
Parameters:
participants
: The participants to share the remarketing audience with
Returns:
- The updated remarketing audience builder
RemarketingAudienceDefinition
RemarketingAudienceDefinition(
*,
name: str,
source_audience_type: str,
shared_with: List[Participant],
)
Class representing the definition of a remarketing audience.
Initialize a remarketing audience definition.
Parameters:
name
: Name of the remarketing audiencesource_audience_type
: The audience type of the seed audience to build fromshared_with
: List of participant groups to share with
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 audiencesource_audience
: The source audience to build fromfilters
: Optional filters to apply to the audiencecombinators
: Optional combinators for combining multiple audiencesshared_with
: Optional list of participant groups to share with
ValidationReports
ValidationReports(
matching: decentriq_platform.media.api.ValidationReport,
segments: decentriq_platform.media.api.ValidationReport,
demographics: decentriq_platform.media.api.ValidationReport,
)
A class to represent the validation reports for a DCR.
Initialize a ValidationReports instance.
Parameters:
matching
: The matching validation reportsegments
: The segments validation reportdemographics
: The demographics validation report
model_dump_json
def model_dump_json(
self,
)
Return a JSON string representation of the validation reports.