Mobile Annotation (Pocket Mode)¶
Potato supports annotating from phones and tablets. Enable Pocket Mode and touch devices that open your task are automatically routed to a mobile-friendly interface: a card stack with thumb-zone label buttons, swipe navigation, offline annotation with automatic sync, and home-screen installation as a PWA. Desktop users see the normal interface; nothing changes for them.
Pocket Mode hosts the simplest types: one card per item and one tap per label. Many more types work on a phone through the regular annotation page, which is laid out for phones (see Phones without Pocket Mode). Only types that have not been checked by touch get a warning recommending a desktop browser. The admin dashboard shows who is annotating from which kind of device either way.
Quick start¶
pocket:
enabled: true
python potato/flask_server.py start examples/advanced/pocket-mode/config.yaml -p 8000
# open http://<your-machine>:8000/ on a phone and log in —
# you land in the mobile interface automatically
How device routing works¶
When a logged-in annotator reaches the annotation page, Potato decides where to send them:
| Device | Pocket-capable task, Pocket enabled | Other task, every type works by touch | Task with a type not checked for touch |
|---|---|---|---|
| Desktop | normal interface | normal interface | normal interface |
| Phone / tablet | redirected to the mobile interface | normal interface, laid out for the phone | normal interface + a dismissible warning that a desktop browser is recommended |
Detection happens in two layers:
- Server-side (User-Agent). Phones and most tablets identify themselves
(
iPhone,Android ... Mobile,iPad, ...). These are redirected before the desktop page ever renders. API clients and unrecognized agents count as desktop, so scripts and integrations are never redirected. - Client-side (pointer check). Some tablets masquerade as desktops — iPadOS Safari reports itself as a Mac. A small script on the annotation page checks whether the device's primary pointer is coarse (a finger) and redirects those too. Touchscreen laptops are not affected: their primary pointer is the trackpad.
Routing only applies to annotators in the annotation phase. Consent, instruction, and survey pages are unaffected.
Phones without Pocket Mode¶
A phone that is not routed to Pocket gets the regular annotation page, laid out for a small screen:
- The header takes two rows and scrolls away with the page. Long task names are shortened, with the full name on hover.
- The task scrolls with the page. Only PDF and document viewers keep their own scrolling box.
- Options, Likert-scale points, ranking arrows, slider handles and image toolbar buttons are at least 44px to touch. Multirate grids become a list of items, each with its ratings as rows.
- Keyboard-shortcut hints are hidden.
- Span highlighting: select text with a long press, then tap the Highlight as "label" button that appears at the bottom of the screen. Choose the label first, or the button asks for one.
These types work on the regular page by touch: radio, multiselect,
likert, slider, number, text, pure_display, select, multirate,
pairwise, bws, ranking, semantic_differential, span and
image_annotation. A task with any other type shows phone and tablet users a
dismissible warning recommending a desktop browser. The warning scrolls away
with the page.
Desktop users can use it too¶
Routing is only automatic for touch devices — the mobile interface itself is
open to everyone. On pocket-capable tasks the desktop navbar shows a
Compact view link to /pocket; with a mouse, the card stack becomes a
rapid one-click-per-item labeling view (the arrow buttons replace swiping).
Desktop users are never redirected in either direction.
Letting users opt out¶
The mobile interface has a Desktop site link in its header. Choosing it
loads the desktop interface (/annotate?desktop=1) and the choice sticks for
the rest of the session — one quiet banner offers the way back, and there are
no further redirects. Opening /pocket again clears the choice.
Turning auto-routing off¶
Auto-routing is on whenever Pocket Mode is enabled. To offer /pocket only
to users who navigate there themselves:
pocket:
enabled: true
auto_redirect: false
Configuration reference¶
pocket:
enabled: true # master switch for the mobile interface (default: false)
auto_redirect: true # send phones/tablets to /pocket automatically (default: true)
batch_size: 25 # items fetched per batch; also the offline queue depth (1-200)
Which annotation types are mobile friendly¶
The mobile interface serves schema types that work well under a thumb:
| Touch-capable (served on mobile) | Desktop-only |
|---|---|
radio, multiselect, likert, slider, number, text, pure_display |
span, image/bounding-box, video, audio, multirate, and everything else |
A task is touch-capable only if all of its schemes are in the left column. A task mixing in even one desktop-only scheme is not degraded onto touch: phones are not redirected, and they see a dismissible notice that the task isn't optimized for mobile. If you expect mobile annotators, design for it — a single-radio task is the ideal case (one tap = one labeled item).
The mobile interface¶
- Card stack — one item per card; the item text is the card. Swipe left = next, swipe right = previous; arrow buttons cover non-touch use. A subtle haptic tick confirms each save on devices that support it.
- Thumb-zone controls — label buttons sit in the bottom third of the
screen where a thumb actually reaches; all touch targets are 48px+;
safe-area insets respected on notched phones;
prefers-reduced-motionhonored. - Scheme rendering — single radio/likert tasks auto-advance on tap;
multi-scheme cards show every control plus an explicit Save & next.
Likert schemes with explicit
labelsrender as labeled buttons; a size-based likert renders numbered segments withmin_labelandmax_labelbeneath them, and stores the scale point under the same label name the desktop page uses. - Progress — the header shows done/total and a progress bar, matching the desktop count.
- Offline annotation — the current batch is prefetched and mirrored to
localStorage. If the connection drops, annotating continues and a chip
shows "Offline — N saves queued". The queue flushes on reconnect, after
every successful save, when the tab becomes visible again, and on a
30-second timer. A phone that keeps its network and loses the server never
fires the browser's
onlineevent, so those last two are how it recovers from a restart or a deploy. A server that refuses the save rather than failing to answer is a different case: the chip turns red and says to sign in again, because retrying a 401 will not fix it. Nothing is discarded either way. A service worker caches the app shell after the first visit, so the page loads with no connection. Field-research note: prefetch a batch on wifi, annotate anywhere, sync when back in coverage. - Install as an app — the page ships a web manifest; "Add to Home Screen" gives a standalone app with its own icon.
Saves use the same /updateinstance endpoint and payload as the desktop
page — Pocket Mode adds no new write path, so all downstream machinery
(exports, IAA, admin dashboard, quality control) sees ordinary annotations.
Attention checks and gold items are injected into the phone's batch the same
way they are on /annotate. Because the phone prefetches, a batch is capped
at the number of items that can be answered before the next check is due, so
the configured frequency still holds. With batch_size: 25 and
frequency: 3 the phone is served 3 items at a time, not 25. Quality control
costs offline depth, and the cap only applies when a frequency is set.
Admin: who is annotating from what¶
The admin dashboard has a Devices tab showing, per annotator: last device seen, visit counts by device class (mobile / tablet / desktop), how many times they used the mobile interface, and when they were last seen. Users who have annotated from a touch device are highlighted, and a summary line gives the headline ("3 of 12 users have visited from a phone or tablet"). The tab also states the routing situation for this task — auto-routing active, task capable but Pocket disabled, or task not mobile friendly.
Why this matters: if your task includes a type not checked for touch and the Devices tab shows annotators on phones anyway, those annotators saw the warning and kept going. Check their output or follow up with them. Device data also answers "would enabling Pocket Mode help?" before you turn it on: visits are tracked whether or not Pocket Mode is enabled.
Data lives in <output_annotation_dir>/pocket/device_visits.json — per-user
aggregates only (device class, counts, timestamps, last User-Agent string),
no per-item tracking.
API reference¶
| Endpoint | Method | Auth | Purpose |
|---|---|---|---|
/pocket |
GET | session (redirects to login) | The mobile page |
/pocket/api/task |
GET | session | Task name, schema specs, capability verdict |
/pocket/api/batch?n= |
GET | session | Next unannotated items for the card stack |
/pocket/api/routing |
GET | session | Routing facts (works even when Pocket is disabled) |
/pocket/api/device_hint |
POST | session | Client-side touch detection report |
/pocket/api/devices |
GET | admin | Per-annotator device usage for the dashboard |
/pocket/manifest.webmanifest |
GET | — | PWA manifest |
/pocket/sw.js |
GET | — | Service worker (served under /pocket for scope) |
Troubleshooting¶
A phone isn't being redirected. Check, in order: pocket.enabled and
pocket.auto_redirect are true; the task is touch-capable (GET
/pocket/api/routing shows capable: true and lists any
incompatible_schemes); the user hasn't chosen "Desktop site" this session
(opening /pocket once resets it).
An iPad gets the desktop page on first load. iPadOS Safari identifies
itself as a Mac, so the server can't catch it — the client-side pointer check
redirects it as soon as the page's scripts run. If scripts are blocked, use
the /pocket URL directly.
A desktop user with a touchscreen got redirected. They shouldn't be: the check uses the primary pointer, which is the trackpad/mouse on touchscreen laptops. If it happens anyway, the "Desktop site" link opts them out for the session; please report the device's User-Agent.
A user is "done" on mobile but the desktop page shows remaining items. They may have unsynced offline saves — the sync chip on the mobile page shows the queue; it flushes when the device comes back online.
Testing the redirect without a phone. Use your browser's device emulation
(a phone profile sends a mobile User-Agent), or
curl -H "User-Agent: ...iPhone..." -i http://localhost:8000/annotate and
look for the 302.
Related documentation¶
- Task Assignment — what lands in an annotator's queue (mobile users draw from the same queue as everyone else)
- Admin Dashboard — where the Devices tab lives
- Crowdsourcing — mobile-heavy crowd platforms