bridge.pipelines.protocols.map module#

Abstract class for mapping between repository and metadata models.

class bridge.pipelines.protocols.map.MapItem(**data)[source]#

Bases: BaseModel

Map metadata property to corresponding repository metadata property and match method.

Parameters:
  • schema_entry (Any)

  • repo_entry (Any)

  • method (Method | None)

  • fn (Callable[[Any, Any], Any] | None)

classmethod ensure_callable_or_none(v)[source]#

Validate that fn is either None, a callable, or a dotted path to a callable.

fn: Callable[[Any, Any], Any] | None#
method: Method | None#
repo_entry: Any#
async run()[source]#

Run the mapping function if provided, otherwise return None.

Returns:

The result of the mapping function or None.

Return type:

Any

schema_entry: Any#
serialize_fn(fn)[source]#

Serialize fn to a dotted path.

class bridge.pipelines.protocols.map.Method(*values)[source]#

Bases: Enum

Matching method for mapping metadata record from one platform to another (GitHub, bio.tools).

class bridge.pipelines.protocols.map.ModelsMap(repo, metadata)[source]#

Bases: ABC

Abstract class for mapping between repository and metadata models.

Parameters:
  • repo (Any) – A repository model instance.

  • metadata (Any) – A metadata model instance.

abstract property map: dict[str, Any]#

Perform the mapping between repository and metadata models.

Returns:

The map representation of the models.

Return type:

Any