medkit.core.operation#

Classes#

Operation

Abstract class for all annotator modules.

DocOperation

Abstract operation directly executed on text documents.

Module Contents#

class medkit.core.operation.Operation(uid: str | None = None, name: str | None = None, **kwargs)#

Bases: abc.ABC

Abstract class for all annotator modules.

Parameters:
uid: str, optional

Operation identifier

name: str, optional

Operation name (defaults to class name)

kwargs:

All other arguments of the child init useful to describe the operation

Examples

In the __init__ function of your annotator, use:

>>> init_args = locals()
>>> init_args.pop("self")
>>> super().__init__(**init_args)
uid: str#
_description: medkit.core.operation_desc.OperationDescription | None = None#
_prov_tracer: medkit.core.prov_tracer.ProvTracer | None = None#
set_prov_tracer(prov_tracer: medkit.core.prov_tracer.ProvTracer)#

Enable provenance tracing.

Parameters:
prov_tracer: ProvTracer

The provenance tracer used to trace the provenance.

property description: medkit.core.operation_desc.OperationDescription#

Contains all the operation init parameters.

check_sanity() bool#
class medkit.core.operation.DocOperation(uid: str | None = None, name: str | None = None, **kwargs)#

Bases: Operation

Abstract operation directly executed on text documents.

It uses a list of documents as input for running the operation and creates annotations that are directly appended to these documents.

abstract run(docs: list[medkit.core.document.Document]) None#