plugins_api.dtos
Data Transfer Objects (DTOs) for plugins.
This module contains all DTOs used in the plugin system.
Classes
| Name | Description |
|---|---|
AccessType | Enum for supported access types for external data objects. |
AssociationRole | Possible roles of an object within a submission association. |
ConnectionField | DTO representing a connection field. |
ExternalAccess | DTO for how to access an external data object. |
ExternalIdentifier | DTO for an identifier assigned by an external repository for submission plugins. |
ExternalIdentifierType | Type of external identifier. |
FieldRepresentation | DTO for a metadata field defined by a plugin. |
MadbotMetadata | DTO for metadata attached to a madbot object, provided by madbot core to plugins. |
MadbotMetadataObject | DTO for a metadata object instance provided by madbot core to plugins. |
MetadataFieldID | DTO for metadata field. |
MetadataFieldMapping | DTO for metadata mapping. |
MetadataGroupNodeDTO | DTO representing a node in a metadata groups navigation tree. |
MetadataObject | DTO for a metadata object instance returned by a submission plugin. |
MetadataObjectMetadata | DTO for one metadata field on a metadata object. |
MetadataObjectType | DTO representing a type of metadata object in the submission plugin. |
MetadataValue | DTO for a metadata value. |
PluginDataAssociation | DTO representing a data association returned by data plugins. |
PluginDataObject | DTO for an external data object returned by a data plugin. |
PluginMetadata | DTO for metadata returned by a plugin. |
PluginStatus | Maturity status of a plugin for a given capability type. |
SchemaRepresentation | DTO for the JSON schema of a metadata or connection field. |
SettingField | DTO for a submission setting schema, returned by get_settings_fields(). |
Settings | DTO for a submission setting value passed to the plugin constructor. |
Source | Abstract base DTO for a madbot object that is the source of a metadata value. |
SourceAssociationData | DTO for a data association that is the source of a metadata value. |
SourceData | DTO for a madbot data object that is the source of a metadata value. |
SourceNode | DTO for a madbot node that is the source of a metadata value. |
SourceSample | DTO for a madbot sample that is the source of a metadata value. |
Submission | DTO for a submission. |
SubmissionAssociation | DTO representing an association (a group of related objects). |
SubmissionAssociationObject | DTO representing an object within a submission association. |
SubmissionData | DTO for a data object included in a submission, provided by madbot core. |
SubmissionMember | DTO for a submission member. |
SubmissionMetadataValue | DTO for a metadata value on a submission. |
AccessTypeclass#
class AccessType(StrEnum)Bases: StrEnum
Enum for supported access types for external data objects.
AssociationRoleclass#
class AssociationRole(StrEnum)Bases: StrEnum
Possible roles of an object within a submission association.
ConnectionFieldclass#
class ConnectionField(BaseModel)Bases: BaseModel
DTO representing a connection field.
ExternalAccessclass#
class ExternalAccess(BaseModel)Bases: BaseModel
DTO for how to access an external data object.
Attributes
| Name | Type | Description |
|---|---|---|
access_type | AccessType | Type of access to the external data object. |
details | str | For AccessType.URL: a URL string. For AccessType.SHELL: a command string.
Stored as a string of at most 1000 characters. |
access_typeattributeinstance attribute#
access_type: AccessTypedetailsattributeinstance attribute#
details: AnyExternalIdentifierclass#
class ExternalIdentifier(BaseModel)Bases: BaseModel
DTO for an identifier assigned by an external repository for submission plugins.
Attributes
| Name | Type | Description |
|---|---|---|
identifier | str | The identifier string itself (DOI, accession, …). |
type | ExternalIdentifierType | Kind of identifier. Must be one of the enum values. |
url | (str, optional) | URL for the identifier, if any. |
ExternalIdentifierTypeclass#
class ExternalIdentifierType(StrEnum)Bases: StrEnum
Type of external identifier.
ACCESSIONattributeclass attributeinstance attribute#
ACCESSION = 'ACCESSION'ARKattributeclass attributeinstance attribute#
ARK = 'ARK'BIOPROJECTattributeclass attributeinstance attribute#
BIOPROJECT = 'BIOPROJECT'BIOSAMPLEattributeclass attributeinstance attribute#
BIOSAMPLE = 'BIOSAMPLE'DOIattributeclass attributeinstance attribute#
DOI = 'DOI'ENA_EXPERIMENTattributeclass attributeinstance attribute#
ENA_EXPERIMENT = 'ENA EXPERIMENT'ENA_PROJECTattributeclass attributeinstance attribute#
ENA_PROJECT = 'ENA PROJECT'ENA_RUNattributeclass attributeinstance attribute#
ENA_RUN = 'ENA RUN'ENA_SAMPLEattributeclass attributeinstance attribute#
ENA_SAMPLE = 'ENA SAMPLE'IDattributeclass attributeinstance attribute#
ID = 'ID'PURLattributeclass attributeinstance attribute#
PURL = 'PURL'FieldRepresentationclass#
class FieldRepresentation(BaseModel)Bases: BaseModel
DTO for a metadata field defined by a plugin.
Attributes
| Name | Type | Description |
|---|---|---|
slug | str | Field slug: plugin__field or plugin__mot__field. |
schema_rep | SchemaRepresentation | Schema for this field. schema_rep.slug should match slug. |
title | str | Display name. |
description | str | Human-readable description. May be empty. |
external_url | str | Documentation URL for the field. Use "" if none. |
madbot_fields | list[str] | Slugs of mapped madbot fields. Empty list if unmapped. |
hidden | bool | If True, the field should be hidden in the UI. |
standard | (str, optional) | Metadata standard this field belongs to, or None. |
descriptionattributeinstance attribute#
description: strexternal_urlattributeinstance attribute#
external_url: strhiddenattributeinstance attribute#
hidden: boolmadbot_fieldsattributeinstance attribute#
madbot_fields: list[str]schema_repattributeinstance attribute#
schema_rep: SchemaRepresentationslugattributeinstance attribute#
slug: strstandardattributeclass attributeinstance attribute#
standard: str | None = Nonetitleattributeinstance attribute#
title: strMadbotMetadataclass#
class MadbotMetadata(BaseModel)Bases: BaseModel
DTO for metadata attached to a madbot object, provided by madbot core to plugins.
Attributes
| Name | Type | Description |
|---|---|---|
field | MetadataFieldID | Field this value belongs to. |
metadata_value | (MetadataValue, optional) | Selected value. Named metadata_value here (not value). |
inherited_values | list[MetadataValue] | Candidate values inherited from ancestors. Same role as
MetadataObjectMetadata.candidate_values. |
fieldattributeinstance attribute#
field: MetadataFieldIDinherited_valuesattributeclass attributeinstance attribute#
inherited_values: list[MetadataValue] = []metadata_valueattributeclass attributeinstance attribute#
metadata_value: MetadataValue | None = NoneMadbotMetadataObjectclass#
class MadbotMetadataObject(BaseModel)Bases: BaseModel
DTO for a metadata object instance provided by madbot core to plugins.
Distinct from MetadataObject, which plugins return from create_metadata_objects().
Attributes
| Name | Type | Description |
|---|---|---|
id | UUID | Madbot identifier of the metadata object. |
type | str | Metadata object type slug (e.g. "sample"). |
metadata | list[MetadataObjectMetadata] | Field values on this object. |
cross_validation | dict[str, Any] | Cross-field validation errors, keyed by field slug. Empty dict if valid. |
external_identifiers | list[ExternalIdentifier] | Identifiers assigned after submission, if any. |
cross_validationattributeinstance attribute#
cross_validation: dict[str, Any]external_identifiersattributeclass attributeinstance attribute#
external_identifiers: list[ExternalIdentifier] = []idattributeclass attributeinstance attribute#
id: UUID = Field(default_factory=uuid4)metadataattributeinstance attribute#
metadata: list[MetadataObjectMetadata]typeattributeinstance attribute#
type: strMetadataFieldIDclass#
class MetadataFieldID(BaseModel)Bases: BaseModel
DTO for metadata field.
Attributes
MetadataFieldMappingclass#
class MetadataFieldMapping(BaseModel)Bases: BaseModel
DTO for metadata mapping.
This DTO is used to map a metadata field from the plugin to a metadata field in madbot. It represents a bidirectional mapping between fields in the madbot referential and fields in a plugin referential, along with transformation functions for converting data between the two systems.
Attributes
| Name | Type | Description |
|---|---|---|
plugin_fields | list[str] | Plugin field slugs involved in this mapping. Keys of the dict passed to
transform_plugin_to_madbot must be a subset of these slugs. |
madbot_fields | list[str] | Madbot field slugs involved in this mapping. Keys of the dict passed to
transform_madbot_to_plugin must be a subset of these slugs. |
transform_madbot_to_plugin | Callable | dict[madbot_slug, value] -> dict[plugin_slug, value]. |
transform_plugin_to_madbot | Callable | dict[plugin_slug, value] -> dict[madbot_slug, value]. |
mapping_id | Optional[str] | Unique identifier for this mapping rule. Useful for distinguishing between multiple mappings for the same field (e.g., different checklists). |
madbot_fieldsattributeinstance attribute#
madbot_fields: list[str]mapping_idattributeclass attributeinstance attribute#
mapping_id: str | None = Nonemodel_configattributeclass attributeinstance attribute#
model_config = ConfigDict(extra='allow')plugin_fieldsattributeinstance attribute#
plugin_fields: list[str]transform_madbot_to_pluginattributeinstance attribute#
transform_madbot_to_plugin: Callable[[dict[str, Any]], dict[str, Any]]transform_plugin_to_madbotattributeinstance attribute#
transform_plugin_to_madbot: Callable[[dict[str, Any]], dict[str, Any]]MetadataGroupNodeDTOclass#
class MetadataGroupNodeDTO(BaseModel)Bases: BaseModel
DTO representing a node in a metadata groups navigation tree.
This tree is for UI navigation only. It is complementary to
get_all_metadata_object_types() / get_contextual_metadata_object_types(),
which define what each metadata object type (MOT) contains (fields, levels,
occurrences). Groups only organize those fields for browsing.
Attributes
| Name | Type | Description |
|---|---|---|
slug | str | Unique slug for the group node. For type="mot", use the MOT slug. |
name | str | Display name of the group node. |
description | str | Human-readable description of the group node. |
type | Literal['mot', 'subgroup'] | None | "mot" for a metadata object type node, "subgroup" for nested groups. |
has_groups | bool | True when this node has child group nodes. |
fields | list[str | dict] | Field slugs attached to this node (usually on subgroups, not on MOT nodes that have children). Each field can be either:
|
children | list[MetadataGroupNodeDTO] | Child group nodes. |
Examples
A single MOT with subgroups (Zenodo-style):
>>> MetadataGroupNodeDTO(... slug="general",... name="General",... description="Deposition metadata",... type="mot",... has_groups=True,... fields=[],... children=[... MetadataGroupNodeDTO(... slug="core_identification",... name="Core identification",... description="Essential identifying information",... type="subgroup",... has_groups=False,... fields=["plugin__title", "plugin__description"],... children=[],... )... ],... )Two MOTs:
>>> [... MetadataGroupNodeDTO(... slug="general",... name="General",... description="General metadata object",... type="mot",... has_groups=False,... fields=["plugin__a", "plugin__b"],... children=[],... ),... MetadataGroupNodeDTO(... slug="complementary",... name="Complementary",... description="Complementary metadata object",... type="mot",... has_groups=False,... fields=["plugin__d", "plugin__e"],... children=[],... ),... ]A subgroup with checklist-specific levels:
>>> MetadataGroupNodeDTO(... slug="sample_environment",... name="Environment",... description="Environmental metadata for the sample",... type="subgroup",... has_groups=False,... fields=[... {"slug": "ena__sample__environmental_sample", "level": "optional"},... {"slug": "ena__sample__geographical_location", "level": "mandatory"},... ],... children=[],... )childrenattributeclass attributeinstance attribute#
children: list[MetadataGroupNodeDTO] = Field(default_factory=list)descriptionattributeinstance attribute#
description: strfieldsattributeclass attributeinstance attribute#
fields: list[
str | dict[Literal['slug', 'level'], str | Literal['mandatory', 'recommended', 'optional'] | None]
] = Field(default_factory=list)has_groupsattributeclass attributeinstance attribute#
has_groups: bool = Falsenameattributeinstance attribute#
name: strslugattributeinstance attribute#
slug: strtypeattributeclass attributeinstance attribute#
type: Literal['mot', 'subgroup'] | None = NoneMetadataObjectclass#
class MetadataObject(BaseModel)Bases: BaseModel
DTO for a metadata object instance returned by a submission plugin.
Distinct from MadbotMetadataObject, which madbot core sends to plugins.
Return these from create_metadata_objects(), keyed by type slug.
Attributes
| Name | Type | Description |
|---|---|---|
id | (UUID, optional) | Existing madbot ID when updating, or a new UUID when creating. |
type | MetadataObjectType | Full type definition, not a slug. |
metadata | list[MetadataObjectMetadata] | Field values on this object. |
cross_validation | dict[str, Any] | Cross-field validation errors, keyed by field slug. Empty dict if valid. |
external_identifiers | list[ExternalIdentifier] | Identifiers assigned after submission, if any. |
cross_validationattributeinstance attribute#
cross_validation: dict[str, Any]external_identifiersattributeclass attributeinstance attribute#
external_identifiers: list[ExternalIdentifier] = []idattributeclass attributeinstance attribute#
id: UUID | None = Field(default_factory=uuid4)metadataattributeinstance attribute#
metadata: list[MetadataObjectMetadata]typeattributeinstance attribute#
type: MetadataObjectTypeMetadataObjectMetadataclass#
class MetadataObjectMetadata(BaseModel)Bases: BaseModel
DTO for one metadata field on a metadata object.
Attributes
| Name | Type | Description |
|---|---|---|
field | MetadataFieldID | Field this value belongs to. |
metadata_value | (MetadataValue or SubmissionMetadataValue, optional) | Selected value. |
candidate_values | list[MetadataValue | SubmissionMetadataValue] | Alternative values the user may pick. Same role as
MadbotMetadata.inherited_values. |
candidate_valuesattributeclass attributeinstance attribute#
candidate_values: list[MetadataValue | SubmissionMetadataValue] = []fieldattributeinstance attribute#
field: MetadataFieldIDmetadata_valueattributeclass attributeinstance attribute#
metadata_value: MetadataValue | SubmissionMetadataValue | None = Nonefrom_metadatamethodclassmethod#
def from_metadata(metadata: MadbotMetadata) -> MetadataObjectMetadataConvert a Metadata to a MetadataObjectMetadata.
to_metadatamethod#
def to_metadata() -> MadbotMetadataConvert a MetadataObjectMetadata to a Metadata.
MetadataObjectTypeclass#
class MetadataObjectType(BaseModel)Bases: BaseModel
DTO representing a type of metadata object in the submission plugin.
This class defines the structure and requirements for a metadata object type in the system. It specifies what fields are required, recommended, or optional, along with their validation rules.
Attributes
| Name | Type | Description |
|---|---|---|
name | str | The display name of the metadata object type (e.g., ‘Sample’, ‘Experiment’, ‘Dataset’). |
slug | str | A unique identifier for the metadata object type, used in URLs and API endpoints. Should be lowercase with hyphens (e.g., ‘sample’, ‘experiment’, ‘dataset’). |
summary_fields | List[str] | List of field names that should be displayed in summary views or lists. These fields provide a quick overview of the metadata object. |
priority | List[str] | Ordered list of field names indicating their display priority. Fields listed first will be displayed before fields listed later. |
description | str | A detailed description of what this metadata object type represents and how it should be used in the system. |
additional_information | (str, optional) | Additional contextual information displayed as an informational alert in the submission UI tabs. Intended to provide guidance or warnings specific to this metadata object type, such as instructions for configuring paired data. If None, no alert is displayed. |
show_additional_information_on_data_tab | bool | Whether the additional_information message should also be displayed in the Data tab of the submission UI, in addition to the metadata object type’s own tab. Useful when the guidance is relevant to data configuration, such as paired file setup. Defaults to False. |
minimal_occurrence | int | The minimum number of instances of this metadata object type that must be provided in a submission. For example, if set to 1, at least one instance is required. |
maximal_occurrence | Optional[int] | The maximum number of instances of this metadata object type allowed in a submission. If None, there is no upper limit to the number of instances. |
mandatory_fields_schemas | list[FieldRepresentation] | List of field schemas that are required for this metadata object type. These fields must be provided for the submission to be valid. |
recommended_fields_schemas | list[FieldRepresentation] | List of field schemas that are recommended but not required for this metadata object type. These fields should be provided when possible but their absence won’t invalidate the submission. |
optional_fields_schemas | list[FieldRepresentation] | List of field schemas that are optional for this metadata object type. These fields can be provided but are not required or recommended. |
additional_informationattributeclass attributeinstance attribute#
additional_information: str | None = Nonedescriptionattributeinstance attribute#
description: strmandatory_fields_schemasattributeinstance attribute#
mandatory_fields_schemas: list[FieldRepresentation]maximal_occurrenceattributeclass attributeinstance attribute#
maximal_occurrence: int | None = Noneminimal_occurrenceattributeinstance attribute#
minimal_occurrence: intnameattributeinstance attribute#
name: stroptional_fields_schemasattributeinstance attribute#
optional_fields_schemas: list[FieldRepresentation]priorityattributeinstance attribute#
priority: list[str]recommended_fields_schemasattributeinstance attribute#
recommended_fields_schemas: list[FieldRepresentation]show_additional_information_on_data_tabattributeclass attributeinstance attribute#
show_additional_information_on_data_tab: bool = Falseslugattributeinstance attribute#
slug: strsummary_fieldsattributeinstance attribute#
summary_fields: list[str]MetadataValueclass#
class MetadataValue(BaseModel)Bases: BaseModel
DTO for a metadata value.
Attributes
PluginDataAssociationclass#
class PluginDataAssociation(BaseModel)Bases: BaseModel
DTO representing a data association returned by data plugins.
A data association represents a relationship between multiple data objects. Each association contains a list of external_id values that should be grouped together in a single DataAssociation in madbot, and optionally metadata that should be attached to the association.
Attributes
| Name | Type | Description |
|---|---|---|
associated_external_ids | list[str] | List of external_id values for data objects that should be associated together. |
metadata | (list[PluginMetadata], optional) | List of metadata that should be attached to the DataAssociation. Defaults to empty list if not provided. |
Examples
If data objects A, B, and C should be associated together:
>>> PluginDataAssociation(associated_external_ids=["A", "B", "C"])If data object A has two separate associations (one with B, one with C):
>>> [... PluginDataAssociation(associated_external_ids=["A", "B"]),... PluginDataAssociation(associated_external_ids=["A", "C"]),... ]With metadata:
>>> PluginDataAssociation(... associated_external_ids=["B", "C"],... metadata=[... PluginMetadata(... field=MetadataFieldID(slug="association_type", source="referential", name="Association Type"),... value=MetadataValue(value="paired")... )... ]... )PluginDataObjectclass#
class PluginDataObject(BaseModel)Bases: BaseModel
DTO for an external data object returned by a data plugin.
Attributes
| Name | Type | Description |
|---|---|---|
id | str | Stable identifier in the external system. Becomes madbot external_id. |
name | str | Display name. |
type | (str, optional) | Free-form kind of object (e.g. "file", "directory", "project"). |
description | (str, optional) | Human-readable description, or None. |
media_type | (str, optional) | MIME type (e.g. "application/gzip"), or None. |
file_extension | (str, optional) | Extension without the leading dot (e.g. "fastq" or "fastq.gz"),
or None. |
size | (int, optional) | Size in bytes, or None. |
icon | (str, optional) | Nerd Font class from get_icon() (e.g. "nf nf-fa-folder"), or None. |
has_children | bool | True if get_data_objects(this id) will return items. |
linkable | bool | Whether the object can be linked into a madbot node. |
children | list[PluginDataObject] | List of child external data objects. Defaults to None. |
accesses | list[ExternalAccess] | Ways to open or download the object. |
accessesattributeclass attributeinstance attribute#
accesses: list[ExternalAccess] = []childrenattributeclass attributeinstance attribute#
children: list[PluginDataObject] = []descriptionattributeclass attributeinstance attribute#
description: str | None = Nonefile_extensionattributeclass attributeinstance attribute#
file_extension: str | None = Nonehas_childrenattributeclass attributeinstance attribute#
has_children: bool = Falseiconattributeclass attributeinstance attribute#
icon: str | None = Noneidattributeinstance attribute#
id: strlinkableattributeclass attributeinstance attribute#
linkable: bool = Falsemedia_typeattributeclass attributeinstance attribute#
media_type: str | None = Nonenameattributeinstance attribute#
name: strsizeattributeclass attributeinstance attribute#
size: int | None = Nonetypeattributeclass attributeinstance attribute#
type: str | None = Noneadd_external_accessmethod#
def add_external_access(access_type: AccessType, access_details: str) -> NoneAdd external access information to the data object.
Parameters
| Name | Type | Description |
|---|---|---|
access_type | AccessType | The type of access being added (must be one of the supported access types). |
access_details | str | The access details to be associated with the specified access type.
For AccessType.URL: a URL. For AccessType.SHELL: a command. |
Raises
ValueError- If the provided access_type is not supported.
PluginMetadataclass#
class PluginMetadata(BaseModel)Bases: BaseModel
DTO for metadata returned by a plugin.
Attributes
| Name | Type | Description |
|---|---|---|
field | MetadataFieldID | Field this value belongs to. |
value | (MetadataValue, optional) | The value. |
fieldattributeinstance attribute#
field: MetadataFieldIDvalueattributeclass attributeinstance attribute#
value: MetadataValue | None = NonePluginStatusclass#
class PluginStatus(StrEnum)Bases: StrEnum
Maturity status of a plugin for a given capability type.
SchemaRepresentationclass#
class SchemaRepresentation(BaseModel)Bases: BaseModel
DTO for the JSON schema of a metadata or connection field.
Attributes
| Name | Type | Description |
|---|---|---|
slug | str | Field slug. For metadata fields: plugin__field or plugin__mot__field. |
schema_content | dict[str, Any] | JSON Schema. originalTitle is read by madbot core as the original
field name when title is a user-friendly label. |
uischema | (dict[str, Any], optional) | JSON Forms UI schema, if any. |
source | str | Plugin slug. |
SettingFieldclass#
class SettingField(ConnectionField)Bases: ConnectionField
DTO for a submission setting schema, returned by get_settings_fields().
The slug must match Settings.field in the plugin constructor.
Inherited from plugins_api.dtos.ConnectionField
schema_contentattributeinstance attribute#
plugins_api.dtos.ConnectionFieldView sourceschema_content: dict[str, Any]slugattributeinstance attribute#
plugins_api.dtos.ConnectionFieldView sourceslug: struischemaattributeclass attributeinstance attribute#
plugins_api.dtos.ConnectionFieldView sourceuischema: dict[str, Any] | None = NoneSettingsclass#
class Settings(BaseModel)Bases: BaseModel
DTO for a submission setting value passed to the plugin constructor.
Distinct from SettingField, which describes the setting schema.
Madbot core passes dict[str, Settings] keyed by setting slug.
Attributes
Sourceclass#
class Source(BaseModel, ABC)Bases: BaseModel, ABC
Abstract base DTO for a madbot object that is the source of a metadata value.
Do not instantiate this class. Use SourceData, SourceNode,
SourceSample, or SourceAssociationData.
Attributes
| Name | Type | Description |
|---|---|---|
madbot_id | UUID | Madbot identifier of the source object. |
SourceAssociationDataclass#
class SourceAssociationData(Source)Bases: Source
DTO for a data association that is the source of a metadata value.
Attributes
| Name | Type | Description |
|---|---|---|
source_data | list[SourceData] | Data objects in the association. |
metadata | list[MadbotMetadata] | Metadata attached to the association. |
metadataattributeclass attributeinstance attribute#
metadata: list[MadbotMetadata] = []source_dataattributeinstance attribute#
source_data: list[SourceData]Inherited from plugins_api.dtos.Source
madbot_idattributeclass attributeinstance attribute#
plugins_api.dtos.SourceView sourcemadbot_id: UUID = Field(default_factory=uuid4)model_post_initmethod#
plugins_api.dtos.SourceView sourcedef model_post_init(__context: Any) -> NoneReject direct instantiation of the abstract base.
SourceDataclass#
class SourceData(Source)Bases: Source
DTO for a madbot data object that is the source of a metadata value.
Attributes
| Name | Type | Description |
|---|---|---|
name | str | Display name of the data object. |
Inherited from plugins_api.dtos.Source
madbot_idattributeclass attributeinstance attribute#
plugins_api.dtos.SourceView sourcemadbot_id: UUID = Field(default_factory=uuid4)model_post_initmethod#
plugins_api.dtos.SourceView sourcedef model_post_init(__context: Any) -> NoneReject direct instantiation of the abstract base.
SourceNodeclass#
class SourceNode(Source)Bases: Source
DTO for a madbot node that is the source of a metadata value.
Attributes
| Name | Type | Description |
|---|---|---|
title | str | Node title. |
description | (str, optional) | Node description as a JSON string of EditorJS content. |
parent | (SourceNode, optional) | Parent node, or None for a root node. |
descriptionattributeclass attributeinstance attribute#
description: str | None = Noneparentattributeclass attributeinstance attribute#
parent: Optional[SourceNode] = Nonetitleattributeinstance attribute#
title: strfrom_nodemethodclassmethod#
def from_node(values: Any) -> AnyConvert a generic node object into a SourceNode.
get_ancestorsmethod#
def get_ancestors() -> list[SourceNode]Get all ancestors of this node, from root to the node itself.
Returns
List[SourceNode]- List of ancestors, ordered from root to this node
Inherited from plugins_api.dtos.Source
madbot_idattributeclass attributeinstance attribute#
plugins_api.dtos.SourceView sourcemadbot_id: UUID = Field(default_factory=uuid4)model_post_initmethod#
plugins_api.dtos.SourceView sourcedef model_post_init(__context: Any) -> NoneReject direct instantiation of the abstract base.
SourceSampleclass#
class SourceSample(Source)Bases: Source
DTO for a madbot sample that is the source of a metadata value.
Inherited from plugins_api.dtos.Source
madbot_idattributeclass attributeinstance attribute#
plugins_api.dtos.SourceView sourcemadbot_id: UUID = Field(default_factory=uuid4)model_post_initmethod#
plugins_api.dtos.SourceView sourcedef model_post_init(__context: Any) -> NoneReject direct instantiation of the abstract base.
Submissionclass#
class Submission(BaseModel)Bases: BaseModel
DTO for a submission.
SubmissionAssociationclass#
class SubmissionAssociation(BaseModel)Bases: BaseModel
DTO representing an association (a group of related objects).
Attributes
| Name | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the association. |
submission_id | UUID | Identifier of the submission to which this association belongs. |
association_name | str | Descriptive name for the association, indicating the kind of relationship
between objects (free-form, e.g. "paired_end"). |
objects | list[SubmissionAssociationObject] | List of objects participating in the association. Each object may have a role (source/target) and can be either a metadata object or a data object. |
SubmissionAssociationObjectclass#
class SubmissionAssociationObject(BaseModel)Bases: BaseModel
DTO representing an object within a submission association.
Attributes
| Name | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the association object. |
role | Optional[AssociationRole] | Role of this object in the association.
|
object | MadbotMetadataObject or SubmissionData or MetadataObject | The actual object participating in the association. Can be either:
|
idattributeinstance attribute#
id: UUIDobjectattributeinstance attribute#
object: Union[MadbotMetadataObject, SubmissionData, MetadataObject]roleattributeclass attributeinstance attribute#
role: AssociationRole | None = NoneSubmissionDataclass#
class SubmissionData(BaseModel)Bases: BaseModel
DTO for a data object included in a submission, provided by madbot core.
Attributes
| Name | Type | Description |
|---|---|---|
filename | str | File name as stored in madbot. |
size | int | File size in bytes. |
madbot_id | UUID | Identifier of the submission-data row (not the Data object). |
data_madbot_id | UUID | Identifier of the Data object. |
parent_node | (SourceNode, optional) | Node the data is linked to. |
path | (str, optional) | Local path of the file, if already downloaded. |
md5_hash | (str, optional) | MD5 checksum of the file. |
file_type | (str, optional) | File type / extension. |
metadata | list[MadbotMetadata] | Metadata attached to this data object. |
data_associations | list[SourceAssociationData] | Associations this data object belongs to. |
bound_samples | list[dict] | Samples bound to this data. Each dict has id (UUID string),
title (str), and alias (str or None). |
bound_samplesattributeclass attributeinstance attribute#
bound_samples: list[dict] = []data_associationsattributeclass attributeinstance attribute#
data_associations: list[SourceAssociationData] = []data_madbot_idattributeclass attributeinstance attribute#
data_madbot_id: UUID = Field(default_factory=uuid4)file_typeattributeclass attributeinstance attribute#
file_type: str | None = Nonefilenameattributeinstance attribute#
filename: strmadbot_idattributeclass attributeinstance attribute#
madbot_id: UUID = Field(default_factory=uuid4)md5_hashattributeclass attributeinstance attribute#
md5_hash: str | None = Nonemetadataattributeclass attributeinstance attribute#
metadata: list[MadbotMetadata] = []parent_nodeattributeclass attributeinstance attribute#
parent_node: SourceNode | None = Nonepathattributeclass attributeinstance attribute#
path: str | None = Nonesizeattributeinstance attribute#
size: intfind_last_common_ancestormethodstaticmethod#
def find_last_common_ancestor(data_objects: list[SubmissionData]) -> list[SourceNode] | NoneFind the last common ancestor of multiple data objects.
Parameters
| Name | Type | Description |
|---|---|---|
data_objects | List[SubmissionData] | List of Data objects to find common ancestor for |
Returns
Optional[List[SourceNode]]- The last common ancestor nodes, or None if no common ancestor exists
SubmissionMemberclass#
class SubmissionMember(BaseModel)Bases: BaseModel
DTO for a submission member.
SubmissionMetadataValueclass#
class SubmissionMetadataValue(MetadataValue)Bases: MetadataValue
DTO for a metadata value on a submission.
Inherits from MetadataValue and adds a list of source submission data IDs. This allows tracking which submission data objects are associated with each metadata value, enabling easier management (such as removal) of metadata values when related submission data objects are deleted.
Attributes
sources_submission_dataattributeclass attributeinstance attribute#
sources_submission_data: list[UUID] = Field(default_factory=list)add_source_for_allmethodclassmethod#
def add_source_for_all(metadata_values: list[SubmissionMetadataValue], source_id: UUID) -> list[SubmissionMetadataValue]Add the same submission data ID to all submission metadata values in the list.
Parameters
| Name | Type | Description |
|---|---|---|
metadata_values | List[SubmissionMetadataValue] | The list of SubmissionMetadataValue instances. |
source_id | UUID | The source ID to add. |
Returns
List[SubmissionMetadataValue]- The list of updated SubmissionMetadataValue instances.
add_sources_submission_datamethod#
def add_sources_submission_data(submission_data_ids: UUID | list[UUID]) -> NoneAdd one or more source submission data IDs to the metadata value.
create_from_metadata_valuemethodclassmethod#
def create_from_metadata_value(metadata_value: MetadataValue) -> SubmissionMetadataValueCreate a SubmissionMetadataValue from a MetadataValue.
Parameters
| Name | Type | Description |
|---|---|---|
metadata_value | MetadataValue | The MetadataValue to convert. |
Returns
SubmissionMetadataValue- The converted SubmissionMetadataValue instance.
Inherited from plugins_api.dtos.MetadataValue
source_idattributeclass attributeinstance attribute#
plugins_api.dtos.MetadataValueView sourcesource_id: UUID | None = Nonevalueattributeclass attributeinstance attribute#
plugins_api.dtos.MetadataValueView sourcevalue: Any | None = None
