pdstools.utils.pega_outcomes¶
Pega standard outcome domain knowledge.
Provides channel-aware defaults for outcome label resolution, based on Pega CDH standard outcomes documentation. Designed for use by any pdstools component that maps raw Pega outcome strings to business metrics.
The Impact Analyzer uses this for Impressions/Accepts per Channel/Direction. The IH class uses it for per-channel Engagement labels and direction-aware OpenRate applicability.
Attributes¶
Functions¶
|
Resolve explicit per-channel outcome label mappings from data. |
|
Return the unfiltered Pega standard outcome defaults for a channel. |
|
Return OpenRate outcome labels if applicable for this channel. |
Module Contents¶
- resolve_outcome_labels(channels_with_outcomes: dict[str, list[str]]) dict[str, dict[str, list[str]]]¶
Resolve explicit per-channel outcome label mappings from data.
For each channel, looks up Pega standard outcome defaults by matching the channel prefix (the part before ‘/’), then filters to only outcome values actually present in the data. Channels not in the defaults table fall back to the global digital-channel defaults.
- Parameters:
channels_with_outcomes (dict[str, list[str]]) – Mapping of channel (Channel/Direction format) to the distinct outcome strings present in the data for that channel.
- Returns:
Per-channel mapping of the form:
{ "Web/Inbound": {"Impressions": ["Impression"], "Accepts": ["Clicked"]}, "Call Center/Inbound": {"Impressions": ["Impression"], "Accepts": ["Accepted"]}, }
Only outcome values present in the data are included.
- Return type:
Examples
>>> resolve_outcome_labels({"Web/Inbound": ["Impression", "Clicked", "Rejected"]}) {'Web/Inbound': {'Impressions': ['Impression'], 'Accepts': ['Clicked']}}
>>> resolve_outcome_labels({"Call Center/Inbound": ["Impression", "Accepted"]}) {'Call Center/Inbound': {'Impressions': ['Impression'], 'Accepts': ['Accepted']}}
- get_channel_defaults(channel: str) dict[str, list[str]]¶
Return the unfiltered Pega standard outcome defaults for a channel.
Looks up the channel prefix (part before ‘/’) in the defaults table. Returns all candidate outcome values regardless of what is in the data.