Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Data extraction

Pull structured data out of the included full texts. This is the step that turns a pile of papers into a dataset you can analyse. The variables (what to extract) and the extraction workflow (who does the extracting) are set once on the Protocol page. The rest lives in tabs on the Full text → Workflow page, in the order you use them: Preparation (PDFs and markdown, covered under full text), Prompt (how to extract), Calibration (test on a few papers), and AI extraction (run it last). The Extraction sidebar page is the per-paper verify queue.

1. Define what to extract, and how

The variables (the fields to pull out) are defined on the Protocol → Variables page, not here. They are shared definitions: each field carries its type, description, options, whether it’s required, and whether a human must verify it. Set them up before you run extraction (see Set up your protocol).

The prompt (how to read the paper) lives on the Prompt tab of this Workflow page, which holds two sections: Extraction prompt, open, and the optional Cross-check prompt, collapsed. In the extraction prompt only two parts are worth editing: your criteria (shown here, but edited on Protocol) and free-form additional instructions ({{additional}}, stage-specific guidance). The rest is a fixed scaffold ailr fills in, tucked under Advanced, and a live preview shows the full prompt exactly as sent. The cross-check section works the same way and is described under Cross-check.

extraction prompt tab, with the full prompt previewextraction prompt: the advanced scaffold and the draft-with-your-AI helper

Quality assessment / risk of bias

There is no separate risk-of-bias module, and that is deliberate: an appraisal is a group of extraction variables, so it goes through the same extraction, verification, and consensus flow as everything else. Two common instruments ship as opt-in modules on Protocol → Variables — rob2 (Cochrane RoB 2 for randomized trials: five domains plus an overall judgement, each Low / Some concerns / High) and newcastle_ottawa (star counts for cohort and case-control studies). Neither is ticked by default. Tick the one that fits your designs, or copy it as a starting point and edit the domains to match the instrument your protocol specifies.

In independent extraction, this means the appraisal is done by two reviewers and reconciled like any other variable, which is what appraisal guidance asks for.

The variables set the structure and the prompt sets the quality. These are independent, and understanding why is worth a few minutes: see How AI extraction works. You can let your own AI draft the variables or, if you rewrite the scaffold, the prompt, or run the model entirely outside the app.

2. Choose the extraction workflow

Set the workflow on Protocol → Workflow, where it sits next to the two screening workflows:

See workflow modes.

Calibrate extraction

Like screening, extraction has a Calibration tab.

extraction calibration

3. Run AI extraction

On the AI extraction tab, run AI extraction on the included papers, or import results you ran yourself. The Run externally helper (copy the exact prompt and download the JSON template) sits right next to Import, so generate-and-import live together. Mock mode fabricates schema-shaped values so you can test the extraction UI with no API call; a Force re-extract toggle re-runs papers that already have extractions (e.g. after you revise the variables). The run makes a couple of AI calls in parallel (2 by default; tune with extraction.workers in lit_review.yaml; see per-stage models).

ailr extract <project-folder>           # included papers
ailr extract <project-folder> --mock    # no API call
ailr extract <project-folder> --force   # re-extract existing

The run summary reports what happened rather than just a count: the quote audit rates for the run (how many values came back with a quote, and how many of those quotes are in the paper word for word), and for any paper that failed, the recorded error and its type, so you can tell a truncated response from a schema mismatch without opening the log.

A response without the per-criterion flag_check gives no full-text verdict, so the paper counts as failed and the next run tries it again. A paper an earlier run extracted without a verdict is not treated as done either: a normal run extracts it again when the same model did the earlier run, and lists it when another source did, so two models never mix in one paper’s record.

Importing results asks for the model that produced them and records it on every row, as an in-app run records its own, so the methods text can name it. Each record’s flag_check.decision is the AI’s full-text verdict; under assisted full-text screening a paper imported without one waits for it, and the import lists those papers.

AI extraction

4. Cross-check

This step is optional; skip it and everything else works as before. A cross-check audits a record that already exists. It is given the recorded value and the quote offered as its support, and asked whether the paper actually backs that up. It never extracts anything of its own, and it is not a third reviewer: because its input contains the record it is judging, it is not independent of it, so its verdicts stay out of agreement statistics, conflict resolution, and the PRISMA counts. Nothing it produces blocks a submission.

There are two layers, and they are stored and shown side by side.

Deterministic (no API calls, free to run). Pure string and schema comparisons, so the verdict is reproducible:

LLM (one call per paper, off by default). A second model reads the paper, the schema, and each value with its quote, and returns agree / disagree / uncertain per field with a one-sentence reason and, where the paper states a specific different value, a suggested value.

The checker is deliberately not shown the extractor’s confidence or reasoning. Seeing how sure the first model was anchors the second onto the answer it is supposed to be testing.

Running it

Both layers run from the AI extraction tab, over the whole project. A single paper can also be cross-checked from its action row in the verify queue. Mock mode runs the LLM layer with fabricated verdicts so you can see the whole flow before spending anything.

Under Settings → Cross-check you choose whose extractions get read (targets: the AI, the humans, or both), the checker’s provider and model, and whether the LLM layer is enabled at all. Each extractor’s findings are stored separately, so checking one reviewer’s rows never clears another’s.

Reading the findings

Findings appear as badges beside each field in the AI panel of the verify form, with a line at the top of the panel naming the flagged fields. A field that was checked and came back clean says checked, so “no problem found” is distinguishable from “never checked”. Expanding a badge shows the reason and, for the LLM layer, any suggested value with a Use this value button that drops it into your form (scalar fields only — a suggestion is a plain string, so list and object fields show it but leave the edit to you). As with the other fill buttons, nothing is written until you Save or Submit.

Two more places surface them: the full-text queue has a Cross-check flagged status filter, and the dashboard’s extraction card counts the flagged papers.

A finding goes stale when the row it judged is re-extracted, since it now describes a value that no longer exists. Stale findings are hidden from the badges and excluded from both the filter and the dashboard count, so the three never disagree about what is outstanding.

What the numbers mean

Its prompt

The cross-check prompt is in the collapsed Cross-check prompt section of the Prompt tab, beside the extraction prompt it judges. ailr ships a default, so you only need to touch it if your variables need domain-specific guidance — for example, that N in your literature means dyads rather than individual participants, which belongs in additional instructions. Under Advanced you can edit the whole scaffold; keep the {{project_name}}, {{schema_md}} and {{additional}} markers so ailr can fill them in. Saving writes prompts/crosscheck.txt into your project; delete that file to fall back to the built-in prompt, or use Restore built-in prompt.

5. Verify and edit

The Extraction page is the verify queue: it shows each paper whose final full-text decision is include, with the extracted fields, the verbatim quote the AI attached to each value, and the AI’s confidence (1 to 10) per field (so you can check the value against the source, and skim to the low-confidence fields first). Verify or edit the values per paper. The AI panel also carries the flag_check block, the model’s PASS / FAIL / UNCERTAIN verdict per criterion, each with the quote it read that verdict off.

Where your value differs from the AI’s, the field is highlighted and shows what the AI proposed with a “changed from AI” badge, so your edits are easy to spot at a glance, and a reviewer can see exactly where human judgement overrode the model. The badge tracks what you type, so a field is marked the moment it diverges.

While you verify, a reader pane beside the form shows the source; toggle it between the original PDF and the converted Markdown. Use Save draft to keep your edits without finalizing (if you leave the page without saving, your edits are not kept), and Submit to mark the paper done and return to the list.

For a repeating group, the field is a small table: rows can be added and removed (select a row, then delete it), and rows left entirely blank are dropped when you save, so a mis-added row does not become an empty object in the data.

Take the AI’s value back

Because the form pins to what you saved, an edit you later think better of used to be yours to retype. Two controls put the AI’s answer back:

Neither writes anything: the values land in the form and are yours to adjust, and nothing is stored until Save draft or Submit. Fields the chosen run left empty are left alone rather than blanked. Both appear only under verify, since independent extraction hides the AI’s values until you submit.

Re-run the AI on one paper

↻ Re-run AI extraction, in the paper’s action row, runs the current prompt and schema against this paper again. Use it after you revise the variables or the prompt and want to see what changes on a paper you already know, without a project-wide --force.

The run it replaces is not discarded: it is kept as an earlier version, listed under the AI extraction panel and available in the fill-all picker. Your saved values are untouched, but the form reloads when the run finishes, so save any unsaved edits first.

Who holds a paper

Saving a draft claims a paper: under verify only one reviewer extracts each paper, and a draft counts as a claim just as a submission does. So:

verify queueverify form

6. Reconcile two extractions

Only in independent mode. Once two reviewers have submitted their own extraction of a paper, it moves to To reconcile on the Full-text review list (the filter is not shown in verify mode, where one person extracts each paper). Click Open comparison →.

The comparison keeps the same split screen as extraction: the paper on the left, the decisions on the right. Variables the two reviewers answered identically are carried over untouched and folded away behind a “show the agreed fields” toggle, so the page opens on the handful that actually need a decision. A multi-select answered in a different order counts as agreement, not a difference.

For each disagreement, pick one reviewer’s answer — its supporting quote comes along — or type a different final value with your own quote. Repeating groups and nested objects are decided whole: both reviewers’ versions render as small tables so you can see how they differ, and you choose one. Aligning individual rows across two reviewers would mean guessing which row corresponds to which, and reviewers usually disagree about how many entries there are rather than about one cell.

Save consensus writes the agreed record and takes the paper out of the queue; Undo consensus removes it and puts the paper back. Anyone can adjudicate, including one of the two extractors; whoever does is recorded on the record.

The consensus record is what Extraction — final exports. A paper that has not been reconciled yet exports as one row per reviewer (each labelled in the extractor_id column) rather than a silently merged row, so unfinished reconciliation is visible in the data.

When extraction is verified, generate your reports and exports.