{"id":13672125,"url":"https://github.com/dsietz/test-data-generation","last_synced_at":"2025-03-17T00:32:30.769Z","repository":{"id":45350998,"uuid":"66575268","full_name":"dsietz/test-data-generation","owner":"dsietz","description":"Test Data Generation","archived":false,"fork":false,"pushed_at":"2021-12-18T21:18:39.000Z","size":2970,"stargazers_count":36,"open_issues_count":0,"forks_count":3,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-13T13:29:54.211Z","etag":null,"topics":["algorithm","archconf","data","data-privacy","generate","json","machine-learning","markov-decision-processes","nfjs","privacy","profile","rust-lang","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsietz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-25T16:32:24.000Z","updated_at":"2023-12-02T10:10:44.000Z","dependencies_parsed_at":"2022-09-10T14:00:36.763Z","dependency_job_id":null,"html_url":"https://github.com/dsietz/test-data-generation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsietz%2Ftest-data-generation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsietz%2Ftest-data-generation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsietz%2Ftest-data-generation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsietz%2Ftest-data-generation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsietz","download_url":"https://codeload.github.com/dsietz/test-data-generation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221669347,"owners_count":16860855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","archconf","data","data-privacy","generate","json","machine-learning","markov-decision-processes","nfjs","privacy","profile","rust-lang","testing"],"created_at":"2024-08-02T09:01:27.346Z","updated_at":"2024-10-27T11:35:28.077Z","avatar_url":"https://github.com/dsietz.png","language":"Rust","readme":"## Test Data Generation\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Coverage Status](https://coveralls.io/repos/github/dsietz/test-data-generation/badge.svg?branch=master)](https://coveralls.io/github/dsietz/test-data-generation?branch=master)\n[![Docs.rs](https://docs.rs/test-data-generation/badge.svg)](https://docs.rs/test-data-generation)\n\nLinux: [![Build Status](https://github.com/dsietz/test-data-generation/actions/workflows/master.yaml/badge.svg)](https://github.com/dsietz/test-data-generation/actions/workflows/master.yaml)\nWindows: [![Build status](https://ci.appveyor.com/api/projects/status/uw58v5t8ynwj8s8o/branch/master?svg=true)](https://ci.appveyor.com/project/dsietz/test-data-generation/branch/master)\n\n## [Fast test data generation!](#head1234)\n\n### Description\nFor software development teams who need realistic test data for testing their software, this Test Data Generation library is a light-weight module that implements Markov decision process machine learning to quickly and easily profile sample data, create an algorithm, and produce representative test data without the need for persistent data sources, data cleaning, or remote services. Unlike other solutions, this open source solution can be integrated into your test source code, or wrapped into a web service or stand-alone utility.   \n\n**PROBLEM**\n\u003c/br\u003e\nIn order to make test data represent production, (a.k.a. realistic) you need to perform one of the following:\n+ load data from a production environment into the non-production environment, which requires ETL (e.g.: masking, obfuscation, etc.)\n+ stand up a pre-loaded \"profile\" database that is randomly sampled, which requires preparing sample data from either another test data source\nor production environment (option #1 above)\n\n**SOLUTION**\n\u003c/br\u003e\n Incorporate this library in your software's testing source code by loading an algorithm from a previously analyzed data sample and generating\n test data during your tests runtime.\n\n---\n\n### Table of Contents\n- [Test Data Generation](#test-data-generation)\n- [Fast test data generation!](#fast-test-data-generation)\n  - [Description](#description)\n  - [Table of Contents](#table-of-contents)\n- [What's New](#whats-new)\n- [About](#about)\n- [Usage](#usage)\n  - [Profile](#profile)\n  - [Data Sample Parser](#data-sample-parser)\n- [Examples](#examples)\n- [How to Contribute](#how-to-contribute)\n- [License](#license)\n\n## What's New\n\nHere's what's new ...\n\n**0.3.4**\n+ [Upgrade crates and improve performance](https://github.com/dsietz/test-data-generation/pull/100)\n\n## About\n\n`test data generation` uses [Markov decision process](https://en.wikipedia.org/wiki/Markov_decision_process) machine learning to create algorithms that enable test data generation on the fly without the overhead\nof test data databases, security data provisioning (e.g.: masking, obfuscation), or standing up remote services.\n\nThe algorithm is built on the bases of:\n1. character patterns\n2. frequency of patterns\n3. character locations\n4. beginning and ending characters\n5. length of entity (string, date, number)\n\n## Usage\n\nThere are multiple ways to use the Test Data Generation library. It all depends on your intent.\n\n### Profile\n\nThe easiest way is to use a Profile. The `profile` module provides functionality to create a profile on a data sample (Strings).\nOnce a profile has been made, data can be generated by calling the _pre_generate()_ and _generate()_ functions, in that order.\n\n```rust\nextern crate test_data_generation;\n\nuse test_data_generation::profile::profile::Profile;\n\nfn main() {\n  // analyze the dataset\n  let mut data_profile =  Profile::new();\n\n  // analyze the dataset\n  data_profile.analyze(\"Smith, John\");\n  data_profile.analyze(\"Doe, John\");\n  data_profile.analyze(\"Dale, Danny\");\n  data_profile.analyze(\"Rickets, Ronney\");\n\n  // confirm 4 data samples were analyzed   \t\t\n  assert_eq!(data_profile.patterns.len(), 4);\n\n  // prepare the generator\n  data_profile.pre_generate();\n\n  // generate some data\n  println!(\"The generated name is {:?}\", data_profile.generate());\n\n  // save the profile (algorithm) for later\n  assert_eq!(data_profile.save(\u0026String::from(\"./tests/samples/sample-00-profile\")).unwrap(), true);\n\n  // later... create a new profile from the saved archive file\n  let mut new_profile = Profile::from_file(\u0026String::from(\"./tests/samples/sample-00-profile\"));\n  new_profile.pre_generate();\n\n  // generate some data\n  println!(\"The generated name is {:?}\", new_profile.generate());\n}\n```\n\n### Data Sample Parser\n\nIf you are using CSV files of data samples, then you may wish to use a Data Sample Parser.\nThe `data_sample_parser` module provides functionality to read sample data, parse and analyze it, so that test data can be generated based on profiles.\n\n```rust\nextern crate test_data_generation;\nuse test_data_generation::data_sample_parser::DataSampleParser;\n\nfn main() {\n  let mut dsp = DataSampleParser::new();\n  dsp.analyze_csv_file(\u0026String::from(\"./tests/samples/sample-01.csv\"), None).unwrap();\n\n  println!(\"My new name is {} {}\", dsp.generate_record()[0], dsp.generate_record()[1]);\n  // My new name is Abbon Aady\n}\n```\n\nYou can also save the Data Sample Parser (the algorithm) as an archive file (json) ...\n\n```rust\nextern crate test_data_generation;\nuse test_data_generation::data_sample_parser::DataSampleParser;\n\nfn main() {\n  let mut dsp =  DataSampleParser::new();  \n  dsp.analyze_csv_file(\u0026String::from(\"./tests/samples/sample-01.csv\"), None).unwrap();\n\n  assert_eq!(dsp.save(\u0026String::from(\"./tests/samples/sample-01-dsp\")).unwrap(), true);\n}\n```\n\nand use it at a later time.\n\n```rust\nextern crate test_data_generation;\nuse test_data_generation::data_sample_parser::DataSampleParser;\n\nfn main() {\n  let mut dsp = DataSampleParser::from_file(\u0026String::from(\"./tests/samples/sample-01-dsp\"));\n\n\tprintln!(\"Sample data is {:?}\", dsp.generate_record()[0]);\n}\n```\n\nYou can also generate a new csv file based on the data sample provided.\n\n```rust\nextern crate test_data_generation;\nuse test_data_generation::data_sample_parser::DataSampleParser;\n\nfn main() {\n  let mut dsp =  DataSampleParser::new();  \n\n  dsp.analyze_csv_file(\u0026String::from(\"./tests/samples/sample-01.csv\"), None).unwrap();\n  dsp.generate_csv(100, \u0026String::from(\"./tests/samples/generated-01.csv\"), None).unwrap();\n}\n```\n\n## Examples\n\nThis library comes with the following examples. To run the examples.\n+ [Demo 1](https://github.com/dsietz/test-data-generation/blob/master/examples/01_demo.rs) : Demonstrates the basic feature of the library to generate dates and people's names from the built-in demo data sets. \n   \u003e `cargo run --example 01_demo`\n+ [Demo 2](https://github.com/dsietz/test-data-generation/blob/master/examples/02_demo.rs) : Demonstrates the basic feature of the library to generate dates and people's names from a CSV file.\n   \u003e `cargo run --example 02_demo`\n+ [Demo 3](https://github.com/dsietz/test-data-generation/blob/master/examples/03_demo.rs) : Demonstrates the ability to continuously add new analyzed data to an existing profile. \n   \u003e `cargo run --example 03_demo`\n\n## How to Contribute\n\nDetails on how to contribute can be found in the [CONTRIBUTING](./CONTRIBUTING.md) file.\n\n## License\n\ntest-data-generation is primarily distributed under the terms of the Apache License (Version 2.0).\n\nSee [LICENSE-APACHE \"Apache License](./LICENSE-APACHE) for details.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsietz%2Ftest-data-generation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsietz%2Ftest-data-generation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsietz%2Ftest-data-generation/lists"}