annie.pages.event_task

Event-annotation task UI — the video-editor timeline surface (UI).

One queued video at a time: a large HTML5 player centred at the top, a transport bar (play/pause, ±5 s, frame-step, “Start/End here”), linked frame/second/timecode jump fields, then the SVG timeline (one lane per track) and an event editor. Events are authored from scratch and saved to the review DB immediately on every change — there is no Save button; export (JSON for code, CSV or XLSX for a spreadsheet) is a separate step.

Which video is shown comes from the Browse annotator queue, like Curation. Frame accuracy is provided by annie.pages.videoclock (HTML5 currentTime stepping); the timeline is drawn by annie.pages.timeline (Python owns the model, JS reports gestures). The layout is fixed: the video and the editor sit side by side on top, with the full-width timeline in its own row beneath both.

This module is heavy on browser interaction (video, JS bridge, SVG gestures) so its wiring is verified in the browser; the pure geometry/export/store pieces it calls are unit-tested in their own modules.

Functions

next_default_category_name(→ str)

Return the next free "<prefix> N" name given the existing names.

cleanup(→ None)

Drop a disconnected client's Event-annotation state and gesture handler flag.

needs_metadata(→ bool)

Whether entry's metadata still has to be read before its work area can be built.

load_metadata(→ bool)

Read entry's frame rate and length off the event loop and apply them.

event_annotation_task(→ None)

Build the Event-annotation work area for the current queued video.

changed_fields(→ dict[str, object])

The subset of fields whose value differs from what event stores.

Module Contents

annie.pages.event_task.next_default_category_name(existing: list[str], prefix: str = 'Participant') → str[source]

Return the next free "<prefix> N" name given the existing names.

Used when a participant or event category is added without a typed name, so “just click Add” still yields a clean, consistent label (Participant 2, Event 3, …) and never a collision.

Parameters:
  • existing – The names already in use.

  • prefix – The name’s first word, "Participant" or "Event".

Returns:

"<prefix> N" for the smallest N >= 1 not already taken.

annie.pages.event_task.cleanup(client_id: str) → None[source]

Drop a disconnected client’s Event-annotation state and gesture handler flag.

annie.pages.event_task.needs_metadata(state_: _EventState, entry: annie.core.models.VideoEntry) → bool[source]

Whether entry’s metadata still has to be read before its work area can be built.

async annie.pages.event_task.load_metadata(state_: _EventState, entry: annie.core.models.VideoEntry) → bool[source]

Read entry’s frame rate and length off the event loop and apply them.

A result that arrives after the reviewer moved on to another video is dropped, so stepping quickly always ends on the video asked for last.

Parameters:
  • state – The client’s Event-annotation state.

  • entry – The video whose metadata to read.

Returns:

True if state_ now holds this video’s metadata (or its read failed, which is reported once), False if the read was stale, duplicate or not needed.

annie.pages.event_task.event_annotation_task() → None

Build the Event-annotation work area for the current queued video.

annie.pages.event_task.changed_fields(event: annie.dataset.storage.EventRecord, fields: dict[str, object]) → dict[str, object][source]

The subset of fields whose value differs from what event stores.