# aufatsaqief/ta-facerecog-qash architecture

> Architecture diagram of the GitHub repository aufatsaqief/ta-facerecog-qash, 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/aufatsaqief/ta-facerecog-qash
- Repository: https://github.com/aufatsaqief/ta-facerecog-qash

## Overview

This is a Flask backend for face-based attendance, with guided registration, face matching, configurable attendance logging, and a geolocation-validation module. The main workflow is browser request → API → registration or recognition → response; successful registration retrains embeddings, while successful recognition records attendance. The README describes location validation as part of attendance, but the sampled recognition code has that call commented out, so geolocation is shown as an unconnected capability. Edges reflect the README or sampled source; unsampled subsystems are not connected speculatively.

Main entry points: [`face_api.py`](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_api.py) (Flask API), [`main.py`](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/main.py) (Embedding retraining), [`face_register_service.py`](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_register_service.py) (Face registration), [`attendance_logger.py`](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/attendance_logger.py) (Attendance logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api_workflow["API workflow"]
  node_api["Flask API<br/>[face_api.py]"]
  node_registration["Face registration"]
  node_recognition["Face recognition"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_face_data["Face data"]
  node_dataset[("Face dataset")]
  node_retraining["Embedding retraining<br/>[main.py]"]
  node_embeddings[("Embedding files")]
  node_data_management["Face data management<br/>[manage_data.py]"]
end

subgraph group_attendance["Attendance"]
  node_attendance_logger["Attendance logger"]
  node_attendance_store[("Attendance records")]
end

subgraph group_location["Location"]
  node_geolocation["Location validation"]
end

node_browser(("Browser client"))

node_browser -->|"sends requests"| node_api
node_api -->|"returns JSON"| node_browser
node_api -->|"routes registration"| node_registration
node_api -->|"routes recognition"| node_recognition
node_api -->|"loads files"| node_embeddings
node_registration -->|"saves photos"| node_dataset
node_registration -->|"invokes retraining"| node_retraining
node_retraining -->|"reads photos"| node_dataset
node_retraining -->|"writes files"| node_embeddings
node_registration -->|"reads settings"| node_config
node_retraining -->|"reads paths"| node_config
node_recognition -->|"logs attendance"| node_attendance_logger
node_attendance_logger -->|"reads settings"| node_config
node_attendance_logger -.->|"writes records"| node_attendance_store
node_data_management -->|"deletes photos"| node_dataset
node_data_management -->|"runs retraining"| node_retraining

click node_api "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_api.py"
click node_registration "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_register_service.py"
click node_recognition "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_recognize_service.py"
click node_config "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/config.py"
click node_retraining "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/main.py"
click node_data_management "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/manage_data.py"
click node_attendance_logger "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/attendance_logger.py"
click node_geolocation "https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/geolocation_service.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_api,node_registration,node_recognition,node_config,node_browser toneBlue
class node_dataset,node_retraining,node_embeddings,node_data_management toneAmber
class node_attendance_logger,node_attendance_store toneMint
class node_geolocation toneRose
```

## Components

### API workflow

- [Flask API](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_api.py): `face_api.py`
- [Face registration](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_register_service.py): `face_register_service.py`
- [Face recognition](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/face_recognize_service.py): `face_recognize_service.py`
- [Runtime configuration](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/config.py): `config.py`

### Face data

- **Face dataset**
- [Embedding retraining](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/main.py): `main.py`
- **Embedding files**
- [Face data management](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/manage_data.py): `manage_data.py`

### Attendance

- [Attendance logger](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/attendance_logger.py): `attendance_logger.py`
- **Attendance records**

### Location

- [Location validation](https://github.com/aufatsaqief/ta-facerecog-qash/blob/main/geolocation_service.py): `geolocation_service.py`

### Other components

- **Browser client**

## Connections

- Browser client → Flask API: sends requests (evidence: `README.md`)
- Flask API → Browser client: returns JSON (evidence: `README.md`)
- Flask API → Face registration: routes registration (evidence: `face_api.py`)
- Flask API → Face recognition: routes recognition (evidence: `face_api.py`)
- Flask API → Embedding files: loads files (evidence: `face_api.py`)
- Face registration → Face dataset: saves photos (evidence: `face_register_service.py`)
- Face registration → Embedding retraining: invokes retraining (evidence: `face_register_service.py`)
- Embedding retraining → Face dataset: reads photos (evidence: `main.py`)
- Embedding retraining → Embedding files: writes files (evidence: `main.py`)
- Face registration → Runtime configuration: reads settings (evidence: `face_register_service.py`)
- Embedding retraining → Runtime configuration: reads paths (evidence: `main.py`)
- Face recognition → Attendance logger: logs attendance (evidence: `face_recognize_service.py`)
- Attendance logger → Runtime configuration: reads settings (evidence: `attendance_logger.py`)
- Attendance logger → Attendance records: writes records (evidence: `README.md`)
- Face data management → Face dataset: deletes photos (evidence: `manage_data.py`)
- Face data management → Embedding retraining: runs retraining (evidence: `manage_data.py`)
