# siddhigangan/final-year-project architecture

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

- Interactive diagram: https://gitdiagram.com/siddhigangan/final-year-project
- Repository: https://github.com/siddhigangan/final-year-project

## Overview

SecureCodeRAG is documented as a framework for benchmarking security risks in retrieval-augmented code generation and evaluating defenses. Its intended workflow runs from clean or poisoned code data through ingestion, chunking, embedding, storage, retrieval, defense, generation, and security evaluation. The README marks most of these capabilities as planned; package descriptions and the documented pipeline support the architecture below, but implementation-level calls cannot be confirmed from the sampled source. Configuration is included as an internal supporting layer.

Main entry points: [`src/generation`](https://github.com/siddhigangan/final-year-project/tree/main/src/generation) (Code Generation), [`src/defense`](https://github.com/siddhigangan/final-year-project/tree/main/src/defense) (Security Defense), [`src/ingestion`](https://github.com/siddhigangan/final-year-project/tree/main/src/ingestion) (Ingestion), [`src/vectorstore`](https://github.com/siddhigangan/final-year-project/tree/main/src/vectorstore) (Vector Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sources["Data Sources"]
  node_clean_data["Clean Data"]
  node_poisoned_data["Poisoned Data"]
end

subgraph group_rag["RAG Pipeline"]
  node_ingestion["Ingestion"]
  node_chunking["AST Chunking"]
  node_embeddings["Embeddings"]
  node_vectorstore[("Vector Store")]
  node_retrieval["Context Retrieval"]
  node_generation["Code Generation"]
end

subgraph group_security["Security Evaluation"]
  node_poisoning["Poisoning Attacks"]
  node_defense["Security Defense"]
  node_static_analysis["Static Analysis"]
  node_evaluation["Security Evaluation"]
  node_results["Evaluation Results"]
end

subgraph group_support["Configuration"]
  node_config["Pipeline Config<br/>[config.py]"]
end

node_code_llm["Code LLM"]

node_clean_data -->|"ingests"| node_ingestion
node_poisoned_data -->|"ingests"| node_ingestion
node_ingestion -->|"passes code"| node_chunking
node_chunking -->|"creates chunks"| node_embeddings
node_embeddings -->|"indexes vectors"| node_vectorstore
node_poisoning -->|"injects attacks"| node_vectorstore
node_retrieval -->|"queries"| node_vectorstore
node_retrieval -->|"passes context"| node_defense
node_defense -.->|"may invoke"| node_static_analysis
node_defense -->|"passes filtered context"| node_generation
node_generation -->|"requests generation"| node_code_llm
node_generation -->|"passes generated code"| node_evaluation
node_evaluation -->|"records metrics"| node_results

click node_clean_data "https://github.com/siddhigangan/final-year-project/tree/main/data/clean"
click node_poisoned_data "https://github.com/siddhigangan/final-year-project/tree/main/data/poisoned"
click node_ingestion "https://github.com/siddhigangan/final-year-project/tree/main/src/ingestion"
click node_chunking "https://github.com/siddhigangan/final-year-project/tree/main/src/chunking"
click node_embeddings "https://github.com/siddhigangan/final-year-project/tree/main/src/embeddings"
click node_vectorstore "https://github.com/siddhigangan/final-year-project/tree/main/src/vectorstore"
click node_retrieval "https://github.com/siddhigangan/final-year-project/tree/main/src/retrieval"
click node_generation "https://github.com/siddhigangan/final-year-project/tree/main/src/generation"
click node_poisoning "https://github.com/siddhigangan/final-year-project/tree/main/src/poisoning"
click node_defense "https://github.com/siddhigangan/final-year-project/tree/main/src/defense"
click node_evaluation "https://github.com/siddhigangan/final-year-project/tree/main/src/evaluation"
click node_results "https://github.com/siddhigangan/final-year-project/tree/main/results"
click node_config "https://github.com/siddhigangan/final-year-project/blob/main/src/config.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_clean_data,node_poisoned_data toneBlue
class node_ingestion,node_chunking,node_embeddings,node_vectorstore,node_retrieval,node_generation toneAmber
class node_poisoning,node_defense,node_static_analysis,node_evaluation,node_results toneMint
class node_config toneRose
class node_code_llm toneIndigo
```

## Components

### Data Sources

- [Clean Data](https://github.com/siddhigangan/final-year-project/tree/main/data/clean): `data/clean`
- [Poisoned Data](https://github.com/siddhigangan/final-year-project/tree/main/data/poisoned): `data/poisoned`

### RAG Pipeline

- [Ingestion](https://github.com/siddhigangan/final-year-project/tree/main/src/ingestion): `src/ingestion`
- [AST Chunking](https://github.com/siddhigangan/final-year-project/tree/main/src/chunking): `src/chunking`
- [Embeddings](https://github.com/siddhigangan/final-year-project/tree/main/src/embeddings): `src/embeddings`
- [Vector Store](https://github.com/siddhigangan/final-year-project/tree/main/src/vectorstore): `src/vectorstore`
- [Context Retrieval](https://github.com/siddhigangan/final-year-project/tree/main/src/retrieval): `src/retrieval`
- [Code Generation](https://github.com/siddhigangan/final-year-project/tree/main/src/generation): `src/generation`

### Security Evaluation

- [Poisoning Attacks](https://github.com/siddhigangan/final-year-project/tree/main/src/poisoning): `src/poisoning`
- [Security Defense](https://github.com/siddhigangan/final-year-project/tree/main/src/defense): `src/defense`
- **Static Analysis**
- [Security Evaluation](https://github.com/siddhigangan/final-year-project/tree/main/src/evaluation): `src/evaluation`
- [Evaluation Results](https://github.com/siddhigangan/final-year-project/tree/main/results): `results`

### Configuration

- [Pipeline Config](https://github.com/siddhigangan/final-year-project/blob/main/src/config.py): `src/config.py`

### Other components

- **Code LLM**

## Connections

- Clean Data → Ingestion: ingests
- Poisoned Data → Ingestion: ingests
- Ingestion → AST Chunking: passes code
- AST Chunking → Embeddings: creates chunks
- Embeddings → Vector Store: indexes vectors
- Poisoning Attacks → Vector Store: injects attacks
- Context Retrieval → Vector Store: queries
- Context Retrieval → Security Defense: passes context
- Security Defense → Static Analysis: may invoke
- Security Defense → Code Generation: passes filtered context
- Code Generation → Code LLM: requests generation
- Code Generation → Security Evaluation: passes generated code
- Security Evaluation → Evaluation Results: records metrics
