Code Monkey home page Code Monkey logo

tofu's Introduction

Tofu

DOI

tofu

Tofu is a Python library for generating synthetic UK Biobank data.

The UK Biobank is a large open-access prospective research cohort study of 500,000 middle aged participants recruited in England, Scotland and Wales. The study has collected and continues to collect extensive phenotypic and genotypic detail about its participants, including data from questionnaires, physical measures, sample assays, accelerometry, multimodal imaging, genome-wide genotyping and longitudinal follow-up for a wide range of health-related outcomes.

Tofu will generate synthetic data which conform to the structure of the baseline data UK Biobank sends researchers by generating random values:

  • For categorical variables (single or multiple choices), a random value will be picked from the UK Biobank data dictionary for that field.
  • For continous variables, a random value will be generated based on the distribution of values reported for that field on the UK Biobank showcase.
  • For date and date/time fields, a random date will be generated.
  • For all other fields, such as polymorphic fields, no data will be generated.

Some general observations:

  • The lookups directory contains lookups downloaded from the UK Biobank showcase - they might need to be updated when new fields become available.
  • Data conform to the structure and schema of the baseline file but are otherwise nonsensical: no checks have been implemented across fields.
  • All eid's (patient identifiers) generated from this tool are prefaced with 'fake' in order to avoid confusion with legitimate datasets.
  • Dates randomly generated are between 1910 and 1990 again to avoid confusion with real data.

You can find more information on the UK Biobank here:

Usage

Generate synthetic data for 100 patients across all baseline fields (not advised unless you really have the entire dataset):

python tofu.py -n 100
Wrote synthetic-20200128181342.csv shape (100,21946).

Generate synthetic data for 100 patients for fields 3 and 20002

Note: you do not have to specify the eid in the list of fields since all generated datasets include it by default.

python tofu.py -n 100 --field 3 20002
Wrote synthetic-20200128171143.csv shape (10,103).

Generate synthetic data for 100 patients for fields 3 and 20002 and make 10% of values missing.

python tofu.py -n 100 --field 3 20002 -j 10
Wrote synthetic-20200128191124.csv shape (100,103).

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Cite as

Spiros Denaxas. (2020). spiros/tofu: Updated release for DOI (Version v1.1). Zenodo. http://doi.org/10.5281/zenodo.3634604

License

MIT

tofu's People

Contributors

spiros avatar

Watchers

James Cloos avatar

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.