ocrd_network.models.workspace module

class ocrd_network.models.workspace.DBWorkspace(*args: Any, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, workspace_id: str, workspace_mets_path: str, ocrd_identifier: str, bagit_profile_identifier: str, ocrd_base_version_checksum: str | None = None, ocrd_mets: str | None = None, bag_info_adds: dict | None = None, mets_server_url: str | None = None, deleted: bool = False)[source]

Bases: Document

Model to store a workspace in the mongo-database.

Information to handle workspaces and from bag-info.txt are stored here.

ocrd_identifier             Ocrd-Identifier
Type:

mandatory

bagit_profile_identifier    BagIt-Profile-Identifier
Type:

mandatory

ocrd_base_version_checksum  Ocrd-Base-Version-Checksum
Type:

mandatory

ocrd_mets                   Ocrd-Mets
Type:

optional

bag_info_adds               bag-info.txt can also

key-value-pairs which are saved here

Type:

optionally

deleted                     the document is deleted if set, however, the record is still preserved
pages_locked                a data structure that holds output `fileGrp`s and their respective locked `page_id`

that are currently being processed by an OCR-D Processing-Worker. If no page_id field is set, an identifier “all_pages” will be used.

mets_server_url             If set, the reading from and writing to the mets file happens through the METS Server

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

workspace_id: str
workspace_mets_path: str
ocrd_identifier: str
bagit_profile_identifier: str
ocrd_base_version_checksum: str | None
ocrd_mets: str | None
bag_info_adds: dict | None
mets_server_url: str | None
deleted: bool
class Settings[source]

Bases: object

name = 'workspace'
model_config = {'alias_generator': <function document_alias_generator>, 'json_schema_extra': <function json_schema_extra>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.