# sanika717/bid-analyser architecture

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

- Interactive diagram: https://gitdiagram.com/sanika717/bid-analyser
- Repository: https://github.com/sanika717/bid-analyser

## Overview

TCE Universal Bid Comparison Engine accepts authenticated bid-analysis jobs, extracts vendor data from PDFs against an Excel template, ranks profiles, and returns a comparison workbook. The main runtime is the FastAPI application and the newer pipeline; the source also contains a separate legacy analysis engine. The README is empty, so capability coverage and relationships here rely on the sampled source and SOURCE INDEX; unsampled legacy internals are not expanded.

Main entry points: [`engine/pipeline/orchestrator.py`](https://github.com/sanika717/bid-analyser/blob/main/engine/pipeline/orchestrator.py) (Job pipeline), [`app/api/jobs.py`](https://github.com/sanika717/bid-analyser/blob/main/app/api/jobs.py) (Job routes), [`app/main.py`](https://github.com/sanika717/bid-analyser/blob/main/app/main.py) (FastAPI app), [`app/auth.py`](https://github.com/sanika717/bid-analyser/blob/main/app/auth.py) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["API and access"]
  node_app["FastAPI app<br/>[main.py]"]
  node_auth_api["Auth routes<br/>[auth.py]"]
  node_jobs_api["Job routes<br/>[jobs.py]"]
  node_auth_service["Auth service<br/>[auth.py]"]
  node_config["App config<br/>[config.py]"]
end

subgraph group_analysis["Bid analysis"]
  node_pipeline["Job pipeline<br/>[orchestrator.py]"]
  node_pdf_reader["PDF text reader<br/>[pdf_reader.py]"]
  node_structured["Structured extraction<br/>[structured.py]"]
  node_semi_structured["Label extraction<br/>[semi_structured.py]"]
  node_unstructured["Unstructured extraction<br/>[unstructured.py]"]
  node_template_parser["Template requirements<br/>[template_parser.py]"]
  node_confidence["Confidence scoring<br/>[confidence.py]"]
  node_ranking["Vendor ranking<br/>[ranking.py]"]
  node_ollama_client["Ollama client<br/>[ollama_client.py]"]
end

subgraph group_results["Results and storage"]
  node_auth_store[("Auth SQLite<br/>[auth.py]")]
  node_job_store[("Job SQLite<br/>[sqlite_db.py]")]
  node_workbook["Workbook writer<br/>[writer.py]"]
end

subgraph group_legacy["Legacy engine"]
  node_legacy_engine["Legacy bid engine<br/>[engine.py]"]
  node_legacy_entry["Legacy entry points<br/>[app_legacy.py]"]
end

node_user(("Authenticated user"))
node_ollama{{"Ollama service"}}

node_user -->|"uses"| node_app
node_app -->|"mounts"| node_auth_api
node_app -->|"mounts"| node_jobs_api
node_app -->|"initializes"| node_job_store
node_app -->|"initializes"| node_auth_service
node_auth_api -->|"calls"| node_auth_service
node_auth_service -->|"reads/writes"| node_auth_store
node_auth_api -->|"reads config"| node_config
node_auth_service -->|"reads config"| node_config
node_jobs_api -->|"requires auth"| node_auth_service
node_jobs_api -->|"reads config"| node_config
node_jobs_api -->|"reads/writes"| node_job_store
node_jobs_api -->|"runs job"| node_pipeline
node_jobs_api -->|"asks assistant"| node_ollama_client
node_ollama_client -->|"HTTP request"| node_ollama
node_pipeline -->|"reads PDF"| node_pdf_reader
node_pipeline -->|"extracts fields"| node_structured
node_pipeline -->|"extracts fields"| node_semi_structured
node_pipeline -->|"extracts fields"| node_unstructured
node_semi_structured -->|"loads requirements"| node_template_parser
node_pipeline -->|"scores profile"| node_confidence
node_pipeline -->|"ranks vendors"| node_ranking
node_pipeline -->|"writes workbook"| node_workbook
node_legacy_entry -->|"imports engine"| node_legacy_engine

click node_app "https://github.com/sanika717/bid-analyser/blob/main/app/main.py"
click node_auth_api "https://github.com/sanika717/bid-analyser/blob/main/app/api/auth.py"
click node_jobs_api "https://github.com/sanika717/bid-analyser/blob/main/app/api/jobs.py"
click node_auth_service "https://github.com/sanika717/bid-analyser/blob/main/app/auth.py"
click node_config "https://github.com/sanika717/bid-analyser/blob/main/app/core/config.py"
click node_auth_store "https://github.com/sanika717/bid-analyser/blob/main/app/auth.py"
click node_job_store "https://github.com/sanika717/bid-analyser/blob/main/app/db/sqlite_db.py"
click node_pipeline "https://github.com/sanika717/bid-analyser/blob/main/engine/pipeline/orchestrator.py"
click node_pdf_reader "https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/pdf_reader.py"
click node_structured "https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/structured.py"
click node_semi_structured "https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/semi_structured.py"
click node_unstructured "https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/unstructured.py"
click node_template_parser "https://github.com/sanika717/bid-analyser/blob/main/engine/template/template_parser.py"
click node_confidence "https://github.com/sanika717/bid-analyser/blob/main/engine/scoring/confidence.py"
click node_ranking "https://github.com/sanika717/bid-analyser/blob/main/engine/scoring/ranking.py"
click node_workbook "https://github.com/sanika717/bid-analyser/blob/main/engine/excel/writer.py"
click node_ollama_client "https://github.com/sanika717/bid-analyser/blob/main/engine/llm/ollama_client.py"
click node_legacy_engine "https://github.com/sanika717/bid-analyser/blob/main/engine1/engine.py"
click node_legacy_entry "https://github.com/sanika717/bid-analyser/blob/main/app_legacy.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,node_auth_api,node_jobs_api,node_auth_service,node_config,node_user toneBlue
class node_pipeline,node_pdf_reader,node_structured,node_semi_structured,node_unstructured,node_template_parser,node_confidence,node_ranking,node_ollama_client toneAmber
class node_auth_store,node_job_store,node_workbook toneMint
class node_legacy_engine,node_legacy_entry toneRose
class node_ollama toneIndigo
```

## Components

### API and access

- [FastAPI app](https://github.com/sanika717/bid-analyser/blob/main/app/main.py): `app/main.py`
- [Auth routes](https://github.com/sanika717/bid-analyser/blob/main/app/api/auth.py): `app/api/auth.py`
- [Job routes](https://github.com/sanika717/bid-analyser/blob/main/app/api/jobs.py): `app/api/jobs.py`
- [Auth service](https://github.com/sanika717/bid-analyser/blob/main/app/auth.py): `app/auth.py`
- [App config](https://github.com/sanika717/bid-analyser/blob/main/app/core/config.py): `app/core/config.py`

### Bid analysis

- [Job pipeline](https://github.com/sanika717/bid-analyser/blob/main/engine/pipeline/orchestrator.py): `engine/pipeline/orchestrator.py`
- [PDF text reader](https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/pdf_reader.py): `engine/extraction/pdf_reader.py`
- [Structured extraction](https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/structured.py): `engine/extraction/structured.py`
- [Label extraction](https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/semi_structured.py): `engine/extraction/semi_structured.py`
- [Unstructured extraction](https://github.com/sanika717/bid-analyser/blob/main/engine/extraction/unstructured.py): `engine/extraction/unstructured.py`
- [Template requirements](https://github.com/sanika717/bid-analyser/blob/main/engine/template/template_parser.py): `engine/template/template_parser.py`
- [Confidence scoring](https://github.com/sanika717/bid-analyser/blob/main/engine/scoring/confidence.py): `engine/scoring/confidence.py`
- [Vendor ranking](https://github.com/sanika717/bid-analyser/blob/main/engine/scoring/ranking.py): `engine/scoring/ranking.py`
- [Ollama client](https://github.com/sanika717/bid-analyser/blob/main/engine/llm/ollama_client.py): `engine/llm/ollama_client.py`

### Results and storage

- [Auth SQLite](https://github.com/sanika717/bid-analyser/blob/main/app/auth.py): `app/auth.py`
- [Job SQLite](https://github.com/sanika717/bid-analyser/blob/main/app/db/sqlite_db.py): `app/db/sqlite_db.py`
- [Workbook writer](https://github.com/sanika717/bid-analyser/blob/main/engine/excel/writer.py): `engine/excel/writer.py`

### Legacy engine

- [Legacy bid engine](https://github.com/sanika717/bid-analyser/blob/main/engine1/engine.py): `engine1/engine.py`
- [Legacy entry points](https://github.com/sanika717/bid-analyser/blob/main/app_legacy.py): `app_legacy.py`

### Other components

- **Authenticated user**
- **Ollama service**

## Connections

- Authenticated user → FastAPI app: uses
- FastAPI app → Auth routes: mounts (evidence: `app/main.py`)
- FastAPI app → Job routes: mounts (evidence: `app/main.py`)
- FastAPI app → Job SQLite: initializes (evidence: `app/main.py`)
- FastAPI app → Auth service: initializes (evidence: `app/main.py`)
- Auth routes → Auth service: calls (evidence: `app/api/auth.py`)
- Auth service → Auth SQLite: reads/writes (evidence: `app/auth.py`)
- Auth routes → App config: reads config (evidence: `app/api/auth.py`)
- Auth service → App config: reads config (evidence: `app/auth.py`)
- Job routes → Auth service: requires auth (evidence: `app/api/jobs.py`)
- Job routes → App config: reads config (evidence: `app/api/jobs.py`)
- Job routes → Job SQLite: reads/writes (evidence: `app/api/jobs.py`)
- Job routes → Job pipeline: runs job (evidence: `app/api/jobs.py`)
- Job routes → Ollama client: asks assistant (evidence: `app/api/jobs.py`)
- Ollama client → Ollama service: HTTP request (evidence: `engine/llm/ollama_client.py`)
- Job pipeline → PDF text reader: reads PDF (evidence: `engine/pipeline/orchestrator.py`)
- Job pipeline → Structured extraction: extracts fields (evidence: `engine/pipeline/orchestrator.py`)
- Job pipeline → Label extraction: extracts fields (evidence: `engine/pipeline/orchestrator.py`)
- Job pipeline → Unstructured extraction: extracts fields (evidence: `engine/pipeline/orchestrator.py`)
- Label extraction → Template requirements: loads requirements (evidence: `engine/extraction/semi_structured.py`)
- Job pipeline → Confidence scoring: scores profile (evidence: `engine/pipeline/orchestrator.py`)
- Job pipeline → Vendor ranking: ranks vendors (evidence: `engine/pipeline/orchestrator.py`)
- Job pipeline → Workbook writer: writes workbook (evidence: `engine/pipeline/orchestrator.py`)
- Legacy entry points → Legacy bid engine: imports engine (evidence: `app_legacy.py`)
