Skip to content

How to Create a Schema or Processor

Last verified: 2026-07-26 against dev at f0388abb.

Use this guide when SDP needs to extract a new structured shape from documents.

Current Constraint

Schema registration is still code-defined. The backend README describes it as basic: add a CreateSchemaRequest in backend/src/altaforge_sdp/schemas/schema_registry.py, then call schema_storage.get_or_create_schema(...).

Old schema/extractor rows are not automatically removed from the database when renamed or deleted in code.

Procedure

  1. Define the target output shape.

Capture field names, field types, optionality, and any document-type assumptions. Keep the schema focused on data the product needs to review or export.

  1. Add the schema registration in backend code.

Follow backend/README.md.

  1. Confirm extractor compatibility.

Processors are built from extractor/schema combinations. If no existing extractor can produce the schema reliably, add or modify an extractor using Create an extractor.

  1. Run backend checks and tests.

Use the commands documented in README.md.

  1. Verify through the API/UI.

Confirm processors list correctly, extraction runs, and extracted items show the expected fields.

  1. Clean up old registry rows if a rename/removal leaves stale database state.

Do this deliberately and record the environment affected.

Verification

  • GET /processors includes the expected processor.
  • A batch run using the processor completes.
  • Extracted fields match the schema.
  • Validation/correction flows still work.