Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate input-files with Pydantic and add CLI for validation #48

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

OscartGiles
Copy link
Contributor

@OscartGiles OscartGiles commented Jan 15, 2021

Summary (WIP)

Warning ⚠️ ☢️ Because I only have implemented this for CTGAN merging to develop will break the whole pipeline. So should only merge once/if every input type has a schema implemented. Also requires additional info for CTGAN for complete validation

I was going to point this at #45 but as it's behind develop its impossible to see diffs.

  • Adds python module schema for defining schema for input-json files using Pydantic. Pydantic can also generate JSON Schema
  • Validating JSON files in synthesize.py using the module
  • Add a simple CLI to validate input files (see reviewer notes)
  • CLI can template the form created by @ots22 with the JSON Schema from pydantic

Dependencies

I added these to env-configurations but maybe this is not the best place. If we like the CLI maybe it should be a package.

Reviewer notes

Test out the CLI:

Docs

python quipp_cli.py --help      

Validate an input file (mess with the file to see errors)

python quipp_cli.py validate run-inputs/ctgan-example-0.json  

But only implemented for CTGAN at the moment (see error)

python quipp_cli.py validate run-inputs/sgf-example-0.json          

Get JSON Schema for a given method

python quipp_cli.py schema CTGAN           

Create an input file in a browser (from @ots22 )

python quipp_cli.py create CTGAN

May want better command names. Because I haven't added any info for validating beyond field names and types the webform is quite minimal.

I thought one form per method type might be best? Thoughts @ots22 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants