# Ralphs Extraction Notes

## Confirmed live-run context
- Live test run succeeded against Ralphs purchase history with 10 orders and 235 item rows written into the grocery ledger workflow.
- Purchase history URL: `https://www.ralphs.com/mypurchases`
- Detail-page pattern observed during planning: `https://www.ralphs.com/mypurchases/v2/{order_id}`

## Page behavior
- Ralphs purchase history is a React SPA.
- Initial navigation can render an incomplete or visually empty list before hydration finishes.
- A second snapshot after a short wait is often required.
- Detail pages can render a partial item list until the page is expanded and scrolled.

## Required expansion logic
- Always look for `Show all`, `View all items`, or `See all N items`.
- After expanding, scroll to the bottom to trigger lazy-loaded rows.
- Snapshot again and verify the item list length stabilizes.
- Repeat until no new rows appear.
- If the visible list still appears truncated, do not write the order as complete.

## Fields to capture
### Order-level
- `order_date`
- `order_id`
- `fulfillment_type`
- `order_total`
- detail URL

### Item-level
- `item_name`
- `quantity`
- `unit_price`
- `item_total`

### Adjustment-level
Capture each visible non-item money row separately, including repeated labels.
Observed / expected adjustment patterns include:
- `CA Redem Val`
- bag fees
- bottle or container deposits
- redemption lines
- taxes or fees shown outside item rows

## Normalization rules
- Preserve repeated adjustment names as separate records.
- Preserve reconciliation deltas exactly.
- Prefer visible text over brittle selectors when interpreting totals.
- Treat partial-item rendering as the main Ralphs failure mode.
