# shradha-khapra/ai-attendance-project-app architecture

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

- Interactive diagram: https://gitdiagram.com/shradha-khapra/ai-attendance-project-app
- Repository: https://github.com/shradha-khapra/ai-attendance-project-app

## Overview

SnapClass is a Streamlit attendance app for teachers and students. Users choose a portal; students sign in with face recognition, optionally enroll a voice profile, and manage subjects and attendance. Teachers manage subjects and enrollment, capture classroom photos or record audio, review AI-detected attendance, and confirm records. The graph distinguishes portal orchestration, UI workflows, recognition pipelines, and persistence. Several dialog and database files were not excerpted; their links are included only where the SOURCE INDEX documents imports. The README provides no further capability detail.

Main entry points: [`src/screens/teacher_screen.py`](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/teacher_screen.py) (Teacher Portal), [`src/screens/student_screen.py`](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/student_screen.py) (Student Portal), [`src/database/db.py`](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/database/db.py) (Database Operations), [`app.py`](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/app.py) (App Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Portals and Layout"]
  node_app["App Router<br/>[app.py]"]
  node_home["Portal Selection<br/>[home_screen.py]"]
  node_layout["Base Styling<br/>[base_layout.py]"]
  node_header["Headers<br/>[header.py]"]
  node_footer["Footers<br/>[footer.py]"]
end

subgraph group_teacher["Teacher Workflows"]
  node_teacher_screen["Teacher Portal<br/>[teacher_screen.py]"]
  node_subject_card["Subject Cards<br/>[subject_card.py]"]
  node_subject_dialogs["Subject Management"]
  node_photo_dialog["Photo Capture"]
  node_voice_dialog["Voice Attendance"]
  node_results["Attendance Review"]
end

subgraph group_student["Student Workflows"]
  node_student_screen["Student Portal<br/>[student_screen.py]"]
  node_enroll_dialog["Subject Enrollment<br/>[dialog_enroll.py]"]
  node_auto_enroll["Join-Code Enrollment"]
end

subgraph group_recognition["Recognition Pipelines"]
  node_face_pipeline["Face Recognition<br/>[face_pipeline.py]"]
  node_voice_pipeline["Voice Recognition<br/>[voice_pipeline.py]"]
end

subgraph group_data["Persistence"]
  node_db["Database Operations<br/>[db.py]"]
  node_config["Database Config<br/>[config.py]"]
end

node_user(("User"))
node_supabase[("Supabase")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_teacher_screen
node_app -->|"routes to"| node_student_screen
node_app -->|"opens"| node_auto_enroll
node_home -->|"renders"| node_header
node_home -->|"renders"| node_footer
node_home -->|"applies"| node_layout
node_teacher_screen -->|"renders"| node_header
node_teacher_screen -->|"renders"| node_footer
node_teacher_screen -->|"applies"| node_layout
node_teacher_screen -->|"renders"| node_subject_card
node_teacher_screen -->|"opens"| node_subject_dialogs
node_teacher_screen -->|"opens"| node_photo_dialog
node_teacher_screen -->|"calls"| node_face_pipeline
node_teacher_screen -->|"shows"| node_results
node_teacher_screen -->|"opens"| node_voice_dialog
node_teacher_screen -->|"queries"| node_db
node_student_screen -->|"renders"| node_header
node_student_screen -->|"renders"| node_footer
node_student_screen -->|"applies"| node_layout
node_student_screen -->|"recognizes faces"| node_face_pipeline
node_student_screen -->|"creates profile"| node_voice_pipeline
node_student_screen -->|"loads and saves"| node_db
node_student_screen -->|"opens"| node_enroll_dialog
node_student_screen -->|"renders"| node_subject_card
node_voice_dialog -->|"processes audio"| node_voice_pipeline
node_voice_dialog -->|"reads enrollment"| node_config
node_voice_dialog -->|"shows results"| node_results
node_results -->|"saves attendance"| node_db
node_face_pipeline -->|"loads students"| node_db
node_photo_dialog -->|"imports enrollment operation"| node_db
node_voice_dialog -->|"reads roster"| node_supabase
node_config -.->|"configures"| node_supabase
node_subject_dialogs -->|"uses operations"| node_db
node_enroll_dialog -->|"uses operations"| node_db

click node_app "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/app.py"
click node_home "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/home_screen.py"
click node_layout "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/ui/base_layout.py"
click node_header "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/header.py"
click node_footer "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/footer.py"
click node_teacher_screen "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/teacher_screen.py"
click node_subject_card "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/subject_card.py"
click node_subject_dialogs "https://github.com/shradha-khapra/ai-attendance-project-app/tree/main/src/components"
click node_photo_dialog "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_add_photo.py"
click node_voice_dialog "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_voice_attendance.py"
click node_results "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_attendance_results.py"
click node_student_screen "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/student_screen.py"
click node_enroll_dialog "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_enroll.py"
click node_auto_enroll "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_auto_enroll.py"
click node_face_pipeline "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/pipelines/face_pipeline.py"
click node_voice_pipeline "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/pipelines/voice_pipeline.py"
click node_db "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/database/db.py"
click node_config "https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/database/config.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,node_home,node_layout,node_header,node_footer,node_user toneBlue
class node_teacher_screen,node_subject_card,node_subject_dialogs,node_photo_dialog,node_voice_dialog,node_results,node_supabase toneAmber
class node_student_screen,node_enroll_dialog,node_auto_enroll toneMint
class node_face_pipeline,node_voice_pipeline toneRose
class node_db,node_config toneIndigo
```

## Components

### Portals and Layout

- [App Router](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/app.py): `app.py`
- [Portal Selection](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/home_screen.py): `src/screens/home_screen.py`
- [Base Styling](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/ui/base_layout.py): `src/ui/base_layout.py`
- [Headers](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/header.py): `src/components/header.py`
- [Footers](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/footer.py): `src/components/footer.py`

### Teacher Workflows

- [Teacher Portal](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/teacher_screen.py): `src/screens/teacher_screen.py`
- [Subject Cards](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/subject_card.py): `src/components/subject_card.py`
- [Subject Management](https://github.com/shradha-khapra/ai-attendance-project-app/tree/main/src/components): `src/components`
- [Photo Capture](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_add_photo.py): `src/components/dialog_add_photo.py`
- [Voice Attendance](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_voice_attendance.py): `src/components/dialog_voice_attendance.py`
- [Attendance Review](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_attendance_results.py): `src/components/dialog_attendance_results.py`

### Student Workflows

- [Student Portal](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/screens/student_screen.py): `src/screens/student_screen.py`
- [Subject Enrollment](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_enroll.py): `src/components/dialog_enroll.py`
- [Join-Code Enrollment](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/components/dialog_auto_enroll.py): `src/components/dialog_auto_enroll.py`

### Recognition Pipelines

- [Face Recognition](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/pipelines/face_pipeline.py): `src/pipelines/face_pipeline.py`
- [Voice Recognition](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/pipelines/voice_pipeline.py): `src/pipelines/voice_pipeline.py`

### Persistence

- [Database Operations](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/database/db.py): `src/database/db.py`
- [Database Config](https://github.com/shradha-khapra/ai-attendance-project-app/blob/main/src/database/config.py): `src/database/config.py`

### Other components

- **User**
- **Supabase**

## Connections

- User → App Router: uses
- App Router → Portal Selection: routes to (evidence: `app.py`)
- App Router → Teacher Portal: routes to (evidence: `app.py`)
- App Router → Student Portal: routes to (evidence: `app.py`)
- App Router → Join-Code Enrollment: opens (evidence: `app.py`)
- Portal Selection → Headers: renders (evidence: `src/screens/home_screen.py`)
- Portal Selection → Footers: renders (evidence: `src/screens/home_screen.py`)
- Portal Selection → Base Styling: applies (evidence: `src/screens/home_screen.py`)
- Teacher Portal → Headers: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Footers: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Base Styling: applies (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Subject Cards: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Subject Management: opens (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Photo Capture: opens (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Face Recognition: calls (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Attendance Review: shows (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Voice Attendance: opens (evidence: `src/screens/teacher_screen.py`)
- Teacher Portal → Database Operations: queries (evidence: `src/screens/teacher_screen.py`)
- Student Portal → Headers: renders (evidence: `src/screens/student_screen.py`)
- Student Portal → Footers: renders (evidence: `src/screens/student_screen.py`)
- Student Portal → Base Styling: applies (evidence: `src/screens/student_screen.py`)
- Student Portal → Face Recognition: recognizes faces (evidence: `src/screens/student_screen.py`)
- Student Portal → Voice Recognition: creates profile (evidence: `src/screens/student_screen.py`)
- Student Portal → Database Operations: loads and saves (evidence: `src/screens/student_screen.py`)
- Student Portal → Subject Enrollment: opens (evidence: `src/screens/student_screen.py`)
- Student Portal → Subject Cards: renders (evidence: `src/screens/student_screen.py`)
- Voice Attendance → Voice Recognition: processes audio (evidence: `src/components/dialog_voice_attendance.py`)
- Voice Attendance → Database Config: reads enrollment (evidence: `src/components/dialog_voice_attendance.py`)
- Voice Attendance → Attendance Review: shows results (evidence: `src/components/dialog_voice_attendance.py`)
- Attendance Review → Database Operations: saves attendance (evidence: `src/components/dialog_attendance_results.py`)
- Face Recognition → Database Operations: loads students (evidence: `src/pipelines/face_pipeline.py`)
- Photo Capture → Database Operations: imports enrollment operation (evidence: `src/components/dialog_add_photo.py`)
- Voice Attendance → Supabase: reads roster (evidence: `src/components/dialog_voice_attendance.py`)
- Database Config → Supabase: configures
- Subject Management → Database Operations: uses operations (evidence: `src/components/dialog_create_subject.py`)
- Subject Enrollment → Database Operations: uses operations (evidence: `src/components/dialog_enroll.py`)
