Spec a contact import that survives messy CSV files
Your task
Customers of your CRM upload contact lists as CSV files of up to 200,000 rows. An agent will build the Python importer that loads them into Postgres. The files come from Excel, Google Sheets and old CRMs, and each one writes CSV a little differently.
Write the spec you would hand the agent.
What you know:
- Python 3.12, Django and Postgres; contacts live in a
contactstable, unique on(account_id, email) - the import runs as a background job, and the user sees a summary when it finishes
- product has decided that a bad row must not block the good ones
- users often upload the same file again after fixing a few rows
Then, in a few sentences: what does "parse the CSV and insert the rows" get wrong?