# aaravhmodi/news architecture

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

- Interactive diagram: https://gitdiagram.com/aaravhmodi/news
- Repository: https://github.com/aaravhmodi/news
- Video tour (about a minute): https://gitdiagram.com/aaravhmodi/news/video

## Overview

The Brief is a scheduled Canadian news digest: it gathers outlet coverage and public indicators, optionally enriches stories with AI, ranks and organizes them, then publishes a web brief and phone notifications. Readers can submit relevance votes that influence later ranking. The README documents archive, weekly and ongoing-story views, plus fallback behavior. The sampled source is partial, so internal call ownership and some persistence details cannot be verified; edges below use README-documented relationships.

Main entry points: [`news.py`](https://github.com/aaravhmodi/news/blob/main/news.py) (Scheduled server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection"]
  node_feeds["News feeds<br/>[news.py]"]
  node_trends["Google Trends<br/>[news.py]"]
  node_markets["Market indicators<br/>[news.py]"]
  node_public_stats["Public statistics<br/>[news.py]"]
end

subgraph group_analysis["Story analysis"]
  node_ai["AI briefing<br/>[news.py]"]
  node_ranking["Story ranking<br/>[news.py]"]
  node_sections["Brief sections<br/>[news.py]"]
end

subgraph group_state["Reader and history"]
  node_feedback[("Reader votes<br/>[news.py]")]
  node_threads[("Ongoing storylines<br/>[news.py]")]
  node_weekly[("This Week archive<br/>[news.py]")]
  node_past_briefs[("Past briefs<br/>[news.py]")]
end

subgraph group_delivery["Brief delivery"]
  node_site["Web brief<br/>[news.py]"]
  node_ntfy["Phone digest<br/>[news.py]"]
  node_server["Scheduled server<br/>[news.py]"]
end

node_reader(("Reader"))
node_outlets["News outlets"]
node_trends_service["Trends RSS"]
node_yahoo["Yahoo Finance"]
node_public_apis["BoC and Statistics Canada"]
node_openai["OpenAI"]
node_ntfy_service["ntfy"]

node_server -->|"refreshes from"| node_feeds
node_feeds -->|"fetches headlines"| node_outlets
node_server -->|"fetches trends"| node_trends
node_trends -->|"reads RSS"| node_trends_service
node_server -->|"fetches prices"| node_markets
node_markets -->|"reads chart API"| node_yahoo
node_server -->|"fetches indicators"| node_public_stats
node_public_stats -->|"reads data"| node_public_apis
node_server -.->|"requests enrichment"| node_ai
node_ai -.->|"calls model"| node_openai
node_server -->|"loads votes"| node_feedback
node_reader -->|"submits votes"| node_server
node_server -->|"ranks stories"| node_ranking
node_feedback -->|"adjusts scores"| node_ranking
node_server -->|"updates storylines"| node_threads
node_server -->|"stores weekly stories"| node_weekly
node_server -->|"archives each run"| node_past_briefs
node_ranking -->|"organizes stories"| node_sections
node_server -->|"writes brief"| node_site
node_sections -->|"renders tabs"| node_site
node_server -->|"sends digest"| node_ntfy
node_ntfy -->|"publishes notification"| node_ntfy_service
node_reader -->|"views brief"| node_site

click node_feeds "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_trends "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_markets "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_public_stats "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_ai "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_ranking "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_sections "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_feedback "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_threads "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_weekly "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_past_briefs "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_site "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_ntfy "https://github.com/aaravhmodi/news/blob/main/news.py"
click node_server "https://github.com/aaravhmodi/news/blob/main/news.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_feeds,node_trends,node_markets,node_public_stats toneBlue
class node_ai,node_ranking,node_sections toneAmber
class node_feedback,node_threads,node_weekly,node_past_briefs toneMint
class node_site,node_ntfy,node_server toneRose
class node_reader,node_outlets,node_trends_service,node_yahoo,node_public_apis,node_openai,node_ntfy_service toneIndigo
```

## Components

### Collection

- [News feeds](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Google Trends](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Market indicators](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Public statistics](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`

### Story analysis

- [AI briefing](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Story ranking](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Brief sections](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`

### Reader and history

- [Reader votes](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Ongoing storylines](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [This Week archive](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Past briefs](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`

### Brief delivery

- [Web brief](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Phone digest](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`
- [Scheduled server](https://github.com/aaravhmodi/news/blob/main/news.py): `news.py`

### Other components

- **Reader**
- **News outlets**
- **Trends RSS**
- **Yahoo Finance**
- **BoC and Statistics Canada**
- **OpenAI**
- **ntfy**

## Connections

- Scheduled server → News feeds: refreshes from (evidence: `README.md`)
- News feeds → News outlets: fetches headlines (evidence: `README.md`)
- Scheduled server → Google Trends: fetches trends (evidence: `README.md`)
- Google Trends → Trends RSS: reads RSS (evidence: `README.md`)
- Scheduled server → Market indicators: fetches prices (evidence: `README.md`)
- Market indicators → Yahoo Finance: reads chart API (evidence: `README.md`)
- Scheduled server → Public statistics: fetches indicators (evidence: `README.md`)
- Public statistics → BoC and Statistics Canada: reads data (evidence: `README.md`)
- Scheduled server → AI briefing: requests enrichment (evidence: `README.md`)
- AI briefing → OpenAI: calls model (evidence: `README.md`)
- Scheduled server → Reader votes: loads votes (evidence: `README.md`)
- Reader → Scheduled server: submits votes (evidence: `README.md`)
- Scheduled server → Story ranking: ranks stories (evidence: `README.md`)
- Reader votes → Story ranking: adjusts scores (evidence: `README.md`)
- Scheduled server → Ongoing storylines: updates storylines (evidence: `README.md`)
- Scheduled server → This Week archive: stores weekly stories (evidence: `README.md`)
- Scheduled server → Past briefs: archives each run (evidence: `README.md`)
- Story ranking → Brief sections: organizes stories (evidence: `README.md`)
- Scheduled server → Web brief: writes brief (evidence: `README.md`)
- Brief sections → Web brief: renders tabs (evidence: `README.md`)
- Scheduled server → Phone digest: sends digest (evidence: `README.md`)
- Phone digest → ntfy: publishes notification (evidence: `README.md`)
- Reader → Web brief: views brief (evidence: `README.md`)
