# proyetei/attendease architecture

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

- Interactive diagram: https://gitdiagram.com/proyetei/attendease
- Repository: https://github.com/proyetei/attendease

## Overview

##### Project type and purpose
- AttendEase is a monolithic Python-based full-stack application for real-time student attendance tracking using facial recognition.
- It has three main stages: initialization (encoding generation and DB seeding), live recognition (video capture, face detection/recognition, UI), and cloud integration (Firebase for data storage).

##### File structure
- Top-level scripts:
- EncodeGenerator.py – generates face encodings from student images.
- AddDataToDatabase.py – uploads student info + encodings into Firebase.
- main.py – runs the live attendance system (video feed, detection, recognition, UI).
- Resources/Images/Modes folders – hold student photos and Haar Cascade XMLs.
- EncodeFile.p – serialized face encodings.
- Pipfile/Pipfile.lock – Python dependencies (OpenCV, face_recognition, cvzone, firebase-admin, pickle).

##### README for additional insights
- Uses OpenCV’s Haar Cascade for detection, face_recognition library for encoding/matching.
- Interacts directly with Firebase Realtime Database and Storage via the Firebase Admin SDK.
- Workflow: capture → detect → load/generate encodings → match → update DB → display UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Initialization Module
    subgraph "Initialization Module"
        IG["EncodeGenerator.py"]:::local
        DBSeed["AddDataToDatabase.py"]:::local
    end

    %% Face Processing Subsystem
    subgraph "Face Processing Subsystem"
        Haar["Haar Cascade Detector"]:::library
        FR["face_recognition Engine"]:::library
    end

    %% Local Storage
    subgraph "Local Storage"
        Encodings["EncodeFile.p"]:::local
        Photos["Images/"]:::local
    end

    %% Runtime Module
    subgraph "Runtime Module"
        App["main.py (Video Capture & UI)"]:::local
    end

    %% Cloud Services
    subgraph "Cloud Services"
        Storage["Firebase Storage"]:::cloud
        Database["Firebase Realtime Database"]:::cloud
    end

    %% Dependencies and Docs
    PipfileNode["Pipfile & Pipfile.lock"]:::local
    Readme["README.md"]:::local

    %% Data Flows
    IG -->|"generates encodings"| Encodings
    IG -->|"uploads data"| DBSeed
    DBSeed -->|"writes to"| Database
    DBSeed -->|"uploads images"| Storage

    App -->|"reads frames from Webcam"| Haar
    Haar -->|"detects faces"| FR
    FR -->|"compares with"| Encodings
    FR -->|"matches found"| App
    App -->|"updates attendance"| Database
    App -->|"uploads capture"| Storage
    App -->|"renders UI overlay"| Photos

    %% Dependency references
    App -.->|uses| PipfileNode
    IG -.->|uses| PipfileNode
    DBSeed -.->|uses| PipfileNode
    Haar -.->|defined in| Photos
    FR -.->|requires| PipfileNode
    IG -.->|docs in| Readme
    App -.->|docs in| Readme
    DBSeed -.->|docs in| Readme

    %% Click Events
    click IG "https://github.com/proyetei/attendease/blob/main/EncodeGenerator.py"
    click DBSeed "https://github.com/proyetei/attendease/blob/main/AddDataToDatabase.py"
    click App "https://github.com/proyetei/attendease/blob/main/main.py"
    click Haar "https://github.com/proyetei/attendease/tree/main/Resources/Modes"
    click Encodings "https://github.com/proyetei/attendease/blob/main/EncodeFile.p"
    click Photos "https://github.com/proyetei/attendease/tree/main/Images/"
    click PipfileNode "https://github.com/proyetei/attendease/tree/main/Pipfile"
    click PipfileNode "https://github.com/proyetei/attendease/blob/main/Pipfile.lock"
    click Readme "https://github.com/proyetei/attendease/blob/main/README.md"

    %% Styles
    classDef local fill:#cfe2f3,stroke:#6fa8dc,stroke-width:1px
    classDef cloud fill:#d9ead3,stroke:#93c47d,stroke-width:1px
    classDef library fill:#f9cb9c,stroke:#e69138,stroke-width:1px
```
