annie.pages.dataset

Dataset tab — define the dataset by adding data sources; see live metrics.

Annie is dataset-agnostic: instead of fixed folder fields, you build the dataset from a list of data sources (the + box). A videos folder is the mandatory spine; vdet/track folders, a protagonist CSV, and any number of label CSVs attach to it. There is no Scan button — adding or removing a source re-scans in place, and every metric and Browse row updates immediately. Each source shows an Available / Unavailable chip and a live item count.

Each browser tab maintains its own scan-in-progress flag and database-mode selection via a per-client _DatasetState keyed by nicegui.Client.id.

Attributes

CarryAction

What saving a config should do with the progress in the currently open database.

Classes

MetricCard

One overview metric card on the Dataset tab.

LayoutCommit

What committing the Layout text boxes should do.

Functions

metric_rows(→ list[list[MetricCard]])

The overview cards that fit the configured sources, as rows (empty rows dropped).

layout_from_input(→ annie.dataset.layout.VideoLayout)

Build and validate a VideoLayout from the Pattern box.

layout_commit(→ LayoutCommit)

Decide what to do when the Pattern box is committed (blur / Enter).

layout_summary(→ str | None)

Describe what a nested layout found, from the last scan (no extra filesystem walk).

render(→ None)

Build the Dataset tab body; register per-client state.

Module Contents

annie.pages.dataset.CarryAction

What saving a config should do with the progress in the currently open database.

class annie.pages.dataset.MetricCard[source]

One overview metric card on the Dataset tab.

title

The card’s caption.

key

The ScanResult.counts key it shows.

color

The caption colour.

annie.pages.dataset.metric_rows(registry: annie.dataset.sources.SourceRegistry) → list[list[MetricCard]][source]

The overview cards that fit the configured sources, as rows (empty rows dropped).

# videos is always shown; vdet and track cards appear only once that folder is a source, so a plain video dataset is not cluttered with face-tracking counts.

Parameters:

registry – The configured sources.

Returns:

file counts first, then per-video coverage.

Return type:

Rows of cards

class annie.pages.dataset.LayoutCommit[source]

What committing the Layout text boxes should do.

layout

The valid layout to apply, or None when there is nothing to apply.

error

A user-readable validation message, or None.

annie.pages.dataset.layout_from_input(pattern: str) → annie.dataset.layout.VideoLayout[source]

Build and validate a VideoLayout from the Pattern box.

Parameters:

pattern – The pattern box (path relative to the folder, with {field} placeholders).

Returns:

The validated layout.

Raises:

ValueError – With a user-readable message if the layout is unusable.

annie.pages.dataset.layout_commit(pattern: str, current: annie.dataset.layout.VideoLayout | None) → LayoutCommit[source]

Decide what to do when the Pattern box is committed (blur / Enter).

Parameters:
  • pattern – The pattern box text.

  • current – The layout already applied to the source, if any.

Returns:

LayoutCommit(layout=...) to apply a new valid layout; LayoutCommit(error=...) for an invalid one (nothing is applied); an empty LayoutCommit() when the box still describes the applied layout, or is still empty (nothing to do yet).

annie.pages.dataset.layout_summary(source: annie.dataset.sources.DataSource, scan: annie.dataset.scanning.ScanResult | None) → str | None[source]

Describe what a nested layout found, from the last scan (no extra filesystem walk).

Parameters:
  • source – The Videos-folder source.

  • scan – The last scan result.

Returns:

A one-line summary such as "278 videos · a ×70 · b ×4 · 0 collisions · e.g. …", or None when the source has no layout or nothing was scanned.

annie.pages.dataset.render() → None[source]

Build the Dataset tab body; register per-client state.