API Documentation

Validation

This is the main module of the package. It contains functions for schema generation and data validation.

generate_validation_schema(parts: list[dict], sets: list[dict] = [], schema_version: str = '2.2.3', schema_additions: dict = {}) dict

Generates a validation schema.

Parameters:
  • parts – the ODM parts table data.

  • sets – the ODM sets table data.

  • schema_version – the ODM version to generate the schema for.

  • schema_additions – any additional rules to inject into the schema.

validate_data(schema: dict, data: dict[str, list[dict]], data_kind: DataKind = DataKind.python, data_version: str = '2.2.3', rule_blacklist: list[RuleId] = []) ValidationReport

Validates data with schema, using Cerberus.

Parameters:
  • schema – the schema to validate.

  • data – the data to validate using the specified schema.

  • data_kind – the data kind, used to show correct line numbers.

  • data_version – the data’s ODM version.

  • rule_blacklist – a list of rule ids to explicitly disable.

Utils

import_csv_file(path: str) list[dict]
import_dataset(path: str) list[dict]

wrapper of import_csv_file

import_json_file(path: str) dict
import_yaml_file(path: str) dict

Specification