Skip to content

Enhance task column cardinality with type groups - #859

Merged
cristian-tamblay merged 1 commit into
developfrom
feat/per-type-task-cardinality
Sep 7, 2026
Merged

Enhance task column cardinality with type groups#859
cristian-tamblay merged 1 commit into
developfrom
feat/per-type-task-cardinality

Conversation

@Irozuku

@Irozuku Irozuku commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

A task stated its column contract as one list of allowed types plus one cardinality for the whole side. That cannot express "one date column and any number of numeric ones": a single total accepts two dates and no numbers just as readily as the intended shape.

Tasks now declare a list of groups, each naming a set of interchangeable types and how many columns of that set it takes, the way BaseGenerativeTask already states its per type counts. Cardinality may be an exact int, "n", or a {min, max} range whose max may itself be "n".

metadata = {
    "inputs": [
        {"types": [Date], "cardinality": 1},
        {"types": [Float, Integer], "cardinality": {"min": 1, "max": "n"}},
    ],
    "outputs": [{"types": [Float, Integer], "cardinality": 1}],
}

The older two key spelling (inputs_types + inputs_cardinality) is read as the single group it always meant, so every existing task and plugin is unchanged. get_metadata reports both views, so every current consumer keeps reading exactly what it read before.


Type of Change

Check all that apply like this [x]:

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/back/tasks/base_task.py: added _column_groups, _bounds, _total_cardinality, _type_name, _cardinality_text and _validate_side. get_metadata now emits inputs/outputs (the per group form) alongside the four flat keys. validate_dataset_for_task delegates to the per side check, which charges each column to the first group that accepts its type and still has room, then checks every group against its own bounds. Error messages name the group's types only when there is more than one group, so single group tasks produce the message they always did.
  • DashAI/front/src/components/models/modelSession/PrepareDatasetStep.jsx: added columnGroupsOf (reads metadata.inputs/outputs, falling back to the flat pair) and describeCardinality. The requirements banner renders one line per group instead of one line per side.
  • DashAI/front/src/types/task.ts: added ITaskColumnGroup and the optional inputs/outputs fields on ITaskMetadataParameters.
  • DashAI/front/src/utils/i18n/locales/{en,es,pt,de,zh}/experiments.json: added label.cardinalityAtLeast and label.cardinalityBetween.
  • tests/back/tasks/test_task_column_groups.py: new. Covers group assignment, a group under its minimum, a group over its maximum, a type in no group, the error naming the short group, the metadata reporting both views, and the older contract still validating the way it did.
  • tests/back/tasks/test_tasks.py: metadata assertions updated from 4 keys to 6, with the group shape asserted.
  • tests/back/api/test_components_api.py: expected task metadata in the API responses gained the inputs/outputs keys.

Testing

  • The column picker banner on an existing task (Tabular Classification, Regression) should read exactly as before, since those declare a single group.

A task stated its column contract as one list of allowed types plus one
cardinality for the whole side. That cannot express "one date column and
any number of numeric ones": a single total accepts two dates and no
numbers just as readily.

Tasks now declare a list of groups, each naming interchangeable types and
how many columns of that set it takes, the way BaseGenerativeTask states
its per type counts. Cardinality may be an exact int, "n", or a
{min, max} range. The older two key spelling is read as a single group,
so existing tasks and plugins are unchanged, and get_metadata reports
both views so every current consumer keeps reading what it read before.

The column picker banner renders one requirement line per group.
@Irozuku Irozuku added front Frontend work back Backend work labels Sep 4, 2026
@cristian-tamblay
cristian-tamblay merged commit 0c858a2 into develop Sep 7, 2026
21 checks passed
@cristian-tamblay
cristian-tamblay deleted the feat/per-type-task-cardinality branch September 7, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back Backend work front Frontend work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants