# 1suryansh1/rough_project architecture

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

- Interactive diagram: https://gitdiagram.com/1suryansh1/rough_project
- Repository: https://github.com/1suryansh1/rough_project

## Overview

Scientist Digital Twin builds a scientist-specific corpus and persona, then answers user questions with hybrid retrieval, session context, and one Gemini generation call; voice output is an optional branch. The graph preserves ingestion sources, chunking/indexing, profile extraction, retrieval, metadata and session memory, context assembly, generation, and voice preparation/synthesis. Edges follow the README’s phase description and the sampled runner/generation excerpts; unsampled component-level wiring is not asserted beyond those documented relationships.

Main entry points: [`scientist_digital_twin_ready/src/generation/generate.py`](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/generation/generate.py) (Generation handler), [`scientist_digital_twin_ready/src/processing/chunker.py`](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/chunker.py) (Section chunker), [`scientist_digital_twin_ready/src/retrieval/retrieval_engine.py`](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/retrieval/retrieval_engine.py) (Hybrid retrieval), [`scientist_digital_twin_ready/src/voice/synthesize.py`](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/synthesize.py) (Voice synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Corpus ingestion"]
  node_wikidata["Wikidata facts<br/>[fetch_wikidata.py]"]
  node_scholar["Paper fetcher"]
  node_supplementary["Supplementary sources"]
  node_wikipedia["Wikipedia fetcher<br/>[fetch_wikipedia.py]"]
  node_transcripts["Transcript fetcher"]
end

subgraph group_processing["Corpus and persona"]
  node_chunker["Section chunker<br/>[chunker.py]"]
  node_bm25[("BM25 index")]
  node_faiss[("FAISS index")]
  node_chunkstore[("Chunk store<br/>[chunk_store.py]")]
  node_profilebuild["Profile extraction"]
  node_profilemerge["Profile merge"]
end

subgraph group_conversation["Retrieval and memory"]
  node_metadata["Query metadata"]
  node_retrieval["Hybrid retrieval"]
  node_sessions[("Session store<br/>[session_store.py]")]
  node_compressor["Session memory"]
end

subgraph group_generation["Answer generation"]
  node_assembler["Context assembler"]
  node_generate["Generation handler<br/>[generate.py]"]
end

subgraph group_voice["Voice output"]
  node_voiceprep["Voice data preparation"]
  node_voicesetup["Fine-tune setup"]
  node_synthesis["Voice synthesis<br/>[synthesize.py]"]
end

node_user(("User"))
node_gemini{{"Gemini API"}}
node_response["Text response"]
node_audio["Spoken response"]

node_wikidata -->|"supplies source"| node_chunker
node_scholar -->|"supplies papers"| node_chunker
node_supplementary -->|"supplies sources"| node_chunker
node_wikipedia -->|"supplies article"| node_chunker
node_transcripts -->|"supplies transcripts"| node_chunker
node_chunker -->|"indexes chunks"| node_bm25
node_chunker -->|"indexes chunks"| node_faiss
node_chunker -->|"stores chunks"| node_chunkstore
node_chunker -.->|"extracts from corpus"| node_profilebuild
node_profilebuild -->|"merges profile"| node_profilemerge
node_user -->|"asks question"| node_generate
node_generate -->|"parses query"| node_metadata
node_generate -->|"requests evidence"| node_retrieval
node_generate -->|"loads history"| node_sessions
node_generate -->|"loads past context"| node_compressor
node_retrieval -->|"searches lexical index"| node_bm25
node_retrieval -->|"searches vector index"| node_faiss
node_retrieval -->|"reads chunks"| node_chunkstore
node_compressor -->|"reads and summarizes"| node_sessions
node_generate -->|"assembles context"| node_assembler
node_assembler -->|"returns prompt"| node_generate
node_generate -->|"generates answer"| node_gemini
node_gemini -->|"returns text"| node_response
node_generate -->|"saves turn"| node_sessions
node_generate -.->|"optionally synthesizes"| node_synthesis
node_response -->|"speaks text"| node_synthesis
node_voiceprep -->|"prepares dataset"| node_voicesetup
node_synthesis -->|"produces audio"| node_audio

click node_wikidata "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_wikidata.py"
click node_scholar "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_semantic_scholar.py"
click node_supplementary "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_supplementary.py"
click node_wikipedia "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_wikipedia.py"
click node_transcripts "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_youtube_transcripts.py"
click node_chunker "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/chunker.py"
click node_bm25 "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_bm25_index.py"
click node_faiss "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_faiss_index.py"
click node_chunkstore "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/chunk_store.py"
click node_profilebuild "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_scientist_profile.py"
click node_profilemerge "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/merge_scientist_profile.py"
click node_metadata "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/metadata_extractor.py"
click node_retrieval "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/retrieval/retrieval_engine.py"
click node_sessions "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/session_store.py"
click node_compressor "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/session_compressor.py"
click node_assembler "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/generation/context_assembler.py"
click node_generate "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/generation/generate.py"
click node_voiceprep "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/prepare_voice_data.py"
click node_voicesetup "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/setup_vibevoice_finetune.py"
click node_synthesis "https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/synthesize.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_wikidata,node_scholar,node_supplementary,node_wikipedia,node_transcripts,node_user toneBlue
class node_chunker,node_bm25,node_faiss,node_chunkstore,node_profilebuild,node_profilemerge toneAmber
class node_metadata,node_retrieval,node_sessions,node_compressor,node_gemini toneMint
class node_assembler,node_generate toneRose
class node_voiceprep,node_voicesetup,node_synthesis,node_response,node_audio toneIndigo
```

## Components

### Corpus ingestion

- [Wikidata facts](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_wikidata.py): `scientist_digital_twin_ready/src/ingestion/fetch_wikidata.py`
- [Paper fetcher](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_semantic_scholar.py): `scientist_digital_twin_ready/src/ingestion/fetch_semantic_scholar.py`
- [Supplementary sources](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_supplementary.py): `scientist_digital_twin_ready/src/ingestion/fetch_supplementary.py`
- [Wikipedia fetcher](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_wikipedia.py): `scientist_digital_twin_ready/src/ingestion/fetch_wikipedia.py`
- [Transcript fetcher](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/ingestion/fetch_youtube_transcripts.py): `scientist_digital_twin_ready/src/ingestion/fetch_youtube_transcripts.py`

### Corpus and persona

- [Section chunker](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/chunker.py): `scientist_digital_twin_ready/src/processing/chunker.py`
- [BM25 index](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_bm25_index.py): `scientist_digital_twin_ready/src/processing/build_bm25_index.py`
- [FAISS index](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_faiss_index.py): `scientist_digital_twin_ready/src/processing/build_faiss_index.py`
- [Chunk store](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/chunk_store.py): `scientist_digital_twin_ready/src/processing/chunk_store.py`
- [Profile extraction](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/build_scientist_profile.py): `scientist_digital_twin_ready/src/processing/build_scientist_profile.py`
- [Profile merge](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/processing/merge_scientist_profile.py): `scientist_digital_twin_ready/src/processing/merge_scientist_profile.py`

### Retrieval and memory

- [Query metadata](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/metadata_extractor.py): `scientist_digital_twin_ready/src/persistence/metadata_extractor.py`
- [Hybrid retrieval](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/retrieval/retrieval_engine.py): `scientist_digital_twin_ready/src/retrieval/retrieval_engine.py`
- [Session store](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/session_store.py): `scientist_digital_twin_ready/src/persistence/session_store.py`
- [Session memory](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/persistence/session_compressor.py): `scientist_digital_twin_ready/src/persistence/session_compressor.py`

### Answer generation

- [Context assembler](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/generation/context_assembler.py): `scientist_digital_twin_ready/src/generation/context_assembler.py`
- [Generation handler](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/generation/generate.py): `scientist_digital_twin_ready/src/generation/generate.py`

### Voice output

- [Voice data preparation](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/prepare_voice_data.py): `scientist_digital_twin_ready/src/voice/prepare_voice_data.py`
- [Fine-tune setup](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/setup_vibevoice_finetune.py): `scientist_digital_twin_ready/src/voice/setup_vibevoice_finetune.py`
- [Voice synthesis](https://github.com/1suryansh1/rough_project/blob/main/scientist_digital_twin_ready/src/voice/synthesize.py): `scientist_digital_twin_ready/src/voice/synthesize.py`

### Other components

- **User**
- **Gemini API**
- **Text response**
- **Spoken response**

## Connections

- Wikidata facts → Section chunker: supplies source (evidence: `README.md`)
- Paper fetcher → Section chunker: supplies papers (evidence: `README.md`)
- Supplementary sources → Section chunker: supplies sources (evidence: `README.md`)
- Wikipedia fetcher → Section chunker: supplies article (evidence: `README.md`)
- Transcript fetcher → Section chunker: supplies transcripts (evidence: `README.md`)
- Section chunker → BM25 index: indexes chunks (evidence: `README.md`)
- Section chunker → FAISS index: indexes chunks (evidence: `README.md`)
- Section chunker → Chunk store: stores chunks (evidence: `README.md`)
- Section chunker → Profile extraction: extracts from corpus (evidence: `README.md`)
- Profile extraction → Profile merge: merges profile (evidence: `README.md`)
- User → Generation handler: asks question (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Query metadata: parses query (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Hybrid retrieval: requests evidence (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Session store: loads history (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Session memory: loads past context (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Hybrid retrieval → BM25 index: searches lexical index (evidence: `scientist_digital_twin_ready/src/retrieval/retrieval_engine.py`)
- Hybrid retrieval → FAISS index: searches vector index (evidence: `scientist_digital_twin_ready/src/retrieval/retrieval_engine.py`)
- Hybrid retrieval → Chunk store: reads chunks (evidence: `scientist_digital_twin_ready/src/retrieval/retrieval_engine.py`)
- Session memory → Session store: reads and summarizes (evidence: `scientist_digital_twin_ready/src/persistence/session_compressor.py`)
- Generation handler → Context assembler: assembles context (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Context assembler → Generation handler: returns prompt (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Gemini API: generates answer (evidence: `README.md`)
- Gemini API → Text response: returns text (evidence: `README.md`)
- Generation handler → Session store: saves turn (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Generation handler → Voice synthesis: optionally synthesizes (evidence: `scientist_digital_twin_ready/src/generation/generate.py`)
- Text response → Voice synthesis: speaks text (evidence: `README.md`)
- Voice data preparation → Fine-tune setup: prepares dataset (evidence: `scientist_digital_twin_ready/src/voice/setup_vibevoice_finetune.py`)
- Voice synthesis → Spoken response: produces audio (evidence: `README.md`)
