To Daily States

Convert the eventstream into daily lifecycle-state events.

Each path is expanded to one row per calendar day from its first event to max_dormant_days days after its last event. Every row is labelled with one of six engagement states.

Active days: new — first-ever active day for this path current — active within the past 7 days reactivated — active 8-30 days ago, not in the last 7 resurrected — last active more than 30 days ago

Inactive days: at_risk_wau — was active within the past 7 days at_risk_mau — was active 8-30 days ago dormant — was last active more than 30 days ago

Usage

    stream.to_daily_states()
    stream.to_daily_states(active_events=["purchase", "add_to_cart"], max_dormant_days=60)

As a preprocessor in MCP update_base_stream / local_preprocessors:
    {"type": "to_daily_states"}
    {"type": "to_daily_states", "active_events": ["purchase"], "max_dormant_days": 60}

Parameters

ParameterTypeDescription
active_eventslist of str, optionalEvents that count as "activity". If omitted, any event counts.
max_dormant_daysint, default 30Days after last event to continue generating state rows.
aggdict, optionalPer-column aggregation overrides (e.g. {"revenue": "sum"}).
path_colstr, optionalOverride the path ID column.
event_colstr, optionalOverride the event column.