People in the US

A hundred people in one table, with places that belong together and social security numbers nobody can have.

en-US 1 table 100 rows CSV

First names follow the gender column. The state and the ZIP code follow the city and come from the same postal register, so a city, its state and its ZIP code belong together. Every social security number is in area 666, which is never issued, so a test cannot touch a real person’s number.

Change count for more rows and seed for other people. Remove a column you do not need, or add one from the generators.

The recipe

people-us.yaml
# A hundred people in the United States, in one table.
#
# Each row has a name, a gender, a birth date, a social security number, a city,
# its state and a ZIP code. First names follow the gender, and the state and the
# ZIP code follow the city. Every social security number is in area 666, which
# is never issued.
#
#   qadg generate people-us.yaml
#
# writes person.csv and run-note.json. The same seed gives the same rows on
# every machine.
version: "0.1"
seed: "people-us"
locale: en-US
entities:
  person:
    count: 100
    primary_key: [ssn]
    fields:
      first_name: { generator: first_name }
      last_name:  { generator: last_name }
      gender:     { generator: gender }
      birth_date: { generator: birth_date }
      ssn:        { generator: ssn, unique: true }
      city:       { generator: city }
      state:      { generator: region }
      zip:        { generator: postal_code }
    consistency:
      - first_name matches: [gender]
output:
  format: csv

Run it

Save the recipe, then run this in the same folder. This is what the program printed for it.

terminal
$ qadg generate people-us.yaml
       person: 100 rows, 8 columns
       person: state follows city, though no rule says so
       person: zip follows city and state, though no rule says so
1 table, 100 rows written

What it writes

person.csv

The first 5 of its 100 rows.

first_namelast_namegenderbirth_datessncitystatezip
IsabellaHillfemale1937-04-01666-97-2936HaskinsOH43525
DavidOsbornmale1940-05-06666-20-1309St. FrancisAR72464
JohnHansonmale1965-04-09666-01-5721ArgoniaKS67004
JavierSantosmale1958-02-25666-64-3250ElizabethNJ07206
KirkBeanmale2000-04-05666-31-2967WolcottNY14590

run-note.json

The seed, the locale and the versions behind the run, and every table it wrote with its rows and columns.