Webhook icon
Schedule icon
If icon
Return icon
Request icon
Fail icon
Parallel icon
Eval icon
ChatCompletion icon
GoogleGemini icon
SlackIncomingWebhook icon
Pause icon
Log icon
Get icon
Queries icon
Set icon

Verify Company Records Against GLEIF and Wikidata with Gemini Adjudication and Human Review

Verify company records against GLEIF and Wikidata, adjudicate mismatches with Gemini, pause for human review and track AI accuracy in DuckDB.

Categories
AIData

Company master data (legal name, address, website, status, headcount) drifts in every CRM and vendor master. This flow verifies a record against two independent public registries, GLEIF (authoritative legal registration data) and Wikidata (community-maintained operating facts), joined on the Legal Entity Identifier so both describe the same entity. Gemini classifies each disagreement, a human is pulled in only when sources or model are inconclusive, and a DuckDB ledger measures the AI's accuracy from real human decisions.

How it works

  1. A Webhook trigger receives the record from your CRM or data-quality tool; a disabled weekly Schedule covers periodic re-verification.
  2. resolve_lei (If) uses the record's LEI or resolves it from the legal name through a GLEIF legal-name search; require_lei stops early when neither works.
  3. lookup_sources (Parallel) fetches the GLEIF LEI record and runs a Wikidata SPARQL query keyed on property P1278 (LEI).
  4. compare_fields (GraalVM JS) normalises names, websites, years and statuses, compares field by field and scores agreement as matched / checkable.
  5. adjudicate_mismatches (Gemini ChatCompletion, JSON schema) runs only when sources disagree and labels each disagreement CONVENTION_DIFFERENCE, CONFLICT, LIKELY_STALE_SOURCE or LIKELY_STALE_RECORD with a confidence and a recommendation; allowFailure routes to a human if the call fails.
  6. review_gate (If) pauses with a Slack deep link when agreement is below the threshold or the model did not clear every disagreement; the resume form captures decision, corrected record and note. Otherwise it auto-accepts.
  7. finalize_verdict builds the golden record and flags whether the human overturned the AI; write_ledger (If) creates or appends the DuckDB ledger in internal storage (URI kept in the KV store) and returns the running auto-accept rate and AI accuracy.

What you get

  • Golden record, decision, agreement score and ledger summary as flow outputs.
  • Humans review only the records that need it; accepted ones keep their evidence in the logs.
  • A ledger with ai_overturned per verdict, so AI accuracy is measured and the threshold is tuned on data.
  • A missing Gemini key or Slack webhook never fails the execution; it routes to a human.

Who it's for

  • Data stewards and MDM teams verifying customer, vendor or counterparty records.
  • Analytics engineers who own company dimension tables and need an audit trail.
  • AI practitioners who want human-in-the-loop evaluation of an LLM in production.

Why orchestrate this with Kestra

  • Pause with onResume inputs is a review step without building a UI.
  • Parallel, If, runIf and allowFailure express the control flow declaratively; outputs and logs are tracked per task.
  • Secrets are masked; the ledger lives in internal storage and the KV store carries state between runs, no external database needed.

Prerequisites

  • Kestra 2.0 with the GraalVM, AI, JDBC DuckDB and Slack plugins.
  • Outbound HTTPS to api.gleif.org and query.wikidata.org (both keyless).

Secrets

  • GEMINI_API_KEY: Google AI Studio key for the adjudication step (optional; without it every disagreement goes to a human).
  • SLACK_WEBHOOK_URL: Slack incoming webhook for review requests (optional).

Quick start

  1. Import the flow and click Execute with the default inputs; the LEI is resolved, both registries are queried and the ledger is created.
  2. Add GEMINI_API_KEY and SLACK_WEBHOOK_URL as secrets to enable adjudication and notifications.
  3. Replace the webhook key with a long random string and POST a record JSON body to the webhook URL.
  4. When an execution pauses, pick a decision in the resume form; the ledger summary is in the summary log.
  5. Enable weekly_reverification once a real record source is wired in.

How to extend

  • Add a third source (OpenCorporates, a national registry) inside lookup_sources and extend compare_fields.
  • Iterate over a vendor master with ForEach or a Subflow per record.
  • Export the ledger to your warehouse and chart auto-accept rate and AI accuracy over time.
  • Swap Gemini for another provider in the AI plugin, or require a second reviewer for CONFLICT.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.