# shanksoff/sentimentdash architecture

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

- Interactive diagram: https://gitdiagram.com/shanksoff/sentimentdash
- Repository: https://github.com/shanksoff/sentimentdash

## Overview

This is a full-stack S&P 500 sentiment and market-analysis dashboard. Users select a ticker in the React dashboard, which requests market, sentiment, fundamentals and analytical results from FastAPI; the API reads PostgreSQL and invokes analytics or AI generation as needed, then the dashboard presents signals, charts and briefings. A separate scheduled workflow gathers news and market data, scores headlines and refreshes stored data. The README documents the major capabilities and high-level wiring; some backend implementation details were not sampled, so uncertain internal calls are omitted.

Main entry points: [`main.py`](https://github.com/shanksoff/sentimentdash/blob/main/main.py) (FastAPI endpoints), [`scheduler.py`](https://github.com/shanksoff/sentimentdash/blob/main/scheduler.py) (Daily scheduler), [`sentiment_engine.py`](https://github.com/shanksoff/sentimentdash/blob/main/sentiment_engine.py) (Headline scoring), [`frontend/src/components/Dashboard.jsx`](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/Dashboard.jsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_ticker_search["Ticker search<br/>[TickerSearch.jsx]"]
  node_analysis_views["Analysis panels<br/>[ForecastPanel.jsx]"]
  node_price_chart["Price and sentiment chart"]
  node_briefing_view["Briefing and Q&amp;A<br/>[AnalysisPanel.jsx]"]
end

subgraph group_api["API and analytics"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_analytics["Time-series analytics<br/>[analytics.py]"]
  node_briefing_engine["AI briefing generator<br/>[analysis_engine.py]"]
  node_db_access["DB connection pool<br/>[database.py]"]
end

subgraph group_ingest["Scheduled data"]
  node_scheduler["Daily scheduler<br/>[scheduler.py]"]
  node_news_fetch["RSS news fetch<br/>[fetch_news.py]"]
  node_market_fetch["Market data refresh"]
  node_sentiment["Headline scoring"]
end

subgraph group_storage["Persistence"]
  node_postgres[("PostgreSQL")]
end

node_investor(("Ticker user"))
node_rss["RSS feeds"]
node_yahoo["Yahoo Finance"]
node_gemini["Gemini AI"]

node_investor -->|"selects ticker"| node_ticker_search
node_ticker_search -->|"submits selection"| node_dashboard
node_dashboard -->|"requests data"| node_api
node_api -->|"opens connections"| node_db_access
node_db_access -->|"reads and writes"| node_postgres
node_api -->|"computes analysis"| node_analytics
node_api -->|"generates briefing"| node_briefing_engine
node_briefing_engine -->|"prompts model"| node_gemini
node_api -.->|"refreshes live data"| node_yahoo
node_api -->|"returns analytics"| node_analysis_views
node_api -->|"returns chart data"| node_price_chart
node_api -->|"returns briefing"| node_briefing_view
node_scheduler -->|"runs fetch"| node_news_fetch
node_news_fetch -->|"reads feeds"| node_rss
node_scheduler -->|"refreshes prices"| node_market_fetch
node_market_fetch -->|"fetches market data"| node_yahoo
node_scheduler -->|"runs scoring"| node_sentiment
node_sentiment -->|"reads articles; writes scores"| node_postgres
node_scheduler -->|"refreshes stored data"| node_postgres
node_sentiment -->|"scores headlines"| node_gemini

click node_dashboard "https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/Dashboard.jsx"
click node_ticker_search "https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/TickerSearch.jsx"
click node_analysis_views "https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/ForecastPanel.jsx"
click node_price_chart "https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/SentimentPriceChart.jsx"
click node_briefing_view "https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/AnalysisPanel.jsx"
click node_api "https://github.com/shanksoff/sentimentdash/blob/main/main.py"
click node_analytics "https://github.com/shanksoff/sentimentdash/blob/main/analytics.py"
click node_briefing_engine "https://github.com/shanksoff/sentimentdash/blob/main/analysis_engine.py"
click node_db_access "https://github.com/shanksoff/sentimentdash/blob/main/database.py"
click node_scheduler "https://github.com/shanksoff/sentimentdash/blob/main/scheduler.py"
click node_news_fetch "https://github.com/shanksoff/sentimentdash/blob/main/fetch_news.py"
click node_market_fetch "https://github.com/shanksoff/sentimentdash/blob/main/fetch_market_data.py"
click node_sentiment "https://github.com/shanksoff/sentimentdash/blob/main/sentiment_engine.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_dashboard,node_ticker_search,node_analysis_views,node_price_chart,node_briefing_view,node_investor toneBlue
class node_api,node_analytics,node_briefing_engine,node_db_access toneAmber
class node_scheduler,node_news_fetch,node_market_fetch,node_sentiment toneMint
class node_postgres toneRose
class node_rss,node_yahoo,node_gemini toneIndigo
```

## Components

### Dashboard

- [Dashboard](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [Ticker search](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/TickerSearch.jsx): `frontend/src/components/TickerSearch.jsx`
- [Analysis panels](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/ForecastPanel.jsx): `frontend/src/components/ForecastPanel.jsx`
- [Price and sentiment chart](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/SentimentPriceChart.jsx): `frontend/src/components/SentimentPriceChart.jsx`
- [Briefing and Q&A](https://github.com/shanksoff/sentimentdash/blob/main/frontend/src/components/AnalysisPanel.jsx): `frontend/src/components/AnalysisPanel.jsx`

### API and analytics

- [FastAPI endpoints](https://github.com/shanksoff/sentimentdash/blob/main/main.py): `main.py`
- [Time-series analytics](https://github.com/shanksoff/sentimentdash/blob/main/analytics.py): `analytics.py`
- [AI briefing generator](https://github.com/shanksoff/sentimentdash/blob/main/analysis_engine.py): `analysis_engine.py`
- [DB connection pool](https://github.com/shanksoff/sentimentdash/blob/main/database.py): `database.py`

### Scheduled data

- [Daily scheduler](https://github.com/shanksoff/sentimentdash/blob/main/scheduler.py): `scheduler.py`
- [RSS news fetch](https://github.com/shanksoff/sentimentdash/blob/main/fetch_news.py): `fetch_news.py`
- [Market data refresh](https://github.com/shanksoff/sentimentdash/blob/main/fetch_market_data.py): `fetch_market_data.py`
- [Headline scoring](https://github.com/shanksoff/sentimentdash/blob/main/sentiment_engine.py): `sentiment_engine.py`

### Persistence

- **PostgreSQL**

### Other components

- **Ticker user**
- **RSS feeds**
- **Yahoo Finance**
- **Gemini AI**

## Connections

- Ticker user → Ticker search: selects ticker
- Ticker search → Dashboard: submits selection
- Dashboard → FastAPI endpoints: requests data
- FastAPI endpoints → DB connection pool: opens connections
- DB connection pool → PostgreSQL: reads and writes
- FastAPI endpoints → Time-series analytics: computes analysis
- FastAPI endpoints → AI briefing generator: generates briefing
- AI briefing generator → Gemini AI: prompts model
- FastAPI endpoints → Yahoo Finance: refreshes live data
- FastAPI endpoints → Analysis panels: returns analytics
- FastAPI endpoints → Price and sentiment chart: returns chart data
- FastAPI endpoints → Briefing and Q&A: returns briefing
- Daily scheduler → RSS news fetch: runs fetch
- RSS news fetch → RSS feeds: reads feeds
- Daily scheduler → Market data refresh: refreshes prices
- Market data refresh → Yahoo Finance: fetches market data
- Daily scheduler → Headline scoring: runs scoring
- Headline scoring → PostgreSQL: reads articles; writes scores
- Daily scheduler → PostgreSQL: refreshes stored data
- Headline scoring → Gemini AI: scores headlines
