# sanjnashenoy05-glitch/enterprise-opportunity-agent architecture

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

- Interactive diagram: https://gitdiagram.com/sanjnashenoy05-glitch/enterprise-opportunity-agent
- Repository: https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent

## Overview

This Streamlit application turns a company name into an enterprise opportunity report: it retrieves recent news, asks an AI model for strategic analysis, adds available revenue trends, and assembles a downloadable PDF that can also be emailed. News, AI analysis, financial retrieval, charting, report generation, and delivery are distinct runtime stages. The sampled app.py shows how these stages are orchestrated; unsampled infrastructure is not included, and external-service links reflect the visible API calls or configuration.

Main entry points: [`app.py`](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/app.py) (Streamlit workflow), [`fetchnews.py`](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/fetchnews.py) (News retrieval), [`analyze_deepseek.py`](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/analyze_deepseek.py) (AI opportunity analysis), [`financial_data.py`](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/financial_data.py) (Revenue data retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User workflow"]
  node_app["Streamlit workflow<br/>[app.py]"]
end

subgraph group_intelligence["News and analysis"]
  node_news["News retrieval<br/>[fetchnews.py]"]
  node_analysis["AI opportunity analysis"]
end

subgraph group_financial["Financial performance"]
  node_financial_data["Revenue data retrieval<br/>[financial_data.py]"]
  node_charts["Revenue charts<br/>[financial_data.py]"]
end

subgraph group_reporting["Report delivery"]
  node_pdf["PDF report generation<br/>[generate_pdf.py]"]
  node_email["Email delivery<br/>[app.py]"]
end

node_user(("Company analyst"))
node_newsapi["NewsAPI"]
node_openrouter["OpenRouter model API"]
node_alphavantage["Alpha Vantage"]
node_smtp["Gmail SMTP"]

node_user -->|"enters company"| node_app
node_app -->|"fetches news"| node_news
node_news -->|"requests articles"| node_newsapi
node_app -->|"analyzes articles"| node_analysis
node_analysis -->|"requests analysis"| node_openrouter
node_app -->|"fetches revenue"| node_financial_data
node_financial_data -->|"requests statements"| node_alphavantage
node_app -->|"creates graphs"| node_charts
node_app -->|"builds report"| node_pdf
node_app -->|"sends report"| node_email
node_email -->|"sends message"| node_smtp
node_app -->|"offers PDF download"| node_user

click node_app "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/app.py"
click node_news "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/fetchnews.py"
click node_analysis "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/analyze_deepseek.py"
click node_financial_data "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/financial_data.py"
click node_charts "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/financial_data.py"
click node_pdf "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/generate_pdf.py"
click node_email "https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/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_app toneBlue
class node_news,node_analysis toneAmber
class node_financial_data,node_charts,node_newsapi,node_openrouter toneMint
class node_pdf,node_email toneRose
class node_user,node_alphavantage,node_smtp toneIndigo
```

## Components

### User workflow

- [Streamlit workflow](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/app.py): `app.py`

### News and analysis

- [News retrieval](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/fetchnews.py): `fetchnews.py`
- [AI opportunity analysis](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/analyze_deepseek.py): `analyze_deepseek.py`

### Financial performance

- [Revenue data retrieval](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/financial_data.py): `financial_data.py`
- [Revenue charts](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/financial_data.py): `financial_data.py`

### Report delivery

- [PDF report generation](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/generate_pdf.py): `generate_pdf.py`
- [Email delivery](https://github.com/sanjnashenoy05-glitch/enterprise-opportunity-agent/blob/main/app.py): `app.py`

### Other components

- **Company analyst**
- **NewsAPI**
- **OpenRouter model API**
- **Alpha Vantage**
- **Gmail SMTP**

## Connections

- Company analyst → Streamlit workflow: enters company (evidence: `app.py`)
- Streamlit workflow → News retrieval: fetches news (evidence: `app.py`)
- News retrieval → NewsAPI: requests articles (evidence: `fetchnews.py`)
- Streamlit workflow → AI opportunity analysis: analyzes articles (evidence: `app.py`)
- AI opportunity analysis → OpenRouter model API: requests analysis (evidence: `analyze_deepseek.py`)
- Streamlit workflow → Revenue data retrieval: fetches revenue (evidence: `app.py`)
- Revenue data retrieval → Alpha Vantage: requests statements (evidence: `financial_data.py`)
- Streamlit workflow → Revenue charts: creates graphs (evidence: `app.py`)
- Streamlit workflow → PDF report generation: builds report (evidence: `app.py`)
- Streamlit workflow → Email delivery: sends report (evidence: `app.py`)
- Email delivery → Gmail SMTP: sends message (evidence: `app.py`)
- Streamlit workflow → Company analyst: offers PDF download (evidence: `app.py`)
