Add barrier_picker_app — Dockerised web picker for barrier opening

A FastAPI app + plain HTML5 video page that replaces the matplotlib
picker. Browse to http://host:8000/, scrub through each video with
arrow keys (±5 s, ±1 s with Shift, ±0.1 s with Ctrl, ±1 frame with
,/.), and click one of three buttons:
  - All barriers open      — every ROI usable
  - Upper barrier opens    — ROIs 1,3,5 usable; lower row marked bad
  - Lower barrier opens    — ROIs 2,4,6 usable; upper row marked bad

The current playhead time is recorded as opening_s; bad_rois is set
accordingly. Also keyboard shortcuts (1/2/3 for the three modes,
s/u for skip/unusable). Refresh-safe: every submission persists to
data/metadata/barrier_opening.csv before advancing.

Server uses byte-range streaming so seeking inside long videos is
fast. Dockerfile + docker-compose.yml mount the data volume RO and
the metadata folder RW.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-01 12:33:28 +01:00
parent 24403e0474
commit 1a7542def2
7 changed files with 611 additions and 5 deletions

View file

@ -0,0 +1,21 @@
services:
picker:
build: .
image: cupido-barrier-picker
container_name: cupido-barrier-picker
ports:
- "8000:8000"
volumes:
# Project data volume (videos + tracking DBs + merged TSV) — read-only.
- /mnt/data/projects/cupido:/mnt/data/projects/cupido:ro
# Source video tree — mount at the same path the inventory references
# (so the mp4_path strings in video_inventory.csv resolve unchanged).
- /mnt/ethoscope_data/videos:/mnt/ethoscope_data/videos:ro
# Repo's data/metadata folder — mount read-write so the app can persist
# barrier_opening.csv. Adjust the host path to your local checkout.
- ../../data/metadata:/cupido/data/metadata:rw
environment:
CUPIDO_DATA_VOLUME: /mnt/data/projects/cupido
CUPIDO_INVENTORY_CSV: /cupido/data/metadata/video_inventory.csv
CUPIDO_OUTPUT_CSV: /cupido/data/metadata/barrier_opening.csv
restart: unless-stopped