# quoccaogia/dsa_final architecture

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

- Interactive diagram: https://gitdiagram.com/quoccaogia/dsa_final
- Repository: https://github.com/quoccaogia/dsa_final

## Overview

This is a student scholarship-ranking application. Users view student details and rankings, add or update records, delete students, or upload CSV data through the browser; the frontend sends JSON requests to the C++ API, which coordinates in-memory student/index operations and SQLite persistence. Ranking is based on GPA, conduct score, GPA-10, and student ID, with whole-school and major/cohort views. README describes running the API alongside main.html. The graph reflects shown calls; unexcerpted page markup and source are not inferred.

Main entry points: [`backend/api.cpp`](https://github.com/quoccaogia/dsa_final/blob/main/backend/api.cpp) (HTTP API), [`backend/ScholarshipSystem.cpp`](https://github.com/quoccaogia/dsa_final/blob/main/backend/ScholarshipSystem.cpp) (Scholarship system), [`frontend/main.html`](https://github.com/quoccaogia/dsa_final/blob/main/frontend/main.html) (Web page), [`frontend/script.js`](https://github.com/quoccaogia/dsa_final/blob/main/frontend/script.js) (UI actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser interface"]
  node_page["Web page<br/>[main.html]"]
  node_ui["UI actions<br/>[script.js]"]
end

subgraph group_service["API service"]
  node_api["HTTP API<br/>[api.cpp]"]
  node_http["HTTP server<br/>[httplib.h]"]
end

subgraph group_domain["Student and rankings"]
  node_system["Scholarship system"]
  node_student["Student record<br/>[Student.cpp]"]
  node_ranking["Ranking comparator<br/>[CmpHocBong.cpp]"]
end

subgraph group_storage["Persistence"]
  node_sqlite_handler["SQLite handler<br/>[SQLiteHandler.h]"]
  node_sqlite[("SQLite database")]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_page -.->|"loads"| node_ui
node_ui -->|"posts JSON"| node_api
node_api -->|"registers routes"| node_http
node_api -->|"dispatches actions"| node_system
node_api -->|"loads and persists"| node_sqlite_handler
node_system -->|"stores records"| node_student
node_system -->|"orders students"| node_ranking
node_sqlite_handler -->|"reads and writes"| node_sqlite

click node_page "https://github.com/quoccaogia/dsa_final/blob/main/frontend/main.html"
click node_ui "https://github.com/quoccaogia/dsa_final/blob/main/frontend/script.js"
click node_api "https://github.com/quoccaogia/dsa_final/blob/main/backend/api.cpp"
click node_http "https://github.com/quoccaogia/dsa_final/blob/main/backend/httplib.h"
click node_system "https://github.com/quoccaogia/dsa_final/blob/main/backend/ScholarshipSystem.cpp"
click node_student "https://github.com/quoccaogia/dsa_final/blob/main/backend/Student.cpp"
click node_ranking "https://github.com/quoccaogia/dsa_final/blob/main/backend/CmpHocBong.cpp"
click node_sqlite_handler "https://github.com/quoccaogia/dsa_final/blob/main/SQL/SQLiteHandler.h"

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_page,node_ui,node_user toneBlue
class node_api,node_http toneAmber
class node_system,node_student,node_ranking toneMint
class node_sqlite_handler,node_sqlite toneRose
```

## Components

### Browser interface

- [Web page](https://github.com/quoccaogia/dsa_final/blob/main/frontend/main.html): `frontend/main.html`
- [UI actions](https://github.com/quoccaogia/dsa_final/blob/main/frontend/script.js): `frontend/script.js`

### API service

- [HTTP API](https://github.com/quoccaogia/dsa_final/blob/main/backend/api.cpp): `backend/api.cpp`
- [HTTP server](https://github.com/quoccaogia/dsa_final/blob/main/backend/httplib.h): `backend/httplib.h`

### Student and rankings

- [Scholarship system](https://github.com/quoccaogia/dsa_final/blob/main/backend/ScholarshipSystem.cpp): `backend/ScholarshipSystem.cpp`
- [Student record](https://github.com/quoccaogia/dsa_final/blob/main/backend/Student.cpp): `backend/Student.cpp`
- [Ranking comparator](https://github.com/quoccaogia/dsa_final/blob/main/backend/CmpHocBong.cpp): `backend/CmpHocBong.cpp`

### Persistence

- [SQLite handler](https://github.com/quoccaogia/dsa_final/blob/main/SQL/SQLiteHandler.h): `SQL/SQLiteHandler.h`
- **SQLite database**

### Other components

- **User**

## Connections

- User → Web page: uses (evidence: `README.md`)
- Web page → UI actions: loads
- UI actions → HTTP API: posts JSON (evidence: `frontend/script.js`)
- HTTP API → HTTP server: registers routes (evidence: `backend/api.cpp`)
- HTTP API → Scholarship system: dispatches actions (evidence: `backend/api.cpp`)
- HTTP API → SQLite handler: loads and persists (evidence: `backend/api.cpp`)
- Scholarship system → Student record: stores records (evidence: `backend/ScholarshipSystem.cpp`)
- Scholarship system → Ranking comparator: orders students (evidence: `backend/ScholarshipSystem.cpp`)
- SQLite handler → SQLite database: reads and writes (evidence: `SQL/SQLiteHandler.h`)
