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
| # | Stage | What Happens | Category | Data Involved |
|---|---|---|---|---|
| 1 | Customer opens app | App loads menu from server | Transport (server → app) | Menu, store hours, inventory flags |
| 2 | Menu displayed | Menu data held in app memory | Storage (temporary) | Menu items, prices, available mods |
| 3 | Customer browses | Selection exists in app memory as they tap | Storage (temporary) | Selected item, size, mods |
| 4 | Customer taps "Add to Cart" | Selection formatted into cart item | Transform | Selection → structured cart item |
| 5 | Cart displayed | Cart data held in app memory | Storage (temporary) | Cart items, running subtotal |
| 6 | Customer taps "Place Order" | Cart data sent to server | Transport (app → server) | Cart items, customer ID, store ID |
| 7 | Server validates order | Each item checked: real menu item? Size valid? Mod available? Store open? | Transform | Raw order → validated order or error |
| 8 | Inventory checked | Server verifies items are in stock | Transform (comparison) | Order items vs. current inventory |
| 9 | Price calculated | Server computes subtotal, tax, total | Transform | Items + prices + tax rate → total |
| 10 | Order summary sent to app | Calculated total returned for confirmation | Transport (server → app) | Total, itemized breakdown |
| 11 | Customer confirms and pays | Payment info sent to server | Transport (app → server) | Payment method token, total amount |
| 12 | Payment forwarded | Server sends charge to payment provider | Transport (server → payment service) | Amount, payment token, merchant ID |
| 13 | Payment processed | Payment provider validates and charges | Transform (external) | Charge request → approval or decline |
| 14 | Payment result returned | Approval/decline sent back to server | Transport (payment service → server) | Transaction ID, status, timestamp |
| 15 | Order status updated | Status changed from "pending" to "paid" | Transform (state change) | Order status field |
| 16 | Order saved | Full order record written to database | Storage (persistent) | All order fields, customer ID, timestamps |
| 17 | Order sent to store | Order details sent to barista screen | Transport (server → store display) | Items, mods, customer name, order # |
| 18 | Queue position calculated | Server computes estimated wait time | Transform | Orders ahead + avg prep time → estimate |
| 19 | Estimate sent to customer | Wait time pushed to app | Transport (server → app) | Estimated minutes |
| 20 | Barista prepares drink | (Physical process, not data — but status tracked) | — | — |
| 21 | Barista marks "ready" | Taps button on store display | Transport (store display → server) | Order ID, "ready" status |
| 22 | Order status updated | Status changed from "in progress" to "ready" | Transform (state change) | Order status field, timestamp |
| 23 | Push notification sent | Server sends notification to customer phone | Transport (server → notification service → phone) | Customer device token, message text |
| 24 | Notification delivery logged | Whether the notification was delivered or failed | Storage (persistent) | Delivery status, timestamp, device info |
| 25 | Customer picks up drink | Barista marks "completed" | Transform (state change) | Order status → "completed," pickup timestamp |
| 26 | Receipt generated | Order data formatted into receipt | Transform | Order data → receipt format |
| 27 | Receipt stored | Saved to customer's order history | Storage (persistent) | Receipt data, linked to customer account |
| 28 | Analytics logged | Order data aggregated into business metrics | Transport (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 Data | Type | Where It Lives | Why It Matters |
|---|---|---|---|
| Timestamps on every action | Metadata | Order record in database | Debugging, performance monitoring, customer disputes |
| Customer's device token | Configuration | Customer account record | Required for push notifications to work |
| Tax rate for the store's location | Configuration | Server config or database | Affects price calculation — changes by jurisdiction |
| Payment provider's transaction ID | Metadata | Order record | Required for refunds, fraud investigation, accounting |
| Menu version | Metadata | App cache + server | If menu prices changed between browsing and ordering, which price applies? |
| Notification delivery status | State | Notification log | If customer didn't get notified, was it our fault or theirs? |
| Inventory snapshot at time of order | Derived | Not typically stored — and maybe it should be | If 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)
| Stage | What Could Fail | Consequence |
|---|---|---|
| Transport: Load menu | App can't reach server (no internet) | Customer can't browse. Show cached menu? Or error? |
| Storage: Menu cache | Cached menu is stale (prices changed) | Customer sees old price, gets charged new price. Angry customer. |
| Transform: Validate order | Item was removed from menu after customer selected it | Order rejected. Good UX: explain what happened. Bad UX: generic error. |
| Transport: Payment | Payment service is down or slow | Customer is stuck. Don't show "order confirmed" until payment is confirmed. |
| Transform: Payment | Card declined | Tell the customer clearly. Don't store the attempt as a completed order. |
| Transport: Send to store | Store display is offline | Order is paid but barista never sees it. Customer waits forever. Critical failure. |
| Transform: State change | Barista 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 notification | Notification service fails silently | Customer doesn't know drink is ready. System should have fallback (in-app polling?). |
Compare and Contrast: What This Example Teaches
This example demonstrates:
- A "simple" system has 27+ data stages — complexity hides in the details
- Multiple external services (payment provider, notification service, store display) each introduce transport risks
- State management is critical — the order status flows through 5 states, and getting out of sync at any point creates visible bugs
- 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
- 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.