# Adjudication

Source: https://www.potatoannotator.com/docs/features/adjudication

Adjudication in Potato is a review page at `/adjudicate` where designated reviewers resolve the items annotators disagreed on and record one final label for each. Potato keeps the page off until the config enables the `adjudication` block and names at least one adjudicator. Adjudication runs beside the annotation phases rather than as an extra phase, and annotators keep working through `/annotate` while adjudicators work through the queue. Each decision records a final answer for each scheme the adjudicator answered, with any notes and error categories, and records the adjudicator's confidence when the config requires one. Potato writes the decisions to disk after every submission and reloads the saved decisions when the server restarts.

## Configuration options

Adjudication compares annotators on the same item, so a study needs more than one annotator per item before any item can reach the queue. Add the lines below to an existing config to send each item to three annotators and turn adjudication on for one reviewer, with every other option at its default:

```yaml
num_annotators_per_item: 3

adjudication:
  enabled: true
  adjudicator_users:
    - "lead_reviewer"
  min_annotations: 2
  agreement_threshold: 0.75
```

With `enabled: true`, Potato rejects the config when `adjudicator_users` is missing or empty, when `min_annotations` is not a positive integer, when `agreement_threshold` falls outside 0 to 1, when `fast_decision_warning_ms` is negative, or when `error_taxonomy` is not a list of strings. With similarity search on, Potato rejects a `similarity.model` that is empty or not a string. Each option and its default are listed below:

| Option | Default | What the option controls |
|---|---|---|
| `enabled` | `false` | Turns adjudication on. While `enabled` is false, `/adjudicate` falls back to Potato's home page and the `/adjudicate/api/` routes return 404. |
| `adjudicator_users` | none | The usernames allowed into the queue, matched exactly and case-sensitively. |
| `min_annotations` | `2` | How many annotators an item needs before the item can enter the queue. Adjudicators' own annotations never count. |
| `agreement_threshold` | `0.75` | Items whose overall agreement is at or above the threshold stay out of the queue. |
| `show_all_items` | `false` | Queues every item with enough annotators, unanimous items included. |
| `min_human_annotations` | `0` | A separate floor on human annotators per item, for studies that declare machine annotators. |
| `include_machine_annotators` | `false` | Counts the annotators declared in the `machine_annotators` block toward `min_annotations` and shows the machine annotators' answers. While the option is false, machine annotators' labels stay out of the queue. |
| `show_annotator_names` | `true` | Shows each annotator's username. Set to false, the queue and the item view replace usernames with per-item aliases ("Annotator 1", "Annotator 2"). |
| `show_timing_data` | `true` | Shows how long each annotator spent on the item in the per-annotator summary row. Set to false, the option hides the timing in that row only. The chips and cards in the decision forms still show each annotator's time, and the server sends the timing data either way. |
| `show_agreement_scores` | `true` | Shows each scheme's agreement score on the item. |
| `fast_decision_warning_ms` | `2000` | Marks an annotator who spent less time on the item than the given number of milliseconds. A value of `0` turns the mark off. |
| `require_confidence` | `true` | Adds a confidence picker with High, Medium, and Low to the page and refuses a decision without a confidence. The server checks only that the confidence is not empty, and only the page limits the value to the three levels. Set to false, the page shows no picker and every decision stores an empty confidence. |
| `require_notes_on_override` | `false` | Refuses a decision whose source is `override` and whose notes are empty. The 2.14.0 adjudication page records each source as `adjudicator` or as the name of the annotator whose answer was adopted, never as `override`, so the option affects only decisions sent straight to the API. With `show_annotator_names: false`, the page records an alias such as "Annotator 2" in place of the username, and the alias reaches `decisions.json` and the `source` column of `adjudicated.csv`. |
| `error_taxonomy` | six categories | The error categories an adjudicator can tick on each decision. The default list is `ambiguous_text`, `guideline_gap`, `annotator_error`, `edge_case`, `subjective_disagreement`, and `other`. |
| `similarity` | off | Shows the items most similar to the open one, from sentence embeddings of the item text. |
| `output_subdir` | `adjudication` | The folder under `output_annotation_dir` where Potato writes `decisions.json`. |

Keep `output_subdir` at its default if you export with the `adjudication` format. The 2.14.0 exporter reads `<output_annotation_dir>/adjudication/decisions.json` whatever `output_subdir` says.

Blinding with `show_annotator_names: false` hides usernames on screen, but the 2.14.0 page does not keep usernames out of the browser. After a submit or a skip on the last item in the list, the page asks the `/adjudicate/api/next` route for the next item, and the route returns the item with the real usernames. Anyone who opens the browser's developer tools can read the usernames in the route's response. Annotators who marked spans but answered no other scheme all appear under the same alias, "Annotator".

Similarity search needs the `sentence-transformers` package, and without the package Potato logs a warning and shows no similar items. To turn the search on, add a `similarity` block inside the `adjudication` block above:

```yaml
adjudication:
  similarity:
    enabled: true
    model: "all-MiniLM-L6-v2"
    top_k: 5
    precompute_on_start: true
```

The `top_k` option takes an integer from 1 to 20 and sets how many similar items the page lists. With `precompute_on_start: true`, Potato embeds the text of every item when the server starts. Keep `precompute_on_start` at true. With the option false, the 2.14.0 server embeds no items at any point, and the page finds similar items only in an embedding cache that an earlier run left on disk.

## Queue criteria and order

Potato scores each item with pairwise percent agreement. For each scheme, Potato counts the pairs of annotators who gave the same answer and divides by the number of pairs. Image schemes are scored by comparing the shapes themselves, and schemes with no defined notion of agreement are left out. The item's overall agreement is the mean over the schemes that have a score. Potato queues an item that meets three conditions:

1. **Enough annotators.** The item has at least `min_annotations` annotators. Adjudicators never count, and machine annotators count only when `include_machine_annotators` is true.
2. **Enough people.** The item has at least `min_human_annotations` human annotators.
3. **Low agreement.** The overall agreement is below `agreement_threshold`, or the item has no score at all. With `show_all_items: true`, Potato skips the agreement check.

Potato leaves an item unscored when no scheme can be compared, as with an item that carries only spans or an item whose schemes each have a single answer. An unscored item goes ahead of every scored one in the queue, because nothing shows that the item's annotators agreed. Within the queue, pending items come first with the lowest agreement at the top, then items in progress, then completed and skipped items.

Potato builds the queue the first time anyone reads the queue after the server starts. From then on, an item joins the queue when the item reaches its annotator cap, provided the cap is 2 or more. The cap is `num_annotators_per_item`, or the per-item cap that [overlap sampling](/docs/deployment/heterogeneous-coverage#adjudication-auto-routing) sets. Annotators who hold the item in their assignments count toward the cap as well as annotators who have submitted the item. With the [labeling engine](/docs/labeling-engine/overview) on, an item the engine finds contested joins the queue as well. Between restarts, any other item that passes `min_annotations` without reaching its cap stays out of the queue. Items decided before a restart stay out of the rebuilt queue, and the **Done** filter and the progress counts then cover only decisions made since the server last started. The earlier decisions stay in `decisions.json` and reach both exports.

## Decision forms

The adjudication page lists the queue in a sidebar, with each item's ID, a one-line preview of the item text, the annotator count, and an agreement badge. Filters at the top of the sidebar switch between **Pending**, **All**, and **Done**. Opening an item shows the item through the project's `instance_display` when the config has one, so the adjudicator sees the item as the annotators saw it. Below the item, each annotator's answers sit side by side, with flags for an annotator who worked unusually fast on the item, changed answers more than five times, or agreed with the majority on fewer than 40% of queued items.

Each scheme gets a decision form built for its annotation type. Radio, select, and multiselect forms put a chip for every annotator beside the option the annotator chose. Likert and slider forms show each annotator's rating on a track. A Likert scheme that declares `labels:` gets the radio form with chips instead. Text and number forms show each response as a card the adjudicator can adopt or merge. Span, image, audio, and video schemes show each annotator's spans, shapes, or segments with controls to adopt each one. Any other type lists the answers annotators gave, one choice each, so the final answer keeps the shape of the annotators' answers.

Under the forms, the adjudicator ticks any error categories, writes optional notes, and can flag the item for a guideline update. With `require_confidence: true`, the adjudicator picks a confidence in the same section. **Submit and continue** saves the decision and opens the next item, and **Skip** marks the item skipped. A submission fails only when no form holds a decision or a required confidence is missing, and a scheme the adjudicator left undecided stays out of the decision. The keyboard shortcuts are N for the next item, P for the previous one, and Ctrl+Enter (Cmd+Enter on a Mac) to submit.

## Exporting adjudicated labels

Potato saves every decision to `<output_annotation_dir>/adjudication/decisions.json` with the default `output_subdir`. The `csv`, `jsonl`, and `parquet` export formats read each annotator's own labels, so an export in any of the three formats after adjudication still holds the disagreements and not the resolution. Two exports carry the decisions.

The `adjudication` export format writes only the decisions. Running the command below produces `adjudicated.csv`, with one row per item and scheme giving the final value, its source, the adjudicator, and the confidence, and `adjudication_log.jsonl`, with the notes, error categories, guideline flags, and time spent:

```bash
python -m potato.export -c config.yaml -f adjudication -o exports/
```

The `potato.adjudication_export` command is meant to merge the decisions with the items annotators agreed on, to make one final dataset. In 2.14.0 the command stops before reading any data, with the error `'str' object has no attribute 'config_file'`, so use the `adjudication` export format above until a release fixes the command. The command and its options are:

```bash
python -m potato.adjudication_export --config config.yaml --output final_dataset.jsonl
```

Each record carries a `source` of `unanimous`, `adjudicated`, or `unresolved`, and studies with machine annotators also get `unanimous_machine` and `unanimous_mixed`. Unresolved items are left out unless you add `--include-unresolved`, and an undecided item with fewer than two annotators is never written. `--format` takes `jsonl`, `json`, or `csv`. Without `adjudication.enabled: true` in the config, `potato.adjudication_export` exits with an error. The [export formats](/docs/features/export-formats) page lists the other formats.

## Who can see the queue

Every adjudication route requires an ordinary Potato login. A logged-in user reaches the queue in one of three ways:

- **Allow-list.** The username appears in `adjudicator_users`.
- **Role.** The user holds the built-in `adjudicator` or `admin` role, or a custom role with the `adjudicate` permission, through the [`rbac` block](/docs/core-concepts/user-management#role-based-access-control).
- **Admin key.** The same browser session carries the admin API key.

Debug mode does not grant access to the queue. A visitor without access who opens `/adjudicate` falls back to Potato's home page. The `/adjudicate/api/` routes return 401 without a login and 403 for a logged-in user without access.

Users on the `adjudicator_users` list see an **Adjudicate** button in the top bar of the annotation page. When Potato cannot assign a user on the list any item at all, the annotation page sends the user to `/adjudicate`. An adjudicator who has finished an assigned set of items stays on the annotation page, and a user who reaches the queue only through a role is never redirected. On the [admin dashboard](/docs/features/admin-dashboard), an **Adjudication** link opens the queue, and the disagreement score of each item with two or more annotations links to the adjudication page. The link selects the item only when the item is pending in the queue. For an item that never entered the queue or was already completed or skipped, the page opens with nothing selected. The admin-only `/admin/api/adjudication` endpoint returns the queue counts, each adjudicator's decision count and mean time, how often each error category was ticked, and how many decisions carry a guideline flag.

With [MACE](/docs/features/mace) enabled and MACE results available, items added when Potato builds the queue carry MACE's predicted label for each scheme in `mace_predictions` in their API records. Items that join the queue later carry no predictions, whether the items reached their cap or came through the labeling engine. The 2.14.0 adjudication page does not show the predicted label. Outside Solo Mode and QDA Mode, Potato rejects a config that enables both adjudication and `search.annotator_claim`.

## Example project

Potato ships a runnable example in [`examples/advanced/adjudication`](https://github.com/davidjurgens/potato/tree/master/examples/advanced/adjudication), a sentiment task with a radio scheme, a multiselect scheme, and eight short reviews of restaurants, products, a movie, a hotel, and a customer service team. The example sets `show_all_items: true`, so every annotated item appears in the queue. From the example's folder, write annotations for three simulated annotators, then start the server:

```bash
python setup_demo.py
potato start config.yaml -p 8000
```

The script writes `user_state.json` files for `user_1`, `user_2`, and `user_3` under `annotation_output/`, and `python setup_demo.py --clean` also deletes saved decisions. Log in at `http://localhost:8000` as `adjudicator`, registering the account if the login page asks for a password, and open `http://localhost:8000/adjudicate`.

## Further reading

- [Adjudication and resolving disagreement](/docs/guides/adjudication-and-disagreement), for when to adjudicate and when to aggregate instead
- [MACE](/docs/features/mace), for estimating annotator competence and a best-guess label without a reviewer
- [Heterogeneous coverage](/docs/deployment/heterogeneous-coverage), for overlap sampling and the per-item caps that route items into the queue
- [Admin dashboard](/docs/features/admin-dashboard), for per-item disagreement and project monitoring
- [Inter-annotator agreement](/docs/guides/inter-annotator-agreement), for agreement coefficients across the whole study
- [Review workflow board](/docs/features/review-workflow), for tracking items through review states on a board whose Adjudication column links to the adjudication page

For implementation details, see the [source documentation](https://github.com/davidjurgens/potato/blob/master/docs/administration/adjudication.md).
