Skip to main content
EnrichmentTask is the durable work-item record for Well’s asynchronous enrichment pipeline. Each row represents one unit of background AI or data-processing work — logo resolution, AI company/people/invoice extraction, OCR, bank-sync reconciliation, provider scoring, custom column compute, field rule evaluation, or monthly invoice closure — targeted at an arbitrary entity identified by the polymorphic (entity_type, entity_id) pair. Tasks are scoped to a Workspace, can be grouped into a batch_id (one Magic-button press), and support parent/subtask nesting via a self-referencing parent_task relationship. The enrichment pipeline writes and advances all lifecycle states; users and operators observe tasks read-only.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

Data model

Attributes

Relationships

System-computed

  • enrichment_task_id — auto-generated by gen_random_uuid() Postgres default at INSERT; never set by application code
  • created_at — set by MikroORM onCreate hook; never writable after insert
  • updated_at — set and maintained by MikroORM onUpdate hook on every flush
  • deleted_at — soft-delete; set by the pipeline or admin tooling, never by user PATCH
  • status — default ‘pending’ at creation; all state transitions (pending → processing → completed / failed / rejected / awaiting_approval) are driven exclusively by enrichment pipeline workers via Cloud Tasks handlers
  • input_hash — computed by the enqueuing service as a fingerprint of the input payload for dedup detection; not computed by the database
  • batch_id — assigned at enqueue time by the orchestrator when multiple tasks are triggered together (Magic button); not user-assignable
  • completed_at — written by the worker on task terminal state; not set by application business logic outside the worker
  • entity_type / entity_id — set at enqueue time from the triggering entity’s public UUID; the generic polymorphic reference replaced per-type FK columns (company_pk, person_pk, document_pk, invoice_pk, transaction_pk) in Migration20260323100000
  • subtasks collection — populated by ORM from the OneToMany inverse of parent_task; not a stored column

Example

Source: apps/api/src/database/entities/EnrichmentTask.ts · domain: ingestion · tier: Infrastructure