# codemisba/attendance-management-system_p2 architecture

> Architecture diagram of the GitHub repository codemisba/attendance-management-system_p2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codemisba/attendance-management-system_p2
- Repository: https://github.com/codemisba/attendance-management-system_p2

## Overview

##### Project Type and Purpose
- This is a desktop‑based Face Recognition Attendance Management System. It uses a Tkinter GUI for user interaction, OpenCV for computer vision (face detection + recognition), and CSV files (and potentially an SQL database) for data persistence. The primary use cases are adding/updating/deleting student records, training a face recognition model, and marking attendance via live camera feed.

##### File Structure
- Top‑level scripts:
- main.py – orchestrates the GUI and ties together the face recognition, data management, and attendance marking flows.
- mini_app.py – a streamlined version of the interface, likely a proof‑of‑concept or simplified front end.
- Test_Camera_Functionality.py – standalone module for verifying camera capture and face detection pipeline.
- Train_Images_By_Haarcascade.py – handles creation of training images from live feed and triggers model training.
- Data directories:
- Training_Images – raw face snapshots labeled per student.
- Training_Image_Label/trainner.yml – serialized trained face recognition model.
- Snapshots – runtime captures for debugging/verification.
- StudentDetails/StudentDetails.csv – master student database (ID, name, …).
- ManualAttendance/attendance.csv & SmartAttendance/*.csv – logs of attendance, separated by manual vs. automatic flows.
- Configuration/Resources:
- haarcascade_frontalface_default.xml – OpenCV cascade for face detection.
- Jupyter notebooks for hyperparameter tuning and experimentation (not part of the production pipeline).

##### README for Additional Insights
- Frameworks/Libraries: Python 3.7+, OpenCV, NumPy, Pandas, Tkinter.
- Data stores: CSV (with plans to move to SQL).
- Core features: real‑time face detection & recognition, timestamped attendance logging, student record CRUD.

##### Detail
- Directories and files that play a role in the runtime path: Training_Images, trainner.yml, haarcascade_frontalface_default.xml, StudentDetails.csv, attendance CSVs.
- Do not over‑abstract—show both ManualAttendance and SmartAttendance modules as separate logging sinks.
- Configuration files or parameters (e.g., hyperparameter notebooks) as side‑notes or footnotes.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Runtime Components
    subgraph "Runtime Components"
        style RuntimeComponents fill:#e0ffe0,stroke:#333,stroke-width:1px
        GUI["Tkinter GUI"]:::runtime
        Detection["OpenCV Face Detector\n(haarcascade_frontalface_default.xml)"]:::runtime
        Recognition["LBPH Recognizer\n(trainner.yml)"]:::runtime
        Records["Student Records\nStudentDetails.csv"]:::datastore
        AttendanceManual["ManualAttendance\nattendance.csv"]:::datastore
        AttendanceSmart1["SmartAttendance\nEnglish_2024-12.csv"]:::datastore
        AttendanceSmart2["SmartAttendance\nTelugu_2024-12.csv"]:::datastore
        Snapshots["Runtime Snapshots\nSnapshots/"]:::runtime
        CameraTest["Camera Test Utility"]:::runtime
    end

    %% Training Components
    subgraph "Training Components"
        style TrainingComponents fill:#e0f0ff,stroke:#333,stroke-width:1px
        ImageCollector["Image Collector\nTraining_Images/"]:::training
        ModelTrainer["Model Trainer\nTrain_Images_By_Haarcascade.py"]:::training
        TrainedModel["Trained Model\ntrainner.yml"]:::training
    end

    %% External Tools
    subgraph "External Analysis Tools"
        style ExternalTools fill:#f0f0f0,stroke:#333,stroke-width:1px
        Notebook1["Hyperparameter Notebook\nOpenCV_Image_Processing_Complete_Work_with_Parameters_and_Hyperparameters.ipynb"]:::external
        Notebook2["Selfie Face Hyperparams\nselfie_face_detection_hyperparameters.ipynb"]:::external
    end

    %% Flows
    GUI -->|"capture frame"| Detection
    Detection -->|"detect faces"| Recognition
    Recognition -->|"lookup ID"| Records
    Recognition -->|"log timestamp"| AttendanceManual
    Recognition -->|"log timestamp"| AttendanceSmart1
    Recognition -->|"log timestamp"| AttendanceSmart2
    GUI -->|"start camera test"| CameraTest
    GUI -->|"capture images"| ImageCollector
    GUI -->|"add/update student"| Records
    GUI -->|"train model"| ModelTrainer
    ModelTrainer -->|"reads images & haarcascade"| ImageCollector
    ModelTrainer -->|"outputs model"| TrainedModel
    TrainedModel --> Recognition

    %% Click Events
    click GUI "https://github.com/codemisba/attendance-management-system_p2/blob/main/main.py"
    click GUI "https://github.com/codemisba/attendance-management-system_p2/blob/main/mini_app.py"
    click Detection "https://github.com/codemisba/attendance-management-system_p2/blob/main/haarcascade_frontalface_default.xml"
    click Recognition "https://github.com/codemisba/attendance-management-system_p2/blob/main/Training_Image_Label/trainner.yml"
    click Records "https://github.com/codemisba/attendance-management-system_p2/blob/main/StudentDetails/StudentDetails.csv"
    click AttendanceManual "https://github.com/codemisba/attendance-management-system_p2/blob/main/ManualAttendance/attendance.csv"
    click AttendanceSmart1 "https://github.com/codemisba/attendance-management-system_p2/blob/main/SmartAttendance/English_2024-12.csv"
    click AttendanceSmart2 "https://github.com/codemisba/attendance-management-system_p2/blob/main/SmartAttendance/Telugu_2024-12.csv"
    click ImageCollector "https://github.com/codemisba/attendance-management-system_p2/tree/main/Training_Images/"
    click ModelTrainer "https://github.com/codemisba/attendance-management-system_p2/blob/main/Train_Images_By_Haarcascade.py"
    click TrainedModel "https://github.com/codemisba/attendance-management-system_p2/blob/main/Training_Image_Label/trainner.yml"
    click Snapshots "https://github.com/codemisba/attendance-management-system_p2/tree/main/Snapshots/"
    click CameraTest "https://github.com/codemisba/attendance-management-system_p2/blob/main/Test_Camera_Functionality.py"
    click Notebook1 "https://github.com/codemisba/attendance-management-system_p2/blob/main/OpenCV_Image_Processing_Complete_Work_with_Parameters_and_Hyperparameters.ipynb"
    click Notebook2 "https://github.com/codemisba/attendance-management-system_p2/blob/main/selfie_face_detection_hyperparameters.ipynb"

    %% Styles
    classDef runtime fill:#e0ffe0,stroke:#333,stroke-width:1px
    classDef training fill:#e0f0ff,stroke:#333,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef datastore fill:#fff2cc,stroke:#333,stroke-width:1px 
    class RuntimeComponents runtime
    class TrainingComponents training
    class ExternalTools external
```
