ocrd_network.models package

DB prefix stands for Database Models PY prefix stands for Pydantic Models

class ocrd_network.models.DBProcessorJob(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, job_id: str, processor_name: str, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, state: StateEnum, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, parameters: dict | None = None, depends_on: List[str] | None = None, result_queue_name: str | None = None, callback_url: str | None = None, internal_callback_url: str | None = None, start_time: datetime | None = None, end_time: datetime | None = None, exec_time: str | None = None, log_file_path: str | None = None)[source]

Bases: Document

Job representation in the database

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

job_id: str
processor_name: str
path_to_mets: str | None
workspace_id: str | None
description: str | None
state: StateEnum
input_file_grps: List[str]
output_file_grps: List[str] | None
page_id: str | None
parameters: dict | None
depends_on: List[str] | None
result_queue_name: str | None
callback_url: str | None
internal_callback_url: str | None
start_time: datetime | None
end_time: datetime | None
exec_time: str | None
log_file_path: str | None
class Settings[source]

Bases: object

use_enum_values = True
to_job_output() PYJobOutput[source]
class ocrd_network.models.DBWorkflowJob(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, job_id: str, page_id: str, page_wise: bool = False, processing_job_ids: Dict, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, workflow_callback_url: str | None = None)[source]

Bases: Document

Workflow job representation in the database

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

job_id: str
page_id: str
page_wise: bool
processing_job_ids: Dict
path_to_mets: str | None
workspace_id: str | None
description: str | None
workflow_callback_url: str | None
class Settings[source]

Bases: object

use_enum_values = True
to_job_output() PYWorkflowJobOutput[source]
class ocrd_network.models.DBWorkspace(*args, _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 processor (server or 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 if the input data cannot be parsed to form a valid model.

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'
class ocrd_network.models.PYJobInput(*, processor_name: str | None = None, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, parameters: dict = {}, result_queue_name: str | None = None, callback_url: str | None = None, agent_type: str | None = 'worker', job_id: str | None = None, depends_on: List[str] | None = None)[source]

Bases: BaseModel

Wraps the parameters required to make a run-processor-request

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

processor_name: str | None
path_to_mets: str | None
workspace_id: str | None
description: str | None
input_file_grps: List[str]
output_file_grps: List[str] | None
page_id: str | None
parameters: dict
result_queue_name: str | None
callback_url: str | None
agent_type: str | None
job_id: str | None
depends_on: List[str] | None
class Config[source]

Bases: object

schema_extra = {'example': {'description': 'The description of this execution', 'input_file_grps': ['INPUT_FILE_GROUP'], 'output_file_grps': ['OUTPUT_FILE_GROUP'], 'page_id': 'PAGE_ID', 'parameters': {}, 'path_to_mets': '/path/to/mets.xml'}}
class ocrd_network.models.PYJobOutput(*, job_id: str, processor_name: str, state: StateEnum, path_to_mets: str | None = None, workspace_id: str | None = None, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, log_file_path: str | None = None)[source]

Bases: BaseModel

Wraps output information for a job-response

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

job_id: str
processor_name: str
state: StateEnum
path_to_mets: str | None
workspace_id: str | None
input_file_grps: List[str]
output_file_grps: List[str] | None
page_id: str | None
log_file_path: str | None
class ocrd_network.models.PYOcrdTool(*, executable: str, categories: List[str], description: str, input_file_grp: List[str], output_file_grp: List[str] | None = None, steps: List[str], parameters: dict | None = None)[source]

Bases: BaseModel

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

executable: str
categories: List[str]
description: str
input_file_grp: List[str]
output_file_grp: List[str] | None
steps: List[str]
parameters: dict | None
class ocrd_network.models.PYResultMessage(*, job_id: str, state: StateEnum, path_to_mets: str | None = None, workspace_id: str | None = None)[source]

Bases: BaseModel

Wraps the parameters required to make a result message request

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

job_id: str
state: StateEnum
path_to_mets: str | None
workspace_id: str | None
class Config[source]

Bases: object

schema_extra = {'example': {'job_id': '123123123', 'path_to_mets': '/path/to/mets.xml', 'state': 'SUCCESS', 'workspace_id': 'c7f25615-fc17-4365-a74d-ad20e1ddbd0e'}}
class ocrd_network.models.PYWorkflowJobOutput(*, job_id: str, page_id: str, page_wise: bool = False, processing_job_ids: Dict, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None)[source]

Bases: BaseModel

Wraps output information for a workflow job-response

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

Raises ValidationError if the input data cannot be parsed to form a valid model.

job_id: str
page_id: str
page_wise: bool
processing_job_ids: Dict
path_to_mets: str | None
workspace_id: str | None
description: str | None
class ocrd_network.models.StateEnum(value)[source]

Bases: str, Enum

An enumeration.

cached = 'CACHED'
cancelled = 'CANCELLED'
queued = 'QUEUED'
running = 'RUNNING'
success = 'SUCCESS'
failed = 'FAILED'

Submodules