# kiapham52-pixel/laptrinhmang architecture

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

- Interactive diagram: https://gitdiagram.com/kiapham52-pixel/laptrinhmang
- Repository: https://github.com/kiapham52-pixel/laptrinhmang

## Overview

DAU Online Exam is a desktop client/server exam-management application. Users log in through the Tkinter client, which sends framed JSON requests over TCP; the server dispatches actions to domain services, which access SQLite. Student workflows include taking exams and viewing results; administrators manage students, questions, subjects, exams, and rooms, and review results and statistics. The README is only a brief project description, so capabilities and relationships are primarily grounded in the supplied source excerpts and SOURCE INDEX; unsampled details are not inferred.

Main entry points: [`DAU_Online_Exam/client/screens/admin_dashboard.py`](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/admin_dashboard.py) (Admin dashboard), [`DAU_Online_Exam/server/client_handler.py`](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/client_handler.py) (Action dispatcher), [`DAU_Online_Exam/database/database.py`](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/database/database.py) (SQLite database), [`DAU_Online_Exam/client/main.py`](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/main.py) (Login and routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_client_app["Login and routing<br/>[main.py]"]
  node_socket_client["Socket client<br/>[socket_client.py]"]
  node_admin_dash["Admin dashboard<br/>[admin_dashboard.py]"]
  node_student_dash["Student dashboard"]
  node_exam_ui["Exam taking<br/>[exam_screen.py]"]
  node_student_ui["Student management<br/>[student_manager.py]"]
  node_question_ui["Question management"]
  node_room_ui["Room management<br/>[room_manager.py]"]
  node_result_ui["Result management"]
  node_subject_ui["Subject management<br/>[subject_manager.py]"]
  node_statistics_ui["Statistics view"]
end

subgraph group_transport["Request handling"]
  node_protocol["JSON framing<br/>[protocol.py]"]
  node_server["TCP server<br/>[server.py]"]
  node_handler["Action dispatcher<br/>[client_handler.py]"]
end

subgraph group_domain["Exam services"]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_exams["Exam lifecycle<br/>[exam_service.py]"]
  node_questions["Question catalog"]
  node_rooms["Exam rooms<br/>[room_service.py]"]
  node_results["Results and statistics<br/>[result_service.py]"]
  node_subjects["Subjects<br/>[subject_service.py]"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite database<br/>[database.py]")]
end

node_students(("Students"))
node_admins(("Administrators"))

node_students -->|"log in"| node_client_app
node_admins -->|"log in"| node_client_app
node_client_app -->|"creates client"| node_socket_client
node_client_app -->|"opens admin view"| node_admin_dash
node_client_app -->|"opens student view"| node_student_dash
node_admin_dash -->|"opens rooms"| node_room_ui
node_admin_dash -->|"opens students"| node_student_ui
node_admin_dash -->|"opens questions"| node_question_ui
node_admin_dash -->|"opens exams"| node_exam_ui
node_admin_dash -->|"opens subjects"| node_subject_ui
node_admin_dash -->|"opens results"| node_result_ui
node_admin_dash -->|"opens statistics"| node_statistics_ui
node_student_dash -->|"opens exam"| node_exam_ui
node_socket_client -->|"frames requests"| node_protocol
node_server -->|"creates handler"| node_handler
node_handler -->|"receives and sends"| node_protocol
node_handler -->|"dispatches auth"| node_auth
node_handler -->|"dispatches exams"| node_exams
node_handler -->|"dispatches questions"| node_questions
node_handler -->|"dispatches rooms"| node_rooms
node_handler -->|"dispatches results"| node_results
node_handler -->|"dispatches subjects"| node_subjects
node_auth -->|"reads and writes"| node_database
node_exams -->|"reads and writes"| node_database
node_questions -->|"reads and writes"| node_database
node_rooms -->|"reads and writes"| node_database
node_results -->|"reads and writes"| node_database
node_subjects -->|"reads and writes"| node_database
node_server -->|"initializes and seeds"| node_database

click node_client_app "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/main.py"
click node_socket_client "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/network/socket_client.py"
click node_admin_dash "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/admin_dashboard.py"
click node_student_dash "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/student_dashboard.py"
click node_exam_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/exam_screen.py"
click node_student_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/student_manager.py"
click node_question_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/question_manager.py"
click node_room_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/room_manager.py"
click node_result_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/result_management.py"
click node_subject_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/subject_manager.py"
click node_statistics_ui "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/statistics_screen.py"
click node_protocol "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/shared/protocol.py"
click node_server "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/server.py"
click node_handler "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/client_handler.py"
click node_auth "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/auth_service.py"
click node_exams "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/exam_service.py"
click node_questions "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/question_service.py"
click node_rooms "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/room_service.py"
click node_results "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/result_service.py"
click node_subjects "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/subject_service.py"
click node_database "https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/database/database.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_client_app,node_socket_client,node_admin_dash,node_student_dash,node_exam_ui,node_student_ui,node_question_ui,node_room_ui,node_result_ui,node_subject_ui,node_statistics_ui toneBlue
class node_protocol,node_server,node_handler toneAmber
class node_auth,node_exams,node_questions,node_rooms,node_results,node_subjects toneMint
class node_database toneRose
class node_students,node_admins toneIndigo
```

## Components

### Desktop client

- [Login and routing](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/main.py): `DAU_Online_Exam/client/main.py`
- [Socket client](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/network/socket_client.py): `DAU_Online_Exam/client/network/socket_client.py`
- [Admin dashboard](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/admin_dashboard.py): `DAU_Online_Exam/client/screens/admin_dashboard.py`
- [Student dashboard](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/student_dashboard.py): `DAU_Online_Exam/client/screens/student_dashboard.py`
- [Exam taking](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/exam_screen.py): `DAU_Online_Exam/client/screens/exam_screen.py`
- [Student management](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/student_manager.py): `DAU_Online_Exam/client/screens/student_manager.py`
- [Question management](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/question_manager.py): `DAU_Online_Exam/client/screens/question_manager.py`
- [Room management](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/room_manager.py): `DAU_Online_Exam/client/screens/room_manager.py`
- [Result management](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/result_management.py): `DAU_Online_Exam/client/screens/result_management.py`
- [Subject management](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/subject_manager.py): `DAU_Online_Exam/client/screens/subject_manager.py`
- [Statistics view](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/client/screens/statistics_screen.py): `DAU_Online_Exam/client/screens/statistics_screen.py`

### Request handling

- [JSON framing](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/shared/protocol.py): `DAU_Online_Exam/shared/protocol.py`
- [TCP server](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/server.py): `DAU_Online_Exam/server/server.py`
- [Action dispatcher](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/client_handler.py): `DAU_Online_Exam/server/client_handler.py`

### Exam services

- [Authentication](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/auth_service.py): `DAU_Online_Exam/server/services/auth_service.py`
- [Exam lifecycle](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/exam_service.py): `DAU_Online_Exam/server/services/exam_service.py`
- [Question catalog](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/question_service.py): `DAU_Online_Exam/server/services/question_service.py`
- [Exam rooms](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/room_service.py): `DAU_Online_Exam/server/services/room_service.py`
- [Results and statistics](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/result_service.py): `DAU_Online_Exam/server/services/result_service.py`
- [Subjects](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/server/services/subject_service.py): `DAU_Online_Exam/server/services/subject_service.py`

### Persistence

- [SQLite database](https://github.com/kiapham52-pixel/laptrinhmang/blob/main/DAU_Online_Exam/database/database.py): `DAU_Online_Exam/database/database.py`

### Other components

- **Students**
- **Administrators**

## Connections

- Students → Login and routing: log in (evidence: `DAU_Online_Exam/client/main.py`)
- Administrators → Login and routing: log in (evidence: `DAU_Online_Exam/client/main.py`)
- Login and routing → Socket client: creates client (evidence: `DAU_Online_Exam/client/main.py`)
- Login and routing → Admin dashboard: opens admin view (evidence: `DAU_Online_Exam/client/main.py`)
- Login and routing → Student dashboard: opens student view (evidence: `DAU_Online_Exam/client/main.py`)
- Admin dashboard → Room management: opens rooms (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Student management: opens students (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Question management: opens questions (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Exam taking: opens exams (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Subject management: opens subjects (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Result management: opens results (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Admin dashboard → Statistics view: opens statistics (evidence: `DAU_Online_Exam/client/screens/admin_dashboard.py`)
- Student dashboard → Exam taking: opens exam (evidence: `DAU_Online_Exam/client/screens/student_dashboard.py`)
- Socket client → JSON framing: frames requests (evidence: `DAU_Online_Exam/client/network/socket_client.py`)
- TCP server → Action dispatcher: creates handler (evidence: `DAU_Online_Exam/server/server.py`)
- Action dispatcher → JSON framing: receives and sends (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Authentication: dispatches auth (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Exam lifecycle: dispatches exams (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Question catalog: dispatches questions (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Exam rooms: dispatches rooms (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Results and statistics: dispatches results (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Action dispatcher → Subjects: dispatches subjects (evidence: `DAU_Online_Exam/server/client_handler.py`)
- Authentication → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/auth_service.py`)
- Exam lifecycle → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/exam_service.py`)
- Question catalog → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/question_service.py`)
- Exam rooms → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/room_service.py`)
- Results and statistics → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/result_service.py`)
- Subjects → SQLite database: reads and writes (evidence: `DAU_Online_Exam/server/services/subject_service.py`)
- TCP server → SQLite database: initializes and seeds (evidence: `DAU_Online_Exam/server/server.py`)
