Skip to content
هذه الصفحة غير متوفرة بلغتك بعد. يتم عرض النسخة الإنجليزية.

Hierarchical Multiselect

Build expandable tree-based taxonomy selectors in Potato for hierarchical classification, topic tagging, and multi-level category annotation tasks.

Hierarchical Multiselect

The hierarchical multiselect annotation schema provides an expandable tree interface for selecting categories from a nested taxonomy. This schema is ideal for tasks where labels are organized in a hierarchy, such as topic classification, product categorization, or any multi-level tagging task.

Overview

The hierarchical multiselect schema presents a collapsible tree view where:

  • Parent nodes expand to reveal child categories
  • Leaf nodes can be selected individually
  • Optional auto-selection propagates selections up or down the tree
  • Search allows annotators to find categories quickly in large taxonomies

Quick Start

yaml
annotation_schemes:
  - annotation_type: hierarchical_multiselect
    name: topic_tags
    description: Select all applicable topic categories.
    taxonomy:
      Science:
        Physics:
          - Quantum Mechanics
          - Thermodynamics
        Biology:
          - Genetics
          - Ecology
      Technology:
        - Software
        - Hardware

Configuration Options

FieldTypeDefaultDescription
annotation_typestringRequiredMust be "hierarchical_multiselect"
namestringRequiredUnique identifier for this schema
descriptionstringRequiredInstructions displayed to annotators
taxonomyobjectRequiredNested object defining the category hierarchy
auto_select_childrenbooleanfalseWhen a parent is selected, automatically select all its children
auto_select_parentbooleanfalseWhen all children are selected, automatically select the parent
show_searchbooleanfalseDisplay a search box to filter the taxonomy tree
max_selectionsinteger/nullnullMaximum number of categories that can be selected (null for unlimited)
expand_depthinteger1Number of tree levels to expand by default
label_requirement.requiredbooleanfalseWhether at least one selection is required before submitting

Examples

Topic Classification

yaml
annotation_schemes:
  - annotation_type: hierarchical_multiselect
    name: topic_classification
    description: Select all topics that apply to this document.
    show_search: true
    max_selections: 5
    taxonomy:
      Politics:
        Domestic:
          - Elections
          - Legislation
          - Policy
        International:
          - Diplomacy
          - Trade
          - Conflict
      Sports:
        - Football
        - Basketball
        - Tennis
      Entertainment:
        Film:
          - Reviews
          - Industry News
        Music:
          - Reviews
          - Concerts

Product Categorization with Auto-Selection

yaml
annotation_schemes:
  - annotation_type: hierarchical_multiselect
    name: product_category
    description: Categorize this product listing.
    auto_select_children: true
    auto_select_parent: true
    expand_depth: 2
    taxonomy:
      Electronics:
        Computers:
          - Laptops
          - Desktops
          - Tablets
        Audio:
          - Headphones
          - Speakers
      Clothing:
        Men:
          - Shirts
          - Pants
        Women:
          - Dresses
          - Tops

Medical Coding

yaml
annotation_schemes:
  - annotation_type: hierarchical_multiselect
    name: diagnosis_codes
    description: Select all applicable diagnosis categories.
    show_search: true
    label_requirement:
      required: true
    taxonomy:
      Cardiovascular:
        Hypertension:
          - Primary
          - Secondary
        Arrhythmia:
          - Atrial Fibrillation
          - Ventricular Tachycardia
      Respiratory:
        Obstructive:
          - Asthma
          - COPD
        Infectious:
          - Pneumonia
          - Bronchitis

Output Format

json
{
  "topic_tags": {
    "labels": ["Science > Physics > Quantum Mechanics", "Technology > Software"]
  }
}

Selected categories are stored as full path strings from root to leaf.

Best Practices

  1. Keep taxonomies manageable - avoid more than 4 levels of nesting; deep trees are hard to navigate
  2. Enable search for large taxonomies - when there are more than 30 categories, show_search: true greatly improves usability
  3. Use auto-selection carefully - auto-selecting children is useful when parent categories imply all children, but can be confusing otherwise
  4. Set appropriate expand depth - expand enough levels so annotators can see the structure without being overwhelmed
  5. Limit selections when appropriate - use max_selections to prevent annotators from over-tagging

Further Reading

For implementation details, see the source documentation.