Giter Site home page Giter Site logo

john-rice / dataloader-faker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bullhorn/dataloader-faker

0.0 0.0 0.0 41 KB

Generate massive amounts of realistic fake CSV data for testing

License: GNU Affero General Public License v3.0

JavaScript 100.00%

dataloader-faker's Introduction

Data Loader Faker

Generate massive amounts of realistic fake CSV data for Data Loader

Get Started

The templates directory contains an entire corporation full of fake data. Each entity will reference other entities in the same directory, same as the dataloader examples. Each entity file should contain the same number of rows as the other entities, and they can all be generated together by providing the number of desired rows. Lookup entities are the exception - there are only 10 of each generated.

// generate 10,000 records along with lookup entities
npm start 10000
// follow-on generation of 10,000 additional records, starting with id: 10001
npm run generate -- -t templates -o generated -r 10000 -s 10001

When provided the number of rows = n, this will generate:

  • n Companies
  • n Contacts, one per company
  • n Jobs, one per company
  • n Candidates
  • 3n Job Submissions, three per Candidate at one Job
  • n Placements, one per Candidate at one Job
  • n Locations, one per Company
  • n Invoice terms, one per Company
  • n Billing Profiles, one per Company
  • 10 General Ledger Accounts
  • 10 Invoice Statement Message Templates

To load all of these records into a test corp, point Data Loader at the directory:

dataloader load ../path/to/generated

Customized Generation

Given a template file and a location of an output file to generate, this method will generate an output file based on the provided template that contains the number of rows desired.

npm run generate -- --template path/to/templateFile.csv --output generatedOutputFile.csv --rows 1000

The Template File Format

A template file contains two rows:

  1. Column header with column names that will be copied from the template to the generated output file.
  2. The data to generate for each row, including any replacements to make the data unique per row.

Replacements

  • {{<faker.dataType>}} = replace with faker-js generated data. See faker-js docs for available options.
    • Example: {{name.lastName}}, {{name.firstName}} {{name.suffix}} will generate random values for each row, formatted as: Corkery, Chaya Jr., Rippin, Tevin II, etc.
  • {{i}} = replace with row number
    • Example: candidate-{{i}} will generate candidate-1, candidate-2, etc.
  • ${<otherColumnName>} = replace with the value of another column, allowing columns to contain values from one or more generated columns.
    • Example: ${firstName} ${middleName} ${lastName} will format three generated columns into one resulting column.
  • [[Option A|Option B|Option C|Option D]] = replace with one of the given options in the vertical bar separated double bracket list. Simply cycles through the options on each row for an even distribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.