# Data Cleanup & Formatting Consistency for Email Delivery

## Formatting Consistency Rule (Jul 10, 2026) — CRITICAL

**Once the user approves a format, all subsequent versions of the same email MUST use that format.** Do not regress from HTML tables to plain text between iterations.

**Violation pattern:** First Apex registration preview used an HTML table with zebra rows, green checkmarks (✓), and red X marks (✗). User said "Looks perfect. Please now send to contact@." Subsequent previews fell back to plain-text ASCII tables. User tried multiple times to get the HTML table back and couldn't — called out as frustrating.

**Rule:** When iterating on an email based on user feedback:
1. Start with HTML tables for structured data (registration lists, status reports, comparison tables)
2. Use visual indicators: green checkmarks (✓) for completed/signed, red X (✗) for missing
3. Use zebra striping (alternating row colors) for readability
4. After each correction, re-send using the SAME HTML format — never downgrade
5. The user's approval of a format is a contract — don't change it

## Data Normalization Rules (from raw database to email)

When pulling structured data from databases (WordPress WPForms, MariaDB) for email summaries:

## Normalize names
- Apply proper case: `name.title()` or `' '.join(w.capitalize() for w in name.split())`
- Never send all-lowercase or all-uppercase names from raw database entries

## Simplify labels
- Convert raw package names to human-readable labels:
  - "NASA Registration w/ Upgraded Photo/Video Package - $2,332.00" → "Photo/Video"
  - "NASA Registration w/ Photo Package - $2,230.00" → "Photo"  
  - "NASA Registration - $1,973.00" → "Basic"
- Decode HTML entities: `&#36;` → `$`

## Consistent ASCII formatting
- Fixed-width columns with ` | ` separators
- `=` or `-` for section borders
- Right-pad names to consistent widths for alignment

## Filter test data
- Exclude test transactions ($1.00 amounts, known test emails)
- Filter by payment amount threshold ($1,973+ is real)

## Preview before send
- Always show Germaine the formatted preview
- Let him correct formatting/columns/labels before the email goes out
