Trial editor

Per-trial column editor at /admin/trials/[registry_id]/edit. Use it to fix a single bad row that the automatic pipeline got wrong — without waiting for the next weekly cron and without re-extracting the whole corpus.

Trial editor with tag editor and column form

What you can edit

Every field on trials, plus tags in trial_tags, drugs in trial_drugs, and locations in trial_locations. The form is grouped into six logical sections matching the underlying schema.

How a save works

Edits land directly in the respective tables. Two columns on trials track the audit:

  • admin_edited_at — timestamp of last save
  • admin_edited_by — free-form actor string (from x-admin-user header or fallback)

Tag rows you touch get tag_source='admin'.

The conflict policy (HARD RULE)

The weekly cron's push_v3_intent.py and push_v4_disease.py scripts respect admin edits. Their DELETE clauses gate on AND tag_source <> 'admin' by default — your manual fixes survive every re-extraction.

This is the inverse of the "manual = automated" rule: by default, manual and automated paths produce identical output; when they diverge (admin edit), the manual path wins until explicitly overridden with --force-overwrite-admin.

Spot-review workflow on /admin/pipeline/[runId]

Often you'll reach the trial editor via the pipeline-run drill-down. The spot-review tab samples N trials from a run and lays the original CT.gov / CTRI text alongside the extracted v3 + v4 tags. Per-card buttons:

  • Audit — re-runs scraper/audit_one_trial.py with a different model (gemini-3.1-flash-lite by default — different family than the cron's gemini-2.5-flash-lite to give a real differential). Read-only verdict.
  • Regen (dry) — re-runs the v3 + v4 extraction on this trial and shows a before/after diff. No DB write.
  • Regen + apply — same, but UPSERTs the new tags with tag_source='v4-admin-regen'.
  • Flag — writes a trial_qa_findings row with kind='admin_review_flag' for later triage.