Ango Hub Docs
Open Ango HubContact iMerit
  • Ango Hub Documentation
  • Video Guides
  • Changelog
  • FAQs & Troubleshooting
  • All Keyboard and Mouse Shortcuts
  • Core Concepts
    • Assets
    • Attachments
    • Batches
    • Benchmarks
    • Category Schema (Ontologies)
    • Frame Interpolation
    • Geofencing
    • Idle Time Detection & Time Tracking
    • Instructions
    • Issues
      • Issue Error Codes
    • Label Validation
    • Labeler Performance
    • Labeling
    • Labeling Queue
    • Multiple Classification
    • Notifications
    • Organizations
    • Projects
    • Requeuing
    • Reviewing
    • Review Queue
    • Skipping
    • Stage History
    • Tasks
    • Usage
    • User Roles
    • Workflow
      • Complete
      • Consensus
      • Hold
      • Label
      • Logic
      • Plugin
      • Review
      • Start
      • Webhook
  • Labeling
    • Managing Users in Projects
      • Profile Page
    • Managing the Project Ontology
    • Labeling Editor Interface
      • Audio Labeling Editor
      • Image Labeling Editor
      • Video Labeling Editor
      • DICOM Labeling Editor
      • Medical Labeling Editor
        • 3D Bounding Box
        • Fill Between Slices
        • Island Tools
        • Line (Tape Measure)
        • Smoothing
      • PDF Labeling Editor
      • Text (NER) Labeling Editor
      • LLM Chat Labeling Editor
      • Markdown Labeling Editor
      • 3D Multi-Sensor Fusion Labeling Editor
    • Labeling Classes
      • Tools
        • Bounding Box
        • Brush
        • Entity
        • Message
        • Nested Classifications
        • PCT
        • PDF Tool
        • Point
        • Polygon
        • Polyline
        • Rotated Bounding Box
        • Segmentation
        • Spline
        • Voxel Brush
      • Classification
        • Checkbox
        • Multiple Dropdown
        • Radio
        • Rank
        • Single Dropdown
        • Text
        • Tree Dropdown Tools (Single and Multiple Selection)
      • Relation
        • Single Relation
        • Group Relation
    • Magnetic Lasso
    • Performance & Compatibility Considerations
  • Data
    • Data in Ango Hub
      • Embedding Private Bucket Files in MD Assets
    • Importing Assets
      • Asset Builder
      • Bundled Assets
        • Importing Multiple Images as One Multi-Page Asset
        • Importing Multiple Single-Frame DICOM Files as One Multi-Page Asset
        • Importing multiple DICOM files to be annotated and displayed at once
        • Importing Multiple Single-Frame DICOM Files as a DICOM Series
        • Importing Multiple Markdown Files as One Multi-Page Asset
      • File Explorer
      • Supported Asset File Types & Codecs
      • Importing Cloud (Remote) Assets
      • Importing From Local Machine
      • Creating and Importing LLM Chat Assets
      • Importing Data in the 3D Multi-Sensor Fusion Labeling Tool
      • Bulk Importing Markdown/HTML Assets
      • Importing Attachments during Asset Import
      • Importing Annotations during Asset Import
      • contextData: Adding Extra Data to Assets
      • Importing Reference Images as Overlay
      • Importing Reference Medical Data During Asset Import
    • Importing and Exporting Annotations
      • Importing Annotations
        • Ango Import Format
        • Importing Brush Traces
        • Importing NRRD Annotations
      • Exporting Annotations
        • Ango Export Format
          • Asset
            • Task
              • Tools
              • Classifications
              • Relations
          • Stage History
    • Adding and Managing LLMs
    • Storages
      • Set up a storage integration with Azure
      • Set up a storage integration with AWS S3
      • Set up a storage integration with MinIO and S3-compatible custom storage services
      • Set up a storage integration with GCP (Google Cloud Platform)
      • Set up CORS
      • Validating Storage Integrations
    • Purging Data from Ango Hub
  • Plugins
    • Overview of Plugins in Ango Hub
      • Installing Plugins
      • Plugin Setting Presets
      • Monitoring Plugin Progress
    • First-Party Plugins
      • Ango Export Converter Plugins
      • Asset Converter Plugins
      • Ango to Mask Converter
      • Batch Assignment
      • ChatGPT
      • Column-Agnostic Markdown Generator
      • CSV Export for Classification
      • DALL-E
      • DALL-E (Model Plugin)
      • File Explorer Plugin
      • General Object Detector
      • General Object Segmenter
      • Markdown Generator
      • One-Click Segmentation
      • Open World Object Detection
      • Optical Character Recognition
      • TPT Export
      • YOLO | Instance Segmentation
      • YOLO | Pose Estimation
      • YOLO | Object Detection
      • YOLO | Image Classification
    • Plugin Developer Documentation
      • Export Plugins
      • Batch Model Plugins
      • Model Plugins
      • File Explorer Plugins
      • Markdown Generator Plugins
      • Plugin Logger
      • [WIP] Deploying your Plugin
      • Plugin 'Host' Information
  • SDK
    • SDK Documentation
      • Project Level SDK Functions
        • add_members_to_project
        • assign_batches
        • assign_task
        • create_attachment
        • create_batch
        • create_issue
        • create_label_set
        • create_project
        • delete_issue
        • export
        • exportV3
        • get_assets
        • get_batches
        • get_issues
        • get_metrics
        • get_project
        • get_project_performance
        • get_task
        • get_tasks
        • get_task_history
        • import_labels
        • list_projects
        • requeue_tasks
        • rerun_webhook
        • update_workflow_stages
        • upload_files
        • upload_files_cloud
        • upload_files_with_asset_builder
        • upload_chat_assets
      • Organization Level SDK Functions
        • create_storage
        • delete_organization_invites
        • delete_organization_members
        • delete_storage
        • get_organization_invites
        • get_organization_members
        • get_storages
        • invite_members_to_org
        • update_organization_members_role
    • SDK - Useful Snippets
    • SDK Changelog
  • API
    • API Documentation
  • How-To
    • Add Members
      • Add multiple users to a project
    • Annotate
      • Annotate 3D Point Cloud Files on Ango Hub
      • Perform targeted OCR on images
    • Export Data
      • Automatically send Ango Hub Webhook contents to Google Sheets, Email, Slack, and more with Zapier
      • Download a JSON of your project ontology
      • Download DICOM Segmentation Masks
      • Download your annotations in the COCO, KITTI, or YOLO format
      • Download your Segmentation Masks
      • Get your export as separate JSON files for each asset
    • Manage a Project
      • Get your API Key
      • Get your Organization ID
      • Mute your notifications
      • Open an asset provided the Asset ID
      • Pre-label assets
      • Share a filtered view of the Tasks table with others
      • Transfer project ontologies between projects
      • Transfer project workflows between projects
    • Perform Model Evaluation on Ango Hub
  • Troubleshooting
    • I get a "0 Tasks Labeled" alert when trying to pre-label tasks
    • I get a 'The data couldn't be loaded properly' error when opening certain assets
    • I get a "Unknown Classification" warning when opening a task
  • Feature Availability Status for projects of the 3D Multi-Sensor Fusion type
  • Comparison between QuickServe and Ango Hub
  • Changes from Ango Hub Legacy
  • Video V2 Breaking Changes and Transition
  • Data Access, Storage, and Security
  • Two-Factor Authentication
  • Single Sign-On (SSO) Support
  • Customer Support
  • Ango Hub Status Page
Powered by GitBook
On this page
  • create_label_set(project_id, tools, classifications, relations, raw_category_schema)
  • Parameters
  • Examples
  1. SDK
  2. SDK Documentation
  3. Project Level SDK Functions

create_label_set

Previouscreate_issueNextcreate_project

Last updated 7 months ago

imerit_ango.sdk.SDK.

create_label_set(project_id, tools, classifications, relations, raw_category_schema)

Create and set the project's ontology.

As this method is more complex than others, we recommend also consulting the examples at the end of this section.

Parameters

  • project_id: string

    • The unique identifier for the project. You can find the project ID in or retrieve it using the function.

  • tools: List[ToolCategory], optional

    • List of tools that will be added to the label set.

    • Example: [ToolCategory(Tool.Segmentation, title="SegmentationTool")]

  • classifications: List[ClassificationCategory], optional, default None

    • List of classifications that will be added to the label set.

    • Example: [ClassificationCategory(Classification.Single_dropdown, title = "Choice", options=[LabelOption("First"), LabelOption("Second")])]

  • relations: List[RelationCategory], optional, default None

    • List of relations that will be added to the label set.

    • Example: [RelationCategory(Relation.Single, title="SingleRelationTool")]

  • raw_category_schema: Dict, optional, default None

    • Instead of creating the label set (category schema) using the previous 'tools', 'classifications', and 'relations' parameters, you may pass here a dictionary representing the entire category schema.

    • See the section below for an example.

To get an example of what can be passed as the raw_category_schema, there are two ways:

  • Using the SDK itself, get the category schema from another existing project. This will also allow you to programmatically copy the category schema between two projects, like so:

Example Code
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

# Extract category schema info from the existing project
existing_project = ango_sdk.get_project(project_id="<EXISTING_PROJECT_ID>")
cat_schema = existing_project.get("data").get("project").get("categorySchema")

# Create a new project and retrieve the ID of the newly created project
new_project = ango_sdk.create_project("New Project Title", "New Project Description")  
new_project_id = new_project.get("data").get("project").get("_id")

# Add new category schema to newly created project
ango_sdk.create_label_set(project_id=new_project_id, raw_category_schema=cat_schema)

As an example, a raw_category_schema obtained from a project could be this:

Sample Category Schema
{
  "tools": [
    {
      "title": "Vehicle",
      "tool": "bounding-box",
      "required": false,
      "schemaId": "c053da596995f93c2c71520",
      "ocrEnabled": false,
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [
    {
      "title": "Color",
      "tool": "radio",
      "required": false,
      "schemaId": "75c02176796c17e7c657955",
      "frameSpecific": false,
      "classifications": [],
      "multiple": false,
      "options": [
        {
          "value": "Red",
          "schemaId": "95df97dc43d2e1dcc77d536"
        },
        {
          "value": "Yellow",
          "schemaId": "f477d05947e30259cc53538"
        },
        {
          "value": "Blue",
          "schemaId": "18a8212c7c48c2ee3464602"
        }
      ],
      "shortcutKey": "2"
    }
  ],
  "relations": []
}

Label Set Classes

ToolCategory:

  • BoundingBox

  • Segmentation

  • Polyline

  • Polygon

  • RotatedBoundingBox

  • Ner

  • Point

  • Pdf

  • Brush

ToolCategory Parameters:

  • tool: Tool

    • The tool type. ex.: Tool.Segmentation

  • title: string, default ""

    • The title of the tool.

  • required: bool, default None

    • Whether annotators are required to draw at least one instance of this tool.

  • schemaId: string, default None

    • Sets the tool's schemaId.

  • columnField: bool, default False

    • Whether this tool should be a table column.

  • color: string, default ""

    • The color assigned to this labeling tool, in the format "#FFFFFF"

  • shortcutKey: string, default ""

    • The shortcut to quickly select this tool, "0"-"9", "ctrl+0"-"ctrl+9", "a"-"k"

  • classifications: List[ClassificationCategory], default []

    • List of nested classifications, if any

  • options: List[LabelOption], default []

    • The tool's answers (options.)


ClassificationCategory:

  • Multi_dropdown

  • Single_dropdown

  • Tree_dropdown

  • Radio

  • Checkbox

  • Text

  • Instance

ClassificationCategory Parameters:

  • classification: Classification

    • The classification type. ex.:Classification.Tree_dropdown

  • title: string, default ""

    • The title of the classification.

  • required: bool, default None

    • Whether annotators have to answer this classification or not.

  • schemaId: string, default None

    • Sets the classification's Schema ID.

  • columnField: bool, default False

    • Whether this classification should be a table column.

  • color: string, default ""

    • The color assigned to this labeling tool, in the format "#FFFFFF"

  • shortcutKey: string, default ""

    • The shortcut to quickly select this tool, "0"-"9", "ctrl+0"-"ctrl+9", "a"-"k"

  • classifications: List, default [ClassificationCategory]

    • List of nested classifications, if any

  • options: List[LabelOption], default []

    • The classification's answers (options.)

  • treeOptions: List[TreeOption], default []

    • For trees, the tree's leaves/branches.

  • parentOptionId: string, default ""

    • The schema ID of the parent option. That is, the option that the labeler needs to select in order for this classification to appear. Enables conditional nesting.

  • richText: bool, default False

    • Set to True to enable the Rich Text editor for the selected text classification tool.


RelationCategory:

  • Single

  • Group

RelationCategory Parameters:

  • relation: Relation

    • The classification type. ex.:Relation.Single

  • title: string, default ""

    • The title of the relation.

  • required: bool, default None

    • Whether annotators have to include at least one such relation in order to submit their annotation.

  • schemaId: string, default None

    • Sets the schemaId of the relation.

  • columnField: bool, default False

    • Whether this relation should be a table column.

  • color: string, default ""

    • The color assigned to this relation, in the format "#FFFFFF"

  • shortcutKey: string, default ""

    • The shortcut to quickly select this relation, "0"-"9", "ctrl+0"-"ctrl+9", "a"-"k"

  • classifications: List[ClassificationCategory], default []

    • List of nested classifications, if any

  • options: List[LabelOption], default []

    • The relation's answers (options.)


LabelOption parameters:

  • value: string

    • The text of the answer (option.)

  • schemaId: string, default None

    • The schema ID of the option. Necessary for conditional nesting.

Returns:

  • output: dict

Examples

Example-1: Creating an ontology with:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import LabelOption, ClassificationCategory, Classification

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

category = ClassificationCategory(Classification.Single_dropdown,
                                  title = "Choice",
                                  options = [LabelOption("First"),
                                             LabelOption("Second")])

label_set = [category]

response = ango_sdk.create_label_set(project_id=project_id, classifications=label_set)
Resulting category schema
{
  "tools": [],
  "classifications": [
    {
      "treeOptions": [],
      "tool": "single-dropdown",
      "title": "Choice",
      "required": false,
      "columnField": false,
      "color": "#20549F",
      "shortcutKey": "",
      "classifications": [],
      "options": [
        {
          "value": "First",
          "schemaId": "793a5f9474b64bf5919d943b4cef9b65"
        },
        {
          "value": "Second",
          "schemaId": "47e022c1cc9b41aa9a3d000c7bbc6524"
        }
      ],
      "schemaId": "e4dd1c6f65a04d51b3ea66d23c92a321",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": []
}

Example-2: Creating an ontology with:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import ClassificationCategory, Classification, LabelOption, Tool, ToolCategory, RelationCategory, Relation

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

dropdown = ClassificationCategory(Classification.Single_dropdown,
                                  title = "SingleDropdown",
                                  options = [LabelOption('First'), 
                                             LabelOption('Second')])
classifications = [dropdown]

segmentation = ToolCategory(Tool.Segmentation, title="SegmentationTool")
tools = [segmentation]

relation = RelationCategory(Relation.Single, title="SingleRelationTool")
relations = [relation]

ango_sdk.create_label_set(project_id=project_id,
                          tools=tools,
                          classifications=classifications,
                          relations=relations)
Resulting category schema
{
  "tools": [
    {
      "tool": "segmentation",
      "title": "SegmentationTool",
      "required": false,
      "columnField": false,
      "color": "#8BE297",
      "shortcutKey": "",
      "classifications": [],
      "options": [],
      "schemaId": "c51c18700440443695cf1c8239c44360"
    }
  ],
  "classifications": [
    {
      "treeOptions": [],
      "tool": "single-dropdown",
      "title": "SingleDropdown",
      "required": false,
      "columnField": false,
      "color": "#C3C6FF",
      "shortcutKey": "",
      "classifications": [],
      "options": [
        {
          "value": "First",
          "schemaId": "0c26447159ce4e7790b47da8c4481681"
        },
        {
          "value": "Second",
          "schemaId": "e39099d2176a494da89833488cf1f88e"
        }
      ],
      "schemaId": "5375ac19fd264d6b9fe07060faaac0d6",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": [
    {
      "tool": "one-to-one",
      "title": "SingleRelationTool",
      "required": false,
      "columnField": false,
      "color": "#2D0509",
      "shortcutKey": "",
      "classifications": [],
      "options": [],
      "schemaId": "412f56e2fce4479da05470317e2845c8"
    }
  ]
}

Example-3: Creating an ontology with:

  • A Single Dropdown classification called "Entity Type" with the choices "Vehicle" and "Person"

  • Another Single Dropdown classification nested inside the first unconditionally (that is, any choice in the first dropdown will open this second) named "Position" with the choices "On Road" and "Off Road".

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import ClassificationCategory, LabelOption, Classification

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

nested_class_in_dropdown = ClassificationCategory(Classification.Single_dropdown,
                                                  title="Position",
                                                  options=[LabelOption('On Road'),
                                                           LabelOption('Off Road')])

dropdown = ClassificationCategory(Classification.Single_dropdown,
                                  title="Entity Type",
                                  options=[LabelOption('Vehicle'),
                                           LabelOption('Person')],
                                  classifications=[nested_class_in_dropdown],
                                  required=True)

classifications = [dropdown]

ango_sdk.create_label_set(project_id=project_id, classifications=classifications)
Resulting category schema
{
  "tools": [],
  "classifications": [
    {
      "treeOptions": [],
      "tool": "single-dropdown",
      "title": "Entity Type",
      "required": true,
      "columnField": false,
      "color": "#96934B",
      "shortcutKey": "",
      "classifications": [
        {
          "treeOptions": [],
          "tool": "single-dropdown",
          "title": "Position",
          "required": false,
          "columnField": false,
          "color": "#978D5E",
          "shortcutKey": "",
          "classifications": [],
          "options": [
            {
              "value": "On Road",
              "schemaId": "8b9cad52f7b84905a697589f402e11e0"
            },
            {
              "value": "Off Road",
              "schemaId": "cbd698bc6805461c9ce2380bec54c429"
            }
          ],
          "schemaId": "ab3ed5e9422c453d93c2bb02d6461ca3",
          "regex": null,
          "parentOptionId": null,
          "frameSpecific": false,
          "showDropdown": false,
          "richText": false
        }
      ],
      "options": [
        {
          "value": "Vehicle",
          "schemaId": "a21ba3c88b8440738e7945e295ca7545"
        },
        {
          "value": "Person",
          "schemaId": "7c13355b336840f9a9eb10def5c04971"
        }
      ],
      "schemaId": "9b42eea24ffc405788a4fad64e21af54",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": []
}

Example-4: Creating an ontology with:

    • A root

      • With a "tree0" branch

        • With a "subtree0" leaf

        • With a "subtree1" leaf

      • With a "tree1" leaf

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import ClassificationCategory, Classification, TreeOption

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

subtree0 = TreeOption(title="subtree0")
subtree1 = TreeOption(title="subtree1")
tree0 = TreeOption(title="tree0", children=[subtree0, subtree1])
tree1 = TreeOption(title="tree1")

tree_tool = ClassificationCategory(classification=Classification.Tree_dropdown,
                                  title="Tree One",
                                  treeOptions=[tree0, tree1])

ango_sdk.create_label_set(project_id=project_id, classifications=[tree_tool])
Resulting category schema
{
  "tools": [],
  "classifications": [
    {
      "treeOptions": [
        {
          "title": "tree0",
          "children": [
            {
              "title": "subtree0",
              "children": [],
              "key": "b4188077d99e4f2cb81cb8089977ee02",
              "value": "b4188077d99e4f2cb81cb8089977ee02"
            },
            {
              "title": "subtree1",
              "children": [],
              "key": "1d313ed3c7e54082af5400f1f589fc4c",
              "value": "1d313ed3c7e54082af5400f1f589fc4c"
            }
          ],
          "key": "bcadecdb205d41e783289638a23ad959",
          "value": "bcadecdb205d41e783289638a23ad959"
        },
        {
          "title": "tree1",
          "children": [],
          "key": "96e3ae4f72c84539a0cfc91d7f48c54c",
          "value": "96e3ae4f72c84539a0cfc91d7f48c54c"
        }
      ],
      "tool": "tree-dropdown",
      "title": "Tree One",
      "required": false,
      "columnField": false,
      "color": "#9B0EE5",
      "shortcutKey": "",
      "classifications": [],
      "options": [
        {
          "value": "tree0",
          "schemaId": "bcadecdb205d41e783289638a23ad959"
        },
        {
          "value": "tree0 / subtree0",
          "schemaId": "b4188077d99e4f2cb81cb8089977ee02"
        },
        {
          "value": "tree0 / subtree1",
          "schemaId": "1d313ed3c7e54082af5400f1f589fc4c"
        },
        {
          "value": "tree1",
          "schemaId": "96e3ae4f72c84539a0cfc91d7f48c54c"
        }
      ],
      "schemaId": "70d5b1df35764048bfebdec5290d6294",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": []
}

Example-5: Creating an ontology with:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import ClassificationCategory, LabelOption, Classification

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

radio1 = LabelOption(value="Radio Option 1", schemaId="radioOption1SchemaId")
radio2 = LabelOption(value="Radio Option 2")

conditional_text = ClassificationCategory(classification=Classification.Text,
                                          title="Text Tool",
                                          parentOptionId="radioOption1SchemaId",
                                          color="#333333",
                                          richText=True)

radio = ClassificationCategory(classification=Classification.Radio,
                               title="Radio Classification",
                               options=[radio1, radio2],
                               classifications=[conditional_text])

ango_sdk.create_label_set(project_id=project_id, classifications=[radio])
Resulting category schema
{
  "tools": [],
  "classifications": [
    {
      "treeOptions": [],
      "tool": "radio",
      "title": "Radio Classification",
      "required": false,
      "columnField": false,
      "color": "#C9ABFF",
      "shortcutKey": "",
      "classifications": [
        {
          "treeOptions": [],
          "tool": "text",
          "title": "Text Tool",
          "required": false,
          "columnField": false,
          "color": "#333333",
          "shortcutKey": "",
          "classifications": [],
          "options": [],
          "schemaId": "62d8398f548b4fa4915e639cf4180fbc",
          "regex": null,
          "parentOptionId": "radioOption1SchemaId",
          "frameSpecific": false,
          "showDropdown": false,
          "richText": true
        }
      ],
      "options": [
        {
          "value": "Radio Option 1",
          "schemaId": "radioOption1SchemaId"
        },
        {
          "value": "Radio Option 2",
          "schemaId": "8daa04c07bd6462294a45870c9c4fa49"
        }
      ],
      "schemaId": "b79f2aeda12346eea6bf16ab5dc0c84f",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": []
}

Example-6: Creating an ontology with:

    • The Tree Dropdown has a main root

      • With a branch called "Branch 1"

        • With leaves called "Leaf 1" and "Leaf 2"

      • With a leaf called "Leaf 3"

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.label_category import ClassificationCategory, TreeOption, LabelOption, Classification

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

leaf1 = TreeOption(title="Leaf 1")
leaf2 = TreeOption(title="Leaf 2")
leaf3 = TreeOption(title="Leaf 3")

branch1 = TreeOption(title="Branch 1",
                     children=[leaf1, leaf2])

tree_tool = ClassificationCategory(classification=Classification.Tree_dropdown,
                                  title='tree',
                                  treeOptions=[branch1, leaf3],
                                  parentOptionId="radioOptionSchemaId")

radio1 = LabelOption(value="Radio Answer 1")
radio2 = LabelOption(value="Radio Answer 2")

radio = ClassificationCategory(classification=Classification.Radio,
                               title='radio',
                               classifications=[tree_tool],
                               options=[radio1, radio2])

ango_sdk.create_label_set(project_id=project_id, classifications=[radio])
Resulting category schema
{
  "tools": [],
  "classifications": [
    {
      "treeOptions": [],
      "tool": "radio",
      "title": "radio",
      "required": false,
      "columnField": false,
      "color": "#C5FA61",
      "shortcutKey": "",
      "classifications": [
        {
          "treeOptions": [
            {
              "title": "Branch 1",
              "children": [
                {
                  "title": "Leaf 1",
                  "children": [],
                  "key": "a5932cf49f804e0fa5c6ae2066875242",
                  "value": "a5932cf49f804e0fa5c6ae2066875242"
                },
                {
                  "title": "Leaf 2",
                  "children": [],
                  "key": "bbb54a7814f84b96857b0b8acb96c0b0",
                  "value": "bbb54a7814f84b96857b0b8acb96c0b0"
                }
              ],
              "key": "ba8ce5a3b853420f9b2fb146db969d3f",
              "value": "ba8ce5a3b853420f9b2fb146db969d3f"
            },
            {
              "title": "Leaf 3",
              "children": [],
              "key": "25b78c7dceff4600ad4074ad316980e6",
              "value": "25b78c7dceff4600ad4074ad316980e6"
            }
          ],
          "tool": "tree-dropdown",
          "title": "tree",
          "required": false,
          "columnField": false,
          "color": "#F9F415",
          "shortcutKey": "",
          "classifications": [],
          "options": [
            {
              "value": "Branch 1",
              "schemaId": "ba8ce5a3b853420f9b2fb146db969d3f"
            },
            {
              "value": "Branch 1 / Leaf 1",
              "schemaId": "a5932cf49f804e0fa5c6ae2066875242"
            },
            {
              "value": "Branch 1 / Leaf 2",
              "schemaId": "bbb54a7814f84b96857b0b8acb96c0b0"
            },
            {
              "value": "Leaf 3",
              "schemaId": "25b78c7dceff4600ad4074ad316980e6"
            }
          ],
          "schemaId": "499e34ff61f4404eac8d7925f8a48119",
          "regex": null,
          "parentOptionId": "radioOptionSchemaId",
          "frameSpecific": false,
          "showDropdown": false,
          "richText": false
        }
      ],
      "options": [
        {
          "value": "Radio Answer 1",
          "schemaId": "0805c3451c6045e0b2bd5179f8c2f858"
        },
        {
          "value": "Radio Answer 2",
          "schemaId": "22f59c2ee19d4ca4856a0894388d9780"
        }
      ],
      "schemaId": "fbb179f75e334396b31774d4d83badf3",
      "regex": null,
      "parentOptionId": null,
      "frameSpecific": false,
      "showDropdown": false,
      "richText": false
    }
  ],
  "relations": []
}

See also

From the UI, navigate to an existing project, then from the Settings tab, navigate to the Category Schema section. From there, click on the button on the right side to open the schema's JSON. Copy that JSON.

A classification, with two choices named "First" and "Second":

A classification with the classifications "First" and "Second"

A tool called "SegmentationTool"

A called "SingleRelationTool"

A tool with:

A with two possible answers, "Radio Option 1" and "Radio Option 2"

A conditionally nested using the rich text editor, which only appears if the labeler clicks on "Radio Option 1" (here, parentOptionId links the text tool to the option which reveals it)

A with the possible answers "Radio Answer 1" and "Radio Answer 2"

A which only appears if the annotator clicks on "Radio Answer 1"

Single Dropdown
Single Dropdown
Segmentation
Single Relation
Tree Dropdown
radio classification tool
Text classification tool
radio classification tool
Tree Dropdown classification tool
get_project
list_projects
the user interface