# piyushpnd/scientific-research-mapper architecture

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

- Interactive diagram: https://gitdiagram.com/piyushpnd/scientific-research-mapper
- Repository: https://github.com/piyushpnd/scientific-research-mapper

## Overview

Scientific Research Mapper turns uploaded CSV paper records into a searchable, interactive semantic topic map. The main workflow runs through CSV ingestion and validation, text preprocessing, sentence-transformer embeddings, clustering and map coordinates, then LDA topic generation; users can explore, search, edit, and delete stored papers. SQLite persists papers and derived stages. The graph preserves the documented discovery and paper-management capabilities; some frontend-to-API details and unsampled implementation links are based on README documentation rather than inspected calls.

Main entry points: [`backend/app/main.py`](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/main.py) (API Routes), [`backend/app/database.py`](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/database.py) (SQLite Database), [`backend/app/ingestion/service.py`](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/service.py) (CSV Ingestion), [`backend/app/clustering/service.py`](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/service.py) (Clustering And Map)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_frontend["Map Interface<br/>[App.tsx]"]
  node_api["API Routes<br/>[main.py]"]
end

subgraph group_ingest["Paper Intake"]
  node_ingestion["CSV Ingestion<br/>[service.py]"]
  node_csv_parser["CSV Parser<br/>[parser.py]"]
  node_record_validator["Record Validator<br/>[validator.py]"]
end

subgraph group_processing["Map Processing"]
  node_preprocessing["Text Preprocessing<br/>[service.py]"]
  node_text_cleaner["Text Cleaner<br/>[cleaner.py]"]
  node_embeddings["Embedding Service<br/>[service.py]"]
  node_embedding_model["Embedding Model<br/>[model.py]"]
  node_clustering["Clustering And Map<br/>[service.py]"]
  node_dimension_reducer["Dimension Reducer<br/>[reducer.py]"]
  node_cluster_algorithm["Cluster Algorithm<br/>[clusterer.py]"]
  node_topics["Topic Generation<br/>[service.py]"]
  node_lda_extractor["LDA Extractor<br/>[extractor.py]"]
  node_topic_labeller["Topic Labeller<br/>[labeller.py]"]
end

subgraph group_discovery["Discovery And Management"]
  node_discovery["Search And Relationships<br/>[service.py]"]
  node_search_ranker["Search Ranker<br/>[search.py]"]
  node_paper_management["Paper Management<br/>[papers.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("SQLite Database<br/>[database.py]")]
end

node_researcher(("Researcher"))
node_encoder{{"Sentence Encoder"}}

node_researcher -->|"explores"| node_frontend
node_frontend -->|"uses API"| node_api
node_api -->|"routes upload"| node_ingestion
node_api -->|"routes processing"| node_preprocessing
node_api -->|"routes embeddings"| node_embeddings
node_api -->|"routes clustering"| node_clustering
node_api -->|"routes topics"| node_topics
node_api -->|"routes discovery"| node_discovery
node_api -->|"routes paper edits"| node_paper_management
node_ingestion -->|"parses CSV"| node_csv_parser
node_ingestion -->|"validates records"| node_record_validator
node_ingestion -->|"stores papers"| node_database
node_preprocessing -->|"cleans text"| node_text_cleaner
node_preprocessing -->|"reads and writes"| node_database
node_embeddings -->|"generates vectors"| node_embedding_model
node_embedding_model -.->|"encodes text"| node_encoder
node_embeddings -->|"reads and writes"| node_database
node_clustering -->|"reduces dimensions"| node_dimension_reducer
node_clustering -->|"clusters papers"| node_cluster_algorithm
node_clustering -->|"reads and writes"| node_database
node_topics -->|"extracts topics"| node_lda_extractor
node_topics -->|"labels topics"| node_topic_labeller
node_topics -->|"reads and writes"| node_database
node_discovery -->|"ranks results"| node_search_ranker
node_discovery -->|"queries papers"| node_database
node_paper_management -->|"reads and updates"| node_database
node_paper_management -->|"validates updates"| node_record_validator

click node_frontend "https://github.com/piyushpnd/scientific-research-mapper/blob/main/frontend/src/App.tsx"
click node_api "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/main.py"
click node_ingestion "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/service.py"
click node_csv_parser "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/parser.py"
click node_record_validator "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/validator.py"
click node_preprocessing "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/preprocessing/service.py"
click node_text_cleaner "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/preprocessing/cleaner.py"
click node_embeddings "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/embeddings/service.py"
click node_embedding_model "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/embeddings/model.py"
click node_clustering "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/service.py"
click node_dimension_reducer "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/reducer.py"
click node_cluster_algorithm "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/clusterer.py"
click node_topics "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/service.py"
click node_lda_extractor "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/extractor.py"
click node_topic_labeller "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/labeller.py"
click node_discovery "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/discovery/service.py"
click node_search_ranker "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/discovery/search.py"
click node_paper_management "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/papers.py"
click node_database "https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/database.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_frontend,node_api toneBlue
class node_ingestion,node_csv_parser,node_record_validator toneAmber
class node_preprocessing,node_text_cleaner,node_embeddings,node_embedding_model,node_clustering,node_dimension_reducer,node_cluster_algorithm,node_topics,node_lda_extractor,node_topic_labeller toneMint
class node_discovery,node_search_ranker,node_paper_management toneRose
class node_database,node_researcher,node_encoder toneIndigo
```

## Components

### User Experience

- [Map Interface](https://github.com/piyushpnd/scientific-research-mapper/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Routes](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/main.py): `backend/app/main.py`

### Paper Intake

- [CSV Ingestion](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/service.py): `backend/app/ingestion/service.py`
- [CSV Parser](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/parser.py): `backend/app/ingestion/parser.py`
- [Record Validator](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/ingestion/validator.py): `backend/app/ingestion/validator.py`

### Map Processing

- [Text Preprocessing](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/preprocessing/service.py): `backend/app/preprocessing/service.py`
- [Text Cleaner](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/preprocessing/cleaner.py): `backend/app/preprocessing/cleaner.py`
- [Embedding Service](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/embeddings/service.py): `backend/app/embeddings/service.py`
- [Embedding Model](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/embeddings/model.py): `backend/app/embeddings/model.py`
- [Clustering And Map](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/service.py): `backend/app/clustering/service.py`
- [Dimension Reducer](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/reducer.py): `backend/app/clustering/reducer.py`
- [Cluster Algorithm](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/clustering/clusterer.py): `backend/app/clustering/clusterer.py`
- [Topic Generation](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/service.py): `backend/app/topics/service.py`
- [LDA Extractor](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/extractor.py): `backend/app/topics/extractor.py`
- [Topic Labeller](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/topics/labeller.py): `backend/app/topics/labeller.py`

### Discovery And Management

- [Search And Relationships](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/discovery/service.py): `backend/app/discovery/service.py`
- [Search Ranker](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/discovery/search.py): `backend/app/discovery/search.py`
- [Paper Management](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/papers.py): `backend/app/papers.py`

### Persistence

- [SQLite Database](https://github.com/piyushpnd/scientific-research-mapper/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **Researcher**
- **Sentence Encoder**

## Connections

- Researcher → Map Interface: explores
- Map Interface → API Routes: uses API
- API Routes → CSV Ingestion: routes upload (evidence: `backend/app/main.py`)
- API Routes → Text Preprocessing: routes processing (evidence: `backend/app/main.py`)
- API Routes → Embedding Service: routes embeddings (evidence: `backend/app/main.py`)
- API Routes → Clustering And Map: routes clustering (evidence: `backend/app/main.py`)
- API Routes → Topic Generation: routes topics (evidence: `backend/app/main.py`)
- API Routes → Search And Relationships: routes discovery (evidence: `backend/app/main.py`)
- API Routes → Paper Management: routes paper edits (evidence: `backend/app/main.py`)
- CSV Ingestion → CSV Parser: parses CSV (evidence: `backend/app/ingestion/service.py`)
- CSV Ingestion → Record Validator: validates records (evidence: `backend/app/ingestion/service.py`)
- CSV Ingestion → SQLite Database: stores papers (evidence: `backend/app/ingestion/service.py`)
- Text Preprocessing → Text Cleaner: cleans text (evidence: `backend/app/preprocessing/service.py`)
- Text Preprocessing → SQLite Database: reads and writes (evidence: `backend/app/preprocessing/service.py`)
- Embedding Service → Embedding Model: generates vectors (evidence: `backend/app/embeddings/service.py`)
- Embedding Model → Sentence Encoder: encodes text
- Embedding Service → SQLite Database: reads and writes (evidence: `backend/app/embeddings/service.py`)
- Clustering And Map → Dimension Reducer: reduces dimensions (evidence: `backend/app/clustering/service.py`)
- Clustering And Map → Cluster Algorithm: clusters papers (evidence: `backend/app/clustering/service.py`)
- Clustering And Map → SQLite Database: reads and writes (evidence: `backend/app/clustering/service.py`)
- Topic Generation → LDA Extractor: extracts topics (evidence: `backend/app/topics/service.py`)
- Topic Generation → Topic Labeller: labels topics (evidence: `backend/app/topics/service.py`)
- Topic Generation → SQLite Database: reads and writes (evidence: `backend/app/topics/service.py`)
- Search And Relationships → Search Ranker: ranks results (evidence: `backend/app/discovery/service.py`)
- Search And Relationships → SQLite Database: queries papers (evidence: `backend/app/discovery/service.py`)
- Paper Management → SQLite Database: reads and updates (evidence: `backend/app/papers.py`)
- Paper Management → Record Validator: validates updates (evidence: `backend/app/papers.py`)
