How shoebsd31/ocr-form-tools works
Project type and purpose
• This is a full-stack hybrid application: a React+Redux web app (bootstrapped with Create React App) that can also run as a desktop app via Electron.
• Purpose: an open-source Form OCR Testing Tool (FOTT) for Azure Form Recognizer. Core workflows are: upload forms, label text/tables, train models, predict/analyze forms, and compose models. A separate Python CLI handles batch redaction.
File structure
• Top-level:
• config/webpack.* – front-end build pipelines (dev/prod)
• Dockerfile + nginx.conf – containerized web deployment
• electron-builder.yml – desktop packaging settings
• scripts/redact_cli_py/ – standalone Python redaction tool
• src/:
• src/react/components & pages – UI views and layouts
• src/redux/ – actions, reducers, middleware, store setup
• src/services/ – business logic (assetService, projectService, ocrService, predictService, telemetryService)
• src/providers/storage – provider pattern for Azure Blob & local file system
• src/electron/ – Electron “main” process, IPC proxies, desktop-only providers
• public/: static Python helpers and HTML entrypoints
README
• Confirms React+Redux architecture, Electron desktop support, Docker instructions, and the tool’s feature set (Label → Train → Analyze → Compose).
• Mentions provider model (extensible source/target), Form Recognizer REST API integration, and Azure Blob Storage.
Main components
A. Frontend (Renderer)
• React components (common, pages, shell, toolbar)
• Redux store (unidirectional data flow)
B. Electron Main (desktop only)
• App bootstrap (main.ts, start.js)
• IPC channel to renderer
• Local file system provider
C. Services Layer
• Business services calling REST APIs (Form Recognizer)
• Asset/project/predict/telemetry services
D. Storage Providers
• Azure Blob Storage (HTTP via SAS URL)
• Local FS (desktop path via IPC)
E. External Dependencies
• Azure Form Recognizer REST endpoint
• Azure Blob Storage account
F. CLI Redaction Tool
• Separate Python process reading/writing blobs or files
Relationships and interactions
• Renderer dispatches Redux actions → Store updates → UI re-renders.
• UI invokes services (via serviceHelper) → storageProviderFactory picks Azure or local provider.
• Services → Azure Blob Storage (list/download/upload) and → Form Recognizer (train/predict).
• In desktop mode: UI ↔ IPC ↔ Electron Main ↔ Local FS.
• CLI tool runs independently for batch redaction of images/documents.
Architectural patterns
• Flux/Redux unidirectional data flow
• Provider pattern for pluggable storage/telemetry
• IPC gateway between Renderer and Main for desktop features
• Modular React component hierarchy (common vs pages)
• Build pipelines (webpack for web, electron-builder for desktop)