Skip to content

ump_intake.mapping

module ump-intake

Mapping suggestions (stage 2): each column to a shared name (date, KPI id, media id from the registry media tree, control, or ignore), with a confidence, the reason and alternatives.

function

def media_tree() -> list[dict[str, Any]]

Source: packages/ump-intake/src/ump_intake/mapping.py, line 44

function

def time_entries() -> list[dict[str, Any]]

The spec §4 time registry: {id, tz, week_start, grain, fiscal, valid} entries.

Source: packages/ump-intake/src/ump_intake/mapping.py, line 48

function

def time_entry(time_id: str | None = None) -> dict[str, Any]

One time registry entry (DEFAULT_TIME_ID when time_id is None); 422 SCHEMA_INVALID if unknown.

Source: packages/ump-intake/src/ump_intake/mapping.py, line 53

function

def convert_week_ending(
t: ParsedTable,
column: str,
time_id: str | None = None,
) -> tuple[ParsedTable, dict[str, Any]]

Spec §4: relabel a week-ending date column by the date each week starts (six days earlier), as a logged step. Returns a new table (the input is left as it was) and the step record. Unreadable dates are kept as they were and counted; a start date that is not the entry’s week_start weekday is converted anyway and labelled in the issues, so the caller sees the weeks do not line up with the registry.

Source: packages/ump-intake/src/ump_intake/mapping.py, line 62

function

def kpi_ids() -> list[str]

Source: packages/ump-intake/src/ump_intake/mapping.py, line 97

function

def slug(s: str) -> str

Source: packages/ump-intake/src/ump_intake/mapping.py, line 117

function

def channel_of(mid: str) -> str

The channel-level ancestor of a media id (a platform such as social.meta rolls up to social).

Source: packages/ump-intake/src/ump_intake/mapping.py, line 121

function

def suggest_column(name: str, values: list[Any], used_kpi: bool) -> dict[str, Any]

Source: packages/ump-intake/src/ump_intake/mapping.py, line 130

function

def suggest_mapping(t: ParsedTable) -> list[dict[str, Any]]

Source: packages/ump-intake/src/ump_intake/mapping.py, line 171

function

def preview(t: ParsedTable, n: int = 8) -> dict[str, Any]

Source: packages/ump-intake/src/ump_intake/mapping.py, line 182

NameTypeValueDescription
DATE_NAMES{'date', 'week', 'week_start', 'week start', 'period', 'weekstart', 'week_end...
WEEK_ENDING_NAMES{'week_ending', 'week ending', 'weekending', 'week end', 'week_end', 'we', 'w...Headers (after _norm) that label a weekly row by its last day (spec §4: convert to week start).
DEFAULT_TIME_ID'iso-week-mon'The time registry entry used when the caller names none (POC default, proposed).
CONTROL_HINTS('price', 'promo', 'holiday', 'temperature', 'temp', 'distribution', 'competi...
SPEND_TOKENS('spend', 'cost', 'investment', 'media', 'usd', '($)', '$', 'gross', 'net', '...
EXPOSURE_TOKENS('impressions', 'impr', 'grps', 'grp', 'trps', 'views', 'clicks', 'reach')
KPI_ALIASESdict[str, str]{'sales': 'revenue', 'revenue': 'revenue', 'gross revenue': 'revenue', 'gross...