RetailPulse Analytics operates 45 stores and an online marketplace in Nigeria, Ghana, and Kenya. With 150k monthly customers and 8k daily transactions, they need a unified source of truth. Centralizing this multi-channel data is essential for scaling operations and enabling consistent, data-driven decision-making.
# RetailPulse Analytics Synthetic Data Generator
Synthetic data generator for the three messy source systems described in your RetailPulse brief:
- Inventory API JSON feed with inconsistent field naming, duplicates, timeout/rate-limit style metadata, and noisy stock data
- Vendor shipment CSV files from multiple vendors, each with its own quirks and parsing issues
- PostgreSQL-style order, customer, and order-item data with nulls, duplicates, and orphaned references
## What this generates
```text
output/
api/
inventory_payload.json
inventory_failures.json
vendors/
vendor_001_nairobi.csv
vendor_002_accra.csv
...
postgres/
customers.csv
orders.csv
order_items.csv
schema.sql
seed_from_csv.sql
```
## Quick start
```bash
cd retailpulse_synth
python generate_all.py
```
Optional arguments:
```bash
python generate_all.py \
--vendors 12 \
--vendor-rows-min 40 \
--vendor-rows-max 120 \
--inventory-records 800 \
--customers 1500 \
--orders 4500
```
## Notes
- The generator intentionally creates dirty data.
- Vendor CSV files are separate by design so you can merge them yourself later.
- PostgreSQL output is delivered as CSV plus schema/seed SQL helper files.
- The API failures file simulates rate-limit and timeout style issues without requiring a real HTTP server.
## Main chaos patterns included
### Inventory API
- `product_id` vs `sku` vs `productId`
- `stock_quantity` vs `stock_qty` vs `qty_on_hand`
- duplicated inventory records
- negative or mismatched stock edge cases
- timestamp field name drift
- failure events for `429`, `408`, and `504`
### Vendor CSV
- multiple date formats
- different column names per vendor
- product naming variations
- duplicated rows
- null fields
- special characters / commas / quotes / ampersands / unicode
- inconsistent quantity and unit-price formatting
### PostgreSQL order data
- customer duplicates
- nullable email / phone / shipping fields
- orphaned `order_items` pointing to missing inventory SKUs or missing order IDs
- statu …