# CRM Import QA Report

## Scope

Pre-import QA pass for a CRM or RevOps CSV before it is pushed into HubSpot, Salesforce, Pipedrive, Airtable, or a custom admin import.

The goal is to stop obvious data damage before production: duplicate contacts, missing companies, unmapped lifecycle stages, empty owners, invalid emails, and bad deal amounts.

## Input

- `sample_contacts.csv`
- `rules.example.json`
- Key field: `email`
- Required fields: `email`, `company`, `stage`
- Stage mapping: `Lead`, `Qualified`, `Customer`
- Owner field: `owner`
- Amount field: `deal_amount`

## Command

```bash
python3 crm_import_audit.py sample_contacts.csv --rules rules.example.json --out out
```

## Summary

- Rows checked: `8`
- Ready to import: `1`
- Rejected rows: `7`
- Duplicate key rows: `2`

## Problem Counts

- `duplicate email`: 2
- `invalid amount`: 1
- `invalid email format`: 1
- `missing owner field`: 1
- `missing required field`: 2
- `unmapped stage`: 1

## Rejected Rows

| Row | Key | Problems |
| ---: | --- | --- |
| 2 | `[email protected]` | duplicate email: [email protected] |
| 4 | `carla@example` | invalid email format |
| 5 | `[email protected]` | duplicate email: [email protected] |
| 6 | `-` | missing required field: email |
| 7 | `[email protected]` | missing required field: company |
| 8 | `[email protected]` | unmapped stage: Needs Review |
| 9 | `[email protected]` | missing owner field: owner; invalid amount: bad_amount |

## Output

- `crm-import-report.md`
- `crm-import-summary.json`
- `crm-import-rejects.csv`
- `handoff.md`

## Acceptance Check

```bash
python3 -m unittest test_crm_import_audit.py
python3 crm_import_audit.py sample_contacts.csv --rules rules.example.json --out out
```

The sample intentionally rejects bad rows. For a client import, the pass is complete when rejected rows reach `0` or the CRM owner explicitly accepts the remaining exceptions.

## Boundary

This proof uses synthetic data only. Real CRM work should use data the client owns or is authorized to process, with staging or exports first. No CRM login, enrichment, mass outreach, credential handling, or production import is needed for the first QA pass.