Package: plaitpy
## plait.pyplait.py is a program for generating fake data from composable yaml templates.The idea behind plait.py is that it should be easy to model fake data thathas an interesting shape. Currently, many fake data generators model their data as acollection of[IID](https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables)variables; with plait.py we can stitch together those variables into a morecoherent model.some example uses for plait.py are:* generating mock application data in test environments* validating the usefulness of statistical techniques* creating synthetic datasets for performance tuning databases### features* declarative syntax* use basic [faker.rb](https://github.com/stympy/faker) fields with #{} interpolators* sample and join data from CSV files* lambda expressions, switch and mixture fields* nested and composable templates* static variables and hidden fields### an example template# a person generatordefine:min_age: 10minor_age: 13working_age: 18fields:age:random: gauss(25, 5)# minimum age is $min_agefinalize: max($min_age, value)gender:mixture:- value: M- value: Fname: "#{name.name}"job:value: "#{job.title}"onlyif: this.age > $working_ageaddress:template: address/usa.yamlphone: # add a phone if the person is older than the minor agetemplate: device/phone.yamlonlyif: this.age > ${minor_age}# we model our height as a gaussian that varies based on# age and genderheight:lambda: this._base_height * this._age_factor_base_height:switch:- onlyif: this.gender == "F"random: gauss(60, 5)- onlyif: this.gender == "M"random: gauss(70, 5)_age_factor:switch:- onlyif: this.age < 15lambda: 1 - (20 - (this.age + 5)) / 20- default:value: 1### how its differentsome specific examples of what plait.py can do:* generate proportional populations using census data and CSVs* create realistic zipcodes by state, city or region (also using CSVs)* create a taxi trip dataset with a cost model based on geodistance* add seasonal patterns (daily, weekly, etc) to data## usage### installation# install with pythonpip install plaitpy# or with pypypypy-pip install plaitpy### cloning the repo for developmentgit clone https://github.com/plaitpy/plaitpy# get the fakerb repogit submodule initgit submodule update### generating records from command linespecify a template as a yaml file, then generate records from that yaml file.# a simple example (if cloning plait.py repo)python main.py templates/timestamp/uniform.yaml# if plait.py is installed via pipplait.py templates/timestamp/uniform.yaml### generating records from APIimport plaitpyt = plaitpy.Template("templates/timestamp/uniform.yaml")print t.gen_record()print t.gen_records(10)### looking up faker fieldsplait.py also simplifies looking up faker fields:# list faker namespacesplait.py --list# lookup faker namespacesplait.py --lookup name# lookup faker keys# (-ll is short for --lookup)plait.py --ll name.suffix## documentation### yaml file commands* see docs/FORMAT.md### datasets* see docs/EXAMPLES.md* also see templates/ dir### troubleshooting* see docs/TROUBLESHOOTING.md### Dependent Markov ProcessesTo simulate data that comes from many markov processes (a markov ecosystem),see the [plaitpy-ipc](https://github.com/plaitpy/plaitpy-ipc) repository.### future directionIf you have ideas on features to add, open an issue - Feedback is appreciated!### License[MIT](https://github.com/plaitpy/plaitpy/blob/master/LICENSE.txt)