Skip to content

Commit b5a0848

Browse files
wesmclaude
andcommitted
docs: Update Amazon mode to use official data export; fix detail view sort
- Update all Amazon documentation to reflect import from official "Your Orders" export instead of personal CSV files - Add step-by-step instructions for requesting Amazon data from Account Settings - Update format documentation to match official Retail.OrderHistory CSV format - Fix crash when navigating to detail view with COUNT sort active by resetting to DATE sort (detail views don't have a count column) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2f7b59d commit b5a0848

File tree

4 files changed

+125
-104
lines changed

4 files changed

+125
-104
lines changed

README.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ moneyflow --demo
4646
moneyflow
4747

4848
# Analyze your Amazon purchase history
49-
moneyflow amazon import ~/Downloads/amazon-purchases.csv
49+
moneyflow amazon import ~/Downloads/"Your Orders"
5050
moneyflow amazon
5151

52-
# Load only recent data for faster startup
52+
# Load only recent data for faster startup (Monarch only)
5353
moneyflow --year 2025
5454
```
5555

@@ -81,33 +81,28 @@ moneyflow --year 2025
8181

8282
### Amazon Purchases
8383

84-
Analyze Amazon purchase history with the same interface. Import CSV files from your personal tracking or Amazon's order history exports.
84+
Analyze Amazon purchase history using the official "Your Orders" data export from Amazon. Import and explore with the same powerful interface.
8585

8686
**Features:**
87-
- Import CSV with automatic deduplication
88-
- Category normalization
87+
- Import from official Amazon data export (Your Orders.zip)
88+
- Automatic deduplication and category assignment
8989
- View by item, category, or time period
9090
- Edit item names and categories
91-
- Track quantity and price per item
91+
- Track quantity, pricing, and order status
9292
- SQLite storage (no cloud dependencies)
9393

9494
**Getting started:**
9595
```bash
96-
# Import your CSV
97-
moneyflow amazon import ~/Downloads/amazon-purchases.csv
96+
# 1. Request your data from Amazon Account Settings > Privacy
97+
# (See docs/guide/amazon-mode.md for detailed instructions)
9898

99-
# Launch the UI
100-
moneyflow amazon
99+
# 2. Unzip the "Your Orders.zip" file
101100

102-
# Use custom database location
103-
moneyflow amazon --db-path ~/my-amazon-data.db
104-
```
101+
# 3. Import the directory
102+
moneyflow amazon import ~/Downloads/"Your Orders"
105103

106-
**Expected CSV format:**
107-
```csv
108-
Order Date,Title,Category,Quantity,Item Total
109-
01/15/2024,Python Crash Course,Books,1,39.99
110-
01/20/2024,USB-C Cable,Electronics,2,15.99
104+
# 4. Launch the UI
105+
moneyflow amazon
111106
```
112107

113108
### Demo Mode

docs/guide/amazon-mode.md

Lines changed: 103 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,53 @@
11
# Amazon Purchase Analysis Mode
22

3-
moneyflow includes a dedicated mode for analyzing Amazon purchase history. This allows you to import, categorize, and explore your Amazon purchases using the same powerful terminal UI.
3+
moneyflow includes a dedicated mode for analyzing Amazon purchase history using Amazon's official "Your Orders" data export. This allows you to import, categorize, and explore your Amazon purchases using the same powerful terminal UI.
44

55
## Overview
66

77
Amazon mode provides:
88

9-
- Import Amazon purchase data from CSV files
10-
- Automatic deduplication across imports
11-
- Category normalization and management
9+
- Import from official Amazon "Your Orders" data export
10+
- Automatic deduplication and category assignment
1211
- SQLite storage (local, no cloud dependencies)
1312
- Same TUI experience as Monarch mode
14-
- Track quantity and price per item
13+
- Track quantity, pricing, and order status
1514

1615
## Getting Started
1716

18-
### 1. Import Your Purchase Data
17+
### 1. Request Your Amazon Data
18+
19+
**IMPORTANT**: You need to request your purchase history from Amazon first.
20+
21+
!!! note "How to Request Your Amazon Data"
22+
1. Log into your Amazon account
23+
2. Go to **Account Settings****Privacy****Request My Data**
24+
3. Select **"Your Orders"** (you don't need all your data)
25+
4. Submit the request
26+
5. Wait 1-3 days for Amazon to prepare your data
27+
6. Download the **Your Orders.zip** file when ready
28+
7. Unzip it to get the "Your Orders" directory
29+
30+
The directory will contain files like:
31+
- `Retail.OrderHistory.1/Retail.OrderHistory.1.csv`
32+
- `Retail.OrderHistory.2/Retail.OrderHistory.2.csv`
33+
- etc.
34+
35+
### 2. Import Your Purchase Data
1936

2037
```bash
21-
# Import from CSV file
22-
moneyflow amazon import ~/Downloads/amazon-purchases.csv
38+
# Import from the unzipped directory
39+
moneyflow amazon import ~/Downloads/"Your Orders"
2340
```
2441

2542
The import will:
26-
- Parse the CSV and validate data
27-
- Normalize category names (e.g., "BOoks" → "Books")
43+
- Scan for all Retail.OrderHistory CSV files
44+
- Parse and validate order data
45+
- Assign categories automatically using Monarch category mappings
2846
- Detect and skip duplicates
29-
- Calculate price per item
47+
- Skip cancelled orders
3048
- Store everything in SQLite
3149

32-
### 2. Check Import Status
50+
### 3. Check Import Status
3351

3452
```bash
3553
# View database statistics
@@ -43,7 +61,7 @@ This shows:
4361
- Number of unique items and categories
4462
- Import history
4563

46-
### 3. Launch the UI
64+
### 4. Launch the UI
4765

4866
```bash
4967
# Open the terminal UI
@@ -54,69 +72,59 @@ Uses the same keyboard-driven interface as Monarch mode.
5472

5573
## CSV Format
5674

57-
### Personal Format (Currently Supported)
75+
moneyflow imports from the official Amazon "Your Orders" data export format.
5876

59-
Your personal Amazon purchase tracking CSV:
77+
### Expected Files
6078

61-
```csv
62-
Order Date,Title,Category,Quantity,Item Total,Reimbursed,Year,Regret,Disposed,Sale Price
63-
01/15/2024,Python Crash Course,Books,1,39.99,,,,,
64-
01/20/2024,USB-C Cable,Electronics,2,15.99,,,,,
65-
03/01/2024,Coffee Maker,Kitchen,1,89.99,,,,,
66-
```
79+
Files named: `Retail.OrderHistory.*.csv`
6780

68-
**Required columns:**
69-
- `Order Date` - Purchase date (MM/DD/YYYY format)
70-
- `Title` - Item name/description
71-
- `Category` - Product category
72-
- `Quantity` - Number of items (must be > 0)
73-
- `Item Total` - Total cost (positive number)
81+
### Expected Columns
7482

75-
Additional columns are ignored.
83+
- **ASIN**: Amazon Standard Identification Number
84+
- **Order ID**: Amazon order identifier
85+
- **Order Date**: ISO timestamp (e.g., "2025-10-13T22:08:07Z")
86+
- **Product Name**: Item description/title
87+
- **Quantity**: Number of items ordered
88+
- **Total Owed**: Final amount paid (after tax)
89+
- **Unit Price**: Item price before tax
90+
- **Order Status**: "Closed", "New", "Cancelled", etc.
91+
- **Shipment Status**: "Shipped", "Delivered", etc.
7692

77-
### Official Amazon Export (Planned)
93+
### Category Assignment
7894

79-
Support for the official Amazon.com order history export format is planned for a future release. This will include automatic category mapping from Amazon's internal categories to moneyflow categories.
95+
Categories are automatically assigned using moneyflow's centralized category mappings (same as Monarch mode). You can edit categories in the UI after import.
8096

8197
## Features
8298

8399
### Automatic Deduplication
84100

85-
Transactions are deduplicated based on a fingerprint of:
86-
- Order date
87-
- Item title
88-
- Amount
89-
- Quantity
101+
Transactions are deduplicated based on a unique ID generated from:
102+
- ASIN (or product name hash if ASIN missing)
103+
- Order ID
90104

91-
This means you can safely re-import the same CSV file multiple times - duplicates will be automatically skipped.
105+
This means you can safely re-import the same directory multiple times - duplicates will be automatically skipped.
92106

93107
```bash
94108
# First import
95-
moneyflow amazon import purchases.csv
109+
moneyflow amazon import ~/Downloads/"Your Orders"
96110
# Output: Imported 100 new transactions
97111

98112
# Re-import (safe!)
99-
moneyflow amazon import purchases.csv
113+
moneyflow amazon import ~/Downloads/"Your Orders"
100114
# Output: Skipped 100 duplicates, Imported 0 new transactions
101115
```
102116

103-
### Category Normalization
104-
105-
Common category variants are automatically normalized:
106-
- `BOoks``Books`
107-
- `VIdeo Game``Video Game`
108-
- `Office Products``Office Product`
109-
110-
This ensures consistent categorization even if your CSV has typos or variants.
117+
Cancelled orders are automatically skipped during import.
111118

112119
### Incremental Imports
113120

114121
Amazon mode supports incremental imports, preserving any manual edits you've made:
115122

116-
1. Import initial data
123+
1. Import initial data export
117124
2. Edit categories and item names in the UI
118-
3. Import updated CSV with new purchases
119-
4. Only new items are added - your edits are preserved
125+
3. Request and import a fresh data export from Amazon (with new purchases)
126+
4. Only new orders are added - your edits are preserved
127+
5. Use `--force` flag to re-import and overwrite existing transactions if needed
120128

121129
### Custom Database Location
122130

@@ -127,7 +135,7 @@ By default, data is stored in `~/.moneyflow/amazon.db`. You can use a custom loc
127135
moneyflow amazon --db-path ~/Documents/amazon-purchases.db
128136

129137
# All commands support --db-path
130-
moneyflow amazon --db-path ~/custom.db import purchases.csv
138+
moneyflow amazon --db-path ~/custom.db import ~/Downloads/"Your Orders"
131139
moneyflow amazon --db-path ~/custom.db status
132140
```
133141

@@ -164,38 +172,40 @@ See [Keyboard Shortcuts](keyboard-shortcuts.md) for the complete list.
164172

165173
Each Amazon purchase is stored as a transaction with:
166174

167-
- **ID**: Generated from fingerprint (for deduplication)
168-
- **Date**: Purchase date
169-
- **Item**: Item title/name (displayed as "Merchant" in UI)
170-
- **Category**: Product category (editable)
171-
- **Amount**: Total cost (negative, like expenses)
172-
- **Quantity**: Number of items purchased
173-
- **Price per Item**: Calculated unit price
174-
- **Notes**: Additional info (e.g., "Qty: 2")
175+
- **ID**: Generated from ASIN + Order ID (for deduplication)
176+
- **Date**: Order date
177+
- **Merchant**: Product name (displayed as "Merchant" in UI)
178+
- **Category**: Automatically assigned from category mappings (editable)
179+
- **Amount**: Total Owed (negative, like expenses)
180+
- **Quantity**: Number of items ordered
181+
- **ASIN**: Amazon product identifier
182+
- **Order ID**: Amazon order number
183+
- **Order Status**: Order state (Closed, New, etc.)
184+
- **Shipment Status**: Shipping state (Shipped, Delivered, etc.)
185+
- **Notes**: Additional info (e.g., order details)
175186
- **Hide from Reports**: Toggle visibility
176187

177188
### Categories
178189

179-
Categories are created automatically from your CSV. You can:
190+
Categories are assigned automatically using moneyflow's centralized category module (shared with Monarch mode). You can:
180191
- Edit category assignments in the UI
181-
- Rename categories
182-
- Create new categories
183192
- View spending by category
193+
- Categories are NOT stored in the database - they come from `categories.py`
184194

185195
## Database
186196

187197
Amazon data is stored in a local SQLite database (default: `~/.moneyflow/amazon.db`).
188198

189199
**Tables:**
190-
- `transactions` - Purchase records
191-
- `categories` - Category definitions
200+
- `transactions` - Order records (one row per item)
192201
- `import_history` - Audit trail of imports
193202

194203
**To inspect directly:**
195204
```bash
196205
sqlite3 ~/.moneyflow/amazon.db
197206
.tables
198207
SELECT * FROM import_history;
208+
SELECT COUNT(*) FROM transactions WHERE order_status = 'Closed';
199209
.quit
200210
```
201211

@@ -205,59 +215,68 @@ SELECT * FROM import_history;
205215
rm ~/.moneyflow/amazon.db
206216

207217
# Re-import
208-
moneyflow amazon import purchases.csv
218+
moneyflow amazon import ~/Downloads/"Your Orders"
209219
```
210220

211221
## Limitations
212222

213223
- **Read-only**: No sync back to Amazon (local edits only)
214-
- **No API**: Works with CSV files only (no live Amazon connection)
215-
- **UI labels**: Currently shows Monarch-style labels (will be customized in future)
224+
- **Manual data export**: Requires requesting "Your Orders" export from Amazon
225+
- **No live updates**: Must re-request data from Amazon to get new orders
226+
- **Item-level only**: Each item in an order is a separate transaction (no order grouping)
216227

217228
## Future Enhancements
218229

219230
Planned improvements:
220-
- Support for official Amazon.com CSV export format
221-
- Automatic category mapping from Amazon categories
222-
- Seller name extraction
223-
- Order-level grouping (multiple items per order)
231+
- Order-level grouping (link items from same order)
232+
- Seller name extraction and filtering
224233
- Returns and refunds tracking
225234
- Subscription detection
235+
- Amazon category to moneyflow category mapping improvements
236+
- Custom category rules
226237

227238
## Troubleshooting
228239

229-
### Import fails with "Missing required columns"
240+
### Import fails with "No Retail.OrderHistory CSV files found"
230241

231-
**Cause**: CSV doesn't have the expected column names.
242+
**Cause**: The directory doesn't contain Amazon export files.
232243

233-
**Solution**: Verify your CSV has these exact column headers:
234-
- `Order Date`
235-
- `Title`
236-
- `Category`
237-
- `Quantity`
238-
- `Item Total`
244+
**Solution**:
245+
1. Make sure you've unzipped the "Your Orders.zip" file
246+
2. Point to the unzipped directory (not individual CSV files)
247+
3. The directory should contain folders like `Retail.OrderHistory.1/`
239248

240249
### "Amazon database is empty" when launching
241250

242251
**Cause**: No data has been imported yet.
243252

244-
**Solution**: Import your CSV first:
253+
**Solution**: Import your data first:
245254
```bash
246-
moneyflow amazon import ~/path/to/purchases.csv
255+
moneyflow amazon import ~/Downloads/"Your Orders"
247256
```
248257

249-
### Duplicate transactions after import
258+
### Import shows "0 new transactions"
259+
260+
**Cause**: All transactions already exist in the database.
261+
262+
**Solution**:
263+
- This is expected if you're re-importing the same data
264+
- Use `--force` flag to re-import: `moneyflow amazon import --force ~/Downloads/"Your Orders"`
265+
- Or delete the database and start fresh: `rm ~/.moneyflow/amazon.db`
266+
267+
### Missing ASIN for some items
250268

251-
**Cause**: Transaction fingerprints are different (different date/amount/quantity).
269+
**Cause**: Some Amazon items don't have ASINs (e.g., digital content, gift cards).
252270

253-
**Solution**: This is expected if the transactions are actually different. If they're true duplicates, check that the CSV columns match exactly.
271+
**Solution**: moneyflow automatically generates a pseudo-ASIN from the product name hash. This is normal and doesn't affect functionality.
254272

255273
## Tips
256274

257-
- **Start with a subset**: Test with a small CSV first (10-20 rows)
258275
- **Check status often**: Use `moneyflow amazon status` to verify imports
259276
- **Safe to experiment**: Edits are local only, delete the database to reset
260277
- **Use custom paths**: Keep different analyses separate with `--db-path`
278+
- **Re-import periodically**: Request fresh exports from Amazon to get new orders
279+
- **Filter by status**: Use order status and shipment status to find specific orders
261280

262281
## Questions?
263282

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ See exactly what changes you're making before saving. All edits are queued and r
104104
**Currently supported:**
105105

106106
- **[Monarch Money](https://www.monarchmoney.com/)** - Full-featured integration with real-time sync
107-
- **Amazon Purchase History** - Import and analyze your Amazon order history from CSV exports
107+
- **Amazon Purchase History** - Import and analyze your Amazon order history from official data exports
108108
- **Demo Mode** - Realistic synthetic data for testing features
109109

110110
**Coming soon:**

0 commit comments

Comments
 (0)