Data Lifecycle — Example: Bank ATM Withdrawal

The Scenario

A customer walks up to an ATM, inserts their card, enters their PIN, requests $200 cash, and walks away with the money and a receipt.

This is one of the most data-sensitive operations in everyday life. Every piece of data must be exact. There is zero tolerance for error — if the system says the customer has $500, they must have exactly $500. Not $499.99, not $500.01.

Let's map it.


Step 1: Identify All the Data

Obvious data:

  • Card data (account number, card info)
  • PIN
  • Withdrawal amount ($200)
  • Account balance
  • Cash dispensed
  • Receipt

Less obvious data:

  • ATM's physical cash inventory (does it have enough $20 bills?)
  • Daily withdrawal limit for this account
  • How much the customer has already withdrawn today
  • ATM network session (the encrypted connection between ATM and bank)
  • Transaction authorization code
  • ATM location and ID
  • Timestamp of the transaction
  • Account hold/freeze status
  • Currency denomination preferences (does the ATM give $20s, $50s, or $100s?)
  • ATM's own status (is the receipt printer working? is the cash drawer jammed?)
  • Fraud detection signals (is this card being used in a different country than it was 5 minutes ago?)

Step 2: Full Lifecycle Map

#StageWhat HappensCategoryKey Details
1Card insertedATM reads magnetic stripe or chip dataTransport (card → ATM)Card number, expiry, bank identifier extracted
2Card data stored temporarilyATM holds card data in encrypted memoryStorage (temporary, encrypted)Never written to disk. Held only for this session.
3ATM connects to bank networkEncrypted session establishedTransport (ATM → bank)Session ID, ATM ID, ATM location transmitted
4Card data sent for validationATM sends card info to bankTransport (ATM → bank)Card number + bank identifier
5Bank validates cardIs this a real card? Is it active? Is it reported stolen? Expired?Transform (validation)Card status checked against bank records
6Card status returnedBank sends result back to ATMTransport (bank → ATM)"Valid" or specific rejection reason
7PIN prompt displayedATM asks customer for PINTransport (ATM → customer screen)No data in transit — just a UI prompt
8Customer enters PINKeypad captures digitsTransport (keypad → ATM memory)PIN stored encrypted, never displayed on screen
9PIN sent for verificationEncrypted PIN sent to bankTransport (ATM → bank)PIN is encrypted end-to-end. ATM never knows the real PIN.
10Bank verifies PINEntered PIN compared to stored PIN hashTransform (comparison)Bank doesn't store plaintext PINs either — it compares hashes
11PIN result returnedBank sends verification resultTransport (bank → ATM)"Correct" or "incorrect" + remaining attempts count
12Customer selects "Withdrawal"Selection capturedStorage (temporary)Transaction type stored in session
13Customer enters $200Amount capturedStorage (temporary)Amount stored in session
14ATM checks local cashDoes ATM have enough cash to dispense?Transform (comparison)$200 requested vs. ATM cash inventory
15Withdrawal request sent to bankATM sends full transaction requestTransport (ATM → bank)Account, amount, ATM ID, timestamp
16Bank checks balanceIs current balance ≥ $200?Transform (comparison)Available balance (accounting for holds and pending transactions)
17Bank checks daily limitHas customer exceeded daily withdrawal limit?Transform (comparison)Today's total withdrawals + $200 vs. limit
18Bank checks fraud signalsIs this transaction suspicious?Transform (analysis)Location, timing, amount patterns checked
19Bank authorizes (or denies)All checks pass → generate authorizationTransformCreates authorization code, places temporary hold on funds
20Funds held (not yet deducted)Bank places a hold of $200 on the accountStorage (state change)Available balance reduced by $200, but actual balance not yet changed
21Authorization sent to ATMBank sends approval + auth codeTransport (bank → ATM)Authorization code, approved amount
22ATM dispenses cashPhysical mechanism releases billsTransport (ATM cash drawer → customer)$200 in $20 bills. ATM cash inventory reduced.
23Customer takes cashATM sensors detect cash was takenTransform (state change)Transaction status: "cash dispensed"
24Dispensing confirmed to bankATM tells bank: cash was taken successfullyTransport (ATM → bank)Auth code + "dispensed" confirmation
25Bank finalizes transactionHold converted to actual deduction. Balance permanently reduced.Transform (state change)Available balance and actual balance both reduced. Transaction recorded.
26Transaction loggedFull record written to bank's transaction databaseStorage (persistent, permanent)Account, amount, ATM ID, location, timestamp, auth code
27Receipt printedATM formats and prints receiptTransform + TransportTransaction data → receipt format → printed paper
28Session endedAll temporary data in ATM memory clearedStorage (destruction)Card data, PIN, session data all wiped

Step 3: Critical Data Detail — The Two-Phase Commit

Notice stages 20 and 25. This is the most important concept in this example:

The bank does NOT deduct the money when it authorizes the transaction. It places a hold first.

Why? Because of the gap between stages 21-24. What if:

  • The ATM authorizes the withdrawal but then jams and can't dispense cash?
  • The customer walks away without taking the money?
  • The network drops between authorization and dispensing confirmation?

If the bank had already deducted the money at step 19, the customer would lose $200 they never received. Instead:

  1. Phase 1 (Hold): Money is reserved but not gone. If something fails, the hold is released and the customer's balance is restored.
  2. Phase 2 (Finalize): Only after the ATM confirms the cash was taken does the bank permanently deduct.

This is called a two-phase commit and it exists specifically because transport between ATM and bank can fail at any point. The data lifecycle design accounts for the worst case.


Step 4: Hidden Data Analysis

Hidden DataTypeWhere It LivesWhy It Matters
PIN attempt counterStateBank's card recordAfter 3 wrong PINs, card is locked. Counter resets on success.
ATM cash inventory by denominationStateATM local storageATM must know exactly how many $20s, $50s, $100s it has. If inventory tracking is wrong, it could promise cash it can't deliver.
Daily withdrawal running totalDerivedBank's transaction recordsCalculated from today's transactions. Not stored as a single number — derived from the sum of today's withdrawals.
Transaction sequence numberMetadataBoth ATM and bankEnsures no transaction is processed twice, even if network hiccups cause a retry.
ATM hardware statusStateATM local diagnosticsPrinter jammed? Card reader failing? Cash drawer low? These are all data that affect whether the ATM can complete a transaction.
Authorization expiryConfigurationBank rulesA hold might expire after 24 hours if not finalized. This prevents money from being locked indefinitely.
Fraud scoring signalsDerivedBank's fraud detection systemGeographic velocity (was this card used 1000 miles away 10 minutes ago?), amount patterns, time-of-day patterns.

Step 5: What Could Go Wrong

Failure PointWhat HappensConsequenceCorrect Response
Network fails after PIN, before authorizationATM can't reach bankTransaction cannot proceedReturn card. Display "service unavailable." Don't guess.
Authorization granted, but ATM cash drawer jamsCash can't be dispensedCustomer authorized but didn't receive moneyATM sends "dispensing failed" to bank. Bank releases hold. Customer balance restored.
Network fails after cash dispensed, before confirmationATM can't tell bank the cash was takenBank doesn't know to finalizeBank's hold expires → money returns to account. But customer HAS the cash. Bank reconciles from ATM's local transaction log during next sync.
Power failure mid-transactionEverything stopsUnclear stateATM writes transaction state to non-volatile storage at each step. On reboot, it replays the state to determine where it stopped and what needs recovery.
Customer walks away without taking cashCash is hanging out of the machineSecurity risk + accounting mismatchATM retracts cash after timeout (usually 30 seconds). Sends "cash retracted" to bank. Hold released.

Compare and Contrast With the Coffee Example

AspectCoffee ShopATM Withdrawal
Data sensitivityLow-medium (order data, payment token)Maximum (financial records, PINs)
Error toleranceMedium (wrong order is bad, but fixable)Zero (wrong balance is unacceptable)
Two-phase commit needed?No (charge and order can be atomic)Yes (must handle gap between authorization and dispensing)
Physical-digital boundaryBarista → digital status updateCash drawer → sensors → digital confirmation
Failure costBad customer experienceFinancial loss or fraud
Hidden data volumeModerateExtensive (fraud signals, hardware status, attempt counters)

The key lesson: the lifecycle structure is the same (storage → transform → transport), but the stakes change everything about how carefully you map it. In the coffee app, missing a notification is annoying. In the ATM system, missing a transaction confirmation means someone loses money.

When you design a system, the first question after "what is the data lifecycle?" is: "What are the stakes when it fails?" The answer determines how much detail your map needs.