# sohamchakravorty2003/tender-procurement architecture

> Architecture diagram of the GitHub repository sohamchakravorty2003/tender-procurement, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sohamchakravorty2003/tender-procurement
- Repository: https://github.com/sohamchakravorty2003/tender-procurement

## Overview

MinChem is an email- and document-driven tender management application. Users review classified Gmail messages, inspect tenders and supplier offers, upload or process PDF attachments, and resolve review cases. The React interface calls a FastAPI backend, which coordinates email, classification, document, offer, and tender services backed by SQLite. The excerpts and source index establish these major capabilities and many module references; some service-to-service edges are therefore based on indexed imports rather than inspected call sites.

Main entry points: [`app/main.py`](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/main.py) (HTTP endpoints), [`minchem-frontend/src/App.jsx`](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/App.jsx) (Application shell), [`minchem-frontend/src/api.js`](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/api.js) (API client), [`app/upload_service.py`](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/upload_service.py) (PDF ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app_ui["Application shell<br/>[App.jsx]"]
  node_inbox["Inbox review<br/>[InboxView.jsx]"]
  node_tender_ui["Tender detail<br/>[TenderDetail.jsx]"]
  node_tenders_ui["Tender list<br/>[TendersView.jsx]"]
  node_reviews_ui["Review cases<br/>[ReviewsView.jsx]"]
  node_compose_ui["Email compose<br/>[ComposeView.jsx]"]
  node_thread_ui["Thread view<br/>[ThreadView.jsx]"]
  node_price_chart["Price chart<br/>[PriceChart.jsx]"]
  node_badges["Status badges<br/>[Badges.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API orchestration"]
  node_fastapi["HTTP endpoints<br/>[main.py]"]
  node_models["Request models<br/>[models.py]"]
end

subgraph group_email["Email and tenders"]
  node_gmail["Gmail access<br/>[gmail_service.py]"]
  node_classification["Email classification"]
  node_bid_service["Bid processing<br/>[bid_service.py]"]
  node_thread_restore["Thread restoration"]
end

subgraph group_documents["Documents and offers"]
  node_upload["PDF ingestion<br/>[upload_service.py]"]
  node_document_analysis["Document analysis"]
  node_offer_extraction["Offer extraction<br/>[offer_service.py]"]
  node_acceptance_marks["Offer review marks<br/>[accept_service.py]"]
  node_linking["Tender linking<br/>[link_service.py]"]
  node_pdf_processing["PDF processing<br/>[pdf_service.py]"]
end

subgraph group_storage["Persistence"]
  node_tender_store[("Tender data store<br/>[tender_store.py]")]
end

node_user(("MinChem user"))
node_external_gmail["Google Gmail"]
node_llm["AWS Bedrock model"]

node_user -.->|"uses"| node_app_ui
node_app_ui -->|"shows"| node_inbox
node_app_ui -->|"shows"| node_tender_ui
node_app_ui -->|"shows"| node_tenders_ui
node_app_ui -->|"shows"| node_reviews_ui
node_app_ui -->|"shows"| node_compose_ui
node_app_ui -->|"loads data"| node_api_client
node_inbox -->|"requests email"| node_api_client
node_inbox -->|"renders"| node_thread_ui
node_inbox -->|"renders"| node_badges
node_tender_ui -->|"requests tender"| node_api_client
node_tender_ui -->|"renders"| node_price_chart
node_tender_ui -->|"renders"| node_thread_ui
node_tender_ui -->|"renders"| node_badges
node_tenders_ui -->|"requests tenders"| node_api_client
node_reviews_ui -->|"requests reviews"| node_api_client
node_reviews_ui -->|"renders"| node_badges
node_compose_ui -->|"sends email"| node_api_client
node_thread_ui -->|"loads thread"| node_api_client
node_api_client -->|"HTTP requests"| node_fastapi
node_fastapi -->|"validates requests"| node_models
node_fastapi -->|"dispatches email"| node_gmail
node_fastapi -->|"dispatches upload"| node_upload
node_fastapi -->|"dispatches bids"| node_bid_service
node_fastapi -->|"dispatches extraction"| node_offer_extraction
node_fastapi -->|"dispatches review"| node_acceptance_marks
node_fastapi -->|"dispatches restore"| node_thread_restore
node_gmail -->|"classifies mail"| node_classification
node_gmail -.->|"accesses mailbox"| node_external_gmail
node_classification -->|"stores analysis"| node_tender_store
node_classification -.->|"classifies content"| node_llm
node_bid_service -->|"reads messages"| node_gmail
node_bid_service -->|"uses extraction"| node_offer_extraction
node_bid_service -->|"reads and writes"| node_tender_store
node_thread_restore -->|"restores thread"| node_gmail
node_thread_restore -->|"reprocesses files"| node_upload
node_thread_restore -->|"updates records"| node_tender_store
node_upload -->|"analyzes PDFs"| node_document_analysis
node_upload -->|"extracts PDF text"| node_pdf_processing
node_upload -->|"links documents"| node_linking
node_upload -->|"refreshes analysis"| node_classification
node_upload -->|"stores documents"| node_tender_store
node_document_analysis -->|"saves references"| node_tender_store
node_document_analysis -.->|"classifies documents"| node_llm
node_offer_extraction -->|"uses document data"| node_document_analysis
node_offer_extraction -->|"uses email analysis"| node_classification
node_offer_extraction -->|"saves offers"| node_tender_store
node_acceptance_marks -->|"uses classifications"| node_classification

click node_app_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/App.jsx"
click node_inbox "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/InboxView.jsx"
click node_tender_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/TenderDetail.jsx"
click node_tenders_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/TendersView.jsx"
click node_reviews_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ReviewsView.jsx"
click node_compose_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ComposeView.jsx"
click node_thread_ui "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ThreadView.jsx"
click node_price_chart "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/PriceChart.jsx"
click node_badges "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/Badges.jsx"
click node_api_client "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/api.js"
click node_fastapi "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/main.py"
click node_models "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/models.py"
click node_gmail "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/gmail_service.py"
click node_classification "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/classify_service.py"
click node_bid_service "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/bid_service.py"
click node_thread_restore "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/thread_restore_service.py"
click node_upload "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/upload_service.py"
click node_document_analysis "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/document_service.py"
click node_offer_extraction "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/offer_service.py"
click node_acceptance_marks "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/accept_service.py"
click node_linking "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/link_service.py"
click node_pdf_processing "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/pdf_service.py"
click node_tender_store "https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/tender_store.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_app_ui,node_inbox,node_tender_ui,node_tenders_ui,node_reviews_ui,node_compose_ui,node_thread_ui,node_price_chart,node_badges,node_api_client,node_user toneBlue
class node_fastapi,node_models toneAmber
class node_gmail,node_classification,node_bid_service,node_thread_restore toneMint
class node_upload,node_document_analysis,node_offer_extraction,node_acceptance_marks,node_linking,node_pdf_processing toneRose
class node_tender_store,node_external_gmail,node_llm toneIndigo
```

## Components

### Web interface

- [Application shell](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/App.jsx): `minchem-frontend/src/App.jsx`
- [Inbox review](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/InboxView.jsx): `minchem-frontend/src/components/InboxView.jsx`
- [Tender detail](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/TenderDetail.jsx): `minchem-frontend/src/components/TenderDetail.jsx`
- [Tender list](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/TendersView.jsx): `minchem-frontend/src/components/TendersView.jsx`
- [Review cases](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ReviewsView.jsx): `minchem-frontend/src/components/ReviewsView.jsx`
- [Email compose](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ComposeView.jsx): `minchem-frontend/src/components/ComposeView.jsx`
- [Thread view](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/ThreadView.jsx): `minchem-frontend/src/components/ThreadView.jsx`
- [Price chart](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/PriceChart.jsx): `minchem-frontend/src/components/PriceChart.jsx`
- [Status badges](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/components/Badges.jsx): `minchem-frontend/src/components/Badges.jsx`
- [API client](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/minchem-frontend/src/api.js): `minchem-frontend/src/api.js`

### API orchestration

- [HTTP endpoints](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/main.py): `app/main.py`
- [Request models](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/models.py): `app/models.py`

### Email and tenders

- [Gmail access](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/gmail_service.py): `app/gmail_service.py`
- [Email classification](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/classify_service.py): `app/classify_service.py`
- [Bid processing](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/bid_service.py): `app/bid_service.py`
- [Thread restoration](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/thread_restore_service.py): `app/thread_restore_service.py`

### Documents and offers

- [PDF ingestion](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/upload_service.py): `app/upload_service.py`
- [Document analysis](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/document_service.py): `app/document_service.py`
- [Offer extraction](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/offer_service.py): `app/offer_service.py`
- [Offer review marks](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/accept_service.py): `app/accept_service.py`
- [Tender linking](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/link_service.py): `app/link_service.py`
- [PDF processing](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/pdf_service.py): `app/pdf_service.py`

### Persistence

- [Tender data store](https://github.com/sohamchakravorty2003/tender-procurement/blob/main/app/tender_store.py): `app/tender_store.py`

### Other components

- **MinChem user**
- **Google Gmail**
- **AWS Bedrock model**

## Connections

- MinChem user → Application shell: uses
- Application shell → Inbox review: shows (evidence: `minchem-frontend/src/App.jsx`)
- Application shell → Tender detail: shows (evidence: `minchem-frontend/src/App.jsx`)
- Application shell → Tender list: shows (evidence: `minchem-frontend/src/App.jsx`)
- Application shell → Review cases: shows (evidence: `minchem-frontend/src/App.jsx`)
- Application shell → Email compose: shows (evidence: `minchem-frontend/src/App.jsx`)
- Application shell → API client: loads data (evidence: `minchem-frontend/src/App.jsx`)
- Inbox review → API client: requests email (evidence: `minchem-frontend/src/components/InboxView.jsx`)
- Inbox review → Thread view: renders (evidence: `minchem-frontend/src/components/InboxView.jsx`)
- Inbox review → Status badges: renders (evidence: `minchem-frontend/src/components/InboxView.jsx`)
- Tender detail → API client: requests tender (evidence: `minchem-frontend/src/components/TenderDetail.jsx`)
- Tender detail → Price chart: renders (evidence: `minchem-frontend/src/components/TenderDetail.jsx`)
- Tender detail → Thread view: renders (evidence: `minchem-frontend/src/components/TenderDetail.jsx`)
- Tender detail → Status badges: renders (evidence: `minchem-frontend/src/components/TenderDetail.jsx`)
- Tender list → API client: requests tenders (evidence: `minchem-frontend/src/components/TendersView.jsx`)
- Review cases → API client: requests reviews (evidence: `minchem-frontend/src/components/ReviewsView.jsx`)
- Review cases → Status badges: renders (evidence: `minchem-frontend/src/components/ReviewsView.jsx`)
- Email compose → API client: sends email (evidence: `minchem-frontend/src/components/ComposeView.jsx`)
- Thread view → API client: loads thread (evidence: `minchem-frontend/src/components/ThreadView.jsx`)
- API client → HTTP endpoints: HTTP requests (evidence: `minchem-frontend/src/api.js`)
- HTTP endpoints → Request models: validates requests (evidence: `app/main.py`)
- HTTP endpoints → Gmail access: dispatches email (evidence: `app/main.py`)
- HTTP endpoints → PDF ingestion: dispatches upload (evidence: `app/main.py`)
- HTTP endpoints → Bid processing: dispatches bids (evidence: `app/main.py`)
- HTTP endpoints → Offer extraction: dispatches extraction (evidence: `app/main.py`)
- HTTP endpoints → Offer review marks: dispatches review (evidence: `app/main.py`)
- HTTP endpoints → Thread restoration: dispatches restore (evidence: `app/main.py`)
- Gmail access → Email classification: classifies mail (evidence: `app/gmail_service.py`)
- Gmail access → Google Gmail: accesses mailbox
- Email classification → Tender data store: stores analysis (evidence: `app/classify_service.py`)
- Email classification → AWS Bedrock model: classifies content
- Bid processing → Gmail access: reads messages (evidence: `app/bid_service.py`)
- Bid processing → Offer extraction: uses extraction (evidence: `app/bid_service.py`)
- Bid processing → Tender data store: reads and writes (evidence: `app/bid_service.py`)
- Thread restoration → Gmail access: restores thread (evidence: `app/thread_restore_service.py`)
- Thread restoration → PDF ingestion: reprocesses files (evidence: `app/thread_restore_service.py`)
- Thread restoration → Tender data store: updates records (evidence: `app/thread_restore_service.py`)
- PDF ingestion → Document analysis: analyzes PDFs (evidence: `app/upload_service.py`)
- PDF ingestion → PDF processing: extracts PDF text (evidence: `app/upload_service.py`)
- PDF ingestion → Tender linking: links documents (evidence: `app/upload_service.py`)
- PDF ingestion → Email classification: refreshes analysis (evidence: `app/upload_service.py`)
- PDF ingestion → Tender data store: stores documents (evidence: `app/upload_service.py`)
- Document analysis → Tender data store: saves references (evidence: `app/document_service.py`)
- Document analysis → AWS Bedrock model: classifies documents
- Offer extraction → Document analysis: uses document data (evidence: `app/offer_service.py`)
- Offer extraction → Email classification: uses email analysis (evidence: `app/offer_service.py`)
- Offer extraction → Tender data store: saves offers (evidence: `app/offer_service.py`)
- Offer review marks → Email classification: uses classifications (evidence: `app/accept_service.py`)
