Skip to content

RAG mandatory-class backfill

ADMINISTRATOR Populates rag_chunks.mandatory_class (v2.31.0.19 column on the rag-corpus DB) so retrieveHybrid({ mandatoryOnly: true }) can filter to chunks from the 6 mandatory blocker docs.

Endpoint

POST /api/admin/backfill/rag-chunks-mandatory-class
Body: { dryRun?: boolean = true }

Chunked at 5000 rows per call; on timeout, returns partial-progress audit so the next call can resume.

Run-until-done loop

do {
  res = POST .../backfill/rag-chunks-mandatory-class { dryRun: false }
} while (res.totalUpdated > 0)

Idempotent — already-classified rows are skipped via WHERE mandatory_class IS NULL.

Mapping logic

docTypeToMandatoryClass(docType) in src/rag-retrieval.js maps both wizard-slot AND classifier-verdict vocabularies to one of the 6 mandatory classes (or null for non-mandatory).

The force flag (added v2.31.0.21) re-classifies rows even if mandatory_class IS NOT NULL — use this after a docTypeToMandatoryClass map change.

RAPAX PMS Help · v2.31.0.26 · released 2026-04-28