# njell85-spec/trend-review architecture

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

- Interactive diagram: https://gitdiagram.com/njell85-spec/trend-review
- Repository: https://github.com/njell85-spec/trend-review

## Overview

This repository implements a clinical-literature trend review system, with a daily automated run and a local command-line entry point. The main workflow collects PubMed papers, analyzes and validates candidates, and generates reports; a separate guideline catch-up track is also documented in the sampled agent and orchestrator code. The repository additionally contains review-queue, archive, notification, and video capabilities. The README is empty, and unsampled modules are represented only where the source index or tree supports their role; edges reflect shown imports, calls, or documented behavior.

Main entry points: [`src/orchestrator/TrendReviewOrchestrator.js`](https://github.com/njell85-spec/trend-review/blob/main/src/orchestrator/TrendReviewOrchestrator.js) (Review orchestrator), [`github-actions-daily.mjs`](https://github.com/njell85-spec/trend-review/blob/main/github-actions-daily.mjs) (Daily runner), [`src/agents/FilterAnalyzerAgent.js`](https://github.com/njell85-spec/trend-review/blob/main/src/agents/FilterAnalyzerAgent.js) (Paper analysis), [`src/utils/LLMClient.js`](https://github.com/njell85-spec/trend-review/blob/main/src/utils/LLMClient.js) (LLM client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Run entry points"]
  node_cli["CLI entry<br/>[index.js]"]
  node_daily["Daily runner"]
end

subgraph group_review["Review workflow"]
  node_orchestrator["Review orchestrator"]
  node_collector["Paper collection"]
  node_filter["Paper analysis"]
  node_fulltext["Full-text analysis<br/>[FullTextAgent.js]"]
  node_validation["Result validation<br/>[ValidationAgent.js]"]
end

subgraph group_guidelines["Guideline track"]
  node_guidelines["Guideline analysis"]
  node_guidelinefit["Guideline fit"]
  node_trackqueue[("Track queue<br/>[trackQueue.js]")]
  node_reviewqueue[("Review queue<br/>[reviewQueue.js]")]
end

subgraph group_support["Scoring and resilience"]
  node_scorer["Metadata scoring<br/>[MetadataScorer.js]"]
  node_llm["LLM client<br/>[LLMClient.js]"]
  node_cache["Cache<br/>[Cache.js]"]
  node_retry["Retry pipeline<br/>[retryPipeline.js]"]
end

subgraph group_outputs["Delivery and media"]
  node_report["Report generation"]
  node_publisher["Pages publishing<br/>[GitHubPublisher.js]"]
  node_archive["Archive handling<br/>[ArchiveAgent.js]"]
  node_notify["Notifications"]
  node_telegram["Telegram delivery"]
  node_video["Video generation<br/>[VideoAgent.js]"]
end

node_operator(("Operator"))
node_scheduler(("Daily scheduler"))
node_pubmed["PubMed"]

node_operator -->|"runs"| node_cli
node_cli -->|"starts"| node_orchestrator
node_scheduler -.->|"triggers"| node_daily
node_daily -->|"runs"| node_orchestrator
node_daily -->|"invokes"| node_telegram
node_daily -->|"invokes"| node_archive
node_daily -->|"invokes"| node_video
node_orchestrator -->|"dispatches"| node_collector
node_collector -->|"queries"| node_pubmed
node_orchestrator -->|"dispatches"| node_filter
node_orchestrator -->|"dispatches"| node_fulltext
node_orchestrator -->|"dispatches"| node_validation
node_filter -->|"scores with"| node_scorer
node_filter -->|"analyzes with"| node_llm
node_guidelines -->|"scores with"| node_scorer
node_guidelinefit -->|"analyzes with"| node_llm
node_orchestrator -->|"dispatches"| node_guidelines
node_orchestrator -->|"dispatches"| node_guidelinefit
node_orchestrator -->|"reads and writes"| node_trackqueue
node_reviewqueue -->|"merges queue"| node_trackqueue
node_orchestrator -->|"dispatches"| node_report
node_orchestrator -->|"publishes through"| node_publisher
node_orchestrator -->|"dispatches"| node_notify
node_llm -->|"checks limits with"| node_retry
node_orchestrator -.->|"uses"| node_cache
node_orchestrator -.->|"dispatches"| node_archive

click node_cli "https://github.com/njell85-spec/trend-review/blob/main/src/index.js"
click node_daily "https://github.com/njell85-spec/trend-review/blob/main/github-actions-daily.mjs"
click node_orchestrator "https://github.com/njell85-spec/trend-review/blob/main/src/orchestrator/TrendReviewOrchestrator.js"
click node_collector "https://github.com/njell85-spec/trend-review/blob/main/src/agents/DataCollectorAgent.js"
click node_filter "https://github.com/njell85-spec/trend-review/blob/main/src/agents/FilterAnalyzerAgent.js"
click node_fulltext "https://github.com/njell85-spec/trend-review/blob/main/src/agents/FullTextAgent.js"
click node_validation "https://github.com/njell85-spec/trend-review/blob/main/src/agents/ValidationAgent.js"
click node_scorer "https://github.com/njell85-spec/trend-review/blob/main/src/utils/MetadataScorer.js"
click node_llm "https://github.com/njell85-spec/trend-review/blob/main/src/utils/LLMClient.js"
click node_cache "https://github.com/njell85-spec/trend-review/blob/main/src/utils/Cache.js"
click node_retry "https://github.com/njell85-spec/trend-review/blob/main/src/utils/retryPipeline.js"
click node_guidelines "https://github.com/njell85-spec/trend-review/blob/main/src/agents/GuidelineAnalyzerAgent.js"
click node_guidelinefit "https://github.com/njell85-spec/trend-review/blob/main/src/agents/GuidelineFitAgent.js"
click node_trackqueue "https://github.com/njell85-spec/trend-review/blob/main/src/utils/trackQueue.js"
click node_reviewqueue "https://github.com/njell85-spec/trend-review/blob/main/src/utils/reviewQueue.js"
click node_report "https://github.com/njell85-spec/trend-review/blob/main/src/agents/ReportGeneratorAgent.js"
click node_publisher "https://github.com/njell85-spec/trend-review/blob/main/src/utils/GitHubPublisher.js"
click node_archive "https://github.com/njell85-spec/trend-review/blob/main/src/agents/ArchiveAgent.js"
click node_notify "https://github.com/njell85-spec/trend-review/blob/main/src/agents/NotificationAgent.js"
click node_telegram "https://github.com/njell85-spec/trend-review/blob/main/src/agents/TelegramNotifier.js"
click node_video "https://github.com/njell85-spec/trend-review/blob/main/src/agents/VideoAgent.js"

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_cli,node_daily toneBlue
class node_orchestrator,node_collector,node_filter,node_fulltext,node_validation toneAmber
class node_guidelines,node_guidelinefit,node_trackqueue,node_reviewqueue toneMint
class node_scorer,node_llm,node_cache,node_retry,node_scheduler toneRose
class node_report,node_publisher,node_archive,node_notify,node_telegram,node_video,node_operator,node_pubmed toneIndigo
```

## Components

### Run entry points

- [CLI entry](https://github.com/njell85-spec/trend-review/blob/main/src/index.js): `src/index.js`
- [Daily runner](https://github.com/njell85-spec/trend-review/blob/main/github-actions-daily.mjs): `github-actions-daily.mjs`

### Review workflow

- [Review orchestrator](https://github.com/njell85-spec/trend-review/blob/main/src/orchestrator/TrendReviewOrchestrator.js): `src/orchestrator/TrendReviewOrchestrator.js`
- [Paper collection](https://github.com/njell85-spec/trend-review/blob/main/src/agents/DataCollectorAgent.js): `src/agents/DataCollectorAgent.js`
- [Paper analysis](https://github.com/njell85-spec/trend-review/blob/main/src/agents/FilterAnalyzerAgent.js): `src/agents/FilterAnalyzerAgent.js`
- [Full-text analysis](https://github.com/njell85-spec/trend-review/blob/main/src/agents/FullTextAgent.js): `src/agents/FullTextAgent.js`
- [Result validation](https://github.com/njell85-spec/trend-review/blob/main/src/agents/ValidationAgent.js): `src/agents/ValidationAgent.js`

### Guideline track

- [Guideline analysis](https://github.com/njell85-spec/trend-review/blob/main/src/agents/GuidelineAnalyzerAgent.js): `src/agents/GuidelineAnalyzerAgent.js`
- [Guideline fit](https://github.com/njell85-spec/trend-review/blob/main/src/agents/GuidelineFitAgent.js): `src/agents/GuidelineFitAgent.js`
- [Track queue](https://github.com/njell85-spec/trend-review/blob/main/src/utils/trackQueue.js): `src/utils/trackQueue.js`
- [Review queue](https://github.com/njell85-spec/trend-review/blob/main/src/utils/reviewQueue.js): `src/utils/reviewQueue.js`

### Scoring and resilience

- [Metadata scoring](https://github.com/njell85-spec/trend-review/blob/main/src/utils/MetadataScorer.js): `src/utils/MetadataScorer.js`
- [LLM client](https://github.com/njell85-spec/trend-review/blob/main/src/utils/LLMClient.js): `src/utils/LLMClient.js`
- [Cache](https://github.com/njell85-spec/trend-review/blob/main/src/utils/Cache.js): `src/utils/Cache.js`
- [Retry pipeline](https://github.com/njell85-spec/trend-review/blob/main/src/utils/retryPipeline.js): `src/utils/retryPipeline.js`

### Delivery and media

- [Report generation](https://github.com/njell85-spec/trend-review/blob/main/src/agents/ReportGeneratorAgent.js): `src/agents/ReportGeneratorAgent.js`
- [Pages publishing](https://github.com/njell85-spec/trend-review/blob/main/src/utils/GitHubPublisher.js): `src/utils/GitHubPublisher.js`
- [Archive handling](https://github.com/njell85-spec/trend-review/blob/main/src/agents/ArchiveAgent.js): `src/agents/ArchiveAgent.js`
- [Notifications](https://github.com/njell85-spec/trend-review/blob/main/src/agents/NotificationAgent.js): `src/agents/NotificationAgent.js`
- [Telegram delivery](https://github.com/njell85-spec/trend-review/blob/main/src/agents/TelegramNotifier.js): `src/agents/TelegramNotifier.js`
- [Video generation](https://github.com/njell85-spec/trend-review/blob/main/src/agents/VideoAgent.js): `src/agents/VideoAgent.js`

### Other components

- **Operator**
- **Daily scheduler**
- **PubMed**

## Connections

- Operator → CLI entry: runs (evidence: `src/index.js`)
- CLI entry → Review orchestrator: starts (evidence: `src/index.js`)
- Daily scheduler → Daily runner: triggers
- Daily runner → Review orchestrator: runs (evidence: `github-actions-daily.mjs`)
- Daily runner → Telegram delivery: invokes (evidence: `github-actions-daily.mjs`)
- Daily runner → Archive handling: invokes (evidence: `github-actions-daily.mjs`)
- Daily runner → Video generation: invokes (evidence: `github-actions-daily.mjs`)
- Review orchestrator → Paper collection: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Paper collection → PubMed: queries (evidence: `src/agents/DataCollectorAgent.js`)
- Review orchestrator → Paper analysis: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Full-text analysis: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Result validation: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Paper analysis → Metadata scoring: scores with (evidence: `src/agents/FilterAnalyzerAgent.js`)
- Paper analysis → LLM client: analyzes with (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Guideline analysis → Metadata scoring: scores with (evidence: `src/agents/GuidelineAnalyzerAgent.js`)
- Guideline fit → LLM client: analyzes with (evidence: `src/agents/GuidelineFitAgent.js`)
- Review orchestrator → Guideline analysis: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Guideline fit: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Track queue: reads and writes (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review queue → Track queue: merges queue (evidence: `src/utils/reviewQueue.js`)
- Review orchestrator → Report generation: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Pages publishing: publishes through (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- Review orchestrator → Notifications: dispatches (evidence: `src/orchestrator/TrendReviewOrchestrator.js`)
- LLM client → Retry pipeline: checks limits with (evidence: `src/utils/LLMClient.js`)
- Review orchestrator → Cache: uses
- Review orchestrator → Archive handling: dispatches
