# sivameghana7/codecraze architecture

> Architecture diagram of the GitHub repository sivameghana7/codecraze, 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/sivameghana7/codecraze
- Repository: https://github.com/sivameghana7/codecraze

## Overview

Smart Campus Intelligence is a role-based student analytics platform. Administrators and faculty review institutional or cohort risk; students explore their own scores, attendance health, explanations, and placement readiness. The backend computes success metrics, predicts risk, segments behavioral personas, explains model outputs, and supports what-if simulation and intervention workflows. The README documents additional data-management and student-facing capabilities. Several endpoint implementations and frontend API calls were not sampled, so those links are shown as unverified rather than asserted as direct calls.

Main entry points: [`backend/app/main.py`](https://github.com/sivameghana7/codecraze/blob/main/backend/app/main.py) (FastAPI Router), [`backend/app/services/simulation_engine.py`](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/simulation_engine.py) (What-If Simulation), [`backend/app/services/data_integration_service.py`](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/data_integration_service.py) (Data Integration), [`backend/app/api/auth.py`](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/auth.py) (Auth Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_users["Role Surfaces"]
  node_admin["Admin Console<br/>[page.tsx]"]
  node_faculty["Faculty Console<br/>[page.tsx]"]
  node_studentui["Student Portal"]
  node_login["Login Surface<br/>[page.tsx]"]
  node_frontendclient["API Client<br/>[client.ts]"]
end

subgraph group_api["API and Identity"]
  node_apiapp["FastAPI Router<br/>[main.py]"]
  node_authroutes["Auth Routes<br/>[auth.py]"]
  node_authservice["Authentication<br/>[auth_service.py]"]
  node_security["Token Security<br/>[security.py]"]
  node_adminroutes["Admin Routes<br/>[admin.py]"]
  node_facultyroutes["Faculty Routes<br/>[faculty.py]"]
  node_studentroutes["Student Routes<br/>[student.py]"]
end

subgraph group_analytics["Student Analytics"]
  node_scoring["Success Scoring<br/>[scoring_engine.py]"]
  node_risk["Risk Prediction<br/>[ml_service.py]"]
  node_personas["Persona Clustering"]
  node_explain["Risk Explanations"]
  node_simulation["What-If Simulation"]
  node_integration["Data Integration"]
  node_xairoutes["XAI Routes<br/>[xai.py]"]
  node_simroutes["Simulation Routes<br/>[simulator.py]"]
end

subgraph group_operations["Intervention Operations"]
  node_interventionroutes["Intervention Routes<br/>[interventions.py]"]
  node_interventionsui["Intervention Console<br/>[page.tsx]"]
end

subgraph group_data["Persistence"]
  node_store[("Relational Store<br/>[database.py]")]
  node_studentmodel["Student Records<br/>[student.py]"]
  node_indicators["Academic and Placement Indicators<br/>[indicators.py]"]
end

node_login -.->|"authenticates through"| node_authroutes
node_frontendclient -.->|"sends API requests"| node_apiapp
node_apiapp -->|"mounts routes"| node_authroutes
node_apiapp -->|"mounts routes"| node_adminroutes
node_apiapp -->|"mounts routes"| node_facultyroutes
node_apiapp -->|"mounts routes"| node_studentroutes
node_authroutes -->|"authenticates with"| node_authservice
node_authservice -->|"uses token security"| node_security
node_admin -.->|"uses API"| node_adminroutes
node_faculty -.->|"uses API"| node_facultyroutes
node_studentui -.->|"uses API"| node_studentroutes
node_xairoutes -.->|"requests explanations"| node_explain
node_explain -->|"explains model outputs"| node_risk
node_simroutes -.->|"dispatches simulation"| node_simulation
node_simulation -->|"computes scores with"| node_scoring
node_simulation -->|"predicts risk with"| node_risk
node_simulation -->|"segments with"| node_personas
node_adminroutes -.->|"uses data integration"| node_integration
node_integration -->|"computes metrics with"| node_scoring
node_integration -->|"predicts risk with"| node_risk
node_integration -->|"segments with"| node_personas
node_interventionsui -.->|"manages interventions"| node_interventionroutes
node_store -->|"provides ORM base"| node_studentmodel
node_store -->|"provides ORM base"| node_indicators

click node_admin "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/admin/page.tsx"
click node_faculty "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/faculty/page.tsx"
click node_studentui "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/modules/student/StudentProfileView.tsx"
click node_login "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/login/page.tsx"
click node_frontendclient "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/lib/api/client.ts"
click node_apiapp "https://github.com/sivameghana7/codecraze/blob/main/backend/app/main.py"
click node_authroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/auth.py"
click node_authservice "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/auth_service.py"
click node_security "https://github.com/sivameghana7/codecraze/blob/main/backend/app/core/security.py"
click node_adminroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/admin.py"
click node_facultyroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/faculty.py"
click node_studentroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/student.py"
click node_scoring "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/scoring_engine.py"
click node_risk "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/ml_service.py"
click node_personas "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/clustering_engine.py"
click node_explain "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/explainability_engine.py"
click node_simulation "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/simulation_engine.py"
click node_integration "https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/data_integration_service.py"
click node_xairoutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/xai.py"
click node_simroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/simulator.py"
click node_interventionroutes "https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/interventions.py"
click node_interventionsui "https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/interventions/page.tsx"
click node_store "https://github.com/sivameghana7/codecraze/blob/main/backend/app/core/database.py"
click node_studentmodel "https://github.com/sivameghana7/codecraze/blob/main/backend/app/models/student.py"
click node_indicators "https://github.com/sivameghana7/codecraze/blob/main/backend/app/models/indicators.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_admin,node_faculty,node_studentui,node_login,node_frontendclient toneBlue
class node_apiapp,node_authroutes,node_authservice,node_security,node_adminroutes,node_facultyroutes,node_studentroutes toneAmber
class node_scoring,node_risk,node_personas,node_explain,node_simulation,node_integration,node_xairoutes,node_simroutes toneMint
class node_interventionroutes,node_interventionsui toneRose
class node_store,node_studentmodel,node_indicators toneIndigo
```

## Components

### Role Surfaces

- [Admin Console](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/admin/page.tsx): `frontend/src/app/admin/page.tsx`
- [Faculty Console](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/faculty/page.tsx): `frontend/src/app/faculty/page.tsx`
- [Student Portal](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/modules/student/StudentProfileView.tsx): `frontend/src/modules/student/StudentProfileView.tsx`
- [Login Surface](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/login/page.tsx): `frontend/src/app/login/page.tsx`
- [API Client](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/lib/api/client.ts): `frontend/src/lib/api/client.ts`

### API and Identity

- [FastAPI Router](https://github.com/sivameghana7/codecraze/blob/main/backend/app/main.py): `backend/app/main.py`
- [Auth Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Authentication](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Token Security](https://github.com/sivameghana7/codecraze/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Admin Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/admin.py): `backend/app/api/admin.py`
- [Faculty Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/faculty.py): `backend/app/api/faculty.py`
- [Student Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/student.py): `backend/app/api/student.py`

### Student Analytics

- [Success Scoring](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/scoring_engine.py): `backend/app/services/scoring_engine.py`
- [Risk Prediction](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/ml_service.py): `backend/app/services/ml_service.py`
- [Persona Clustering](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/clustering_engine.py): `backend/app/services/clustering_engine.py`
- [Risk Explanations](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/explainability_engine.py): `backend/app/services/explainability_engine.py`
- [What-If Simulation](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/simulation_engine.py): `backend/app/services/simulation_engine.py`
- [Data Integration](https://github.com/sivameghana7/codecraze/blob/main/backend/app/services/data_integration_service.py): `backend/app/services/data_integration_service.py`
- [XAI Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/xai.py): `backend/app/api/xai.py`
- [Simulation Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/simulator.py): `backend/app/api/simulator.py`

### Intervention Operations

- [Intervention Routes](https://github.com/sivameghana7/codecraze/blob/main/backend/app/api/interventions.py): `backend/app/api/interventions.py`
- [Intervention Console](https://github.com/sivameghana7/codecraze/blob/main/frontend/src/app/interventions/page.tsx): `frontend/src/app/interventions/page.tsx`

### Persistence

- [Relational Store](https://github.com/sivameghana7/codecraze/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Student Records](https://github.com/sivameghana7/codecraze/blob/main/backend/app/models/student.py): `backend/app/models/student.py`
- [Academic and Placement Indicators](https://github.com/sivameghana7/codecraze/blob/main/backend/app/models/indicators.py): `backend/app/models/indicators.py`

## Connections

- Login Surface → Auth Routes: authenticates through
- API Client → FastAPI Router: sends API requests
- FastAPI Router → Auth Routes: mounts routes
- FastAPI Router → Admin Routes: mounts routes
- FastAPI Router → Faculty Routes: mounts routes
- FastAPI Router → Student Routes: mounts routes
- Auth Routes → Authentication: authenticates with (evidence: `backend/app/api/auth.py`)
- Authentication → Token Security: uses token security (evidence: `backend/app/services/auth_service.py`)
- Admin Console → Admin Routes: uses API
- Faculty Console → Faculty Routes: uses API
- Student Portal → Student Routes: uses API
- XAI Routes → Risk Explanations: requests explanations
- Risk Explanations → Risk Prediction: explains model outputs (evidence: `backend/app/services/explainability_engine.py`)
- Simulation Routes → What-If Simulation: dispatches simulation
- What-If Simulation → Success Scoring: computes scores with (evidence: `backend/app/services/simulation_engine.py`)
- What-If Simulation → Risk Prediction: predicts risk with (evidence: `backend/app/services/simulation_engine.py`)
- What-If Simulation → Persona Clustering: segments with (evidence: `backend/app/services/simulation_engine.py`)
- Admin Routes → Data Integration: uses data integration
- Data Integration → Success Scoring: computes metrics with (evidence: `backend/app/services/data_integration_service.py`)
- Data Integration → Risk Prediction: predicts risk with (evidence: `backend/app/services/data_integration_service.py`)
- Data Integration → Persona Clustering: segments with (evidence: `backend/app/services/data_integration_service.py`)
- Intervention Console → Intervention Routes: manages interventions
- Relational Store → Student Records: provides ORM base (evidence: `backend/app/models/student.py`)
- Relational Store → Academic and Placement Indicators: provides ORM base (evidence: `backend/app/models/indicators.py`)
