Store timestamps in UTC and keep the local calendar that business features need. Define the unique
snapshot key. Use customer IDs as join keys, and as features only for a deliberate reason. For
each snapshot at as_of, record the feature lookback, latest allowed availability time, label
window, label completion time and training cutoff.
For fixed-horizon targets, require label_available_at <= training_cutoff and verified outcome
coverage through label_end at fitting time. Apply any documented reporting allowance too. A
passed calendar horizon is not enough when the outcome feed is late or missing.
For survival targets, keep the event indicator and observed event or censoring time instead. Use only records available at the training cutoff and a verified observation limit. Partial follow-up can stay under the censoring assumptions, but an unfinished horizon is not a negative fixed-horizon label. Document the supported evaluation horizons and the censoring/reference-sample protocol.
An example historical aggregation, assuming available_at is when an event became usable and each
event has an immutable ID:
SELECT s.customer_id, s.as_of,
COUNT(e.event_id) AS purchases_30d,
COALESCE(SUM(e.net_contribution), 0) AS contribution_30d
FROM snapshots AS s
LEFT JOIN purchase_events AS e
ON e.customer_id = s.customer_id
AND e.event_time >= s.as_of - INTERVAL '30 days'
AND e.event_time < s.as_of
AND e.available_at <= s.as_of
GROUP BY s.customer_id, s.as_of;This is a query pattern, not a complete feature system. Deduplicate upstream and check timezone types and join cardinality. Version corrections instead of overwriting history with today's values. A margin finalised later needs its own availability and version record. Use the same definitions for replay and serving. Retrieval tools still leave you to check what “available” means (Feast point-in-time joins).
For experiments, keep eligible opportunities even when no action was delivered. Keep assignment, delivery and outcome in separate tables. Assignment defines the main analysis group, and delivery explains implementation failures. Report the main result on everyone assigned, not only redeemers, buyers, contacted responders or other groups selected after treatment.