AggregatorProcessor

class burdoc.processors.aggregator_processor.AggregatorProcessor(processors: List[Type[Processor]], processor_args: Dict[str, Dict[str, Any]] | None = None, additional_reqs: List[str] | None = None, render_default: bool = False, log_level: int = 20)

The Aggregator processor is used to combine several processors into a single processing step. Best practice is to place any chain of processors within an aggregator when each step in the chain runs of the same data and can be run within the same thread. This minimises the overhead of copying data between threads.

__init__(processors: List[Type[Processor]], processor_args: Dict[str, Dict[str, Any]] | None = None, additional_reqs: List[str] | None = None, render_default: bool = False, log_level: int = 20)

Create AggregatorProcessor.

Parameters:
  • processors (List[Type[Processor]]) – List of processors to be run together, in desired execution order.

  • processor_args (Optional[Dict[str, Dict[str, Any]]], optional) – Any initialisation parameters to be passed to the processors. Can also use a special ‘render’ argument to control whether each processor output gets drawin if the render step is used. Defaults to None.

  • additional_reqs (Optional[List[str]], optional) – Any additional requirements that should be added to the requirements list. Can be used to force ingest of a field that is modified within the AggregatorProcessor. Defaults to None.

  • render_default – Whether each processor renders by default (when global rendering is enabled).

  • log_level (int, optional) – Log level. Defaults to logging.INFO.

add_generated_items_to_fig(page_number: int, fig: Figure, data: Dict[str, Any])

Draw any items generated by this processor to a page image

generates() List[str]

Returns the superset of fields generated by the child processors

Returns:

List[str]

initialise()

Run initialise for all child processors

requirements() Tuple[List[str], List[str]]

Generates a smart superset of fields required by the child procesors.

Note that if a field is generated by an earlier processor if won’t be added to the requirements. If you want to manually require this field (e.g. as it’s initially generated by a non-aggregated processor) you can add it via additional_reqs argument in class instantiation.

Returns:

Required and optional fields

Return type:

Tuple[List[str], List[str]]