# meenish/innoblock-ps6-sentiment-ledger architecture

> Architecture diagram of the GitHub repository meenish/innoblock-ps6-sentiment-ledger, 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/meenish/innoblock-ps6-sentiment-ledger
- Repository: https://github.com/meenish/innoblock-ps6-sentiment-ledger

## Overview

Sentiment Ledger collects crypto headlines, scores and aggregates token sentiment, stores the detailed analysis off-chain, and publishes tamper-evident summaries to Ethereum Sepolia. The dashboard reads scores and history directly from the contract, then requests headlines and analysis details from the backend; it can also trigger agent runs and verify an analysis against its on-chain hash. The graph preserves the documented sample-data/backfill and AI-fallback capabilities. Some storage and aggregation internals were not sampled, so their connections are shown only where the README or source index supports them.

Main entry points: [`backend/api.py`](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/api.py) (HTTP API), [`backend/agent.py`](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/agent.py) (Agent orchestration), [`frontend/app.js`](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/frontend/app.js) (Dashboard and verification), [`backend/chain.py`](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/chain.py) (Chain adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Agent backend"]
  node_app["Flask entry point<br/>[app.py]"]
  node_api["HTTP API<br/>[api.py]"]
  node_agent["Agent orchestration<br/>[agent.py]"]
  node_news["Headline collection<br/>[news.py]"]
  node_scorer["Sentiment scoring<br/>[scorer.py]"]
  node_aggregate["Signal aggregation<br/>[aggregate.py]"]
  node_db[("Analysis database<br/>[db.py]")]
  node_config["Backend settings<br/>[config.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Dashboard and verification<br/>[app.js]"]
  node_frontend_config["Dashboard settings<br/>[config.js]"]
end

subgraph group_chain["On-chain ledger"]
  node_chain_adapter["Chain adapter<br/>[chain.py]"]
  node_registry[("Sentiment registry")]
end

subgraph group_integrations["Data and services"]
  node_rss["RSS feeds"]
  node_sample["Sample headlines"]
  node_ai_service{{"AI scoring service"}}
  node_ethereum{{"Sepolia RPC"}}
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_dashboard_app
node_app -->|"creates app"| node_api
node_dashboard_app -->|"reads settings"| node_frontend_config
node_dashboard_app -->|"reads history"| node_registry
node_dashboard_app -->|"requests details"| node_api
node_dashboard_app -->|"starts runs"| node_api
node_api -->|"runs agent"| node_agent
node_api -->|"checks chain"| node_chain_adapter
node_api -->|"queries records"| node_db
node_api -->|"reads settings"| node_config
node_agent -->|"collects headlines"| node_news
node_agent -->|"scores headlines"| node_scorer
node_agent -->|"builds signals"| node_aggregate
node_agent -->|"stores analysis"| node_db
node_agent -->|"publishes signals"| node_chain_adapter
node_rss -.->|"provides headlines"| node_news
node_sample -->|"provides headlines"| node_news
node_scorer -->|"requests scores"| node_ai_service
node_chain_adapter -->|"publishes and reads"| node_registry
node_chain_adapter -->|"uses RPC"| node_ethereum

click node_app "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/app.py"
click node_api "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/api.py"
click node_agent "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/agent.py"
click node_news "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/news.py"
click node_scorer "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/scorer.py"
click node_aggregate "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/aggregate.py"
click node_db "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/db.py"
click node_config "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/config.py"
click node_dashboard_app "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/frontend/app.js"
click node_frontend_config "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/frontend/config.js"
click node_chain_adapter "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/chain.py"
click node_registry "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/contracts/SentimentRegistry.sol"
click node_sample "https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/data/sample_headlines.json"

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,node_api,node_agent,node_news,node_scorer,node_aggregate,node_db,node_config,node_user toneBlue
class node_dashboard_app,node_frontend_config toneAmber
class node_chain_adapter,node_registry toneMint
class node_rss,node_sample,node_ai_service,node_ethereum toneRose
```

## Components

### Agent backend

- [Flask entry point](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/app.py): `backend/app.py`
- [HTTP API](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/api.py): `backend/api.py`
- [Agent orchestration](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/agent.py): `backend/agent.py`
- [Headline collection](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/news.py): `backend/news.py`
- [Sentiment scoring](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/scorer.py): `backend/scorer.py`
- [Signal aggregation](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/aggregate.py): `backend/aggregate.py`
- [Analysis database](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/db.py): `backend/db.py`
- [Backend settings](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/config.py): `backend/config.py`

### Dashboard

- [Dashboard and verification](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/frontend/app.js): `frontend/app.js`
- [Dashboard settings](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/frontend/config.js): `frontend/config.js`

### On-chain ledger

- [Chain adapter](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/chain.py): `backend/chain.py`
- [Sentiment registry](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/contracts/SentimentRegistry.sol): `contracts/SentimentRegistry.sol`

### Data and services

- **RSS feeds**
- [Sample headlines](https://github.com/meenish/innoblock-ps6-sentiment-ledger/blob/main/backend/data/sample_headlines.json): `backend/data/sample_headlines.json`
- **AI scoring service**
- **Sepolia RPC**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard and verification: uses (evidence: `README.md`)
- Flask entry point → HTTP API: creates app (evidence: `backend/app.py`)
- Dashboard and verification → Dashboard settings: reads settings (evidence: `frontend/app.js`)
- Dashboard and verification → Sentiment registry: reads history (evidence: `frontend/app.js`)
- Dashboard and verification → HTTP API: requests details (evidence: `frontend/app.js`)
- Dashboard and verification → HTTP API: starts runs (evidence: `README.md`)
- HTTP API → Agent orchestration: runs agent (evidence: `backend/api.py`)
- HTTP API → Chain adapter: checks chain (evidence: `backend/api.py`)
- HTTP API → Analysis database: queries records (evidence: `backend/api.py`)
- HTTP API → Backend settings: reads settings (evidence: `backend/api.py`)
- Agent orchestration → Headline collection: collects headlines (evidence: `backend/agent.py`)
- Agent orchestration → Sentiment scoring: scores headlines (evidence: `backend/agent.py`)
- Agent orchestration → Signal aggregation: builds signals (evidence: `backend/agent.py`)
- Agent orchestration → Analysis database: stores analysis (evidence: `backend/agent.py`)
- Agent orchestration → Chain adapter: publishes signals (evidence: `backend/agent.py`)
- RSS feeds → Headline collection: provides headlines (evidence: `README.md`)
- Sample headlines → Headline collection: provides headlines (evidence: `README.md`)
- Sentiment scoring → AI scoring service: requests scores (evidence: `backend/scorer.py`)
- Chain adapter → Sentiment registry: publishes and reads (evidence: `backend/chain.py`)
- Chain adapter → Sepolia RPC: uses RPC (evidence: `backend/chain.py`)
