# namantenguria/llm-powered-auditor architecture

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

- Interactive diagram: https://gitdiagram.com/namantenguria/llm-powered-auditor
- Repository: https://github.com/namantenguria/llm-powered-auditor

## Overview

AuditIQ is a local audit-evidence review assistant. Auditors upload documents, which are extracted, chunked, embedded, and indexed; they can then ask evidence-grounded questions or run risk review. Risks can be turned into structured findings, surfaced in dashboard metrics, and included in an exportable report. The graph shows the API orchestration, analysis services, and persistent stores. The README documents the Streamlit interface and major capabilities; its source was read, but the excerpts do not show frontend request wiring, so that connection is left unverified.

Main entry points: [`backend/main.py`](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/main.py) (FastAPI application), [`backend/database.py`](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/database.py) (SQLite records), [`backend/routers/upload.py`](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/upload.py) (Document upload), [`backend/services/risk_extractor.py`](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/risk_extractor.py) (Risk extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_ui["Streamlit interface<br/>[streamlit_app.py]"]
end

subgraph group_api["API orchestration"]
  node_api["FastAPI application<br/>[main.py]"]
  node_upload["Document upload<br/>[upload.py]"]
  node_ask["Question endpoint<br/>[ask.py]"]
  node_risks["Risk endpoint<br/>[risks.py]"]
  node_findings["Finding endpoint<br/>[findings.py]"]
  node_dashboard["Dashboard endpoint<br/>[dashboard.py]"]
  node_report["Report endpoint<br/>[report.py]"]
  node_admin["Admin controls<br/>[admin.py]"]
end

subgraph group_evidence["Evidence processing"]
  node_loader["Document text extraction<br/>[document_loader.py]"]
  node_chunks["Chunking and indexing<br/>[vector_store.py]"]
end

subgraph group_analysis["Audit analysis"]
  node_rag["Evidence Q&amp;A<br/>[rag_chain.py]"]
  node_riskreview["Risk extraction<br/>[risk_extractor.py]"]
  node_findinggen["Finding generation"]
  node_reportgen["Report generation"]
  node_prompts["LLM prompt templates"]
end

subgraph group_persistence["Local persistence"]
  node_sqlite[("SQLite records<br/>[database.py]")]
  node_chroma[("Chroma vector store<br/>[vector_store.py]")]
  node_uploads["Uploaded evidence files<br/>[upload.py]"]
end

node_auditor(("Auditor"))
node_ollama["Local Ollama models"]

node_auditor -.->|"uses"| node_ui
node_ui -.->|"calls API"| node_api
node_api -->|"registers route"| node_upload
node_api -->|"registers route"| node_ask
node_api -->|"registers route"| node_risks
node_api -->|"registers route"| node_findings
node_api -->|"registers route"| node_dashboard
node_api -->|"registers route"| node_report
node_api -->|"registers route"| node_admin
node_api -->|"initializes"| node_sqlite
node_upload -->|"saves file"| node_uploads
node_upload -->|"extracts text"| node_loader
node_upload -->|"chunks text"| node_chunks
node_upload -->|"saves metadata"| node_sqlite
node_chunks -->|"stores chunks"| node_chroma
node_chunks -->|"embeds chunks"| node_ollama
node_ask -->|"answers question"| node_rag
node_ask -->|"logs answer"| node_sqlite
node_rag -->|"retrieves chunks"| node_chunks
node_rag -->|"generates answer"| node_ollama
node_rag -->|"loads template"| node_prompts
node_risks -->|"runs review"| node_riskreview
node_riskreview -->|"searches evidence"| node_chunks
node_riskreview -->|"extracts risks"| node_ollama
node_riskreview -->|"loads template"| node_prompts
node_riskreview -->|"saves risks"| node_sqlite
node_findings -->|"generates finding"| node_findinggen
node_findinggen -->|"reads risk, saves finding"| node_sqlite
node_findinggen -->|"drafts finding"| node_ollama
node_findinggen -->|"loads template"| node_prompts
node_dashboard -->|"reads metrics"| node_sqlite
node_report -->|"generates report"| node_reportgen
node_reportgen -->|"reads audit records"| node_sqlite
node_admin -->|"clears records"| node_sqlite
node_admin -->|"clears index"| node_chroma
node_admin -->|"clears files"| node_uploads

click node_ui "https://github.com/namantenguria/llm-powered-auditor/blob/master/frontend/streamlit_app.py"
click node_api "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/main.py"
click node_upload "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/upload.py"
click node_ask "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/ask.py"
click node_risks "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/risks.py"
click node_findings "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/findings.py"
click node_dashboard "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/dashboard.py"
click node_report "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/report.py"
click node_admin "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/admin.py"
click node_loader "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/document_loader.py"
click node_chunks "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/vector_store.py"
click node_rag "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/rag_chain.py"
click node_riskreview "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/risk_extractor.py"
click node_findinggen "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/finding_generator.py"
click node_reportgen "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/report_generator.py"
click node_prompts "https://github.com/namantenguria/llm-powered-auditor/tree/master/backend/prompts"
click node_sqlite "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/database.py"
click node_chroma "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/vector_store.py"
click node_uploads "https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/upload.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_ui toneBlue
class node_api,node_upload,node_ask,node_risks,node_findings,node_dashboard,node_report,node_admin toneAmber
class node_loader,node_chunks toneMint
class node_rag,node_riskreview,node_findinggen,node_reportgen,node_prompts toneRose
class node_sqlite,node_chroma,node_uploads,node_auditor,node_ollama toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/namantenguria/llm-powered-auditor/blob/master/frontend/streamlit_app.py): `frontend/streamlit_app.py`

### API orchestration

- [FastAPI application](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/main.py): `backend/main.py`
- [Document upload](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/upload.py): `backend/routers/upload.py`
- [Question endpoint](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/ask.py): `backend/routers/ask.py`
- [Risk endpoint](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/risks.py): `backend/routers/risks.py`
- [Finding endpoint](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/findings.py): `backend/routers/findings.py`
- [Dashboard endpoint](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/dashboard.py): `backend/routers/dashboard.py`
- [Report endpoint](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/report.py): `backend/routers/report.py`
- [Admin controls](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/admin.py): `backend/routers/admin.py`

### Evidence processing

- [Document text extraction](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/document_loader.py): `backend/services/document_loader.py`
- [Chunking and indexing](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/vector_store.py): `backend/services/vector_store.py`

### Audit analysis

- [Evidence Q&A](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/rag_chain.py): `backend/services/rag_chain.py`
- [Risk extraction](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/risk_extractor.py): `backend/services/risk_extractor.py`
- [Finding generation](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/finding_generator.py): `backend/services/finding_generator.py`
- [Report generation](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/report_generator.py): `backend/services/report_generator.py`
- [LLM prompt templates](https://github.com/namantenguria/llm-powered-auditor/tree/master/backend/prompts): `backend/prompts`

### Local persistence

- [SQLite records](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/database.py): `backend/database.py`
- [Chroma vector store](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/services/vector_store.py): `backend/services/vector_store.py`
- [Uploaded evidence files](https://github.com/namantenguria/llm-powered-auditor/blob/master/backend/routers/upload.py): `backend/routers/upload.py`

### Other components

- **Auditor**
- **Local Ollama models**

## Connections

- Auditor → Streamlit interface: uses
- Streamlit interface → FastAPI application: calls API
- FastAPI application → Document upload: registers route (evidence: `backend/main.py`)
- FastAPI application → Question endpoint: registers route (evidence: `backend/main.py`)
- FastAPI application → Risk endpoint: registers route (evidence: `backend/main.py`)
- FastAPI application → Finding endpoint: registers route (evidence: `backend/main.py`)
- FastAPI application → Dashboard endpoint: registers route (evidence: `backend/main.py`)
- FastAPI application → Report endpoint: registers route (evidence: `backend/main.py`)
- FastAPI application → Admin controls: registers route (evidence: `backend/main.py`)
- FastAPI application → SQLite records: initializes (evidence: `backend/main.py`)
- Document upload → Uploaded evidence files: saves file (evidence: `backend/routers/upload.py`)
- Document upload → Document text extraction: extracts text (evidence: `backend/routers/upload.py`)
- Document upload → Chunking and indexing: chunks text (evidence: `backend/routers/upload.py`)
- Document upload → SQLite records: saves metadata (evidence: `backend/routers/upload.py`)
- Chunking and indexing → Chroma vector store: stores chunks (evidence: `backend/services/vector_store.py`)
- Chunking and indexing → Local Ollama models: embeds chunks (evidence: `backend/services/vector_store.py`)
- Question endpoint → Evidence Q&A: answers question (evidence: `backend/routers/ask.py`)
- Question endpoint → SQLite records: logs answer (evidence: `backend/routers/ask.py`)
- Evidence Q&A → Chunking and indexing: retrieves chunks (evidence: `backend/services/rag_chain.py`)
- Evidence Q&A → Local Ollama models: generates answer (evidence: `backend/services/rag_chain.py`)
- Evidence Q&A → LLM prompt templates: loads template (evidence: `backend/services/rag_chain.py`)
- Risk endpoint → Risk extraction: runs review (evidence: `backend/routers/risks.py`)
- Risk extraction → Chunking and indexing: searches evidence (evidence: `backend/services/risk_extractor.py`)
- Risk extraction → Local Ollama models: extracts risks (evidence: `backend/services/risk_extractor.py`)
- Risk extraction → LLM prompt templates: loads template (evidence: `backend/services/risk_extractor.py`)
- Risk extraction → SQLite records: saves risks (evidence: `backend/services/risk_extractor.py`)
- Finding endpoint → Finding generation: generates finding (evidence: `backend/routers/findings.py`)
- Finding generation → SQLite records: reads risk, saves finding (evidence: `backend/services/finding_generator.py`)
- Finding generation → Local Ollama models: drafts finding (evidence: `backend/services/finding_generator.py`)
- Finding generation → LLM prompt templates: loads template (evidence: `backend/services/finding_generator.py`)
- Dashboard endpoint → SQLite records: reads metrics (evidence: `backend/routers/dashboard.py`)
- Report endpoint → Report generation: generates report (evidence: `backend/routers/report.py`)
- Report generation → SQLite records: reads audit records (evidence: `backend/services/report_generator.py`)
- Admin controls → SQLite records: clears records (evidence: `backend/routers/admin.py`)
- Admin controls → Chroma vector store: clears index (evidence: `backend/routers/admin.py`)
- Admin controls → Uploaded evidence files: clears files (evidence: `backend/routers/admin.py`)
