Skip to content
Beta · version 0.8.3 · commands and the JSON format may still change.

Generate e-commerce orders

The e-commerce example creates one CSV of online retail orders across the United States and Canada, each tied to a customer, a shipping timeline, a payment method and an order amount.

Terminal window
tabalyst generate --example ecommerce -o ecommerce-orders.csv

The file has 15 columns and 20,000 rows by default; --rows changes the count and --seed the data. The same seed gives the same file.

The 15 columns fall into three groups. Orders placed by the same customer share customer_id, customer_segment, country, state_province and city, drawn from a pool of 2,000 synthetic customers.

GroupColumns
Order (4)order_id (ORD-000001, …), order_date, ship_date, delivery_date
Customer & geography (5)customer_id (CUST-00001, …), customer_segment, country, state_province, city
Sale (6)currency, channel, payment_method, category, order_amount, order_status

Rules tie the columns together. The clean file holds no exception to them:

  • Geography (US 80%, CA 20%): country is US for about 80% of the customers and CA for about 20%. Within each country, state_province follows population weights across all 50 US states plus DC (for example CA, TX, FL, NY lead in the US) and all 13 Canadian provinces and territories (ON ~39%, QC ~22%, BC ~14%, AB ~12%). Each state_province picks from its main cities according to population weights.
  • Currency: currency is USD when country is US, and CAD when CA.
  • Customer segment: customer_segment is Returning (55%), New (30%) or VIP (15%).
  • Channel and payment: channel is Web (62%) or Mobile App (38%). Apple Pay appears only on Mobile App orders; Credit Card, Debit Card, PayPal and Gift Card appear on both channels.
  • Categories and order status: category has six values (Apparel, Home & Kitchen, Electronics, Beauty & Health, Sports & Outdoors, Books & Media). order_status is Delivered, Shipped, Returned or Cancelled: Apparel has a higher return rate (14%) and Books & Media a lower one (2%).
  • Dates: order_date runs from 2022 to 2026-09-24 with 25% annual growth, except Shipped orders which are placed between 2026-09-25 and 2026-09-29 (in transit at the reference date 2026-09-30). ship_date is one day after order_date and empty when Cancelled. delivery_date is four days after ship_date and empty when Cancelled or Shipped.
  • Order amount: order_amount is drawn from 15 to 1,200 (log-normal draw, median 65), scaled by category (Electronics 2.6x, Home & Kitchen 1.3x, Sports & Outdoors 1.2x, Apparel 0.9x, Beauty & Health 0.7x, Books & Media 0.45x) and by the month of order_date (1.25x in November, 1.35x in December, 0.9x in January, 0.85x in February).

These are synthetic records. Nothing in them comes from an actual store.

The dirty_realistic anomaly profile keeps the clean file and writes an altered copy, a cell change log and a JSON summary (-d is required):

Terminal window
tabalyst generate --example ecommerce --rows 5000 -d ecom-dirty/ --anomaly-profile dirty_realistic
ColumnDefectRate
order_idCopied from another row, creating duplicates0.5%
order_dateWritten day first, 30-09-20262%
countryReplaced by USA (US rows) or Canada (CA rows)4%
cityWritten in capitals3%
cityA space added at the end3%
categoryWritten in lower case4%
payment_methodEmptied2%
order_amountWritten $68.50, with a currency prefix2.5%
order_amountWritten with a decimal comma1.5%
order_amountEmptied1%

The rule_breaks profile leaves the formats alone and breaks the rules that tie the columns together, each change tagged by its class in changes.csv:

Terminal window
tabalyst generate --example ecommerce -d ecom-rules/ --anomaly-profile rule_breaks
ClassWhat changesRate
delivery_before_orderdelivery_date set to 2021-01-15 on a Delivered order1.5%
delivered_when_cancelleddelivery_date set to 2026-06-15 on a Cancelled order10%
currency_vs_countrycurrency set to CAD on a US order1%
state_vs_countrystate_province set to QC on a US order1%
apple_pay_on_webpayment_method set to Apple Pay on a Web order1.5%
negative_amountMinus sign added to order_amount on a Delivered order1%