# m2nwo079/tod architecture

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

- Interactive diagram: https://gitdiagram.com/m2nwo079/tod
- Repository: https://github.com/m2nwo079/tod

## Overview

This repository is a research pipeline for discovering technology opportunities in reinforcement-learning literature and testing whether LLM promise judgments track later diffusion. Its main workflow runs from OpenAlex corpus collection through graph construction, community/link prediction, and concept narration, then branches into dual-judge scoring and diffusion backtesting. Separate validation branches test judge agreement and hindsight leakage; the results feed comparison, DVF opportunity briefs, figures, and a bilingual report. The graph follows README-documented relationships; unsampled modules are represented only where their role is documented.

Main entry points: [`src/04_describe.py`](https://github.com/m2nwo079/tod/blob/main/src/04_describe.py) (Concept Narration), [`src/06_backtest.py`](https://github.com/m2nwo079/tod/blob/main/src/06_backtest.py) (Diffusion Backtest), [`results`](https://github.com/m2nwo079/tod/tree/main/results) (Result Files), [`src/05_judge_gemini.py`](https://github.com/m2nwo079/tod/blob/main/src/05_judge_gemini.py) (Gemini Judge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_corpus["Corpus and Graph"]
  node_collector["Collect Works<br/>[01_collect.py]"]
  node_tkg["Build TKG<br/>[02b_tkg_tfidf.py]"]
end

subgraph group_concepts["Concept Discovery"]
  node_communities["Themes and Links"]
  node_narration["Concept Narration<br/>[04_describe.py]"]
end

subgraph group_validation["Validation"]
  node_gemini_judge["Gemini Judge<br/>[05_judge_gemini.py]"]
  node_qwen_judge["Qwen Judge"]
  node_agreement["Judge Agreement"]
  node_backtest["Diffusion Backtest<br/>[06_backtest.py]"]
  node_leak_rewrite["Blind and Control"]
  node_blind_judge["Blind/Control Judge"]
  node_leak_compare["Leakage Comparison"]
end

subgraph group_outputs["Analysis and Outputs"]
  node_compare["Three-way Comparison<br/>[07_compare.py]"]
  node_dvf["DVF Briefs<br/>[08_brief_dvf.py]"]
  node_figures["Figures<br/>[09_make_figures.py]"]
  node_graph_preview["Graph Preview<br/>[preview_graph.py]"]
  node_report["Bilingual Report<br/>[index.html]"]
  node_results["Result Files"]
end

subgraph group_shared["Shared Settings"]
  node_config["Shared Configuration<br/>[config.py]"]
end

node_openalex(("OpenAlex"))
node_gemini{{"Gemini API"}}

node_openalex -->|"supplies works"| node_collector
node_collector -->|"corpus input"| node_tkg
node_tkg -->|"graph input"| node_communities
node_communities -->|"concept candidates"| node_narration
node_narration -->|"descriptions"| node_gemini_judge
node_narration -->|"descriptions"| node_qwen_judge
node_gemini_judge -->|"scores"| node_agreement
node_qwen_judge -->|"scores"| node_agreement
node_narration -->|"seed terms"| node_backtest
node_openalex -->|"diffusion counts"| node_backtest
node_narration -->|"descriptions"| node_leak_rewrite
node_leak_rewrite -->|"rewritten concepts"| node_blind_judge
node_gemini -->|"generates"| node_narration
node_gemini -->|"scores"| node_gemini_judge
node_gemini -->|"scores"| node_blind_judge
node_gemini -->|"generates and scores"| node_dvf
node_backtest -->|"diffusion baseline"| node_leak_compare
node_gemini_judge -->|"original scores"| node_leak_compare
node_blind_judge -->|"condition scores"| node_leak_compare
node_gemini_judge -->|"promise scores"| node_compare
node_qwen_judge -->|"promise scores"| node_compare
node_backtest -->|"diffusion results"| node_compare
node_backtest -->|"diffusion evidence"| node_dvf
node_narration -->|"concept descriptions"| node_dvf
node_compare -->|"writes comparison"| node_results
node_agreement -->|"writes agreement"| node_results
node_backtest -->|"writes diffusion"| node_results
node_leak_compare -->|"writes leakage results"| node_results
node_dvf -->|"writes briefs"| node_results
node_results -->|"loads plotted data"| node_figures
node_tkg -->|"loads graph"| node_graph_preview
node_results -->|"reports findings"| node_report
node_config -->|"configures paths"| node_collector
node_config -->|"configures paths"| node_tkg
node_config -->|"configures paths"| node_communities
node_config -->|"sets thresholds"| node_backtest

click node_collector "https://github.com/m2nwo079/tod/blob/main/src/01_collect.py"
click node_tkg "https://github.com/m2nwo079/tod/blob/main/src/02b_tkg_tfidf.py"
click node_communities "https://github.com/m2nwo079/tod/blob/main/src/03_community_linkpred.py"
click node_narration "https://github.com/m2nwo079/tod/blob/main/src/04_describe.py"
click node_gemini_judge "https://github.com/m2nwo079/tod/blob/main/src/05_judge_gemini.py"
click node_qwen_judge "https://github.com/m2nwo079/tod/blob/main/colab/05_judge_qwen.ipynb"
click node_agreement "https://github.com/m2nwo079/tod/blob/main/src/05b_judge_agreement.py"
click node_backtest "https://github.com/m2nwo079/tod/blob/main/src/06_backtest.py"
click node_leak_rewrite "https://github.com/m2nwo079/tod/blob/main/src/06b_blind_describe.py"
click node_blind_judge "https://github.com/m2nwo079/tod/blob/main/src/06c_judge_blind_gemini.py"
click node_leak_compare "https://github.com/m2nwo079/tod/blob/main/src/06d_leakage_compare.py"
click node_compare "https://github.com/m2nwo079/tod/blob/main/src/07_compare.py"
click node_dvf "https://github.com/m2nwo079/tod/blob/main/src/08_brief_dvf.py"
click node_figures "https://github.com/m2nwo079/tod/blob/main/src/09_make_figures.py"
click node_graph_preview "https://github.com/m2nwo079/tod/blob/main/src/preview_graph.py"
click node_report "https://github.com/m2nwo079/tod/blob/main/index.html"
click node_config "https://github.com/m2nwo079/tod/blob/main/config.py"
click node_results "https://github.com/m2nwo079/tod/tree/main/results"

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_tkg toneBlue
class node_communities,node_narration toneAmber
class node_gemini_judge,node_qwen_judge,node_agreement,node_backtest,node_leak_rewrite,node_blind_judge,node_leak_compare,node_gemini toneMint
class node_compare,node_dvf,node_figures,node_graph_preview,node_report,node_results toneRose
class node_config,node_openalex toneIndigo
```

## Components

### Corpus and Graph

- [Collect Works](https://github.com/m2nwo079/tod/blob/main/src/01_collect.py): `src/01_collect.py`
- [Build TKG](https://github.com/m2nwo079/tod/blob/main/src/02b_tkg_tfidf.py): `src/02b_tkg_tfidf.py`

### Concept Discovery

- [Themes and Links](https://github.com/m2nwo079/tod/blob/main/src/03_community_linkpred.py): `src/03_community_linkpred.py`
- [Concept Narration](https://github.com/m2nwo079/tod/blob/main/src/04_describe.py): `src/04_describe.py`

### Validation

- [Gemini Judge](https://github.com/m2nwo079/tod/blob/main/src/05_judge_gemini.py): `src/05_judge_gemini.py`
- [Qwen Judge](https://github.com/m2nwo079/tod/blob/main/colab/05_judge_qwen.ipynb): `colab/05_judge_qwen.ipynb`
- [Judge Agreement](https://github.com/m2nwo079/tod/blob/main/src/05b_judge_agreement.py): `src/05b_judge_agreement.py`
- [Diffusion Backtest](https://github.com/m2nwo079/tod/blob/main/src/06_backtest.py): `src/06_backtest.py`
- [Blind and Control](https://github.com/m2nwo079/tod/blob/main/src/06b_blind_describe.py): `src/06b_blind_describe.py`
- [Blind/Control Judge](https://github.com/m2nwo079/tod/blob/main/src/06c_judge_blind_gemini.py): `src/06c_judge_blind_gemini.py`
- [Leakage Comparison](https://github.com/m2nwo079/tod/blob/main/src/06d_leakage_compare.py): `src/06d_leakage_compare.py`

### Analysis and Outputs

- [Three-way Comparison](https://github.com/m2nwo079/tod/blob/main/src/07_compare.py): `src/07_compare.py`
- [DVF Briefs](https://github.com/m2nwo079/tod/blob/main/src/08_brief_dvf.py): `src/08_brief_dvf.py`
- [Figures](https://github.com/m2nwo079/tod/blob/main/src/09_make_figures.py): `src/09_make_figures.py`
- [Graph Preview](https://github.com/m2nwo079/tod/blob/main/src/preview_graph.py): `src/preview_graph.py`
- [Bilingual Report](https://github.com/m2nwo079/tod/blob/main/index.html): `index.html`
- [Result Files](https://github.com/m2nwo079/tod/tree/main/results): `results`

### Shared Settings

- [Shared Configuration](https://github.com/m2nwo079/tod/blob/main/config.py): `config.py`

### Other components

- **OpenAlex**
- **Gemini API**

## Connections

- OpenAlex → Collect Works: supplies works (evidence: `README.md`)
- Collect Works → Build TKG: corpus input (evidence: `README.md`)
- Build TKG → Themes and Links: graph input (evidence: `README.md`)
- Themes and Links → Concept Narration: concept candidates (evidence: `README.md`)
- Concept Narration → Gemini Judge: descriptions (evidence: `README.md`)
- Concept Narration → Qwen Judge: descriptions (evidence: `README.md`)
- Gemini Judge → Judge Agreement: scores (evidence: `README.md`)
- Qwen Judge → Judge Agreement: scores (evidence: `README.md`)
- Concept Narration → Diffusion Backtest: seed terms (evidence: `README.md`)
- OpenAlex → Diffusion Backtest: diffusion counts (evidence: `README.md`)
- Concept Narration → Blind and Control: descriptions (evidence: `README.md`)
- Blind and Control → Blind/Control Judge: rewritten concepts (evidence: `README.md`)
- Gemini API → Concept Narration: generates (evidence: `README.md`)
- Gemini API → Gemini Judge: scores (evidence: `README.md`)
- Gemini API → Blind/Control Judge: scores (evidence: `README.md`)
- Gemini API → DVF Briefs: generates and scores (evidence: `README.md`)
- Diffusion Backtest → Leakage Comparison: diffusion baseline (evidence: `README.md`)
- Gemini Judge → Leakage Comparison: original scores (evidence: `README.md`)
- Blind/Control Judge → Leakage Comparison: condition scores (evidence: `README.md`)
- Gemini Judge → Three-way Comparison: promise scores (evidence: `README.md`)
- Qwen Judge → Three-way Comparison: promise scores (evidence: `README.md`)
- Diffusion Backtest → Three-way Comparison: diffusion results (evidence: `README.md`)
- Diffusion Backtest → DVF Briefs: diffusion evidence (evidence: `README.md`)
- Concept Narration → DVF Briefs: concept descriptions (evidence: `src/08_brief_dvf.py`)
- Three-way Comparison → Result Files: writes comparison (evidence: `README.md`)
- Judge Agreement → Result Files: writes agreement (evidence: `README.md`)
- Diffusion Backtest → Result Files: writes diffusion (evidence: `README.md`)
- Leakage Comparison → Result Files: writes leakage results (evidence: `README.md`)
- DVF Briefs → Result Files: writes briefs (evidence: `README.md`)
- Result Files → Figures: loads plotted data (evidence: `src/09_make_figures.py`)
- Build TKG → Graph Preview: loads graph (evidence: `src/preview_graph.py`)
- Result Files → Bilingual Report: reports findings (evidence: `README.md`)
- Shared Configuration → Collect Works: configures paths (evidence: `src/01_collect.py`)
- Shared Configuration → Build TKG: configures paths (evidence: `src/02b_tkg_tfidf.py`)
- Shared Configuration → Themes and Links: configures paths (evidence: `src/03_community_linkpred.py`)
- Shared Configuration → Diffusion Backtest: sets thresholds (evidence: `src/06_backtest.py`)
