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: JobState = JobState.unset, 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: JobState
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.DBWorkflowScript(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, workflow_id: str, content: str, content_hash: str)[source]

Bases: Document

Model to store a workflow-script 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.

workflow_id: str
content: str
content_hash: str
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: AgentType = AgentType.PROCESSING_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: AgentType
job_id: str | None
depends_on: List[str] | None
class Config[source]

Bases: object

schema_extra = {'example': {'agent_type': AgentType.PROCESSING_WORKER, 'description': 'The description of this execution', 'input_file_grps': ['DEFAULT'], 'output_file_grps': ['OCR-D-BIN'], 'page_id': 'PHYS_0001..PHYS_0003', 'parameters': {}, 'path_to_mets': '/path/to/mets.xml'}}
class ocrd_network.models.PYJobOutput(*, job_id: str, processor_name: str, state: JobState = JobState.unset, 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: JobState
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: JobState = JobState.unset, 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: JobState
path_to_mets: str | None
workspace_id: str | None
class Config[source]

Bases: object

schema_extra = {'example': {'job_id': 'd8e36726-ed28-5476-b83c-bc31d2eecf1f', 'path_to_mets': '/path/to/mets.xml', 'state': JobState.success, 'workspace_id': 'c7f25615-fc17-4365-a74d-ad20e1ddbd0e'}}
class ocrd_network.models.PYWorkflowJobOutput(*, processing_job_ids: Dict[str, List[str]], page_id: str, page_wise: bool = False, job_id: str, 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.

processing_job_ids: Dict[str, List[str]]
page_id: str
page_wise: bool
job_id: str
path_to_mets: str | None
workspace_id: str | None
description: str | None

Submodules