Single-ORCID Resync
Section titled “Single-ORCID Resync”Force a full publication + ORCID profile resync for a single researcher from the terminal.
Script: scripts/db/resync-orcid.mjs (relay) → cli/src/commands/resync/orcid.ts
pnpm alias: pnpm resync:orcid -- <orcid-id> [flags]
Requires CLOUDFLARE_API_TOKEN (or CF_API_TOKEN) in .env at the repo root.
Optional: SENTRY_DSN / GLITCHTIP_DSN to forward errors to GlitchTip.
What it does
Section titled “What it does”- Discovers entity memberships — queries D1 across all 5 shards to find every active entity the researcher belongs to. Sends one ingestion job per entity.
- Resolves Cloudflare Queue IDs via the CF REST API.
- Per-entity: inserts a pre-flight
ingestion_jobsrow into D1 (required — the process worker drops messages with no matching row), then sends anIngestionJobMessagetoworker-ingestion-queue. - Sends a direct
OrcidSyncJobMessagetoworker-ingestion-orcid-sync-queuetargeting just this ORCID (not a bulk scheduler). --watchmode — polls the D1 job rows every 3 s and prints live status until all jobs reachcompleteorfailed(15-minute timeout).
Commands
Section titled “Commands”Dry-run (plan only, nothing sent)
Section titled “Dry-run (plan only, nothing sent)”pnpm resync:orcid -- 0000-0002-8685-5194 --dry-runFull resync — both pipelines
Section titled “Full resync — both pipelines”Re-enrich all publications and sync the ORCID profile:
pnpm resync:orcid -- 0000-0002-8685-5194Watch terminal output until jobs finish
Section titled “Watch terminal output until jobs finish”pnpm resync:orcid -- 0000-0002-8685-5194 --watchForce re-sync even if the ORCID record is unchanged
Section titled “Force re-sync even if the ORCID record is unchanged”pnpm resync:orcid -- 0000-0002-8685-5194 --forceForce + watch (recommended for debugging)
Section titled “Force + watch (recommended for debugging)”pnpm resync:orcid -- 0000-0002-8685-5194 --force --watchSkip already-enriched publications (only queue new DOIs)
Section titled “Skip already-enriched publications (only queue new DOIs)”pnpm resync:orcid -- 0000-0002-8685-5194 --skip-existingPublication ingestion only (skip ORCID profile sync)
Section titled “Publication ingestion only (skip ORCID profile sync)”pnpm resync:orcid -- 0000-0002-8685-5194 --ingestion-onlyORCID profile sync only (skip publication enrichment)
Section titled “ORCID profile sync only (skip publication enrichment)”pnpm resync:orcid -- 0000-0002-8685-5194 --orcid-sync-onlyRestrict to a specific entity
Section titled “Restrict to a specific entity”pnpm resync:orcid -- 0000-0002-8685-5194 --entity-id cesamUse local D1 (for development)
Section titled “Use local D1 (for development)”pnpm resync:orcid -- 0000-0002-8685-5194 --local --dry-runAll flags
Section titled “All flags”| Flag | Default | Description |
|---|---|---|
--dry-run | false | Print plan, do not send anything to queues |
--force | false | Force ORCID sync even if record is unchanged |
--skip-existing | false | Skip DOIs already in D1 (default: re-enrich all) |
--local | false | Use local D1 instead of --remote |
--entity-id <id> | auto-detect | Restrict to a single entity |
--ingestion-only | false | Only queue publication ingestion, skip ORCID sync |
--orcid-sync-only | false | Only queue ORCID sync, skip ingestion |
--watch | false | Poll ingestion job status until complete or failed |
Pipelines
Section titled “Pipelines”| Pipeline | Queue | What it does |
|---|---|---|
| Publication ingestion | worker-ingestion-queue | Re-fetches ORCID works → enriches via OpenAlex/Crossref → writes to publications |
| ORCID profile sync | worker-ingestion-orcid-sync-queue | Fetches full ORCID record → writes to orcid_works, orcid_educations, orcid_employments, orcid_fundings |
Environment variables
Section titled “Environment variables”| Variable | Required | Description |
|---|---|---|
CLOUDFLARE_API_TOKEN | Yes | CF token with Queues Edit permission. Also accepted as CF_API_TOKEN. |
SENTRY_DSN / GLITCHTIP_DSN | No | GlitchTip DSN — errors during dispatch are forwarded automatically. |
See also
Section titled “See also”- resync.md — bulk resync for all researchers
cli/src/commands/resync/orcid.ts— implementationscripts/db/resync-orcid.mjs— pnpm relay script