aind_data_schema.utils package


aind_data_schema.utils.diagrams module

Module to build diagrams of core models

aind_data_schema.utils.diagrams.save_all_core_model_diagrams(output_directory: Path | None = None) None

Save all the core model diagrams to a directory. :param output_directory: Location where to save the diagrams to. Default is current directory :type output_directory: Optional[Path]

Return type:


aind_data_schema.utils.diagrams.save_diagram(model: Type[BaseModel], output_directory: Path | None = None, filename: str | None = None) None

Save a BaseModel diagram to a directory. :param model: Model to create a diagram. For example,

from aind_data_schema.core.subject import Subject model = Subject

  • output_directory (Optional[Path]) – If None, will use current working directory.

  • filename (Optional[str]) – If None, will use model class name plus ‘.svg’

Return type:


aind_data_schema.utils.json_writer module

Utility method to write Pydantic schemas to JSON

class aind_data_schema.utils.json_writer.SchemaWriter(args: list)

Bases: object

Class to write Pydantic schemas to JSON

DEFAULT_FILE_PATH = '/home/docs/checkouts/'
static get_schemas() Iterator[AindCoreModel]

Returns Iterator of AindCoreModel classes

write_to_json() None

Writes Pydantic models to JSON file.

aind_data_schema.utils.schema_version_bump module

Module to handle the schema_versions

class aind_data_schema.utils.schema_version_bump.SchemaVersionHandler(commit_message: str = '', json_schemas_location: Path = PosixPath('/home/docs/checkouts/'))

Bases: object

Class that manages semantic versioning of the schemas


This method will compare the json schema generated by the core models to the json schema in the schemas folder, see which schemas have changed, increment the versions, and update the necessary files.

Module contents

Utility methods