# nicolasbgt-cell/daily-digest architecture

> Architecture diagram of the GitHub repository nicolasbgt-cell/daily-digest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nicolasbgt-cell/daily-digest
- Repository: https://github.com/nicolasbgt-cell/daily-digest

## Overview

daily-digest is a personal news-digest demo and public archive. Its main workflow collects RSS articles, filters and groups them into readable topics, lets one reader select topics in Telegram, then writes and returns a French PDF while tracking API cost. JSON files connect the processing stages. The README also describes a public archive, but archive publishing is outside this repository’s production code; its link is therefore shown as unverified. Source excerpts do not expose every call, so documented relationships use README evidence.

Main entry points: [`redaction.py`](https://github.com/nicolasbgt-cell/daily-digest/blob/main/redaction.py) (Article writing and checks), [`bot.py`](https://github.com/nicolasbgt-cell/daily-digest/blob/main/bot.py) (Topic selection bot), [`regrouper.py`](https://github.com/nicolasbgt-cell/daily-digest/blob/main/regrouper.py) (Topic filtering and grouping), [`budget.py`](https://github.com/nicolasbgt-cell/daily-digest/blob/main/budget.py) (Cost accounting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Collection"]
  node_collector["Article collector<br/>[collecte.py]"]
  node_articles["Article JSON"]
end

subgraph group_editorial["Topic preparation"]
  node_grouping["Topic filtering and grouping<br/>[regrouper.py]"]
  node_topics["Topic JSON"]
  node_pagecheck["Readability checks<br/>[regrouper.py]"]
end

subgraph group_interaction["Reader workflow"]
  node_bot["Topic selection bot<br/>[bot.py]"]
end

subgraph group_publication["Edition and archive"]
  node_writer["Article writing and checks<br/>[redaction.py]"]
  node_pdf["A5 PDF edition<br/>[redaction.py]"]
  node_samples["Sample editions"]
  node_archive["Public topic archive<br/>[archive.md]"]
  node_archiver["Archive publishing"]
end

subgraph group_operations["Cost tracking"]
  node_budget["Cost accounting<br/>[budget.py]"]
  node_usage["Usage log"]
end

node_reader(("Reader"))
node_feeds{{"RSS sources"}}
node_telegram{{"Telegram"}}
node_sourcepages{{"Source pages"}}
node_anthropic{{"Anthropic API"}}

node_feeds -->|"provides feeds"| node_collector
node_collector -->|"writes articles"| node_articles
node_articles -->|"supplies articles"| node_grouping
node_grouping -->|"filters and groups"| node_anthropic
node_grouping -->|"checks readability"| node_pagecheck
node_pagecheck -->|"writes readable topics"| node_topics
node_topics -->|"loads topic list"| node_bot
node_reader -->|"selects topics"| node_telegram
node_telegram -->|"sends selections"| node_bot
node_bot -->|"invokes writing"| node_writer
node_writer -->|"fetches sources"| node_sourcepages
node_writer -->|"requests articles"| node_anthropic
node_writer -->|"lays out edition"| node_pdf
node_bot -->|"returns PDF"| node_telegram
node_pdf -.->|"shown as examples"| node_samples
node_reader -.->|"browses topics"| node_archive
node_archiver -.->|"publishes topics"| node_archive
node_grouping -->|"logs API usage"| node_budget
node_writer -->|"logs API usage"| node_budget
node_bot -->|"checks monthly cost"| node_budget
node_budget -->|"appends and totals"| node_usage

click node_collector "https://github.com/nicolasbgt-cell/daily-digest/blob/main/collecte.py"
click node_grouping "https://github.com/nicolasbgt-cell/daily-digest/blob/main/regrouper.py"
click node_pagecheck "https://github.com/nicolasbgt-cell/daily-digest/blob/main/regrouper.py"
click node_bot "https://github.com/nicolasbgt-cell/daily-digest/blob/main/bot.py"
click node_writer "https://github.com/nicolasbgt-cell/daily-digest/blob/main/redaction.py"
click node_pdf "https://github.com/nicolasbgt-cell/daily-digest/blob/main/redaction.py"
click node_samples "https://github.com/nicolasbgt-cell/daily-digest/blob/main/samples/edition-2026-10-08-evening-EN.pdf"
click node_archive "https://github.com/nicolasbgt-cell/daily-digest/blob/main/archive.md"
click node_budget "https://github.com/nicolasbgt-cell/daily-digest/blob/main/budget.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_collector,node_articles toneBlue
class node_grouping,node_topics,node_pagecheck toneAmber
class node_bot,node_anthropic toneMint
class node_writer,node_pdf,node_samples,node_archive,node_archiver toneRose
class node_budget,node_usage,node_reader,node_feeds,node_telegram,node_sourcepages toneIndigo
```

## Components

### Collection

- [Article collector](https://github.com/nicolasbgt-cell/daily-digest/blob/main/collecte.py): `collecte.py`
- **Article JSON**

### Topic preparation

- [Topic filtering and grouping](https://github.com/nicolasbgt-cell/daily-digest/blob/main/regrouper.py): `regrouper.py`
- **Topic JSON**
- [Readability checks](https://github.com/nicolasbgt-cell/daily-digest/blob/main/regrouper.py): `regrouper.py`

### Reader workflow

- [Topic selection bot](https://github.com/nicolasbgt-cell/daily-digest/blob/main/bot.py): `bot.py`

### Edition and archive

- [Article writing and checks](https://github.com/nicolasbgt-cell/daily-digest/blob/main/redaction.py): `redaction.py`
- [A5 PDF edition](https://github.com/nicolasbgt-cell/daily-digest/blob/main/redaction.py): `redaction.py`
- [Sample editions](https://github.com/nicolasbgt-cell/daily-digest/blob/main/samples/edition-2026-10-08-evening-EN.pdf): `samples/edition-2026-10-08-evening-EN.pdf`
- [Public topic archive](https://github.com/nicolasbgt-cell/daily-digest/blob/main/archive.md): `archive.md`
- **Archive publishing**

### Cost tracking

- [Cost accounting](https://github.com/nicolasbgt-cell/daily-digest/blob/main/budget.py): `budget.py`
- **Usage log**

### Other components

- **Reader**
- **RSS sources**
- **Telegram**
- **Source pages**
- **Anthropic API**

## Connections

- RSS sources → Article collector: provides feeds (evidence: `README.md`)
- Article collector → Article JSON: writes articles (evidence: `README.md`)
- Article JSON → Topic filtering and grouping: supplies articles (evidence: `README.md`)
- Topic filtering and grouping → Anthropic API: filters and groups (evidence: `README.md`)
- Topic filtering and grouping → Readability checks: checks readability (evidence: `regrouper.py`)
- Readability checks → Topic JSON: writes readable topics (evidence: `README.md`)
- Topic JSON → Topic selection bot: loads topic list (evidence: `README.md`)
- Reader → Telegram: selects topics (evidence: `README.md`)
- Telegram → Topic selection bot: sends selections (evidence: `README.md`)
- Topic selection bot → Article writing and checks: invokes writing (evidence: `bot.py`)
- Article writing and checks → Source pages: fetches sources (evidence: `README.md`)
- Article writing and checks → Anthropic API: requests articles (evidence: `README.md`)
- Article writing and checks → A5 PDF edition: lays out edition (evidence: `README.md`)
- Topic selection bot → Telegram: returns PDF (evidence: `bot.py`)
- A5 PDF edition → Sample editions: shown as examples (evidence: `README.md`)
- Reader → Public topic archive: browses topics (evidence: `README.md`)
- Archive publishing → Public topic archive: publishes topics
- Topic filtering and grouping → Cost accounting: logs API usage (evidence: `README.md`)
- Article writing and checks → Cost accounting: logs API usage (evidence: `README.md`)
- Topic selection bot → Cost accounting: checks monthly cost (evidence: `README.md`)
- Cost accounting → Usage log: appends and totals (evidence: `budget.py`)
