# anurag07-crypto/grasp architecture

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

- Interactive diagram: https://gitdiagram.com/anurag07-crypto/grasp
- Repository: https://github.com/anurag07-crypto/grasp

## Overview

This repository builds a Kubernetes learning knowledge graph from PDF corpora: documents are chunked, an LLM extracts concepts and prerequisite relationships, and a graph builder serializes those relationships. A separate embedding path generates concept vectors; a Chroma-backed storage helper is present, but the sampled code does not show it being wired into that path. The FastAPI entry point is empty, so no user-facing serving workflow is evidenced. The README is empty, and some source excerpts are incomplete.

Main entry points: [`backend/ingestion/extracter.py`](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/extracter.py) (Concept extractor), [`backend/ingestion/embedder.py`](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/embedder.py) (Concept embedding pipeline), [`data/extracted/extracted_chunks.json`](https://github.com/anurag07-crypto/grasp/blob/main/data/extracted/extracted_chunks.json) (Extracted concepts), [`backend/graph/builder.py`](https://github.com/anurag07-crypto/grasp/blob/main/backend/graph/builder.py) (Prerequisite graph builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Corpus ingestion"]
  node_pdf_corpus["PDF corpus"]
  node_chunker["PDF chunker<br/>[chunker.py]"]
  node_chunk_file["Text chunks<br/>[chunks.json]"]
end

subgraph group_knowledge["Knowledge modeling"]
  node_extracter["Concept extractor<br/>[extracter.py]"]
  node_prompt["Extraction prompt<br/>[prompt.py]"]
  node_extracted_file["Extracted concepts"]
  node_graph_builder["Prerequisite graph builder<br/>[builder.py]"]
end

subgraph group_embeddings["Concept embeddings"]
  node_chunk_embedder["Concept embedding pipeline<br/>[embedder.py]"]
  node_hf_embedder["Local embedding wrapper<br/>[embedder.py]"]
  node_embedding_file["Concept vectors"]
end

subgraph group_storage["Persistence"]
  node_graph_file["Serialized graph<br/>[graph.pkl]"]
  node_vector_store["Chroma store helper<br/>[store.py]"]
  node_chroma_db[("Persistent vector store")]
end

node_groq{{"Groq LLM"}}
node_sentence_transformer{{"SentenceTransformer model"}}

node_pdf_corpus -->|"loads PDFs"| node_chunker
node_chunker -->|"writes chunks"| node_chunk_file
node_extracter -->|"reads chunks"| node_chunk_file
node_extracter -->|"formats prompt"| node_prompt
node_extracter -->|"requests extraction"| node_groq
node_extracter -->|"writes concepts"| node_extracted_file
node_graph_builder -->|"reads concepts"| node_extracted_file
node_graph_builder -->|"serializes graph"| node_graph_file
node_chunk_embedder -->|"reads concepts"| node_extracted_file
node_chunk_embedder -->|"requests embeddings"| node_hf_embedder
node_hf_embedder -->|"encodes concepts"| node_sentence_transformer
node_chunk_embedder -->|"writes vectors"| node_embedding_file
node_vector_store -->|"initializes collection"| node_chroma_db

click node_pdf_corpus "https://github.com/anurag07-crypto/grasp/tree/main/corpora"
click node_chunker "https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/chunker.py"
click node_chunk_file "https://github.com/anurag07-crypto/grasp/blob/main/data/chunks/chunks.json"
click node_extracter "https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/extracter.py"
click node_prompt "https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/prompt.py"
click node_extracted_file "https://github.com/anurag07-crypto/grasp/blob/main/data/extracted/extracted_chunks.json"
click node_graph_builder "https://github.com/anurag07-crypto/grasp/blob/main/backend/graph/builder.py"
click node_graph_file "https://github.com/anurag07-crypto/grasp/blob/main/data/graph/graph.pkl"
click node_chunk_embedder "https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/embedder.py"
click node_hf_embedder "https://github.com/anurag07-crypto/grasp/blob/main/backend/vector/embedder.py"
click node_embedding_file "https://github.com/anurag07-crypto/grasp/blob/main/data/extracted/concept_embeddings.json"
click node_vector_store "https://github.com/anurag07-crypto/grasp/blob/main/backend/graph/store.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_pdf_corpus,node_chunker,node_chunk_file toneBlue
class node_extracter,node_prompt,node_extracted_file,node_graph_builder toneAmber
class node_chunk_embedder,node_hf_embedder,node_embedding_file toneMint
class node_graph_file,node_vector_store,node_chroma_db toneRose
class node_groq,node_sentence_transformer toneIndigo
```

## Components

### Corpus ingestion

- [PDF corpus](https://github.com/anurag07-crypto/grasp/tree/main/corpora): `corpora`
- [PDF chunker](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/chunker.py): `backend/ingestion/chunker.py`
- [Text chunks](https://github.com/anurag07-crypto/grasp/blob/main/data/chunks/chunks.json): `data/chunks/chunks.json`

### Knowledge modeling

- [Concept extractor](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/extracter.py): `backend/ingestion/extracter.py`
- [Extraction prompt](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/prompt.py): `backend/ingestion/prompt.py`
- [Extracted concepts](https://github.com/anurag07-crypto/grasp/blob/main/data/extracted/extracted_chunks.json): `data/extracted/extracted_chunks.json`
- [Prerequisite graph builder](https://github.com/anurag07-crypto/grasp/blob/main/backend/graph/builder.py): `backend/graph/builder.py`

### Concept embeddings

- [Concept embedding pipeline](https://github.com/anurag07-crypto/grasp/blob/main/backend/ingestion/embedder.py): `backend/ingestion/embedder.py`
- [Local embedding wrapper](https://github.com/anurag07-crypto/grasp/blob/main/backend/vector/embedder.py): `backend/vector/embedder.py`
- [Concept vectors](https://github.com/anurag07-crypto/grasp/blob/main/data/extracted/concept_embeddings.json): `data/extracted/concept_embeddings.json`

### Persistence

- [Serialized graph](https://github.com/anurag07-crypto/grasp/blob/main/data/graph/graph.pkl): `data/graph/graph.pkl`
- [Chroma store helper](https://github.com/anurag07-crypto/grasp/blob/main/backend/graph/store.py): `backend/graph/store.py`
- **Persistent vector store**

### Other components

- **Groq LLM**
- **SentenceTransformer model**

## Connections

- PDF corpus → PDF chunker: loads PDFs
- PDF chunker → Text chunks: writes chunks
- Concept extractor → Text chunks: reads chunks
- Concept extractor → Extraction prompt: formats prompt
- Concept extractor → Groq LLM: requests extraction
- Concept extractor → Extracted concepts: writes concepts
- Prerequisite graph builder → Extracted concepts: reads concepts
- Prerequisite graph builder → Serialized graph: serializes graph
- Concept embedding pipeline → Extracted concepts: reads concepts
- Concept embedding pipeline → Local embedding wrapper: requests embeddings
- Local embedding wrapper → SentenceTransformer model: encodes concepts
- Concept embedding pipeline → Concept vectors: writes vectors
- Chroma store helper → Persistent vector store: initializes collection
