# shuiii129/financial-intelligence-rag architecture

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

- Interactive diagram: https://gitdiagram.com/shuiii129/financial-intelligence-rag
- Repository: https://github.com/shuiii129/financial-intelligence-rag

## Overview

This Streamlit application takes a financial-report PDF through parsing and retrieval setup, then presents an executive dashboard, conversational analysis, and a direct document explorer. Its main runtime is concentrated in app.py; the README documents major capabilities such as hybrid search, multilingual chat, model fallback, and rate-limit handling, while excerpts show parts of indexing, dashboard rendering, and document search. Internal relationships not visible in the excerpts are included only where the README describes them.

Main entry points: [`app.py`](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py) (Conversational Agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Document Ingestion"]
  node_upload["Report Upload<br/>[app.py]"]
  node_pdf["PDF Parsing<br/>[app.py]"]
  node_chunks["Text Chunking<br/>[app.py]"]
  node_retrieval["Hybrid Retrieval<br/>[app.py]"]
  node_vector_index[("Dense Vector Index<br/>[app.py]")]
  node_keyword_search["Keyword Search<br/>[app.py]"]
end

subgraph group_analysis["Financial Analysis"]
  node_financial_analysis["Financial Analysis<br/>[app.py]"]
  node_swot["SWOT Analysis<br/>[app.py]"]
end

subgraph group_interaction["User Experience"]
  node_dashboard["Executive Dashboard<br/>[app.py]"]
  node_trend_charts["Trend Charts<br/>[app.py]"]
  node_chat["Conversational Agent<br/>[app.py]"]
  node_memory["Query Memory<br/>[app.py]"]
  node_inspector["Document Explorer<br/>[app.py]"]
end

subgraph group_services["AI Services"]
  node_gemini{{"Gemini Models"}}
end

node_user(("Financial Analyst"))

node_user -->|"uploads PDF"| node_upload
node_upload -->|"parses report"| node_pdf
node_pdf -->|"splits text"| node_chunks
node_chunks -->|"embeds chunks"| node_vector_index
node_chunks -->|"indexes text"| node_keyword_search
node_vector_index -->|"dense search"| node_retrieval
node_keyword_search -->|"sparse search"| node_retrieval
node_user -->|"asks questions"| node_chat
node_chat -->|"retrieves context"| node_retrieval
node_chat -->|"condenses follow-ups"| node_memory
node_chat -->|"generates answers"| node_gemini
node_user -->|"searches document"| node_inspector
node_inspector -->|"searches chunks"| node_retrieval
node_user -->|"views results"| node_dashboard
node_financial_analysis -->|"analyzes report"| node_gemini
node_financial_analysis -->|"provides summary"| node_dashboard
node_financial_analysis -->|"produces SWOT"| node_swot
node_dashboard -->|"renders metrics"| node_trend_charts

click node_upload "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_pdf "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_chunks "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_retrieval "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_vector_index "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_keyword_search "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_financial_analysis "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_dashboard "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_trend_charts "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_swot "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_chat "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_memory "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py"
click node_inspector "https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.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_upload,node_pdf,node_chunks,node_retrieval,node_vector_index,node_keyword_search toneBlue
class node_financial_analysis,node_swot toneAmber
class node_dashboard,node_trend_charts,node_chat,node_memory,node_inspector toneMint
class node_gemini toneRose
class node_user toneIndigo
```

## Components

### Document Ingestion

- [Report Upload](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [PDF Parsing](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Text Chunking](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Hybrid Retrieval](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Dense Vector Index](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Keyword Search](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`

### Financial Analysis

- [Financial Analysis](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [SWOT Analysis](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`

### User Experience

- [Executive Dashboard](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Trend Charts](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Conversational Agent](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Query Memory](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`
- [Document Explorer](https://github.com/shuiii129/financial-intelligence-rag/blob/main/app.py): `app.py`

### AI Services

- **Gemini Models**

### Other components

- **Financial Analyst**

## Connections

- Financial Analyst → Report Upload: uploads PDF (evidence: `README.md`)
- Report Upload → PDF Parsing: parses report (evidence: `README.md`)
- PDF Parsing → Text Chunking: splits text (evidence: `app.py`)
- Text Chunking → Dense Vector Index: embeds chunks (evidence: `app.py`)
- Text Chunking → Keyword Search: indexes text (evidence: `README.md`)
- Dense Vector Index → Hybrid Retrieval: dense search (evidence: `README.md`)
- Keyword Search → Hybrid Retrieval: sparse search (evidence: `README.md`)
- Financial Analyst → Conversational Agent: asks questions (evidence: `README.md`)
- Conversational Agent → Hybrid Retrieval: retrieves context (evidence: `README.md`)
- Conversational Agent → Query Memory: condenses follow-ups (evidence: `README.md`)
- Conversational Agent → Gemini Models: generates answers (evidence: `README.md`)
- Financial Analyst → Document Explorer: searches document (evidence: `README.md`)
- Document Explorer → Hybrid Retrieval: searches chunks (evidence: `app.py`)
- Financial Analyst → Executive Dashboard: views results (evidence: `README.md`)
- Financial Analysis → Gemini Models: analyzes report (evidence: `README.md`)
- Financial Analysis → Executive Dashboard: provides summary (evidence: `README.md`)
- Financial Analysis → SWOT Analysis: produces SWOT (evidence: `README.md`)
- Executive Dashboard → Trend Charts: renders metrics (evidence: `app.py`)
