Data models
Ce contenu n’est pas encore disponible dans votre langue.
The models of the API are in api/madbot_api/core/models.py. Most use a UUID primary key and carry audit fields: created_by, last_edited_by, created_time and last_edited_time. The concepts page explains what each object means for the people who use madbot.
The full list of models is kept for developers and agents in docs/data-models-api.md.
Overview
Section titled “Overview”Workspace├── WorkspaceMember├── Connection ──── Credential (in Vault), SharedConnectionParam│ └── Data (tree) ──── DataAccessRight└── Node (tree) ──── NodeMember ├── DataLink ──── Data ├── Sample ──── SampleBoundData ──── Data └── Metadata
Submission ──── Connection├── SubmissionMember, SubmissionSettings├── SubmissionData ──── Data├── SubmissionMetadataObject ──── SubmissionMetadata├── SubmissionAssociation ──── SubmissionAssociationObject└── ExternalIdentifierOrganisation
Section titled “Organisation”| Model | Role |
|---|---|
Workspace | The container of a project. Every other object belongs to a workspace. |
WorkspaceMember | A user’s membership of a workspace, with their role. |
Node | An element of the project tree. A tree node (django-tree-queries): parent, children, subtree. |
NodeMember | A user’s membership of a node, with their role. A member of a node is also a member of its ancestors. |
| Model | Role |
|---|---|
Connection | A connection to a source or a repository, through a plugin, with its settings. |
Credential | The credentials of a user for a connection. The secrets themselves are in Vault. |
Data | A file or a folder of a source, seen through a connection. A tree node, like Node. Holds its size, media type and extension, and an enrichment status (see below). |
DataAccessRight | Whether a user can reach a data in its source. |
DataLink | The link between a node and a data. |
DataAssociation | A group of data that belong together, which can carry metadata. |
Sample | An object the project studies, attached to a node. Its alias is unique among the samples of the node (constraint unique_sample_alias_per_node). |
SampleBoundData | The link between a sample and a data. |
Data carries a status, in the vocabulary of Node. A data created by a batch of datalinks is in progress until the enrich_datalinks task has read it from its source, then active, or failed with an enrichment_error ({code, message}). enrichment_task_id is the last task that enriched it. The status belongs to the data, not to the datalink: what is read from the source (attributes, metadata, associations) is shared by every datalink of the data. A data that is not active can only be read and deleted.
Metadata
Section titled “Metadata”| Model | Role |
|---|---|
RawSchema | A JSON schema: MadbotRawSchema for madbot’s own fields, PluginRawSchema for the fields of a plugin. |
MetadataField | The definition of a field: MadbotMetadataField or PluginMetadataField. |
MetadataMapping | The correspondence between fields of different sources. |
Metadata | A value of a field, on a node, a sample, a data or a data association. Validated against the JSON schema of its field. |
Metadata are inherited down the node tree, and from samples to their data.
Submissions
Section titled “Submissions”A Submission sends data and metadata to a repository through a Connection. Its status follows the steps of the submission:
| Status | Meaning |
|---|---|
draft | Being prepared. |
generating metadata | The Celery task async_create_metadata_objects builds the metadata objects. |
ready | Ready to submit. |
submission in progress | The Celery task async_submit sends it. |
submitted | Accepted by the repository. |
update available | Deposited, and an update can be sent to the repository. |
A submission records its errors, and the last task that failed, to help diagnose it.
| Model | Role |
|---|---|
SubmissionMember | A user’s membership of a submission. |
SubmissionSettings | The settings of the submission plugin. |
SubmissionData | A data included in the submission. |
SubmissionMetadataObject | A metadata object of the target repository: a study, a sample… |
SubmissionMetadata, SubmissionMetadataValue | The metadata of the submission and their values. |
SubmissionAssociation, SubmissionAssociationObject | Associations of objects inside the submission. |
ExternalIdentifier | An identifier given by the repository after the deposit. |
Users and access
Section titled “Users and access”| Model | Role |
|---|---|
MadbotUser | The user. Extends Django’s user with an approval workflow and a profile (ORCID, ROR). |
ApplicationUserParam, UserNotificationSettings | The preferences of a user. |
PersonalAccessToken | A token to call the API from a script. |
ImpersonateIntent, ImpersonateSession | The impersonation of a user by an administrator, and its audit trail. |
AlertBanner | A banner shown to the users, served by /api/alerts. |
History
Section titled “History”django-simple-history records the changes of the main models. When you add a field to a model that has a history, check whether the history should exclude it.

