Skip to main content

Validator of output files for Omnibencharmk.

Project description

omniValidator

omniValidator is a python module to control file requirements in an Omnibenchmark project.

Usage

The following sections assume that your working directory is an Omnibenchmark project associated to an existing Omnibenchmark and stage (data, method, metric, etc.).

You can check here if the Omnibenchmark you are working on has available validators.

If you are working with an Omnibenchmark object, the main function (omniValidator.validate_requirements) can be used without other specifications.

Display the requirements

The requirements for a given Omnibenchmark module can be visualized with the following function:

import omniValidator as ov
from omnibenchmark.utils.build_omni_object import get_omni_object_from_yaml
from omnibenchmark.renku_commands.general import renku_save

## Load config
omni_obj = get_omni_object_from_yaml('src/config.yaml')

## shows the requirements
ov.display_requirements(omni_obj = omni_obj)

which will render an html table of the requirements needed for the Omnibenchmark project you are working on.

Validate required files and JSON files

The validate_all function of omniValidator shows you how to check for:

  • output files needed for the downstream modules and if they are correctly generated and named

  • JSON files that you created and if they are correctly formatted (ie, contain the required fields for downstream projects)

import omniValidator as ov
ov.validate_all(
    benchmark = 'omni_batch_py', 
    keyword = 'omni_batch_data', 
    data_folder = 'examples/csf-patients-py/data/csf_patient_py'
)

which will raise an Exception if an output file is missing or if a JSON file is badly formatted.

Validate required files only

The output files of an Omnibenchmark workflow can be validated by specifying an omnibenchmark object:

import omniValidator as ov
from omnibenchmark.utils.build_omni_object import get_omni_object_from_yaml
from omnibenchmark.renku_commands.general import renku_save

## Load config
omni_obj = get_omni_object_from_yaml('src/config.yaml')

## Validates the output mapping
ov.validate_requirements(omni_obj = omni_obj)

Which will return a boolean (True) if valid and an Exception error if some output are missing.

If multiple output are detected, you will get a warning message such as below:

.../omniValidator/src/omniValidator/core.py:119: UserWarning: Multiple files associated to counts.*mtx.gz:
['csf_patient_py_counts (copy).mtx.gz', 'csf_patient_py_counts.mtx.gz']

It is highly advised to check your workflow if this happens as it might create issues in downstream steps.

The output files of an Omnibenchmark workflow can also be validated with manual specifications, assuming that the output files were already generated:

import omniValidator as ov
ov.validate_requirements(
    benchmark = 'omni_batch_py', 
    keyword = 'omni_batch_data', 
    data_folder = 'examples/csf-patients-py/data/csf_patient_py'
)

Validation requirements can be accessed on the official repo of the module.

Validate JSON files only

JSON files contain metadata and are used in most Omnibenchmark projects. The content and structure of JSON files can be validated as follows:

import omniValidator as ov

## Retrieve the schema validator associated with your project
sch = ov.get_schema(
    benchmark = 'omni_batch_py', 
    keyword = 'omni_batch_data', 
    ftype = 'data_info'
)
## Validate your JSON file
ov.validate_json_file(
    json_input_path = 'examples/csf-patients-py/data/csf_patient_py/csf_patient_py_data_info_CORRECT.json', 
    json_schema_path = sch
)

Which returns a boolean (True) if your JSON is valid.

How to modify requirements

You can modify existing requirements/ JSON schemas or add new ones using pull requests or by opening an issue on the Github page of the module.

All schemas and requirements are in the src/omniValidator/schemas folder of the module.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omniValidator-0.0.15.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omniValidator-0.0.15-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file omniValidator-0.0.15.tar.gz.

File metadata

  • Download URL: omniValidator-0.0.15.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for omniValidator-0.0.15.tar.gz
Algorithm Hash digest
SHA256 a3d829edcaa677a88449ca1b1bf3cae7b908cc8acf5f64fbb22c891dd5580340
MD5 4ea6e16eb41beb4842339c5f3e858a21
BLAKE2b-256 1320018141e262c6e8942579ddfb1996239d379bdd666d5997ca95d4df5da2bc

See more details on using hashes here.

File details

Details for the file omniValidator-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: omniValidator-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for omniValidator-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 97b8695025d3cd92898a94e7b1614ad66c85eb1ff74e5c357cb9a83f968c6460
MD5 9fa02595d8f4c2fa4c68ba5ab2ba84be
BLAKE2b-256 31e3f63edcf6da139dbbbf70437163e6d2e1a598141949413c91bb02919acad1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page