# aminul1993/extraction-workbench architecture

> Architecture diagram of the GitHub repository aminul1993/extraction-workbench, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aminul1993/extraction-workbench
- Repository: https://github.com/aminul1993/extraction-workbench

## Overview

Extraction Workbench turns an uploaded document into a schema-shaped record, then lets a reviewer verify and submit it. The browser renders the document and runs OCR locally while sending the file and OCR text to the Flask extraction API; the API converts available document text and asks Groq for structured fields. The review model associates values with page locations and statuses, while the workbench presents editing and review controls. Edges reflect the shown imports, calls, and README-documented integrations; unsampled implementation details are not inferred.

Main entry points: [`static/js/workbench.js`](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/workbench.js) (Review workbench), [`api/app.py`](https://github.com/aminul1993/extraction-workbench/blob/main/api/app.py) (Flask API), [`static/js/main.js`](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/main.js) (Page startup), [`api/extraction.py`](https://github.com/aminul1993/extraction-workbench/blob/main/api/extraction.py) (Extraction workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser workbench"]
  node_workbench_page["Workbench page<br/>[index.html]"]
  node_entry["Page startup<br/>[main.js]"]
  node_workbench["Review workbench<br/>[workbench.js]"]
  node_doc_viewer["Document viewer<br/>[documents.js]"]
  node_browser_ocr["Browser OCR<br/>[ocr.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_api_config["API endpoints<br/>[config.js]"]
  node_icons["Icon rendering<br/>[icons.js]"]
  node_ui_helpers["Dialogs and notices<br/>[ui.js]"]
end

subgraph group_backend["Extraction API"]
  node_flask_api["Flask API<br/>[app.py]"]
  node_extraction["Extraction workflow<br/>[extraction.py]"]
  node_launch_tokens["Launch token checks<br/>[launch_token.py]"]
end

subgraph group_domain["Review domain"]
  node_schema_model["Schema model<br/>[schema.js]"]
  node_review_model["Review rules<br/>[review-model.js]"]
  node_shared_utils["Shared utilities<br/>[util.js]"]
  node_schema_file["Reference schema"]
end

subgraph group_integration["External integrations"]
  node_document_converter["Document conversion<br/>[extraction.py]"]
end

node_reviewer(("Reviewer"))
node_parent(("Parent application"))
node_groq_model["Groq model"]

node_reviewer -->|"opens and uploads"| node_workbench_page
node_workbench_page -->|"loads"| node_entry
node_entry -->|"starts"| node_workbench
node_entry -->|"loads config"| node_api_client
node_workbench -->|"renders page"| node_doc_viewer
node_workbench -->|"recognizes text"| node_browser_ocr
node_workbench -->|"requests extraction"| node_api_client
node_workbench -->|"uses endpoints"| node_api_config
node_workbench -->|"parses schema"| node_schema_model
node_workbench -->|"applies review rules"| node_review_model
node_workbench -->|"shows notices"| node_ui_helpers
node_workbench -->|"uses icons"| node_icons
node_ui_helpers -->|"renders icons"| node_icons
node_review_model -->|"reads schema"| node_schema_model
node_review_model -->|"uses helpers"| node_shared_utils
node_schema_model -->|"uses helpers"| node_shared_utils
node_api_client -->|"calls endpoints"| node_flask_api
node_flask_api -->|"serves page"| node_workbench_page
node_flask_api -->|"loads schema"| node_schema_file
node_flask_api -->|"invokes workflow"| node_extraction
node_flask_api -->|"verifies token"| node_launch_tokens
node_extraction -->|"converts documents"| node_document_converter
node_extraction -->|"requests structured data"| node_groq_model
node_workbench -->|"posts verified record"| node_parent

click node_workbench_page "https://github.com/aminul1993/extraction-workbench/blob/main/index.html"
click node_entry "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/main.js"
click node_workbench "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/workbench.js"
click node_doc_viewer "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/documents.js"
click node_browser_ocr "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/ocr.js"
click node_api_client "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/api.js"
click node_api_config "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/config.js"
click node_icons "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/icons.js"
click node_ui_helpers "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/ui.js"
click node_schema_model "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/schema.js"
click node_review_model "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/review-model.js"
click node_shared_utils "https://github.com/aminul1993/extraction-workbench/blob/main/static/js/util.js"
click node_schema_file "https://github.com/aminul1993/extraction-workbench/blob/main/api/reference_schema.json"
click node_flask_api "https://github.com/aminul1993/extraction-workbench/blob/main/api/app.py"
click node_extraction "https://github.com/aminul1993/extraction-workbench/blob/main/api/extraction.py"
click node_launch_tokens "https://github.com/aminul1993/extraction-workbench/blob/main/api/launch_token.py"
click node_document_converter "https://github.com/aminul1993/extraction-workbench/blob/main/api/extraction.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workbench_page,node_entry,node_workbench,node_doc_viewer,node_browser_ocr,node_api_client,node_api_config,node_icons,node_ui_helpers,node_reviewer toneBlue
class node_flask_api,node_extraction,node_launch_tokens toneAmber
class node_schema_model,node_review_model,node_shared_utils,node_schema_file toneMint
class node_document_converter toneRose
class node_parent,node_groq_model toneIndigo
```

## Components

### Browser workbench

- [Workbench page](https://github.com/aminul1993/extraction-workbench/blob/main/index.html): `index.html`
- [Page startup](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/main.js): `static/js/main.js`
- [Review workbench](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/workbench.js): `static/js/workbench.js`
- [Document viewer](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/documents.js): `static/js/documents.js`
- [Browser OCR](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/ocr.js): `static/js/ocr.js`
- [API client](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/api.js): `static/js/api.js`
- [API endpoints](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/config.js): `static/js/config.js`
- [Icon rendering](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/icons.js): `static/js/icons.js`
- [Dialogs and notices](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/ui.js): `static/js/ui.js`

### Extraction API

- [Flask API](https://github.com/aminul1993/extraction-workbench/blob/main/api/app.py): `api/app.py`
- [Extraction workflow](https://github.com/aminul1993/extraction-workbench/blob/main/api/extraction.py): `api/extraction.py`
- [Launch token checks](https://github.com/aminul1993/extraction-workbench/blob/main/api/launch_token.py): `api/launch_token.py`

### Review domain

- [Schema model](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/schema.js): `static/js/schema.js`
- [Review rules](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/review-model.js): `static/js/review-model.js`
- [Shared utilities](https://github.com/aminul1993/extraction-workbench/blob/main/static/js/util.js): `static/js/util.js`
- [Reference schema](https://github.com/aminul1993/extraction-workbench/blob/main/api/reference_schema.json): `api/reference_schema.json`

### External integrations

- [Document conversion](https://github.com/aminul1993/extraction-workbench/blob/main/api/extraction.py): `api/extraction.py`

### Other components

- **Reviewer**
- **Parent application**
- **Groq model**

## Connections

- Reviewer → Workbench page: opens and uploads (evidence: `README.md`)
- Workbench page → Page startup: loads (evidence: `README.md`)
- Page startup → Review workbench: starts (evidence: `static/js/main.js`)
- Page startup → API client: loads config (evidence: `static/js/main.js`)
- Review workbench → Document viewer: renders page (evidence: `static/js/workbench.js`)
- Review workbench → Browser OCR: recognizes text (evidence: `static/js/workbench.js`)
- Review workbench → API client: requests extraction (evidence: `static/js/workbench.js`)
- Review workbench → API endpoints: uses endpoints (evidence: `static/js/workbench.js`)
- Review workbench → Schema model: parses schema (evidence: `static/js/workbench.js`)
- Review workbench → Review rules: applies review rules (evidence: `static/js/workbench.js`)
- Review workbench → Dialogs and notices: shows notices (evidence: `static/js/workbench.js`)
- Review workbench → Icon rendering: uses icons (evidence: `static/js/workbench.js`)
- Dialogs and notices → Icon rendering: renders icons (evidence: `static/js/ui.js`)
- Review rules → Schema model: reads schema (evidence: `static/js/review-model.js`)
- Review rules → Shared utilities: uses helpers (evidence: `static/js/review-model.js`)
- Schema model → Shared utilities: uses helpers (evidence: `static/js/schema.js`)
- API client → Flask API: calls endpoints (evidence: `README.md`)
- Flask API → Workbench page: serves page (evidence: `README.md`)
- Flask API → Reference schema: loads schema (evidence: `api/app.py`)
- Flask API → Extraction workflow: invokes workflow (evidence: `api/app.py`)
- Flask API → Launch token checks: verifies token (evidence: `api/app.py`)
- Extraction workflow → Document conversion: converts documents (evidence: `api/extraction.py`)
- Extraction workflow → Groq model: requests structured data (evidence: `README.md`)
- Review workbench → Parent application: posts verified record (evidence: `README.md`)
