Skip to content

data_mapper.aind_data_schema

AindDataSchemaDataMapper

Bases: DataMapper[_TAdsObject], ABC

Abstract base class for mapping data to aind-data-schema objects.

This class provides the foundation for mapping experimental data to AIND data schema formats, ensuring consistent structure and metadata handling across different data types.

Attributes:

Name Type Description
session_name str

The name of the session associated with the data

Example
# Example subclass implementing session_name
class MySessionMapper(AindDataSchemaDataMapper):
    @property
    def session_name(self) -> str:
        return "session_001"

session_name abstractmethod property

session_name: str

Abstract property that must be implemented to return the session name.

Subclasses must implement this property to provide the session name associated with the data being mapped.

Returns:

Name Type Description
str str

The name of the session

mapped abstractmethod property

mapped: TMapTo

Retrieves the mapped data object.

This property should return the successfully mapped data object. Implementations should ensure that mapping has been completed before returning the data.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

This method should contain the core logic for transforming input data into the target format specified by the TMapTo type parameter.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
56
57
58
59
60
61
62
63
64
65
66
67
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    This method should contain the core logic for transforming input data
    into the target format specified by the TMapTo type parameter.

    Returns:
        TMapTo: The mapped data object
    """
    pass

is_mapped abstractmethod

is_mapped() -> bool

Checks if the data has been successfully mapped.

This method should verify whether the mapping operation has been completed and the data is available in the target format.

Returns:

Name Type Description
bool bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
69
70
71
72
73
74
75
76
77
78
79
80
@abc.abstractmethod
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    This method should verify whether the mapping operation has been completed
    and the data is available in the target format.

    Returns:
        bool: True if the data is mapped, False otherwise
    """
    pass

AindDataSchemaSessionDataMapper

Bases: AindDataSchemaDataMapper[Session], ABC

Abstract base class for mapping session data to aind-data-schema Session objects.

This class specializes the generic data mapper for session-specific data, providing the interface for converting experimental session data to the AIND data schema Session format.

mapped abstractmethod property

mapped: TMapTo

Retrieves the mapped data object.

This property should return the successfully mapped data object. Implementations should ensure that mapping has been completed before returning the data.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

session_name abstractmethod property

session_name: str

Abstract property that must be implemented to return the session name.

Subclasses must implement this property to provide the session name associated with the data being mapped.

Returns:

Name Type Description
str str

The name of the session

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

This method should contain the core logic for transforming input data into the target format specified by the TMapTo type parameter.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
56
57
58
59
60
61
62
63
64
65
66
67
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    This method should contain the core logic for transforming input data
    into the target format specified by the TMapTo type parameter.

    Returns:
        TMapTo: The mapped data object
    """
    pass

is_mapped abstractmethod

is_mapped() -> bool

Checks if the data has been successfully mapped.

This method should verify whether the mapping operation has been completed and the data is available in the target format.

Returns:

Name Type Description
bool bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
69
70
71
72
73
74
75
76
77
78
79
80
@abc.abstractmethod
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    This method should verify whether the mapping operation has been completed
    and the data is available in the target format.

    Returns:
        bool: True if the data is mapped, False otherwise
    """
    pass

AindDataSchemaRigDataMapper

Bases: AindDataSchemaDataMapper[Rig], ABC

Abstract base class for mapping rig data to aind-data-schema Rig objects.

This class specializes the generic data mapper for rig-specific data, providing the interface for converting experimental rig configurations to the AIND data schema Rig format.

mapped abstractmethod property

mapped: TMapTo

Retrieves the mapped data object.

This property should return the successfully mapped data object. Implementations should ensure that mapping has been completed before returning the data.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

session_name abstractmethod property

session_name: str

Abstract property that must be implemented to return the session name.

Subclasses must implement this property to provide the session name associated with the data being mapped.

Returns:

Name Type Description
str str

The name of the session

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

This method should contain the core logic for transforming input data into the target format specified by the TMapTo type parameter.

Returns:

Name Type Description
TMapTo TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
56
57
58
59
60
61
62
63
64
65
66
67
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    This method should contain the core logic for transforming input data
    into the target format specified by the TMapTo type parameter.

    Returns:
        TMapTo: The mapped data object
    """
    pass

is_mapped abstractmethod

is_mapped() -> bool

Checks if the data has been successfully mapped.

This method should verify whether the mapping operation has been completed and the data is available in the target format.

Returns:

Name Type Description
bool bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
69
70
71
72
73
74
75
76
77
78
79
80
@abc.abstractmethod
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    This method should verify whether the mapping operation has been completed
    and the data is available in the target format.

    Returns:
        bool: True if the data is mapped, False otherwise
    """
    pass