# jin7744/tendercheck architecture

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

- Interactive diagram: https://gitdiagram.com/jin7744/tendercheck
- Repository: https://github.com/jin7744/tendercheck

## Overview

TenderCheck verifies public-tender bid packages against tender documents; it reports evidence and cautions, but leaves the eligibility decision to a person. The main workflow normalizes and masks source text, extracts and verifies requirements, matches bidder files, checks conflicts and file rules, then produces a report. Scanned-page analysis adds a cautious evidence branch. The graph follows the documented workflow and source-index references; some internal calls and the web interface’s data wiring were not shown in excerpts, so those links are omitted where unverified.

Main entry points: [`engine/pipeline.py`](https://github.com/jin7744/tendercheck/blob/main/engine/pipeline.py) (Run Pipeline), [`tools/run_scenario.py`](https://github.com/jin7744/tendercheck/blob/main/tools/run_scenario.py) (Run Scenario), [`engine/model_client.py`](https://github.com/jin7744/tendercheck/blob/main/engine/model_client.py) (Model Client), [`engine/report.py`](https://github.com/jin7744/tendercheck/blob/main/engine/report.py) (Report Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Bid Inputs"]
  node_scenario_runner["Run Scenario<br/>[run_scenario.py]"]
  node_tender_bundle["Tender Documents<br/>[normalize.py]"]
  node_bidder_manifest["Bidder File List<br/>[manifest.py]"]
end

subgraph group_engine["Verification Engine"]
  node_pipeline["Run Pipeline<br/>[pipeline.py]"]
  node_normalizer["Normalize and Mask<br/>[normalize.py]"]
  node_stages["Model Stages<br/>[stages.py]"]
  node_quote_checks["Quote Checks<br/>[checks.py]"]
  node_date_rules["Date Arithmetic<br/>[dates.py]"]
  node_conflicts["Conflict Analysis<br/>[conflicts.py]"]
  node_page_vision["Scanned Page Reading<br/>[vision.py]"]
  node_file_checks["File Checks<br/>[filechecks.py]"]
  node_status_rules["Status Decisions<br/>[rules.py]"]
  node_call_ledger[("Call Budget Ledger<br/>[ledger.py]")]
  node_call_replay["Call Replay<br/>[replay.py]"]
end

subgraph group_model["Model Services"]
  node_model_client["Model Client<br/>[model_client.py]"]
end

subgraph group_outputs["Results"]
  node_report["Report Builder<br/>[report.py]"]
  node_web_report["Demo Report Page<br/>[app.js]"]
end

node_preparer(("Bid Preparer"))
node_meta_api{{"Meta Model API"}}

node_preparer -->|"submits run"| node_scenario_runner
node_scenario_runner -->|"runs pipeline"| node_pipeline
node_scenario_runner -.->|"loads package"| node_tender_bundle
node_scenario_runner -.->|"loads manifest"| node_bidder_manifest
node_pipeline -->|"normalizes inputs"| node_normalizer
node_normalizer -->|"returns bundle"| node_pipeline
node_pipeline -->|"runs stages"| node_stages
node_stages -->|"sends requests"| node_model_client
node_model_client -->|"calls API"| node_meta_api
node_model_client -->|"records budget"| node_call_ledger
node_model_client -->|"records or replays"| node_call_replay
node_pipeline -->|"verifies quotes"| node_quote_checks
node_quote_checks -->|"checks dates"| node_date_rules
node_pipeline -->|"finds conflicts"| node_conflicts
node_pipeline -.->|"optionally reads pages"| node_page_vision
node_pipeline -->|"checks files"| node_file_checks
node_pipeline -->|"decides statuses"| node_status_rules
node_pipeline -->|"builds report"| node_report
node_status_rules -->|"supplies decisions"| node_report
node_report -.->|"renders results"| node_web_report
node_call_replay -.->|"feeds recorded runs"| node_web_report

click node_scenario_runner "https://github.com/jin7744/tendercheck/blob/main/tools/run_scenario.py"
click node_tender_bundle "https://github.com/jin7744/tendercheck/blob/main/engine/normalize.py"
click node_bidder_manifest "https://github.com/jin7744/tendercheck/blob/main/engine/manifest.py"
click node_pipeline "https://github.com/jin7744/tendercheck/blob/main/engine/pipeline.py"
click node_normalizer "https://github.com/jin7744/tendercheck/blob/main/engine/normalize.py"
click node_stages "https://github.com/jin7744/tendercheck/blob/main/engine/stages.py"
click node_model_client "https://github.com/jin7744/tendercheck/blob/main/engine/model_client.py"
click node_quote_checks "https://github.com/jin7744/tendercheck/blob/main/engine/checks.py"
click node_date_rules "https://github.com/jin7744/tendercheck/blob/main/engine/dates.py"
click node_conflicts "https://github.com/jin7744/tendercheck/blob/main/engine/conflicts.py"
click node_page_vision "https://github.com/jin7744/tendercheck/blob/main/engine/vision.py"
click node_file_checks "https://github.com/jin7744/tendercheck/blob/main/engine/filechecks.py"
click node_status_rules "https://github.com/jin7744/tendercheck/blob/main/engine/rules.py"
click node_report "https://github.com/jin7744/tendercheck/blob/main/engine/report.py"
click node_call_ledger "https://github.com/jin7744/tendercheck/blob/main/engine/ledger.py"
click node_call_replay "https://github.com/jin7744/tendercheck/blob/main/engine/replay.py"
click node_web_report "https://github.com/jin7744/tendercheck/blob/main/web/app.js"

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_scenario_runner,node_tender_bundle,node_bidder_manifest toneBlue
class node_pipeline,node_normalizer,node_stages,node_quote_checks,node_date_rules,node_conflicts,node_page_vision,node_file_checks,node_status_rules,node_call_ledger,node_call_replay toneAmber
class node_model_client,node_meta_api toneMint
class node_report,node_web_report toneRose
class node_preparer toneIndigo
```

## Components

### Bid Inputs

- [Run Scenario](https://github.com/jin7744/tendercheck/blob/main/tools/run_scenario.py): `tools/run_scenario.py`
- [Tender Documents](https://github.com/jin7744/tendercheck/blob/main/engine/normalize.py): `engine/normalize.py`
- [Bidder File List](https://github.com/jin7744/tendercheck/blob/main/engine/manifest.py): `engine/manifest.py`

### Verification Engine

- [Run Pipeline](https://github.com/jin7744/tendercheck/blob/main/engine/pipeline.py): `engine/pipeline.py`
- [Normalize and Mask](https://github.com/jin7744/tendercheck/blob/main/engine/normalize.py): `engine/normalize.py`
- [Model Stages](https://github.com/jin7744/tendercheck/blob/main/engine/stages.py): `engine/stages.py`
- [Quote Checks](https://github.com/jin7744/tendercheck/blob/main/engine/checks.py): `engine/checks.py`
- [Date Arithmetic](https://github.com/jin7744/tendercheck/blob/main/engine/dates.py): `engine/dates.py`
- [Conflict Analysis](https://github.com/jin7744/tendercheck/blob/main/engine/conflicts.py): `engine/conflicts.py`
- [Scanned Page Reading](https://github.com/jin7744/tendercheck/blob/main/engine/vision.py): `engine/vision.py`
- [File Checks](https://github.com/jin7744/tendercheck/blob/main/engine/filechecks.py): `engine/filechecks.py`
- [Status Decisions](https://github.com/jin7744/tendercheck/blob/main/engine/rules.py): `engine/rules.py`
- [Call Budget Ledger](https://github.com/jin7744/tendercheck/blob/main/engine/ledger.py): `engine/ledger.py`
- [Call Replay](https://github.com/jin7744/tendercheck/blob/main/engine/replay.py): `engine/replay.py`

### Model Services

- [Model Client](https://github.com/jin7744/tendercheck/blob/main/engine/model_client.py): `engine/model_client.py`

### Results

- [Report Builder](https://github.com/jin7744/tendercheck/blob/main/engine/report.py): `engine/report.py`
- [Demo Report Page](https://github.com/jin7744/tendercheck/blob/main/web/app.js): `web/app.js`

### Other components

- **Bid Preparer**
- **Meta Model API**

## Connections

- Bid Preparer → Run Scenario: submits run (evidence: `README.md`)
- Run Scenario → Run Pipeline: runs pipeline (evidence: `tools/run_scenario.py`)
- Run Scenario → Tender Documents: loads package
- Run Scenario → Bidder File List: loads manifest
- Run Pipeline → Normalize and Mask: normalizes inputs (evidence: `engine/pipeline.py`)
- Normalize and Mask → Run Pipeline: returns bundle (evidence: `engine/normalize.py`)
- Run Pipeline → Model Stages: runs stages (evidence: `engine/pipeline.py`)
- Model Stages → Model Client: sends requests (evidence: `engine/stages.py`)
- Model Client → Meta Model API: calls API (evidence: `README.md`)
- Model Client → Call Budget Ledger: records budget (evidence: `engine/model_client.py`)
- Model Client → Call Replay: records or replays (evidence: `engine/model_client.py`)
- Run Pipeline → Quote Checks: verifies quotes (evidence: `README.md`)
- Quote Checks → Date Arithmetic: checks dates (evidence: `engine/checks.py`)
- Run Pipeline → Conflict Analysis: finds conflicts (evidence: `README.md`)
- Run Pipeline → Scanned Page Reading: optionally reads pages (evidence: `README.md`)
- Run Pipeline → File Checks: checks files (evidence: `README.md`)
- Run Pipeline → Status Decisions: decides statuses (evidence: `engine/pipeline.py`)
- Run Pipeline → Report Builder: builds report (evidence: `engine/pipeline.py`)
- Status Decisions → Report Builder: supplies decisions (evidence: `engine/report.py`)
- Report Builder → Demo Report Page: renders results (evidence: `README.md`)
- Call Replay → Demo Report Page: feeds recorded runs (evidence: `README.md`)
