# roshanjpr80/snap-class architecture

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

- Interactive diagram: https://gitdiagram.com/roshanjpr80/snap-class
- Repository: https://github.com/roshanjpr80/snap-class

## Overview

Snap Class is a Streamlit attendance application for teachers and students. A teacher captures classroom photos or invokes voice attendance, reviews detected attendance, then confirms saving auditable records; students enroll through a code or link, sign in with face recognition or backup credentials, and view their attendance. The README documents the broader dashboard capabilities; several components are represented from its structure and the SOURCE INDEX rather than sampled implementation. Edges cite the README or indexed caller references where available.

Main entry points: [`src/screens/teacher_screen.py`](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/teacher_screen.py) (Teacher dashboard), [`src/screens/student_screen.py`](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/student_screen.py) (Student dashboard), [`src/database/db.py`](https://github.com/roshanjpr80/snap-class/blob/main/src/database/db.py) (Attendance and enrollment data), [`src/screens/home_screen.py`](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/home_screen.py) (Role selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_app["Routing and session<br/>[app.py]"]
end

subgraph group_screens["User screens"]
  node_home["Role selection<br/>[home_screen.py]"]
  node_teacher["Teacher dashboard<br/>[teacher_screen.py]"]
  node_student["Student dashboard<br/>[student_screen.py]"]
  node_subject_create["Create subject"]
  node_subject_share["Share join code"]
  node_student_enroll["Join subject<br/>[dialog_enroll.py]"]
  node_auto_enroll["Deep-link enrollment"]
  node_subject_card["Subject cards<br/>[subject_card.py]"]
end

subgraph group_attendance["Attendance capture"]
  node_photo_capture["Classroom photo capture"]
  node_review["Review and confirm"]
  node_voice_dialog["Voice attendance"]
end

subgraph group_identity["Identity pipelines"]
  node_face["Face matching<br/>[face_pipeline.py]"]
  node_voice["Speaker verification<br/>[voice_pipeline.py]"]
end

subgraph group_data["Data and UI"]
  node_db_ops["Attendance and enrollment data<br/>[db.py]"]
  node_db_config["Supabase client<br/>[config.py]"]
  node_supabase[("Supabase PostgreSQL")]
  node_layout["Shared styling<br/>[base_layout.py]"]
  node_header["Shared header<br/>[header.py]"]
  node_footer["Shared footer<br/>[footer.py]"]
  node_back_top["Back-to-top control<br/>[dialog_to_top.py]"]
end

node_user(("Teacher or student"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_teacher
node_app -->|"routes to"| node_student
node_app -->|"dispatches link"| node_auto_enroll
node_home -->|"selects role"| node_teacher
node_home -->|"selects role"| node_student
node_home -->|"renders"| node_header
node_home -->|"renders"| node_footer
node_home -->|"applies styling"| node_layout
node_teacher -->|"opens capture"| node_photo_capture
node_teacher -->|"shows results"| node_review
node_teacher -->|"opens voice flow"| node_voice_dialog
node_teacher -->|"opens creation"| node_subject_create
node_teacher -->|"opens sharing"| node_subject_share
node_teacher -->|"matches faces"| node_face
node_teacher -->|"reads and writes"| node_db_ops
node_teacher -->|"renders"| node_subject_card
node_teacher -->|"renders"| node_header
node_teacher -->|"renders"| node_footer
node_teacher -->|"applies styling"| node_layout
node_photo_capture -.->|"analyzes images"| node_face
node_review -->|"saves confirmed logs"| node_db_ops
node_voice_dialog -->|"verifies speaker"| node_voice
node_voice_dialog -->|"shows results"| node_review
node_voice_dialog -->|"reads attendance data"| node_db_ops
node_student -->|"checks face login"| node_face
node_student -->|"checks voice backup"| node_voice
node_student -->|"opens enrollment"| node_student_enroll
node_student -->|"reads and writes"| node_db_ops
node_student -->|"renders"| node_subject_card
node_student -->|"renders"| node_header
node_student -->|"renders"| node_footer
node_student -->|"applies styling"| node_layout
node_subject_create -->|"creates subject"| node_db_ops
node_student_enroll -->|"enrolls student"| node_db_ops
node_auto_enroll -->|"enrolls student"| node_db_ops
node_face -->|"loads embeddings"| node_db_ops
node_db_ops -->|"uses client"| node_db_config
node_db_config -->|"connects"| node_supabase
node_footer -->|"renders"| node_back_top

click node_app "https://github.com/roshanjpr80/snap-class/blob/main/app.py"
click node_home "https://github.com/roshanjpr80/snap-class/blob/main/src/screens/home_screen.py"
click node_teacher "https://github.com/roshanjpr80/snap-class/blob/main/src/screens/teacher_screen.py"
click node_student "https://github.com/roshanjpr80/snap-class/blob/main/src/screens/student_screen.py"
click node_subject_create "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_create_subject.py"
click node_subject_share "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_share_subject.py"
click node_student_enroll "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_enroll.py"
click node_auto_enroll "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_auto_enroll.py"
click node_subject_card "https://github.com/roshanjpr80/snap-class/blob/main/src/components/subject_card.py"
click node_photo_capture "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_add_photo.py"
click node_review "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_attendance_results.py"
click node_voice_dialog "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_voice_attendance.py"
click node_face "https://github.com/roshanjpr80/snap-class/blob/main/src/pipelines/face_pipeline.py"
click node_voice "https://github.com/roshanjpr80/snap-class/blob/main/src/pipelines/voice_pipeline.py"
click node_db_ops "https://github.com/roshanjpr80/snap-class/blob/main/src/database/db.py"
click node_db_config "https://github.com/roshanjpr80/snap-class/blob/main/src/database/config.py"
click node_layout "https://github.com/roshanjpr80/snap-class/blob/main/src/ui/base_layout.py"
click node_header "https://github.com/roshanjpr80/snap-class/blob/main/src/components/header.py"
click node_footer "https://github.com/roshanjpr80/snap-class/blob/main/src/components/footer.py"
click node_back_top "https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_to_top.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 toneBlue
class node_home,node_teacher,node_student,node_subject_create,node_subject_share,node_student_enroll,node_auto_enroll,node_subject_card toneAmber
class node_photo_capture,node_review,node_voice_dialog toneMint
class node_face,node_voice toneRose
class node_db_ops,node_db_config,node_supabase,node_layout,node_header,node_footer,node_back_top,node_user toneIndigo
```

## Components

### App entry

- [Routing and session](https://github.com/roshanjpr80/snap-class/blob/main/app.py): `app.py`

### User screens

- [Role selection](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/home_screen.py): `src/screens/home_screen.py`
- [Teacher dashboard](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/teacher_screen.py): `src/screens/teacher_screen.py`
- [Student dashboard](https://github.com/roshanjpr80/snap-class/blob/main/src/screens/student_screen.py): `src/screens/student_screen.py`
- [Create subject](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_create_subject.py): `src/components/dialog_create_subject.py`
- [Share join code](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_share_subject.py): `src/components/dialog_share_subject.py`
- [Join subject](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_enroll.py): `src/components/dialog_enroll.py`
- [Deep-link enrollment](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_auto_enroll.py): `src/components/dialog_auto_enroll.py`
- [Subject cards](https://github.com/roshanjpr80/snap-class/blob/main/src/components/subject_card.py): `src/components/subject_card.py`

### Attendance capture

- [Classroom photo capture](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_add_photo.py): `src/components/dialog_add_photo.py`
- [Review and confirm](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_attendance_results.py): `src/components/dialog_attendance_results.py`
- [Voice attendance](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_voice_attendance.py): `src/components/dialog_voice_attendance.py`

### Identity pipelines

- [Face matching](https://github.com/roshanjpr80/snap-class/blob/main/src/pipelines/face_pipeline.py): `src/pipelines/face_pipeline.py`
- [Speaker verification](https://github.com/roshanjpr80/snap-class/blob/main/src/pipelines/voice_pipeline.py): `src/pipelines/voice_pipeline.py`

### Data and UI

- [Attendance and enrollment data](https://github.com/roshanjpr80/snap-class/blob/main/src/database/db.py): `src/database/db.py`
- [Supabase client](https://github.com/roshanjpr80/snap-class/blob/main/src/database/config.py): `src/database/config.py`
- **Supabase PostgreSQL**
- [Shared styling](https://github.com/roshanjpr80/snap-class/blob/main/src/ui/base_layout.py): `src/ui/base_layout.py`
- [Shared header](https://github.com/roshanjpr80/snap-class/blob/main/src/components/header.py): `src/components/header.py`
- [Shared footer](https://github.com/roshanjpr80/snap-class/blob/main/src/components/footer.py): `src/components/footer.py`
- [Back-to-top control](https://github.com/roshanjpr80/snap-class/blob/main/src/components/dialog_to_top.py): `src/components/dialog_to_top.py`

### Other components

- **Teacher or student**

## Connections

- Teacher or student → Routing and session: opens (evidence: `README.md`)
- Routing and session → Role selection: routes to (evidence: `app.py`)
- Routing and session → Teacher dashboard: routes to (evidence: `app.py`)
- Routing and session → Student dashboard: routes to (evidence: `app.py`)
- Routing and session → Deep-link enrollment: dispatches link (evidence: `app.py`)
- Role selection → Teacher dashboard: selects role (evidence: `src/screens/home_screen.py`)
- Role selection → Student dashboard: selects role (evidence: `src/screens/home_screen.py`)
- Role selection → Shared header: renders (evidence: `src/screens/home_screen.py`)
- Role selection → Shared footer: renders (evidence: `src/screens/home_screen.py`)
- Role selection → Shared styling: applies styling (evidence: `src/screens/home_screen.py`)
- Teacher dashboard → Classroom photo capture: opens capture (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Review and confirm: shows results (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Voice attendance: opens voice flow (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Create subject: opens creation (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Share join code: opens sharing (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Face matching: matches faces (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Attendance and enrollment data: reads and writes (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Subject cards: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Shared header: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Shared footer: renders (evidence: `src/screens/teacher_screen.py`)
- Teacher dashboard → Shared styling: applies styling (evidence: `src/screens/teacher_screen.py`)
- Classroom photo capture → Face matching: analyzes images
- Review and confirm → Attendance and enrollment data: saves confirmed logs (evidence: `src/components/dialog_attendance_results.py`)
- Voice attendance → Speaker verification: verifies speaker (evidence: `src/components/dialog_voice_attendance.py`)
- Voice attendance → Review and confirm: shows results (evidence: `src/components/dialog_voice_attendance.py`)
- Voice attendance → Attendance and enrollment data: reads attendance data (evidence: `src/components/dialog_voice_attendance.py`)
- Student dashboard → Face matching: checks face login (evidence: `src/screens/student_screen.py`)
- Student dashboard → Speaker verification: checks voice backup (evidence: `src/screens/student_screen.py`)
- Student dashboard → Join subject: opens enrollment (evidence: `src/screens/student_screen.py`)
- Student dashboard → Attendance and enrollment data: reads and writes (evidence: `src/screens/student_screen.py`)
- Student dashboard → Subject cards: renders (evidence: `src/screens/student_screen.py`)
- Student dashboard → Shared header: renders (evidence: `src/screens/student_screen.py`)
- Student dashboard → Shared footer: renders (evidence: `src/screens/student_screen.py`)
- Student dashboard → Shared styling: applies styling (evidence: `src/screens/student_screen.py`)
- Create subject → Attendance and enrollment data: creates subject (evidence: `src/components/dialog_create_subject.py`)
- Join subject → Attendance and enrollment data: enrolls student (evidence: `src/components/dialog_enroll.py`)
- Deep-link enrollment → Attendance and enrollment data: enrolls student (evidence: `src/components/dialog_auto_enroll.py`)
- Face matching → Attendance and enrollment data: loads embeddings (evidence: `src/pipelines/face_pipeline.py`)
- Attendance and enrollment data → Supabase client: uses client (evidence: `src/database/db.py`)
- Supabase client → Supabase PostgreSQL: connects (evidence: `src/database/config.py`)
- Shared footer → Back-to-top control: renders (evidence: `src/components/footer.py`)
