Asset Tag Management

list

Lists all tags in the project. Tags are indexed by creation date, i.e. the oldest created tag has an index of 0, while the most recently created tag has the highest index value.

Return

A list of dictionaries containing tag metadata with the following structure:

[Tag(
    index=0,
    name='Platelets',
    color=None,
    description=None
)]

Example

  • List all tags:
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.tags.list()
  • Find the tag named "dog":
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

// List all tags 
tags = project.tags.list()

// Filter tag whose name is 'dog'
dog_tag = [tag for tag in tags if tag["name"] == "dog"][0]

create

Creates a new tag. The indices of new tags created will begin from the last existing tag index.

🚧

Tags must have unique names. If there is an existing tag with the same name, the new tag will be ignored.

Parameters

NameTypeDescription
metadatadictThe metadata of the new tag.

Return

An updated msgspec struct containing tag metadata with the following structure:

[
    Tag(
        index=0,
        name='boat',
        color='#7ed957',
        description='This is boat tag'
    ),
    Tag(
        index=1,
        name='persion',
        color='#ff3131', 
        description="This is persion tag"
    )
]

Example

from datature.nexus import Client, ApiTypes

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.tags.create({"name":"persion", "color": "#ff3131", "description"="This is a persion tag."}

# or
project.tags.create(
  ApiTypes.TagMetadata(name="persion", color="#ff3131", description="This is a persion tag.")
)

update

Updates the name of a specific tag using the tag index.

❗️

Tags must have unique names. If there is an existing tag with the same name, please use mergefucntion to merge the tags.

Parameters

NameTypeDescription
indexintThe index of the tag to update.
metadatadictThe metadata of the new tag.

Return

An updated msgspec struct containing tag metadata with the following structure:

[
    Tag(
        index=0,
        name='boat',
        color='#7ed957',
        description='This is boat tag.'
    ),
    Tag(
        index=1,
        name='persion',
        color='#ff3131', 
        description="This is persion tag."
    )
]

Example

  • Modify tag name of specific tag index:
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.tags.update(1, {"name": "persion"})
  • Modify tag name of "dog" tag to "cat":
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

// List all current tags
tags = datature.tags.list()

// Filter the tag which name is dog
dog_tag = [tag for tag in tags if tag["name"] == "dog"][0]

project.tags.update(dog_tag["index"], {"name":"cat"})

delete

Deletes a specific tag using the tag index. The tag indices of other tags will be left unchanged. The indices of new tags created will begin from the last existing tag index.

❗️

Deleted tags are permanently deleted - all annotations with those tags will be deleted and cannot be recovered. This action cannot be undone, so only delete your tags when you are absolutely sure.

Parameters

NameTypeDescription
indexintThe index of the tag.

Return

A msgspec struct containing the deletion status of the tag with the following structure:

DeleteResponse(deleted=True, id=None)

Example

  • Delete tag by specific tag index:
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.tags.delete(1)
  • Delete tag by specific tag name:
from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

// List all tags
tags = project.tags.list()

// Filter the tag which name is dog
dog_tag = [tag for tag in tags if tag["name"] == "dog"][0]

project.tags.delete(dog_tag["index"])

merge

Merges a tag into another tag.

❗️

Merged tags are permanently deleted - all annotations with those tags will be merged into target tag and cannot be recovered. This action cannot be undone, so only merge your tags when you are absolutely sure.

Parameters

NameTypeDescription
merged_indexintThe index of the merge tag.
target_indexintThe index of the target ta

Return

An updated msgspec struct containing tag metadata with the following structure:

[
    Tag(
        index=0,
        name='boat',
      	color='#7ed957',
      	description='This is boat tag.'
    )
]

Example

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.tags.merge(1, 0)