# harshmohite777/analyzer-bom-extraction architecture

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

- Interactive diagram: https://gitdiagram.com/harshmohite777/analyzer-bom-extraction
- Repository: https://github.com/harshmohite777/analyzer-bom-extraction

## Overview

Drawing-to-BOM is a web application for extracting procurement and engineering data from PDF drawings, checking it against source text and rules, and supporting human review and export. The main path runs from upload or sample selection through PDF rendering/text extraction, model extraction, verification and checks, then saved results. The UI also supports drawing-page viewing and review actions. Source excerpts establish the route, pipeline, verification and audit responsibilities; several internal calls and UI features are only partially shown, so uncertain links are omitted.

Main entry points: [`drawing-to-bom-demo/app/main.py`](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py) (API routes), [`drawing-to-bom-demo/app/pipeline.py`](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pipeline.py) (Run orchestration), [`drawing-to-bom-demo/static/app.js`](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/static/app.js) (Review interface), [`drawing-to-bom-demo/app/pdf_utils.py`](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pdf_utils.py) (PDF rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_frontend["Review interface<br/>[app.js]"]
  node_routes["API routes<br/>[main.py]"]
end

subgraph group_ingest["Drawing ingestion"]
  node_upload["PDF and sample input<br/>[main.py]"]
  node_pdf["PDF rendering<br/>[pdf_utils.py]"]
  node_text["Text and OCR spans<br/>[pdf_utils.py]"]
end

subgraph group_analysis["Extraction and checks"]
  node_extract["Model extraction<br/>[extract.py]"]
  node_verify["Source verification<br/>[checks.py]"]
  node_rules["Integrity checks<br/>[checks.py]"]
end

subgraph group_run["Runs and review"]
  node_pipeline["Run orchestration<br/>[pipeline.py]"]
  node_review["Human review<br/>[pipeline.py]"]
  node_storage[("Run results<br/>[audit.py]")]
  node_audit[("Audit log<br/>[audit.py]")]
  node_export["CSV and JSON export<br/>[main.py]"]
end

node_user(("Engineer"))
node_model{{"AI model service"}}

node_user -->|"uses"| node_frontend
node_frontend -->|"requests"| node_routes
node_routes -->|"accepts PDFs"| node_upload
node_routes -->|"starts runs"| node_pipeline
node_pipeline -->|"renders pages"| node_pdf
node_pipeline -->|"extracts spans"| node_text
node_pdf -->|"provides pages"| node_text
node_pipeline -->|"requests extraction"| node_extract
node_extract -->|"sends drawing data"| node_model
node_pipeline -->|"verifies fields"| node_verify
node_pipeline -->|"runs checks"| node_rules
node_routes -->|"applies review"| node_review
node_review -->|"reevaluates results"| node_rules
node_pipeline -->|"saves results"| node_storage
node_pipeline -->|"records events"| node_audit
node_routes -->|"loads results"| node_storage
node_routes -->|"reads events"| node_audit
node_routes -->|"exports data"| node_export
node_frontend -->|"uploads PDF"| node_routes
node_routes -.->|"returns run data"| node_frontend

click node_frontend "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/static/app.js"
click node_routes "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py"
click node_upload "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py"
click node_pdf "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pdf_utils.py"
click node_text "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pdf_utils.py"
click node_pipeline "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pipeline.py"
click node_extract "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/extract.py"
click node_verify "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/checks.py"
click node_rules "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/checks.py"
click node_review "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pipeline.py"
click node_storage "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/audit.py"
click node_audit "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/audit.py"
click node_export "https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.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_frontend,node_routes toneBlue
class node_upload,node_pdf,node_text toneAmber
class node_extract,node_verify,node_rules toneMint
class node_pipeline,node_review,node_storage,node_audit,node_export toneRose
class node_user,node_model toneIndigo
```

## Components

### Web interface

- [Review interface](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/static/app.js): `drawing-to-bom-demo/static/app.js`
- [API routes](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py): `drawing-to-bom-demo/app/main.py`

### Drawing ingestion

- [PDF and sample input](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py): `drawing-to-bom-demo/app/main.py`
- [PDF rendering](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pdf_utils.py): `drawing-to-bom-demo/app/pdf_utils.py`
- [Text and OCR spans](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pdf_utils.py): `drawing-to-bom-demo/app/pdf_utils.py`

### Extraction and checks

- [Model extraction](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/extract.py): `drawing-to-bom-demo/app/extract.py`
- [Source verification](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/checks.py): `drawing-to-bom-demo/app/checks.py`
- [Integrity checks](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/checks.py): `drawing-to-bom-demo/app/checks.py`

### Runs and review

- [Run orchestration](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pipeline.py): `drawing-to-bom-demo/app/pipeline.py`
- [Human review](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/pipeline.py): `drawing-to-bom-demo/app/pipeline.py`
- [Run results](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/audit.py): `drawing-to-bom-demo/app/audit.py`
- [Audit log](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/audit.py): `drawing-to-bom-demo/app/audit.py`
- [CSV and JSON export](https://github.com/harshmohite777/analyzer-bom-extraction/blob/main/drawing-to-bom-demo/app/main.py): `drawing-to-bom-demo/app/main.py`

### Other components

- **Engineer**
- **AI model service**

## Connections

- Engineer → Review interface: uses (evidence: `drawing-to-bom-demo/static/app.js`)
- Review interface → API routes: requests (evidence: `drawing-to-bom-demo/static/app.js`)
- API routes → PDF and sample input: accepts PDFs (evidence: `drawing-to-bom-demo/app/main.py`)
- API routes → Run orchestration: starts runs (evidence: `drawing-to-bom-demo/app/main.py`)
- Run orchestration → PDF rendering: renders pages (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- Run orchestration → Text and OCR spans: extracts spans (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- PDF rendering → Text and OCR spans: provides pages (evidence: `drawing-to-bom-demo/app/pdf_utils.py`)
- Run orchestration → Model extraction: requests extraction (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- Model extraction → AI model service: sends drawing data (evidence: `drawing-to-bom-demo/app/extract.py`)
- Run orchestration → Source verification: verifies fields (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- Run orchestration → Integrity checks: runs checks (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- API routes → Human review: applies review (evidence: `drawing-to-bom-demo/app/main.py`)
- Human review → Integrity checks: reevaluates results (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- Run orchestration → Run results: saves results (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- Run orchestration → Audit log: records events (evidence: `drawing-to-bom-demo/app/pipeline.py`)
- API routes → Run results: loads results (evidence: `drawing-to-bom-demo/app/main.py`)
- API routes → Audit log: reads events (evidence: `drawing-to-bom-demo/app/main.py`)
- API routes → CSV and JSON export: exports data (evidence: `drawing-to-bom-demo/app/main.py`)
- Review interface → API routes: uploads PDF (evidence: `drawing-to-bom-demo/static/app.js`)
- API routes → Review interface: returns run data
