Skip to content

Unify metadata attachments across web and desktop - #1807

Open
PaulHax wants to merge 2 commits into
fm-stack-00-upload-package-authorityfrom
fm-stack-01-metadata-attachments
Open

Unify metadata attachments across web and desktop#1807
PaulHax wants to merge 2 commits into
fm-stack-00-upload-package-authorityfrom
fm-stack-01-metadata-attachments

Conversation

@PaulHax

@PaulHax PaulHax commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Second of a four-PR stack, on top of #1806. Review only this PR's own commits; the base branch
carries #1806's changes.

Summary

One optional metadata attachment per dataset scope, consistent across web and desktop.

Single-camera datasets get one shared attachment; multicamera datasets get one shared parent
attachment plus one camera-local attachment per camera, camera-local taking precedence. Image
sequences and videos are supported from the start. JSON, TXT, and CSV stay opaque pipeline inputs
here — row parsing is the next PR.

Carried through: web and desktop creation-time selection; headless and RPC ingestion; single-camera
and multicamera imports; clone-root lookup; export/import round trips; pipeline discovery and opt-in
injection; and a normalized GET /dive_dataset/:id/frame_metadata_sources.

Reserved frame-metadata.* and frame_metadata.* names are recognized identically by Python and
TypeScript, pinned by a shared conformance fixture, and never sent through annotation parsing.

The read path — the source endpoint, the web and desktop loaders, and loadFrameMetadata on the
Api interface — lands here with no production consumer, because it is the attachment contract
and the next PR is its first caller. Review it against test_frame_metadata_sources.py, not a UI.

Two changes outside the attachment story ride along:

  • One annotation CSV per sweep. process_items imported every CSV, last write winning. It now
    imports the oldest and names the rest in a warning, so the headless sweep enforces the rule Upload exactly the server-validated package #1806
    enforces interactively. The sweep is already rewritten here to pre-scan for reserved names.
  • Metadata-item download path. _inject_dataset_metadata_file reconstructed <dir>/<item name>,
    wrong when girder_client sanitizes or nests the name — in the nested case exists() passes and a
    directory is bound into the KWIVER setting. It now locates what actually landed.

The write-only metadataFile item marker and its helper are dropped; nothing ever read it, and the
folder's metadataFileItemId is the only attachment locator. Items in existing datasets keep the
stale key harmlessly.

Reviewer focus

  • Attachment identity is stored once per scope and stays inside the owning dataset/clone root.
  • Camera-local attachments override shared ones without hiding shared data from other cameras.
  • Attachment bytes stay opaque to the server.
  • Pipeline injection happens only for pipelines declaring a metadata-file key.
  • Clone/export/import preserve original names and create no annotation tracks.
  • Replacing an attachment deletes the superseded file only when DIVE stored it. A reserved-name file
    is the user's own content, uploaded with the media and merely discovered — and process_items
    records what it discovers in the same marker, so ownership is decided by the reserved-name
    predicate, not the marker's presence.
  • A camera's attachment is the optional third argument of Upload exactly the server-validated package #1806's camera package. Unlike the
    annotation pick it is removed from the package rather than swapped into it — it is uploaded and
    declared separately once the camera dataset exists — and a folder file it displaces is still
    reported.
  • Metadata selections use opaque per-selection ids, so same-named attachments picked from different
    directories for different cameras do not collide.

Manual test

Uses okeanos-frame-metadata-upload, okeanos-video-explicit-frame, and okeanos-video-opaque-json
from okeanos-frame-metadata-fixtures.zip, attached to #1806 — CC0 NOAA Okeanos Explorer media with
synthetic metadata and annotations. Select all files in one directory per test.

  1. Select all files; confirm the reserved name takes the Metadata File slot, not the annotation slot.
    In okeanos-frame-metadata-upload both slots fill at once: annotations.csv is the
    annotation pick and frame-metadata.csv the attachment, from a single selection of two CSVs.
  2. Create and open: expected media, and the only tracks are the two from the VIAME CSV — the
    attachment contributes none.
  3. GET /api/v1/dive_dataset/<folder-id>/frame_metadata_sources — one shared object with an
    itemId, the original name, and an empty cameras object.
  4. Clone the image dataset; the same request against the clone still resolves through the clone root.
  5. For the JSON case, the endpoint reports frame_metadata.json — stored for pipelines, not
    interpreted, and the underscore spelling is discovered exactly like the hyphen one.

Desktop smoke test: import a media directory, choose its sidecar in Metadata File,
export the archive, reopen, and confirm the attachment name survives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant