Git Product home page Git Product logo

csvrandomsimulator's Introduction

CSV Random Simulator

The simulator creates CSV files with random records by defining its fields and random distributions on a YAML properties file.

Requirements

The JAR file execution only requires Java 8 and the development requires Maven and optionally Eclipse. Additionally, the random variable dependencies visualization requires GraphViz.

How to build it

Once the code was downloaded, run the next command inside the project directory:

mvn compile
mvn assembly:assembly -DdescriptorId=jar-with-dependencies
mv target/csvSimulator-1.0-jar-with-dependencies.jar target/csvSimulator-1.0.jar

Aditionally, an eclipse project can be created by running:

mvn eclipse:eclipse

Simulator execution

The simulator needs a YAML configuration file that defines a CsvGenerator structure. For example, the next snippet shows the contents of greetings.yml:

!!com.csvsim.wrapper.CsvGenerator
fields:
- &id001 {name: greeting, type: STRING}
generator: !!com.csvsim.wrapper.String {field: *id001, discreteHistogram: {Hi: 0.4, Bye: 0.4, Au revoir: 0.2}}

This files defines a single field named greeting and its discrete distribution with three strings: "Hi", "Bye", and "Au revoir".

To simulate an infinite number of records run:

java -jar target/csvSimulator-1.0.jar -f greetings.yml

To simulate only five records run:

java -jar target/csvSimulator-1.0.jar -f greetings.yml -n 5

Both simulations can be run on a socket server, for example, to simulate 100 records and start the server on port 2020 type:

java -jar target/csvSimulator-1.0.jar -f greetings.yml -n 100 -p 2020

To test the server, open another terminal and run telnet on port 2020:

telnet localhost 2020

Finally, to create a field and random distribution dependency graph in DOT language run:

java -jar target/csvSimulator-1.0.jar -f greetings.yml -d greetings.dot

To create a SVG file run:

dot -Tsvg greetings.dot > greetings.svg

For instance, the next image shows the fields and random distributions of the 3.containers.yml example.

containers

Examples

The next example files are located in the main directory:

  • 0.helloWorld.yml
  • 1.fieldStructure.yml
  • 2.basicGenerators.yml
  • 3.containers.yml
  • 4.discreteEventDispatcher.yml

csvrandomsimulator's People

Contributors

gorayni avatar osake avatar dependabot[bot] avatar

Watchers

 avatar

Forkers

osake

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.