# atishayd/aifred architecture

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

- Interactive diagram: https://gitdiagram.com/atishayd/aifred
- Repository: https://github.com/atishayd/aifred

## Overview

AiFRED is a desktop classroom tool for course and student management, face-based attendance, hand-raise tracking, and question relevance analysis. In the main workflow, an instructor selects a course, registers students, and uses camera/audio features to capture attendance and engagement; question audio is transcribed and classified, and records are stored for review. The excerpts show both a main-window analysis path and a separate engagement tab with an audio processor. Some tab wiring and database methods are unsampled, so uncertain connections are omitted.

Main entry points: [`src/database/db_manager.py`](https://github.com/atishayd/aifred/blob/main/src/database/db_manager.py) (Database manager), [`src/ui/main_window.py`](https://github.com/atishayd/aifred/blob/main/src/ui/main_window.py) (Main window), [`src/ui/components/engagement_tab.py`](https://github.com/atishayd/aifred/blob/main/src/ui/components/engagement_tab.py) (Engagement tracking), [`src/main.py`](https://github.com/atishayd/aifred/blob/main/src/main.py) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and courses"]
  node_app_entry["Application startup<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_main_window["Main window<br/>[main_window.py]"]
  node_course_dialog["Course selection<br/>[course_dialog.py]"]
  node_student_dialog["Student details<br/>[student_dialog.py]"]
end

subgraph group_classroom["Classroom workflows"]
  node_registration["Student registration"]
  node_attendance["Attendance capture<br/>[attendance_tab.py]"]
  node_face_recognition["Face recognition"]
  node_engagement_tab["Engagement tracking<br/>[engagement_tab.py]"]
  node_pose_detection["Pose detection"]
end

subgraph group_analysis["Question analysis"]
  node_audio_processor["Audio processor<br/>[audio_processor.py]"]
  node_openai{{"OpenAI APIs"}}
end

subgraph group_storage["Storage and services"]
  node_database_manager["Database manager<br/>[db_manager.py]"]
  node_mongodb[("MongoDB")]
end

node_instructor(("Instructor"))
node_camera["Camera"]

node_instructor -->|"starts"| node_app_entry
node_app_entry -->|"loads settings"| node_config
node_app_entry -->|"initializes"| node_database_manager
node_app_entry -->|"opens"| node_main_window
node_instructor -->|"selects course"| node_course_dialog
node_course_dialog -->|"reads and creates courses"| node_database_manager
node_instructor -->|"registers students"| node_registration
node_registration -->|"captures image"| node_camera
node_registration -->|"detects faces"| node_face_recognition
node_registration -->|"adds student"| node_database_manager
node_instructor -->|"marks attendance"| node_attendance
node_attendance -->|"captures frame"| node_camera
node_attendance -->|"matches faces"| node_face_recognition
node_attendance -->|"records attendance"| node_database_manager
node_instructor -->|"tracks engagement"| node_engagement_tab
node_engagement_tab -->|"reads frames"| node_camera
node_engagement_tab -->|"detects raises"| node_pose_detection
node_engagement_tab -->|"records questions"| node_audio_processor
node_audio_processor -->|"transcribes and classifies"| node_openai
node_engagement_tab -->|"logs engagement"| node_database_manager
node_main_window -->|"recognizes students"| node_face_recognition
node_main_window -->|"tracks student actions"| node_pose_detection
node_main_window -->|"classifies relevance"| node_openai
node_main_window -->|"records and reads results"| node_database_manager
node_database_manager -->|"reads and writes"| node_mongodb
node_main_window -->|"shows details"| node_student_dialog

click node_app_entry "https://github.com/atishayd/aifred/blob/main/src/main.py"
click node_config "https://github.com/atishayd/aifred/blob/main/src/utils/config.py"
click node_main_window "https://github.com/atishayd/aifred/blob/main/src/ui/main_window.py"
click node_course_dialog "https://github.com/atishayd/aifred/blob/main/src/ui/course_dialog.py"
click node_student_dialog "https://github.com/atishayd/aifred/blob/main/src/ui/student_dialog.py"
click node_registration "https://github.com/atishayd/aifred/blob/main/src/ui/components/student_registration_tab.py"
click node_attendance "https://github.com/atishayd/aifred/blob/main/src/ui/components/attendance_tab.py"
click node_engagement_tab "https://github.com/atishayd/aifred/blob/main/src/ui/components/engagement_tab.py"
click node_audio_processor "https://github.com/atishayd/aifred/blob/main/src/utils/audio_processor.py"
click node_database_manager "https://github.com/atishayd/aifred/blob/main/src/database/db_manager.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_app_entry,node_config,node_main_window,node_course_dialog,node_student_dialog toneBlue
class node_registration,node_attendance,node_face_recognition,node_engagement_tab,node_pose_detection toneAmber
class node_audio_processor,node_openai toneMint
class node_database_manager,node_mongodb toneRose
class node_instructor,node_camera toneIndigo
```

## Components

### Application and courses

- [Application startup](https://github.com/atishayd/aifred/blob/main/src/main.py): `src/main.py`
- [Configuration](https://github.com/atishayd/aifred/blob/main/src/utils/config.py): `src/utils/config.py`
- [Main window](https://github.com/atishayd/aifred/blob/main/src/ui/main_window.py): `src/ui/main_window.py`
- [Course selection](https://github.com/atishayd/aifred/blob/main/src/ui/course_dialog.py): `src/ui/course_dialog.py`
- [Student details](https://github.com/atishayd/aifred/blob/main/src/ui/student_dialog.py): `src/ui/student_dialog.py`

### Classroom workflows

- [Student registration](https://github.com/atishayd/aifred/blob/main/src/ui/components/student_registration_tab.py): `src/ui/components/student_registration_tab.py`
- [Attendance capture](https://github.com/atishayd/aifred/blob/main/src/ui/components/attendance_tab.py): `src/ui/components/attendance_tab.py`
- **Face recognition**
- [Engagement tracking](https://github.com/atishayd/aifred/blob/main/src/ui/components/engagement_tab.py): `src/ui/components/engagement_tab.py`
- **Pose detection**

### Question analysis

- [Audio processor](https://github.com/atishayd/aifred/blob/main/src/utils/audio_processor.py): `src/utils/audio_processor.py`
- **OpenAI APIs**

### Storage and services

- [Database manager](https://github.com/atishayd/aifred/blob/main/src/database/db_manager.py): `src/database/db_manager.py`
- **MongoDB**

### Other components

- **Instructor**
- **Camera**

## Connections

- Instructor → Application startup: starts
- Application startup → Configuration: loads settings
- Application startup → Database manager: initializes
- Application startup → Main window: opens
- Instructor → Course selection: selects course
- Course selection → Database manager: reads and creates courses
- Instructor → Student registration: registers students
- Student registration → Camera: captures image
- Student registration → Face recognition: detects faces
- Student registration → Database manager: adds student
- Instructor → Attendance capture: marks attendance
- Attendance capture → Camera: captures frame
- Attendance capture → Face recognition: matches faces
- Attendance capture → Database manager: records attendance
- Instructor → Engagement tracking: tracks engagement
- Engagement tracking → Camera: reads frames
- Engagement tracking → Pose detection: detects raises
- Engagement tracking → Audio processor: records questions
- Audio processor → OpenAI APIs: transcribes and classifies
- Engagement tracking → Database manager: logs engagement
- Main window → Face recognition: recognizes students
- Main window → Pose detection: tracks student actions
- Main window → OpenAI APIs: classifies relevance
- Main window → Database manager: records and reads results
- Database manager → MongoDB: reads and writes
- Main window → Student details: shows details
