# sami210105/scholar-press architecture

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

- Interactive diagram: https://gitdiagram.com/sami210105/scholar-press
- Repository: https://github.com/sami210105/scholar-press

## Overview

Scholar Press accepts research-paper PDFs, builds a session-specific searchable index, compares papers and extracts per-paper methodologies, then presents a report with comparison, flowchart, deep-dive and citation views. The graph follows the evidenced orchestration and UI relationships; some backend routes and unsampled subsystem internals are known only through the source index, so their detailed connections are omitted.

Main entry points: [`backend/report.py`](https://github.com/sami210105/scholar-press/blob/main/backend/report.py) (Session and report), [`frontend/src/pages/ReportPage.jsx`](https://github.com/sami210105/scholar-press/blob/main/frontend/src/pages/ReportPage.jsx) (Report view), [`backend/llm/extractor.py`](https://github.com/sami210105/scholar-press/blob/main/backend/llm/extractor.py) (Methodology extraction), [`frontend/src/components/CitationModal.jsx`](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/CitationModal.jsx) (Citation modal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_app["App shell<br/>[App.jsx]"]
  node_home["Upload workflow<br/>[HomePage.jsx]"]
  node_api["API client<br/>[client.js]"]
  node_report_view["Report view<br/>[ReportPage.jsx]"]
  node_paper_views["Paper views<br/>[PapersStrip.jsx]"]
  node_comparison_view["Comparison table"]
  node_agreement_view["Agreement section"]
  node_flowchart_view["Flowchart view<br/>[FlowchartView.jsx]"]
  node_deep_dive["Paper deep dive<br/>[PaperDeepDive.jsx]"]
  node_citation_modal["Citation modal<br/>[CitationModal.jsx]"]
end

subgraph group_workflow["Analysis orchestration"]
  node_api_server["Backend API<br/>[main.py]"]
  node_session_workflow["Session and report<br/>[report.py]"]
  node_session_store[("Session files")]
end

subgraph group_indexing["Paper indexing"]
  node_pdf_loader["PDF loading<br/>[loader.py]"]
  node_chunking["Text chunking<br/>[chunker.py]"]
  node_embedding["Chunk embeddings<br/>[embedder.py]"]
  node_retrieval["Semantic retrieval<br/>[retriever.py]"]
end

subgraph group_analysis["Research analysis"]
  node_comparison["Paper comparison<br/>[comparator.py]"]
  node_methodology["Methodology extraction<br/>[extractor.py]"]
  node_flowchart_generation["Flowchart generation<br/>[flowchart.py]"]
  node_prompting["Analysis prompts<br/>[prompts.py]"]
  node_criteria["Evaluation criteria<br/>[okf_loader.py]"]
end

node_user(("Researcher"))
node_ollama{{"Ollama service"}}

node_user -->|"uses"| node_app
node_app -->|"shows"| node_home
node_home -->|"requests"| node_api
node_api -->|"calls HTTP routes"| node_api_server
node_api_server -->|"delegates"| node_session_workflow
node_session_workflow -->|"writes and reads"| node_session_store
node_session_workflow -->|"loads PDFs"| node_pdf_loader
node_session_workflow -->|"chunks documents"| node_chunking
node_session_workflow -->|"embeds chunks"| node_embedding
node_session_workflow -->|"retrieves chunks"| node_retrieval
node_session_workflow -->|"compares papers"| node_comparison
node_session_workflow -->|"extracts methods"| node_methodology
node_session_workflow -->|"generates charts"| node_flowchart_generation
node_comparison -->|"uses retrieval"| node_retrieval
node_comparison -->|"uses prompts"| node_prompting
node_methodology -->|"builds prompt"| node_prompting
node_methodology -->|"sends chat request"| node_ollama
node_prompting -->|"loads criteria"| node_criteria
node_flowchart_generation -->|"uses extracted method"| node_methodology
node_api_server -.->|"returns report"| node_report_view
node_report_view -->|"renders"| node_paper_views
node_report_view -->|"renders"| node_comparison_view
node_report_view -->|"renders"| node_agreement_view
node_report_view -->|"renders"| node_flowchart_view
node_report_view -->|"opens"| node_deep_dive
node_agreement_view -->|"opens citations"| node_citation_modal
node_comparison_view -->|"opens citations"| node_citation_modal
node_deep_dive -->|"opens citations"| node_citation_modal
node_citation_modal -->|"fetches chunk"| node_api

click node_app "https://github.com/sami210105/scholar-press/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/sami210105/scholar-press/blob/main/frontend/src/pages/HomePage.jsx"
click node_api "https://github.com/sami210105/scholar-press/blob/main/frontend/src/api/client.js"
click node_api_server "https://github.com/sami210105/scholar-press/blob/main/backend/main.py"
click node_report_view "https://github.com/sami210105/scholar-press/blob/main/frontend/src/pages/ReportPage.jsx"
click node_paper_views "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/PapersStrip.jsx"
click node_comparison_view "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/ComparisonTable.jsx"
click node_agreement_view "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/AgreementSection.jsx"
click node_flowchart_view "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/FlowchartView.jsx"
click node_deep_dive "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/PaperDeepDive.jsx"
click node_citation_modal "https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/CitationModal.jsx"
click node_session_workflow "https://github.com/sami210105/scholar-press/blob/main/backend/report.py"
click node_session_store "https://github.com/sami210105/scholar-press/tree/main/backend/sessions"
click node_pdf_loader "https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/loader.py"
click node_chunking "https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/chunker.py"
click node_embedding "https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/embedder.py"
click node_retrieval "https://github.com/sami210105/scholar-press/blob/main/backend/retrieval/retriever.py"
click node_comparison "https://github.com/sami210105/scholar-press/blob/main/backend/llm/comparator.py"
click node_methodology "https://github.com/sami210105/scholar-press/blob/main/backend/llm/extractor.py"
click node_flowchart_generation "https://github.com/sami210105/scholar-press/blob/main/backend/llm/flowchart.py"
click node_prompting "https://github.com/sami210105/scholar-press/blob/main/backend/llm/prompts.py"
click node_criteria "https://github.com/sami210105/scholar-press/blob/main/backend/llm/okf_loader.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_app,node_home,node_api,node_report_view,node_paper_views,node_comparison_view,node_agreement_view,node_flowchart_view,node_deep_dive,node_citation_modal toneBlue
class node_api_server,node_session_workflow,node_session_store toneAmber
class node_pdf_loader,node_chunking,node_embedding,node_retrieval toneMint
class node_comparison,node_methodology,node_flowchart_generation,node_prompting,node_criteria toneRose
class node_user,node_ollama toneIndigo
```

## Components

### Web experience

- [App shell](https://github.com/sami210105/scholar-press/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Upload workflow](https://github.com/sami210105/scholar-press/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [API client](https://github.com/sami210105/scholar-press/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Report view](https://github.com/sami210105/scholar-press/blob/main/frontend/src/pages/ReportPage.jsx): `frontend/src/pages/ReportPage.jsx`
- [Paper views](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/PapersStrip.jsx): `frontend/src/components/PapersStrip.jsx`
- [Comparison table](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/ComparisonTable.jsx): `frontend/src/components/ComparisonTable.jsx`
- [Agreement section](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/AgreementSection.jsx): `frontend/src/components/AgreementSection.jsx`
- [Flowchart view](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/FlowchartView.jsx): `frontend/src/components/FlowchartView.jsx`
- [Paper deep dive](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/PaperDeepDive.jsx): `frontend/src/components/PaperDeepDive.jsx`
- [Citation modal](https://github.com/sami210105/scholar-press/blob/main/frontend/src/components/CitationModal.jsx): `frontend/src/components/CitationModal.jsx`

### Analysis orchestration

- [Backend API](https://github.com/sami210105/scholar-press/blob/main/backend/main.py): `backend/main.py`
- [Session and report](https://github.com/sami210105/scholar-press/blob/main/backend/report.py): `backend/report.py`
- [Session files](https://github.com/sami210105/scholar-press/tree/main/backend/sessions): `backend/sessions`

### Paper indexing

- [PDF loading](https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/loader.py): `backend/ingestion/loader.py`
- [Text chunking](https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/chunker.py): `backend/ingestion/chunker.py`
- [Chunk embeddings](https://github.com/sami210105/scholar-press/blob/main/backend/ingestion/embedder.py): `backend/ingestion/embedder.py`
- [Semantic retrieval](https://github.com/sami210105/scholar-press/blob/main/backend/retrieval/retriever.py): `backend/retrieval/retriever.py`

### Research analysis

- [Paper comparison](https://github.com/sami210105/scholar-press/blob/main/backend/llm/comparator.py): `backend/llm/comparator.py`
- [Methodology extraction](https://github.com/sami210105/scholar-press/blob/main/backend/llm/extractor.py): `backend/llm/extractor.py`
- [Flowchart generation](https://github.com/sami210105/scholar-press/blob/main/backend/llm/flowchart.py): `backend/llm/flowchart.py`
- [Analysis prompts](https://github.com/sami210105/scholar-press/blob/main/backend/llm/prompts.py): `backend/llm/prompts.py`
- [Evaluation criteria](https://github.com/sami210105/scholar-press/blob/main/backend/llm/okf_loader.py): `backend/llm/okf_loader.py`

### Other components

- **Researcher**
- **Ollama service**

## Connections

- Researcher → App shell: uses
- App shell → Upload workflow: shows (evidence: `frontend/src/App.jsx`)
- Upload workflow → API client: requests (evidence: `frontend/src/pages/HomePage.jsx`)
- API client → Backend API: calls HTTP routes (evidence: `frontend/src/api/client.js`)
- Backend API → Session and report: delegates (evidence: `backend/main.py`)
- Session and report → Session files: writes and reads (evidence: `backend/report.py`)
- Session and report → PDF loading: loads PDFs (evidence: `backend/report.py`)
- Session and report → Text chunking: chunks documents (evidence: `backend/report.py`)
- Session and report → Chunk embeddings: embeds chunks (evidence: `backend/report.py`)
- Session and report → Semantic retrieval: retrieves chunks (evidence: `backend/report.py`)
- Session and report → Paper comparison: compares papers (evidence: `backend/report.py`)
- Session and report → Methodology extraction: extracts methods (evidence: `backend/report.py`)
- Session and report → Flowchart generation: generates charts (evidence: `backend/report.py`)
- Paper comparison → Semantic retrieval: uses retrieval (evidence: `backend/llm/comparator.py`)
- Paper comparison → Analysis prompts: uses prompts (evidence: `backend/llm/comparator.py`)
- Methodology extraction → Analysis prompts: builds prompt (evidence: `backend/llm/extractor.py`)
- Methodology extraction → Ollama service: sends chat request (evidence: `backend/llm/extractor.py`)
- Analysis prompts → Evaluation criteria: loads criteria (evidence: `backend/llm/prompts.py`)
- Flowchart generation → Methodology extraction: uses extracted method (evidence: `backend/llm/flowchart.py`)
- Backend API → Report view: returns report
- Report view → Paper views: renders (evidence: `frontend/src/pages/ReportPage.jsx`)
- Report view → Comparison table: renders (evidence: `frontend/src/pages/ReportPage.jsx`)
- Report view → Agreement section: renders (evidence: `frontend/src/pages/ReportPage.jsx`)
- Report view → Flowchart view: renders (evidence: `frontend/src/pages/ReportPage.jsx`)
- Report view → Paper deep dive: opens (evidence: `frontend/src/pages/ReportPage.jsx`)
- Agreement section → Citation modal: opens citations (evidence: `frontend/src/components/AgreementSection.jsx`)
- Comparison table → Citation modal: opens citations (evidence: `frontend/src/components/ComparisonTable.jsx`)
- Paper deep dive → Citation modal: opens citations (evidence: `frontend/src/components/PaperDeepDive.jsx`)
- Citation modal → API client: fetches chunk (evidence: `frontend/src/components/CitationModal.jsx`)
