Package: tsfaker
Generate tabular fake data conforming to aTable Schema.tsfakerlibrary is available on PyPI.This library was originally developed to generate a synthetic version ofSNDS database, which contains hundreds of tables, hencetsfakerefficiently deals withforeign keys.Notes :We aim to generate fake data conforming to aschema, not fake data with realistic statistical information (seeRelated worksection).This library is in beta and subject to frequent changes (seeReleases notessection).UsageInstallation$pip3installtsfakerSimple usageGenerate 3 rows of fake data from a single table schema file.$tsfakerhttps://gitlab.com/healthdatahub/tsfaker/raw/master/tests/schemas/implemented_types.json--nrows3--prettybooleanstringnumberintegerdatedatetimeyearyearmonth01haHoKysholbSI9780230269.512-70613090681914-10-031902-04-11T11:21:11Z193919640510rLugGhNek990894536.894525298794432026-09-082015-11-27T16:21:54Z193219290921ipqVXm-4371053960.8987-5298803731994-09-271937-01-12T18:40:15Z2021193303Advanced usageShow help message.$tsfaker--helpUsage:tsfaker[OPTIONS][SCHEMA_DESCRIPTORS]......Download examples schemas from projectschema-snds.$gitclonehttps://gitlab.com/healthdatahub/schema-snds&&cdschema-sndsGenerate fake data for all schemas in aschemasfolder using csv files innomenclaturesfolder, and write them tofake_datafolder.$mkdirfake_data$tsfakerschemas-ofake_data-rnomenclatures2019-01-0100:00:00::INFO::Datageneratedfromdescriptor'schemas/PMSI/PMSI MCO/T_MCOaa_nnE.json'willbewrittenon'fake_data/PMSI/PMSI MCO/T_MCOaa_nnE.csv'2019-01-0100:00:00::INFO::Datageneratedfromdescriptor'schemas/PMSI/PMSI MCO/T_MCOaa_nnFASTC.json'willbewrittenon'fake_data/PMSI/PMSI MCO/T_MCOaa_nnFASTC.csv'2019-01-0100:00:00::INFO::Datageneratedfromdescriptor'schemas/PMSI/PMSI SSR/T_SSRaa_nnE.json'willbewrittenon'fake_data/PMSI/PMSI SSR/T_SSRaa_nnE.csv'...Related workWe use directly or get inspiration from the following libraries.Simple data Generatorsnumpycomes with many functions to generate random data.rstrandexrexgenerate random string following regular expressions.FakerandMimesisallow to generate fake data. They both focus on generating high level data, such as names, email or addresses, which does not seem necessary for us.DataScienceFakergenerate synthetic data conforming to statistical distributions. It is based on numpy and rstr.Table generatorpydbgenis a shallow wrapper around Faker to generate tables as pandas dataframe, sqlite table or Excel files.pySyntheticDatasetGeneratoris a wrapper around dsfaker, that generate tables with their relations as described in yaml configuration files.datafillergenerate random data from database schema. API could be interesting.plaitpyis a fake table generator from a yaml configuration file.Realistic dataGenerating realistic data - ie data carrying statistical information -  could mean different things in different contexts :realistic statistical distribution on single columns,realistic temporal dynamics,realistic correlations between pairs of columns,realistic correlations between pairs of columns from different (joinable) tables,etc.Hence there is no universal way to generate realistic data. Most approaches follow two steps :learn a statistical model from the real data,generate data using this model.The statistical model depends of the context, and is usually not expressed in the form of a generic schema, such as table-schema.
However, a schema of your data will be often be necessary toconfigurethis kind of libraries.This topic is an active research area, with many articles but few production implementations :DataSynthesizer(article) learn a diferentially private Bayesian network capturing the correlation structure between attributesdpgan(article) Differentially Private Releasing via Deep Generative Model.SDV(article) Generative modeling for relational databases.medGAN(article) Generative adversarial network for generating electronic health records.CTGAN(article) Modeling Tabular data using Conditional GANThe statistical model may convey sensitive information and personnal data.
It is important fact to bear in mind, as protecting sensitive information is a common reason to generate fake data in the first place.Some tools offer ways to mitigate the risk from personal data leakage, with no formal guarantees.
Other tools offer formal privacy guarantees throughdifferential privacy.An active line of work is to use Generative Adversial Network to generate realistic data, for example dpgan (see above) orPrivacy-Preserving Generative Deep Neural Networks Support Clinical Data Sharing.When using Neural Network, one can use TensorFlow’sspecific library.PySyft projectaims to provide a generic implementation for PyTorch.Release notesVersion 0.14[Fix] Update command line default value to match Click library version >=8.0Version 0.13[Fix] Adapt maximum default integer value to local systemVersion 0.12It is possible to specify trueValues and falseValues for boolean type (according to TableSchema standard)Only one item is accepted in trueValues and falseValues arraysIt is possible to specify a format for types date and datetimeVersion 0.11yearmonth type does not follow ISO 8601 format ‘YYYY-MM’ and is now generated without a dash ‘YYYYMM’Version 0.10boolean type is implemented, default values for this type are 0 for False and 1 for True