Skip to content

data_mapper.aind_data_schema

AindDataSchemaDataMapper

Bases: DataMapper[_TAdsObject], ABC

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

Provides the foundation for mapping experimental data to AIND data schema formats, ensuring consistent structure and metadata handling.

session_name abstractmethod property

session_name: str

Returns the session name associated with the data.

Returns:

Type Description
str

The name of the session

mapped property

mapped: TMapTo

Retrieves the mapped data object.

Returns:

Type Description
TMapTo

The mapped data object

Raises:

Type Description
ValueError

If the data has not been mapped yet

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

Returns:

Type Description
TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
25
26
27
28
29
30
31
32
33
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    Returns:
        The mapped data object
    """
    pass

is_mapped

is_mapped() -> bool

Checks if the data has been successfully mapped.

Returns:

Type Description
bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
35
36
37
38
39
40
41
42
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    Returns:
        True if the data is mapped, False otherwise
    """
    return self._mapped is not None

AindDataSchemaSessionDataMapper

Bases: AindDataSchemaDataMapper[Session], ABC

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

Specializes the generic data mapper for session-specific data, providing the interface for converting experimental session data to the AIND data schema format.

mapped property

mapped: TMapTo

Retrieves the mapped data object.

Returns:

Type Description
TMapTo

The mapped data object

Raises:

Type Description
ValueError

If the data has not been mapped yet

session_name abstractmethod property

session_name: str

Returns the session name associated with the data.

Returns:

Type Description
str

The name of the session

session_schema

session_schema() -> Session

Returns the session schema for the mapped session data.

Returns:

Type Description
Session

The session schema object

Source code in src/clabe/data_mapper/aind_data_schema.py
72
73
74
75
76
77
78
79
def session_schema(self) -> Session:
    """
    Returns the session schema for the mapped session data.

    Returns:
        The session schema object
    """
    raise NotImplementedError("Subclasses must implement this method to return the session schema.")

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

Returns:

Type Description
TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
25
26
27
28
29
30
31
32
33
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    Returns:
        The mapped data object
    """
    pass

is_mapped

is_mapped() -> bool

Checks if the data has been successfully mapped.

Returns:

Type Description
bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
35
36
37
38
39
40
41
42
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    Returns:
        True if the data is mapped, False otherwise
    """
    return self._mapped is not None

AindDataSchemaRigDataMapper

Bases: AindDataSchemaDataMapper[Rig], ABC

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

Specializes the generic data mapper for rig-specific data, providing the interface for converting experimental rig configurations to the AIND data schema format.

mapped property

mapped: TMapTo

Retrieves the mapped data object.

Returns:

Type Description
TMapTo

The mapped data object

Raises:

Type Description
ValueError

If the data has not been mapped yet

session_name abstractmethod property

session_name: str

Returns the session name associated with the data.

Returns:

Type Description
str

The name of the session

rig_schema

rig_schema() -> Rig

Returns the rig schema for the mapped rig data.

Returns:

Type Description
Rig

The rig schema object

Source code in src/clabe/data_mapper/aind_data_schema.py
90
91
92
93
94
95
96
97
def rig_schema(self) -> Rig:
    """
    Returns the rig schema for the mapped rig data.

    Returns:
        The rig schema object
    """
    raise NotImplementedError("Subclasses must implement this method to return the rig schema.")

map abstractmethod

map() -> TMapTo

Maps data to the target schema or format.

Returns:

Type Description
TMapTo

The mapped data object

Source code in src/clabe/data_mapper/_base.py
25
26
27
28
29
30
31
32
33
@abc.abstractmethod
def map(self) -> TMapTo:
    """
    Maps data to the target schema or format.

    Returns:
        The mapped data object
    """
    pass

is_mapped

is_mapped() -> bool

Checks if the data has been successfully mapped.

Returns:

Type Description
bool

True if the data is mapped, False otherwise

Source code in src/clabe/data_mapper/_base.py
35
36
37
38
39
40
41
42
def is_mapped(self) -> bool:
    """
    Checks if the data has been successfully mapped.

    Returns:
        True if the data is mapped, False otherwise
    """
    return self._mapped is not None