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¶
- 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.
- Add the schema registration in backend code.
Follow backend/README.md.
- 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.
- Run backend checks and tests.
Use the commands documented in README.md.
- Verify through the API/UI.
Confirm processors list correctly, extraction runs, and extracted items show the expected fields.
- Clean up old registry rows if a rename/removal leaves stale database state.
Do this deliberately and record the environment affected.
Verification¶
GET /processorsincludes the expected processor.- A batch run using the processor completes.
- Extracted fields match the schema.
- Validation/correction flows still work.