Plugin system¶
Plug-and-play architecture: add or remove parsers without changing the orchestrator, API, or HTML UI.
Flow¶
flowchart LR
UI[HTML UI] --> API[FastAPI]
API --> Orch[orchestrator]
Orch --> Reg[registry]
Reg --> P1[tesseract]
Reg --> P2[docai]
Reg --> E1[gemini-extract]
Protocols¶
All OCR parsers implement OcrParser:
info() -> ParserInfo— includesenabledanddisabled_reasonparse(document) -> list[OcrPageResult]
All extractors implement Extractor:
info() -> ParserInfoextract(ocr_text, document) -> list[AnalyteRow]
Built-in plugins¶
| ID | Kind | Enabled when |
|---|---|---|
tesseract |
OCR | tesseract on PATH (included in Docker image) |
docai |
OCR | GCP_PROJECT_ID + DOCAI_LAYOUT_PROCESSOR_ID |
gemini-extract |
Extract | GCP_PROJECT_ID + credentials |
Add a new parser¶
- Create
faxautomation/plugins/ocr/my_engine.py(orextract/) - Implement the protocol
- Register in
faxautomation/plugins/__init__.py:
from faxautomation.plugins.ocr import my_engine
register_ocr_parser(my_engine.parser)
- Add tests in
tests/ - Update this page
No changes required to orchestrator.py, API routes, or app.js.
Remove a parser¶
Delete the module and remove the register_* line from plugins/__init__.py.
Registry API¶
register_ocr_parser(parser)register_extractor(extractor)list_ocr_parsers()/list_extractors()get_ocr_parser(id)/get_extractor(id)