# grsrse/wikipedia-market-insights architecture

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

- Interactive diagram: https://gitdiagram.com/grsrse/wikipedia-market-insights
- Repository: https://github.com/grsrse/wikipedia-market-insights

## Overview

This is a CLI-driven Wikipedia market-intelligence skill: a researcher or agent requests analysis, comparison, clustering, or benchmarking; the CLI resolves topics and retrieves pageviews, the statistical engine evaluates demand, and chart/PDF generators produce decision artifacts. A separate ambient radar scans watchlists, applies a restraint threshold, emits verified alerts, and records fatigue/alert state. Edges reflect the CLI and radar references in the sampled source index and excerpts; unsampled implementation details are not inferred.

Main entry points: [`scripts/ambient_radar.py`](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py) (Ambient radar), [`scripts/run.py`](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/run.py) (Command dispatcher), [`scripts/client.py`](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/client.py) (API client and cache), [`scripts/analyzer.py`](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/analyzer.py) (Time-series analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and orchestration"]
  node_cli["Command dispatcher<br/>[run.py]"]
end

subgraph group_data["Data acquisition"]
  node_client["API client and cache<br/>[client.py]"]
end

subgraph group_analysis["Market analysis"]
  node_analyzer["Time-series analysis<br/>[analyzer.py]"]
end

subgraph group_outputs["Decision artifacts"]
  node_visualizer["Market charts<br/>[visualizer.py]"]
  node_pdf["Executive PDF reports<br/>[report_pdf.py]"]
  node_verifier["Artifact quality gate<br/>[verify_memo.py]"]
end

subgraph group_radar["Ambient monitoring"]
  node_radar["Ambient radar<br/>[ambient_radar.py]"]
  node_restraint[("Restraint and fatigue state<br/>[ambient_radar.py]")]
  node_alerts["Alert records<br/>[ambient_radar.py]"]
end

node_researcher(("Researcher or agent"))
node_wikimedia["Wikimedia APIs"]

node_researcher -->|"invokes commands"| node_cli
node_cli -->|"resolves and fetches"| node_client
node_client -->|"queries APIs"| node_wikimedia
node_cli -->|"analyzes pageviews"| node_analyzer
node_cli -->|"generates charts"| node_visualizer
node_cli -->|"generates reports"| node_pdf
node_cli -->|"optionally verifies"| node_verifier
node_researcher -->|"starts scans"| node_radar
node_radar -->|"resolves and fetches"| node_client
node_radar -->|"scores demand"| node_analyzer
node_radar -->|"reads and updates"| node_restraint
node_radar -->|"generates alert charts"| node_visualizer
node_radar -->|"generates alert memos"| node_pdf
node_radar -->|"verifies artifacts"| node_verifier
node_radar -->|"writes alert records"| node_alerts

click node_cli "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/run.py"
click node_client "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/client.py"
click node_analyzer "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/analyzer.py"
click node_visualizer "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/visualizer.py"
click node_pdf "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/report_pdf.py"
click node_verifier "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/verify_memo.py"
click node_radar "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py"
click node_restraint "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py"
click node_alerts "https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.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_cli toneBlue
class node_client toneAmber
class node_analyzer,node_wikimedia toneMint
class node_visualizer,node_pdf,node_verifier toneRose
class node_radar,node_restraint,node_alerts,node_researcher toneIndigo
```

## Components

### Entry and orchestration

- [Command dispatcher](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/run.py): `scripts/run.py`

### Data acquisition

- [API client and cache](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/client.py): `scripts/client.py`

### Market analysis

- [Time-series analysis](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/analyzer.py): `scripts/analyzer.py`

### Decision artifacts

- [Market charts](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/visualizer.py): `scripts/visualizer.py`
- [Executive PDF reports](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/report_pdf.py): `scripts/report_pdf.py`
- [Artifact quality gate](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/verify_memo.py): `scripts/verify_memo.py`

### Ambient monitoring

- [Ambient radar](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py): `scripts/ambient_radar.py`
- [Restraint and fatigue state](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py): `scripts/ambient_radar.py`
- [Alert records](https://github.com/grsrse/wikipedia-market-insights/blob/main/scripts/ambient_radar.py): `scripts/ambient_radar.py`

### Other components

- **Researcher or agent**
- **Wikimedia APIs**

## Connections

- Researcher or agent → Command dispatcher: invokes commands (evidence: `README.md`)
- Command dispatcher → API client and cache: resolves and fetches (evidence: `scripts/run.py`)
- API client and cache → Wikimedia APIs: queries APIs (evidence: `scripts/client.py`)
- Command dispatcher → Time-series analysis: analyzes pageviews (evidence: `scripts/run.py`)
- Command dispatcher → Market charts: generates charts (evidence: `scripts/run.py`)
- Command dispatcher → Executive PDF reports: generates reports (evidence: `scripts/run.py`)
- Command dispatcher → Artifact quality gate: optionally verifies (evidence: `scripts/run.py`)
- Researcher or agent → Ambient radar: starts scans (evidence: `README.md`)
- Ambient radar → API client and cache: resolves and fetches (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Time-series analysis: scores demand (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Restraint and fatigue state: reads and updates (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Market charts: generates alert charts (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Executive PDF reports: generates alert memos (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Artifact quality gate: verifies artifacts (evidence: `scripts/ambient_radar.py`)
- Ambient radar → Alert records: writes alert records (evidence: `scripts/ambient_radar.py`)
