Data Lifecycle — Example: Coffee Shop Ordering

The Scenario

A customer orders coffee from a mobile app. They browse the menu, customize a drink, pay, and receive their drink at the store. The barista sees the order on a screen. The customer gets a push notification when the drink is ready.

This seems simple. Let's map it and see how much data is actually involved.


Step 1: Identify All the Data

Obvious data:

  • The customer's drink selection (item, size, modifications)
  • The customer's payment information
  • The store's menu
  • The order itself
  • The receipt

Less obvious data:

  • The store's current inventory (do they have oat milk today?)
  • Store hours and availability (is the store even open?)
  • The customer's account info (name, payment methods on file, order history)
  • Order status (placed → paid → in progress → ready → picked up)
  • Timestamps (when was the order placed? when was it ready?)
  • The queue position (how many orders are ahead of this one?)
  • Estimated wait time
  • Push notification delivery status (did the notification reach the phone?)

That's at least 13 pieces of data for a single coffee order. Most people would have named 3 or 4.


Step 2: Full Lifecycle Map

#StageWhat HappensCategoryData Involved
1Customer opens appApp loads menu from serverTransport (server → app)Menu, store hours, inventory flags
2Menu displayedMenu data held in app memoryStorage (temporary)Menu items, prices, available mods
3Customer browsesSelection exists in app memory as they tapStorage (temporary)Selected item, size, mods
4Customer taps "Add to Cart"Selection formatted into cart itemTransformSelection → structured cart item
5Cart displayedCart data held in app memoryStorage (temporary)Cart items, running subtotal
6Customer taps "Place Order"Cart data sent to serverTransport (app → server)Cart items, customer ID, store ID
7Server validates orderEach item checked: real menu item? Size valid? Mod available? Store open?TransformRaw order → validated order or error
8Inventory checkedServer verifies items are in stockTransform (comparison)Order items vs. current inventory
9Price calculatedServer computes subtotal, tax, totalTransformItems + prices + tax rate → total
10Order summary sent to appCalculated total returned for confirmationTransport (server → app)Total, itemized breakdown
11Customer confirms and paysPayment info sent to serverTransport (app → server)Payment method token, total amount
12Payment forwardedServer sends charge to payment providerTransport (server → payment service)Amount, payment token, merchant ID
13Payment processedPayment provider validates and chargesTransform (external)Charge request → approval or decline
14Payment result returnedApproval/decline sent back to serverTransport (payment service → server)Transaction ID, status, timestamp
15Order status updatedStatus changed from "pending" to "paid"Transform (state change)Order status field
16Order savedFull order record written to databaseStorage (persistent)All order fields, customer ID, timestamps
17Order sent to storeOrder details sent to barista screenTransport (server → store display)Items, mods, customer name, order #
18Queue position calculatedServer computes estimated wait timeTransformOrders ahead + avg prep time → estimate
19Estimate sent to customerWait time pushed to appTransport (server → app)Estimated minutes
20Barista prepares drink(Physical process, not data — but status tracked)
21Barista marks "ready"Taps button on store displayTransport (store display → server)Order ID, "ready" status
22Order status updatedStatus changed from "in progress" to "ready"Transform (state change)Order status field, timestamp
23Push notification sentServer sends notification to customer phoneTransport (server → notification service → phone)Customer device token, message text
24Notification delivery loggedWhether the notification was delivered or failedStorage (persistent)Delivery status, timestamp, device info
25Customer picks up drinkBarista marks "completed"Transform (state change)Order status → "completed," pickup timestamp
26Receipt generatedOrder data formatted into receiptTransformOrder data → receipt format
27Receipt storedSaved to customer's order historyStorage (persistent)Receipt data, linked to customer account
28Analytics loggedOrder data aggregated into business metricsTransport (server → analytics)Order total, items, time to fulfill, store ID

Step 3: Flow Diagram

┌─────────┐    load menu    ┌──────────┐   fetch    ┌──────────┐
│Customer  │ ◄───────────── │  Server  │ ─────────►│ Database │
│  App     │                │          │            │(menu,    │
│          │ ──────────────►│          │            │inventory)│
│          │   place order  │          │            └──────────┘
└─────────┘                 │          │
     ▲                      │          │──────────────►┌──────────┐
     │ push notification    │          │  charge card   │ Payment  │
     │                      │          │◄──────────────│ Provider │
     │                      │          │  confirmation  └──────────┘
     │                      │          │
     │                      │          │──────────────►┌──────────┐
     │                      │          │  send order    │  Store   │
     │                      │          │◄──────────────│ Display  │
     │                      │          │  mark ready    └──────────┘
     │                      │          │
     │                      │          │──────────────►┌──────────┐
     │                      │          │  log events    │Analytics │
     │                      └──────────┘               └──────────┘
     │                           │
     │                           │ send notification
     │                      ┌──────────┐
     └──────────────────────│  Push    │
                            │ Service  │
                            └──────────┘

Step 4: Hidden Data Analysis

Let's call out the hidden data specifically:

Hidden DataTypeWhere It LivesWhy It Matters
Timestamps on every actionMetadataOrder record in databaseDebugging, performance monitoring, customer disputes
Customer's device tokenConfigurationCustomer account recordRequired for push notifications to work
Tax rate for the store's locationConfigurationServer config or databaseAffects price calculation — changes by jurisdiction
Payment provider's transaction IDMetadataOrder recordRequired for refunds, fraud investigation, accounting
Menu versionMetadataApp cache + serverIf menu prices changed between browsing and ordering, which price applies?
Notification delivery statusStateNotification logIf customer didn't get notified, was it our fault or theirs?
Inventory snapshot at time of orderDerivedNot typically stored — and maybe it should beIf a customer says "it showed oat milk was available," can you prove whether it was?

That last row is interesting — it's data that doesn't exist in most systems but should, which is something you'd only discover by doing this analysis.


Step 5: What Could Go Wrong (by Lifecycle Stage)

StageWhat Could FailConsequence
Transport: Load menuApp can't reach server (no internet)Customer can't browse. Show cached menu? Or error?
Storage: Menu cacheCached menu is stale (prices changed)Customer sees old price, gets charged new price. Angry customer.
Transform: Validate orderItem was removed from menu after customer selected itOrder rejected. Good UX: explain what happened. Bad UX: generic error.
Transport: PaymentPayment service is down or slowCustomer is stuck. Don't show "order confirmed" until payment is confirmed.
Transform: PaymentCard declinedTell the customer clearly. Don't store the attempt as a completed order.
Transport: Send to storeStore display is offlineOrder is paid but barista never sees it. Customer waits forever. Critical failure.
Transform: State changeBarista forgets to tap "ready"Customer never gets notified. Drink gets cold. Operational failure (not a system bug, but the system should account for it — timeout alert?).
Transport: Push notificationNotification service fails silentlyCustomer doesn't know drink is ready. System should have fallback (in-app polling?).

Compare and Contrast: What This Example Teaches

This example demonstrates:

  1. A "simple" system has 27+ data stages — complexity hides in the details
  2. Multiple external services (payment provider, notification service, store display) each introduce transport risks
  3. State management is critical — the order status flows through 5 states, and getting out of sync at any point creates visible bugs
  4. Hidden data (metadata, config, logs) is as important as the obvious data — timestamps, tax rates, and delivery receipts make or break the system's debuggability
  5. Failure at any stage has different consequences — some failures are cosmetic, some lose money, some lose customers

When you encounter the test questions, map them at this level of detail. If your lifecycle map has 5 stages, you probably missed 20.