What Should We Recommend Tonight

A hard Pipeline Design interview practice problem on DataDriven. Design the pipeline on the canvas: sources, transforms, storage and checks, then get feedback on it.

Domain
Pipeline Design
Difficulty
hard
Seniority
L6

Problem

Orders and menu updates live in separate operational systems that are never joined, yet the recommendations team needs a feature store it can query in real time. At our meal kit service, those systems hold customer order history and the full menu catalog with nutritional and ingredient data. Design the ingestion and feature pipeline.

They ordered pad thai twice. That means something.

Business requirements

Worked solution and explanation

What this really is

This is a dual-store feature platform with a food-safety clock bolted on. Anyone can draw orders and menu flowing into one table the model reads. The real test is seeing that one store cannot serve two masters: checkout needs today's value in tens of milliseconds, and training needs the value as it was on each order's date. Collapse them into a nightly join and three things break together. An allergen added at noon keeps being recommended to allergic customers until tomorrow. Training joins today's menu onto last year's orders and learns the future. Checkout waits on a warehouse query.

Walk the requirements

Step 1: Precompute for checkout

Customer and item features live in online_feature_store, keyed for point lookups. The service fetches them, the model scores, and the page renders inside its budget. Computing features at request time is the design where checkout hangs at dinner rush.

Step 2: Stream the menu, because allergens are a safety clock

menu_stream tails menu CDC and upserts the item row in the online store within a minute. The same event lands in offline_feature_store with its effective date. A nightly refresh here is not a freshness tradeoff; it is an unsafe-recommendation window.

Step 3: Join training rows as of the order date

Training reads each historical order against the menu state on order_date, not the latest row. That only works if the offline store kept every version, which is why the stream appends history there instead of overwriting.

Step 4: Read features once per request

recommendation_service fetches the user's features once and hands the same values to whichever variant scores. Two variants with two reads, or two caches, means the experiment measures cache timing as well as the model.

Both CDC streams write the online store for checkout and the offline store for point-in-time training; allergen changes reach serving in under a minute.
  • orders_oltp (source, CDC)
  • menu_oltp (source, CDC)
  • order_stream (transform, Flink)
  • menu_stream (transform, Flink); freshness: real-time
  • online_feature_store (storage, Redis)
  • offline_feature_store (storage, Delta Lake)
  • recommendation_service (transform, SQL)
  • training_job (consumer, Jupyter)
  • checkout_app (consumer, API)
  • orders_oltp -> order_stream
  • menu_oltp -> menu_stream
  • order_stream -> online_feature_store
  • order_stream -> offline_feature_store
  • menu_stream -> online_feature_store
  • menu_stream -> offline_feature_store
  • online_feature_store -> recommendation_service
  • recommendation_service -> checkout_app
  • offline_feature_store -> training_job
  • Sources + streams: orders_oltp, menu_oltp, order_stream, menu_stream
  • Stores: online_feature_store, offline_feature_store
  • Serving + training: recommendation_service, checkout_app, training_job
One nightly table
Checkout queries the warehouse. A noon allergen change waits for tomorrow's run. Training joins the current menu onto old orders, so offline metrics beat production.
Online plus offline store
Checkout hits online_feature_store in milliseconds. menu_stream pushes allergens in under a minute. training_job reads offline_feature_store as of each order_date.

Common follow-up questions