# kswkm/q.investment-email architecture

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

- Interactive diagram: https://gitdiagram.com/kswkm/q.investment-email
- Repository: https://github.com/kswkm/q.investment-email

## Overview

Investment-email is a reference-only, multi-market stock-analysis pipeline: Toss market data feeds candidate selection and quantitative scoring, with optional disclosure/news-based reliability analysis, then an HTML report is emailed. The graph follows the README’s documented workflow and the shown imports/calls; unsampled implementation details are not inferred beyond documented capabilities.

Main entry points: [`main.py`](https://github.com/kswkm/q.investment-email/blob/main/main.py) (Pipeline Orchestrator), [`ai/reliability_analyzer.py`](https://github.com/kswkm/q.investment-email/blob/main/ai/reliability_analyzer.py) (Reliability Analyzer), [`data/data_collector.py`](https://github.com/kswkm/q.investment-email/blob/main/data/data_collector.py) (Market Collector), [`api/toss_api.py`](https://github.com/kswkm/q.investment-email/blob/main/api/toss_api.py) (Toss API Adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow"]
  node_orchestrator["Pipeline Orchestrator<br/>[main.py]"]
  node_configuration["Runtime Configuration<br/>[config.py]"]
end

subgraph group_market["Market Data"]
  node_collector["Market Collector<br/>[data_collector.py]"]
  node_symbols["Symbol Utilities<br/>[symbol_utils.py]"]
  node_toss["Toss API Adapter<br/>[toss_api.py]"]
end

subgraph group_quant["Quant Analysis"]
  node_quant_analyzer["Quant Analyzer<br/>[quant_analyzer.py]"]
end

subgraph group_reliability["Reliability Analysis"]
  node_reliability_analyzer["Reliability Analyzer"]
  node_dart["DART Client<br/>[dart_client.py]"]
  node_sec["SEC Client<br/>[sec_client.py]"]
  node_news["News Client<br/>[news_client.py]"]
  node_normalizer["Evidence Normalizer<br/>[data_normalizer.py]"]
  node_ollama_client["Ollama Client<br/>[ollama_client.py]"]
end

subgraph group_delivery["Report Delivery"]
  node_report["HTML Report Generator"]
  node_email["Email Manager<br/>[email_manager.py]"]
end

node_investor(("Investor"))
node_toss_service{{"Toss Open API"}}
node_dart_service{{"DART Open API"}}
node_sec_service{{"SEC EDGAR"}}
node_news_service{{"Google News RSS"}}
node_ollama_service{{"Ollama Server"}}
node_gmail{{"Gmail SMTP"}}

node_investor -->|"starts analysis"| node_orchestrator
node_orchestrator -->|"loads settings"| node_configuration
node_orchestrator -->|"collects candidates"| node_collector
node_collector -->|"validates symbols"| node_symbols
node_collector -->|"requests prices and charts"| node_toss
node_toss -->|"fetches market data"| node_toss_service
node_orchestrator -->|"scores candidates"| node_quant_analyzer
node_orchestrator -->|"requests reliability"| node_reliability_analyzer
node_reliability_analyzer -->|"queries disclosures"| node_dart
node_reliability_analyzer -->|"queries filings"| node_sec
node_reliability_analyzer -->|"collects news"| node_news
node_reliability_analyzer -->|"normalizes evidence"| node_normalizer
node_reliability_analyzer -->|"evaluates evidence"| node_ollama_client
node_reliability_analyzer -->|"validates symbols"| node_symbols
node_dart -->|"requests disclosures"| node_dart_service
node_sec -->|"requests filings"| node_sec_service
node_news -->|"searches RSS"| node_news_service
node_ollama_client -->|"generates JSON"| node_ollama_service
node_orchestrator -->|"builds report"| node_report
node_orchestrator -->|"sends report"| node_email
node_email -->|"delivers email"| node_gmail

click node_orchestrator "https://github.com/kswkm/q.investment-email/blob/main/main.py"
click node_configuration "https://github.com/kswkm/q.investment-email/blob/main/config.py"
click node_collector "https://github.com/kswkm/q.investment-email/blob/main/data/data_collector.py"
click node_symbols "https://github.com/kswkm/q.investment-email/blob/main/shared/symbol_utils.py"
click node_toss "https://github.com/kswkm/q.investment-email/blob/main/api/toss_api.py"
click node_quant_analyzer "https://github.com/kswkm/q.investment-email/blob/main/analysis/quant_analyzer.py"
click node_reliability_analyzer "https://github.com/kswkm/q.investment-email/blob/main/ai/reliability_analyzer.py"
click node_dart "https://github.com/kswkm/q.investment-email/blob/main/ai/data/dart_client.py"
click node_sec "https://github.com/kswkm/q.investment-email/blob/main/ai/data/sec_client.py"
click node_news "https://github.com/kswkm/q.investment-email/blob/main/ai/data/news_client.py"
click node_normalizer "https://github.com/kswkm/q.investment-email/blob/main/ai/data/data_normalizer.py"
click node_ollama_client "https://github.com/kswkm/q.investment-email/blob/main/ai/ollama_client.py"
click node_report "https://github.com/kswkm/q.investment-email/blob/main/communication/report_generator.py"
click node_email "https://github.com/kswkm/q.investment-email/blob/main/communication/email_manager.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_orchestrator,node_configuration toneBlue
class node_collector,node_symbols,node_toss toneAmber
class node_quant_analyzer,node_toss_service,node_dart_service,node_ollama_service toneMint
class node_reliability_analyzer,node_dart,node_sec,node_news,node_normalizer,node_ollama_client toneRose
class node_report,node_email,node_investor,node_sec_service,node_news_service,node_gmail toneIndigo
```

## Components

### Workflow

- [Pipeline Orchestrator](https://github.com/kswkm/q.investment-email/blob/main/main.py): `main.py`
- [Runtime Configuration](https://github.com/kswkm/q.investment-email/blob/main/config.py): `config.py`

### Market Data

- [Market Collector](https://github.com/kswkm/q.investment-email/blob/main/data/data_collector.py): `data/data_collector.py`
- [Symbol Utilities](https://github.com/kswkm/q.investment-email/blob/main/shared/symbol_utils.py): `shared/symbol_utils.py`
- [Toss API Adapter](https://github.com/kswkm/q.investment-email/blob/main/api/toss_api.py): `api/toss_api.py`

### Quant Analysis

- [Quant Analyzer](https://github.com/kswkm/q.investment-email/blob/main/analysis/quant_analyzer.py): `analysis/quant_analyzer.py`

### Reliability Analysis

- [Reliability Analyzer](https://github.com/kswkm/q.investment-email/blob/main/ai/reliability_analyzer.py): `ai/reliability_analyzer.py`
- [DART Client](https://github.com/kswkm/q.investment-email/blob/main/ai/data/dart_client.py): `ai/data/dart_client.py`
- [SEC Client](https://github.com/kswkm/q.investment-email/blob/main/ai/data/sec_client.py): `ai/data/sec_client.py`
- [News Client](https://github.com/kswkm/q.investment-email/blob/main/ai/data/news_client.py): `ai/data/news_client.py`
- [Evidence Normalizer](https://github.com/kswkm/q.investment-email/blob/main/ai/data/data_normalizer.py): `ai/data/data_normalizer.py`
- [Ollama Client](https://github.com/kswkm/q.investment-email/blob/main/ai/ollama_client.py): `ai/ollama_client.py`

### Report Delivery

- [HTML Report Generator](https://github.com/kswkm/q.investment-email/blob/main/communication/report_generator.py): `communication/report_generator.py`
- [Email Manager](https://github.com/kswkm/q.investment-email/blob/main/communication/email_manager.py): `communication/email_manager.py`

### Other components

- **Investor**
- **Toss Open API**
- **DART Open API**
- **SEC EDGAR**
- **Google News RSS**
- **Ollama Server**
- **Gmail SMTP**

## Connections

- Investor → Pipeline Orchestrator: starts analysis (evidence: `README.md`)
- Pipeline Orchestrator → Runtime Configuration: loads settings (evidence: `README.md`)
- Pipeline Orchestrator → Market Collector: collects candidates (evidence: `README.md`)
- Market Collector → Symbol Utilities: validates symbols (evidence: `data/data_collector.py`)
- Market Collector → Toss API Adapter: requests prices and charts (evidence: `data/data_collector.py`)
- Toss API Adapter → Toss Open API: fetches market data (evidence: `api/toss_api.py`)
- Pipeline Orchestrator → Quant Analyzer: scores candidates (evidence: `README.md`)
- Pipeline Orchestrator → Reliability Analyzer: requests reliability (evidence: `README.md`)
- Reliability Analyzer → DART Client: queries disclosures (evidence: `ai/reliability_analyzer.py`)
- Reliability Analyzer → SEC Client: queries filings (evidence: `ai/reliability_analyzer.py`)
- Reliability Analyzer → News Client: collects news (evidence: `ai/reliability_analyzer.py`)
- Reliability Analyzer → Evidence Normalizer: normalizes evidence (evidence: `ai/reliability_analyzer.py`)
- Reliability Analyzer → Ollama Client: evaluates evidence (evidence: `ai/reliability_analyzer.py`)
- Reliability Analyzer → Symbol Utilities: validates symbols (evidence: `ai/reliability_analyzer.py`)
- DART Client → DART Open API: requests disclosures (evidence: `ai/data/dart_client.py`)
- SEC Client → SEC EDGAR: requests filings (evidence: `ai/data/sec_client.py`)
- News Client → Google News RSS: searches RSS (evidence: `ai/data/news_client.py`)
- Ollama Client → Ollama Server: generates JSON (evidence: `ai/ollama_client.py`)
- Pipeline Orchestrator → HTML Report Generator: builds report (evidence: `README.md`)
- Pipeline Orchestrator → Email Manager: sends report (evidence: `README.md`)
- Email Manager → Gmail SMTP: delivers email (evidence: `communication/email_manager.py`)
