Project guidance for AI coding agents working on this Python OCR application.
- Install dependencies:
pip install -r requirements.txt - Run one test:
python -m unittest tests.test_ocr_utils.TestOCRUtils.test_get_ocr_settings_cli_mode - Run the suite:
python -m unittest tests/orpython -m pytest tests/ - Run the CLI:
python cli/ocr_combined.py --mode cli document.pdf - Run a GUI locally:
python cli/pdf_ocr_gui.py - There is no configured Python lint or build command. The VS Code
dotnet buildtask is unrelated.
Do not assume the documented Uvicorn or Docker entry points work: src/api_server.py exposes get_api_server(config), not a module-level app, and the current Docker image does not copy cli/. Verify API/container wiring before changing or documenting it.
src/ocr_utils.py: core OCR, file handling, and input collection (OCRUtils,FileUtils,InputProcessor)cli/ocr_combined.py: command-line entry pointcli/pdf_ocr_gui.py: desktop GUI entry pointsrc/api_server.py: API server and job endpointssrc/config.py: dataclass configuration, JSON config loading, andOCR_environment variablessrc/progress_tracker.py,src/database_manager.py,src/notification_manager.py: job state and integrationssrc/security_validator.py: validate input before processing
- Call OCR through
OCRUtils; do not callocrmypdfdirectly. - Use
FileUtilsfor output, archiving, and zip operations. - Use
ErrorContextand the custom handler insrc/error_handler.pyfor structured errors. - Use
log_managerfromsrc/logger.pyfor structured logging and include event types. - Use dataclass configuration from
src/config.py; environment variables use theOCR_prefix. - Preserve Tesseract
--psm 3in OCR settings. - Validate files with
security_validatorbefore OCR. - Route API job state through
progress_trackerand database work throughdatabase_manager.
- Modes are
cli,force, andvisual. cli:force_ocr=False,skip_text=True.force:force_ocr=True,skip_text=False.visual:force_ocr=False,skip_text=True.- Default language is
heb+eng. - Results use
ocr_<mode>/<filename>_<timestamp>/with PDF, text, and log output; force mode may also produce a zip. - When archiving originals, preserve their relative directory structure.
- Complete technical documentation
- Deployment guidance
- Administration and monitoring
- OCR utility tests
Keep this file focused on agent-discoverable conventions. Use the linked documents for detailed operational guidance. There is no indexed session history for this repository yet; use /chronicle improve after future work to refine these instructions from recurring friction.