# nagahanuma/candidate-semantic-ranking-grading-system architecture

> Architecture diagram of the GitHub repository nagahanuma/candidate-semantic-ranking-grading-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nagahanuma/candidate-semantic-ranking-grading-system
- Repository: https://github.com/nagahanuma/candidate-semantic-ranking-grading-system

## Overview

This is a FastAPI candidate semantic-matching and grading API. Its main workflow is to ingest CSV/JSON candidate profiles into a local FAISS index, retrieve the top semantic matches for a job description, grade candidates concurrently with Groq, validate and sort evaluations, and return and export a shortlist. The graph includes documented embedding/indexing capabilities and the shared configuration and logging layer. Some vector-service internals were only partially excerpted; edges reflect the excerpts or README rather than assumed implementation details.

Main entry points: [`main.py`](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/main.py) (FastAPI endpoints), [`vector_service.py`](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py) (Profile loader), [`llm_service.py`](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/llm_service.py) (Candidate grading), [`config.py`](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/config.py) (Application settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API orchestration"]
  node_fastapi["FastAPI endpoints<br/>[main.py]"]
  node_request_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_indexing["Candidate indexing"]
  node_profile_loader["Profile loader<br/>[vector_service.py]"]
  node_profile_text["Profile synthesis<br/>[vector_service.py]"]
  node_embeddings["Text embeddings<br/>[vector_service.py]"]
  node_faiss_index[("FAISS index<br/>[vector_service.py]")]
end

subgraph group_ranking["Semantic ranking"]
  node_retrieval["Similarity retrieval<br/>[vector_service.py]"]
  node_llm_grading["Candidate grading<br/>[llm_service.py]"]
  node_evaluation_schema["Evaluation validation<br/>[schemas.py]"]
  node_shortlist_export["Ranked shortlist &amp; exports<br/>[main.py]"]
end

subgraph group_shared["Shared infrastructure"]
  node_configuration["Application settings<br/>[config.py]"]
  node_logging["JSON logging<br/>[logger.py]"]
end

node_recruiter(("Recruiter / API client"))
node_candidate_data["Candidate dataset"]
node_groq{{"Groq LLM"}}

node_recruiter -->|"submits requests"| node_fastapi
node_candidate_data -->|"provides ingestion path"| node_fastapi
node_fastapi -->|"validates payloads"| node_request_schemas
node_fastapi -->|"calls ingestion"| node_profile_loader
node_profile_loader -->|"synthesizes profiles"| node_profile_text
node_profile_loader -->|"builds and saves"| node_faiss_index
node_profile_text -->|"embeds profiles"| node_embeddings
node_embeddings -->|"indexes vectors"| node_faiss_index
node_fastapi -->|"requests matches"| node_retrieval
node_retrieval -->|"searches index"| node_faiss_index
node_fastapi -->|"dispatches evaluations"| node_llm_grading
node_llm_grading -->|"invokes model"| node_groq
node_llm_grading -->|"enforces output shape"| node_evaluation_schema
node_fastapi -->|"returns validated results"| node_evaluation_schema
node_fastapi -->|"sorts and exports"| node_shortlist_export
node_fastapi -->|"reads settings"| node_configuration
node_fastapi -->|"records events"| node_logging
node_llm_grading -->|"reads model settings"| node_configuration
node_llm_grading -->|"records inference"| node_logging
node_profile_loader -->|"reads index settings"| node_configuration
node_profile_loader -->|"records ingestion"| node_logging

click node_fastapi "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/main.py"
click node_request_schemas "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/schemas.py"
click node_profile_loader "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py"
click node_profile_text "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py"
click node_embeddings "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py"
click node_faiss_index "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py"
click node_retrieval "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py"
click node_llm_grading "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/llm_service.py"
click node_evaluation_schema "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/schemas.py"
click node_shortlist_export "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/main.py"
click node_configuration "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/config.py"
click node_logging "https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/logger.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_fastapi,node_request_schemas,node_recruiter toneBlue
class node_profile_loader,node_profile_text,node_embeddings,node_faiss_index toneAmber
class node_retrieval,node_llm_grading,node_evaluation_schema,node_shortlist_export toneMint
class node_configuration,node_logging toneRose
class node_candidate_data,node_groq toneIndigo
```

## Components

### API orchestration

- [FastAPI endpoints](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/main.py): `main.py`
- [API schemas](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/schemas.py): `schemas.py`

### Candidate indexing

- [Profile loader](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py): `vector_service.py`
- [Profile synthesis](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py): `vector_service.py`
- [Text embeddings](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py): `vector_service.py`
- [FAISS index](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py): `vector_service.py`

### Semantic ranking

- [Similarity retrieval](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/vector_service.py): `vector_service.py`
- [Candidate grading](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/llm_service.py): `llm_service.py`
- [Evaluation validation](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/schemas.py): `schemas.py`
- [Ranked shortlist & exports](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/main.py): `main.py`

### Shared infrastructure

- [Application settings](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/config.py): `config.py`
- [JSON logging](https://github.com/nagahanuma/candidate-semantic-ranking-grading-system/blob/main/logger.py): `logger.py`

### Other components

- **Recruiter / API client**
- **Candidate dataset**
- **Groq LLM**

## Connections

- Recruiter / API client → FastAPI endpoints: submits requests (evidence: `README.md`)
- Candidate dataset → FastAPI endpoints: provides ingestion path (evidence: `README.md`)
- FastAPI endpoints → API schemas: validates payloads (evidence: `main.py`)
- FastAPI endpoints → Profile loader: calls ingestion (evidence: `main.py`)
- Profile loader → Profile synthesis: synthesizes profiles (evidence: `vector_service.py`)
- Profile loader → FAISS index: builds and saves (evidence: `vector_service.py`)
- Profile synthesis → Text embeddings: embeds profiles (evidence: `README.md`)
- Text embeddings → FAISS index: indexes vectors (evidence: `README.md`)
- FastAPI endpoints → Similarity retrieval: requests matches (evidence: `main.py`)
- Similarity retrieval → FAISS index: searches index (evidence: `vector_service.py`)
- FastAPI endpoints → Candidate grading: dispatches evaluations (evidence: `main.py`)
- Candidate grading → Groq LLM: invokes model (evidence: `llm_service.py`)
- Candidate grading → Evaluation validation: enforces output shape (evidence: `llm_service.py`)
- FastAPI endpoints → Evaluation validation: returns validated results (evidence: `main.py`)
- FastAPI endpoints → Ranked shortlist & exports: sorts and exports (evidence: `main.py`)
- FastAPI endpoints → Application settings: reads settings (evidence: `main.py`)
- FastAPI endpoints → JSON logging: records events (evidence: `main.py`)
- Candidate grading → Application settings: reads model settings (evidence: `llm_service.py`)
- Candidate grading → JSON logging: records inference (evidence: `llm_service.py`)
- Profile loader → Application settings: reads index settings (evidence: `vector_service.py`)
- Profile loader → JSON logging: records ingestion (evidence: `vector_service.py`)
