# claire-mata/control_asistencia architecture

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

- Interactive diagram: https://gitdiagram.com/claire-mata/control_asistencia
- Repository: https://github.com/claire-mata/control_asistencia

## Overview

1. **What this system is**
   - `Control_Asistencia` is a monolithic **PHP + MySQL** web application for employee attendance control.
   - The app is organized around server-rendered pages, form submissions, and a shared database schema (`empleados.sql`), rather than a separate API/backend frontend split.

2. **Main runtime and storage**
   - **PHP** handles authentication, CRUD, attendance marking, and report generation.
   - **MySQL** is the persistent store, with the schema defined in `empleados.sql`.
   - The app likely runs in a classic LAMP-style deployment, with no evidence of a framework.

3. **Core architectural boundary: login/session control**
   - `login.php` is the entry entry point for authentication.
   - `salir.php` handles session termination.
   - `index.php` and `admin_ventana.php` appear to be post-login landing pages for different roles.
   - The README explicitly indicates an administrator account (`ADMIN` / `admin`), so role-based access is part of the design.

4. **Administrative subsystem: employee management**
   - CRUD for employees/users is split into page + action pairs:
     - `form_agregar.php` → `agregar.php`
     - `form_modificar.php` → `modificar.php`
     - `form_eliminar.php` → `eliminar.php`
   - This suggests a form-driven flow where the UI page gathers data and a separate PHP handler performs the DB mutation.
   - `admin_ventana.php` is likely the admin dashboard that links these actions together.

5. **Attendance capture subsystem**
   - The employee attendance flow is centered on:
     - `asistencia.php`
     - `ins_marca_dia.php`
     - `verAsistencia.php`
     - `ver_llegadas.php`
     - `mostrar_llegadas.php`
   - This likely supports marking entry/exit and viewing recent clock-ins.
   - The presence of `js/clock.js` and `js/marcar.js` indicates time-based UI behavior and attendance marking interactions are partially handled client-side.

6. **Schedule/configuration subsystem**
   - `config_horario.php` and `js/config_horario.js` implement schedule setup.
   - This is an important business-rule boundary: attendance evaluation depends on configured work hours, so schedule configuration affects how arrivals and lateness are interpreted.

7. **Reporting subsystem**
   - Reports are separated by time scope and employee scope:
     - `reporteDiario.php`
     - `reporteAnual.php`
     - `reporteEmp.php`
     - `js/reporteRango.js`
   - `mostrar_llegadas.php` and `ver_llegadas.php` appear to support report-like views of arrival data.
   - The architecture suggests report pages query the same attendance tables with different filters rather than using a reporting service layer.

8. **Shared application structure**
   - `conexion.php` is the shared DB connection layer used across most PHP pages.
   - `funciones.php` likely contains reusable business logic and helper functions, reducing duplication in attendance, user, and report pages.
   - `head.php`, `foot.php`, and `leftmenu.php` are shared UI fragments, which means the page layout is assembled from common includes.

9. **Client-side assets**
   - The `js/` folder contains small feature-specific scripts:
     - `clock.js` for live time display or timestamp behavior
     - `marcar.js` for attendance marking UI
     - `config_horario.js` for schedule form behavior
     - `reporteRango.js` for date-range report selection
     - `ver_llegadas.js` for arrival listing interactions
   - These scripts support the server-rendered pages but do not form a separate frontend application.

10. **Data flow through the system**
   - User starts at `login.php`.
   - On success, session state routes them to either admin or employee-facing views.
   - Admin actions submit forms to PHP handlers that write to MySQL.
   - Attendance actions capture current date/time and persist attendance records.
   - Reports and history screens read from the same attendance and employee tables, filtered by date, employee, or period.

11. **Likely domain entities**
   - Based on the file names and project scope, the key entities are:
     - employee/user records
     - attendance marks by day and time
     - schedules/hours configuration
     - report views over attendance history
   - `empleados.sql` is the authoritative source for the table structure behind these entities.

12. **Project organization style**
   - The repository follows a **page-per-action** architecture common in small PHP systems:
     - UI page
     - form page
     - processing page
   - This keeps implementation simple, but also means there is no strong separation into controllers/services/models; business logic is distributed across PHP files and shared includes.

13. **Documentation and deliverables**
   - The PDF files (`AgendaSprint1.pdf`, `AgendaEntregable1.pdf`, `IEEE.pdf`, `ManualProgramador.pdf`) indicate this is a coursework-style or structured team project with formal documentation.
   - The README also reflects sprint planning and backlog tracking, which helps explain why the codebase is organized around complete vertical features rather than layered architecture.

14. **What an architecture diagram should show**
   - A browser client interacting with a PHP web app.
   - A shared MySQL database at the center.
   - Four major functional blocks around it:
     - authentication/session management
     - employee administration
     - attendance capture/consultation
     - reporting and schedule configuration
   - Shared include files and JavaScript assets as supporting components across those blocks.

Main entry points: [`empleados.sql`](https://github.com/claire-mata/control_asistencia/blob/main/empleados.sql) (Schema), [`admin_ventana.php`](https://github.com/claire-mata/control_asistencia/blob/main/admin_ventana.php) (Admin desk), [`asistencia.php`](https://github.com/claire-mata/control_asistencia/blob/main/asistencia.php) (Attendance), [`conexion.php`](https://github.com/claire-mata/control_asistencia/blob/main/conexion.php) (DB connect)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_browser(("Browser<br/>client"))
end

subgraph group_auth["Auth"]
  node_login_php["Login<br/>php page<br/>[login.php]"]
  node_salir_php["Logout<br/>php page<br/>[salir.php]"]
  node_index_php["Home<br/>php page<br/>[index.php]"]
end

subgraph group_admin["Admin"]
  node_admin_ventana_php["Admin desk<br/>php page<br/>[admin_ventana.php]"]
  node_form_agregar_php["Add form<br/>php form<br/>[form_agregar.php]"]
  node_agregar_php["Add employee<br/>php action<br/>[agregar.php]"]
  node_form_modificar_php["Edit form<br/>php form<br/>[form_modificar.php]"]
  node_modificar_php["Update employee<br/>php action<br/>[modificar.php]"]
  node_form_eliminar_php["Delete form<br/>php form<br/>[form_eliminar.php]"]
  node_eliminar_php["Delete employee<br/>php action<br/>[eliminar.php]"]
end

subgraph group_attendance["Attendance"]
  node_asistencia_php["Attendance<br/>php page<br/>[asistencia.php]"]
  node_ins_marca_dia_php["Mark day<br/>php action<br/>[ins_marca_dia.php]"]
  node_ver_asistencia_php["View attendance<br/>php page<br/>[verAsistencia.php]"]
  node_ver_llegadas_php["Arrivals<br/>php page<br/>[ver_llegadas.php]"]
  node_mostrar_llegadas_php["Show arrivals<br/>php page"]
end

subgraph group_reports["Reports"]
  node_config_horario_php["Schedule<br/>php page<br/>[config_horario.php]"]
  node_reporte_diario_php["Daily report<br/>php page<br/>[reporteDiario.php]"]
  node_reporte_anual_php["Annual report<br/>php page<br/>[reporteAnual.php]"]
  node_reporte_emp_php["Employee report<br/>php page<br/>[reporteEmp.php]"]
end

subgraph group_shared["Shared"]
  node_conexion_php["DB connect<br/>php include<br/>[conexion.php]"]
  node_funciones_php["Helpers<br/>php include<br/>[funciones.php]"]
  node_head_php["Header<br/>ui include<br/>[head.php]"]
  node_foot_php["Footer<br/>ui include<br/>[foot.php]"]
  node_leftmenu_php["Menu<br/>ui include<br/>[leftmenu.php]"]
end

subgraph group_assets["Assets"]
  node_clock_js["Clock<br/>js<br/>[clock.js]"]
  node_marcar_js["Mark UI<br/>js<br/>[marcar.js]"]
  node_config_horario_js["Sched UI<br/>js<br/>[config_horario.js]"]
  node_reporte_rango_js["Range UI<br/>js<br/>[reporteRango.js]"]
  node_ver_llegadas_js["Arrivals UI<br/>js<br/>[ver_llegadas.js]"]
end

subgraph group_data["Data"]
  node_empleados_sql[("Schema<br/>[empleados.sql]")]
end

node_browser -->|"start"| node_login_php
node_login_php -->|"success"| node_index_php
node_login_php -->|"admin"| node_admin_ventana_php
node_index_php -->|"logout"| node_salir_php
node_admin_ventana_php -->|"add"| node_form_agregar_php
node_admin_ventana_php -->|"edit"| node_form_modificar_php
node_admin_ventana_php -->|"delete"| node_form_eliminar_php
node_form_agregar_php -->|"submit"| node_agregar_php
node_form_modificar_php -->|"submit"| node_modificar_php
node_form_eliminar_php -->|"submit"| node_eliminar_php
node_index_php -->|"attendance"| node_asistencia_php
node_asistencia_php -->|"mark"| node_ins_marca_dia_php
node_asistencia_php -->|"history"| node_ver_asistencia_php
node_ver_asistencia_php -->|"arrivals"| node_ver_llegadas_php
node_ver_llegadas_php -->|"filter"| node_mostrar_llegadas_php
node_config_horario_php -->|"basis"| node_reporte_diario_php
node_config_horario_php -->|"basis"| node_reporte_anual_php
node_config_horario_php -->|"basis"| node_reporte_emp_php
node_login_php -->|"db"| node_conexion_php
node_admin_ventana_php -->|"db"| node_conexion_php
node_asistencia_php -->|"db"| node_conexion_php
node_reporte_diario_php -->|"db"| node_conexion_php
node_reporte_anual_php -->|"db"| node_conexion_php
node_reporte_emp_php -->|"db"| node_conexion_php
node_agregar_php -->|"write"| node_empleados_sql
node_modificar_php -->|"write"| node_empleados_sql
node_eliminar_php -->|"write"| node_empleados_sql
node_ins_marca_dia_php -->|"write"| node_empleados_sql
node_ver_asistencia_php -->|"read"| node_empleados_sql
node_reporte_diario_php -->|"read"| node_empleados_sql
node_reporte_anual_php -->|"read"| node_empleados_sql
node_reporte_emp_php -->|"read"| node_empleados_sql
node_head_php -.->|"layout"| node_index_php
node_foot_php -.->|"layout"| node_index_php
node_leftmenu_php -.->|"layout"| node_admin_ventana_php
node_funciones_php -.->|"helpers"| node_agregar_php
node_funciones_php -.->|"helpers"| node_ins_marca_dia_php
node_clock_js -.->|"ui"| node_asistencia_php
node_marcar_js -.->|"ui"| node_asistencia_php
node_config_horario_js -.->|"ui"| node_config_horario_php
node_reporte_rango_js -.->|"ui"| node_reporte_diario_php
node_ver_llegadas_js -.->|"ui"| node_ver_llegadas_php

click node_login_php "https://github.com/claire-mata/control_asistencia/blob/main/login.php"
click node_salir_php "https://github.com/claire-mata/control_asistencia/blob/main/salir.php"
click node_index_php "https://github.com/claire-mata/control_asistencia/blob/main/index.php"
click node_admin_ventana_php "https://github.com/claire-mata/control_asistencia/blob/main/admin_ventana.php"
click node_form_agregar_php "https://github.com/claire-mata/control_asistencia/blob/main/form_agregar.php"
click node_agregar_php "https://github.com/claire-mata/control_asistencia/blob/main/agregar.php"
click node_form_modificar_php "https://github.com/claire-mata/control_asistencia/blob/main/form_modificar.php"
click node_modificar_php "https://github.com/claire-mata/control_asistencia/blob/main/modificar.php"
click node_form_eliminar_php "https://github.com/claire-mata/control_asistencia/blob/main/form_eliminar.php"
click node_eliminar_php "https://github.com/claire-mata/control_asistencia/blob/main/eliminar.php"
click node_asistencia_php "https://github.com/claire-mata/control_asistencia/blob/main/asistencia.php"
click node_ins_marca_dia_php "https://github.com/claire-mata/control_asistencia/blob/main/ins_marca_dia.php"
click node_ver_asistencia_php "https://github.com/claire-mata/control_asistencia/blob/main/verAsistencia.php"
click node_ver_llegadas_php "https://github.com/claire-mata/control_asistencia/blob/main/ver_llegadas.php"
click node_mostrar_llegadas_php "https://github.com/claire-mata/control_asistencia/blob/main/mostrar_llegadas.php"
click node_config_horario_php "https://github.com/claire-mata/control_asistencia/blob/main/config_horario.php"
click node_reporte_diario_php "https://github.com/claire-mata/control_asistencia/blob/main/reporteDiario.php"
click node_reporte_anual_php "https://github.com/claire-mata/control_asistencia/blob/main/reporteAnual.php"
click node_reporte_emp_php "https://github.com/claire-mata/control_asistencia/blob/main/reporteEmp.php"
click node_conexion_php "https://github.com/claire-mata/control_asistencia/blob/main/conexion.php"
click node_funciones_php "https://github.com/claire-mata/control_asistencia/blob/main/funciones.php"
click node_head_php "https://github.com/claire-mata/control_asistencia/blob/main/head.php"
click node_foot_php "https://github.com/claire-mata/control_asistencia/blob/main/foot.php"
click node_leftmenu_php "https://github.com/claire-mata/control_asistencia/blob/main/leftmenu.php"
click node_clock_js "https://github.com/claire-mata/control_asistencia/blob/main/js/clock.js"
click node_marcar_js "https://github.com/claire-mata/control_asistencia/blob/main/js/marcar.js"
click node_config_horario_js "https://github.com/claire-mata/control_asistencia/blob/main/js/config_horario.js"
click node_reporte_rango_js "https://github.com/claire-mata/control_asistencia/blob/main/js/reporteRango.js"
click node_ver_llegadas_js "https://github.com/claire-mata/control_asistencia/blob/main/js/ver_llegadas.js"
click node_empleados_sql "https://github.com/claire-mata/control_asistencia/blob/main/empleados.sql"

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_browser,node_clock_js,node_marcar_js,node_config_horario_js,node_reporte_rango_js,node_ver_llegadas_js toneBlue
class node_login_php,node_salir_php,node_index_php,node_empleados_sql toneAmber
class node_admin_ventana_php,node_form_agregar_php,node_agregar_php,node_form_modificar_php,node_modificar_php,node_form_eliminar_php,node_eliminar_php toneMint
class node_asistencia_php,node_ins_marca_dia_php,node_ver_asistencia_php,node_ver_llegadas_php,node_mostrar_llegadas_php toneRose
class node_config_horario_php,node_reporte_diario_php,node_reporte_anual_php,node_reporte_emp_php toneIndigo
class node_conexion_php,node_funciones_php,node_head_php,node_foot_php,node_leftmenu_php toneTeal
```

## Components

### Client

Browser-side entry point

- **Browser**: client · User-facing web client

### Auth

Login and session control

- [Login](https://github.com/claire-mata/control_asistencia/blob/main/login.php): php page · Authentication entry page · `login.php`
- [Logout](https://github.com/claire-mata/control_asistencia/blob/main/salir.php): php page · Terminates the session · `salir.php`
- [Home](https://github.com/claire-mata/control_asistencia/blob/main/index.php): php page · Post-login landing page · `index.php`

### Admin

Employee management

- [Admin desk](https://github.com/claire-mata/control_asistencia/blob/main/admin_ventana.php): php page · Administrator dashboard · `admin_ventana.php`
- [Add form](https://github.com/claire-mata/control_asistencia/blob/main/form_agregar.php): php form · Employee creation form · `form_agregar.php`
- [Add employee](https://github.com/claire-mata/control_asistencia/blob/main/agregar.php): php action · Persists new employee data · `agregar.php`
- [Edit form](https://github.com/claire-mata/control_asistencia/blob/main/form_modificar.php): php form · Employee edit form · `form_modificar.php`
- [Update employee](https://github.com/claire-mata/control_asistencia/blob/main/modificar.php): php action · Updates employee records · `modificar.php`
- [Delete form](https://github.com/claire-mata/control_asistencia/blob/main/form_eliminar.php): php form · Employee delete confirmation form · `form_eliminar.php`
- [Delete employee](https://github.com/claire-mata/control_asistencia/blob/main/eliminar.php): php action · Removes employee records · `eliminar.php`

### Attendance

Clock-in and history

- [Attendance](https://github.com/claire-mata/control_asistencia/blob/main/asistencia.php): php page · Attendance capture and consultation page · `asistencia.php`
- [Mark day](https://github.com/claire-mata/control_asistencia/blob/main/ins_marca_dia.php): php action · Stores daily attendance mark · `ins_marca_dia.php`
- [View attendance](https://github.com/claire-mata/control_asistencia/blob/main/verAsistencia.php): php page · Attendance history view · `verAsistencia.php`
- [Arrivals](https://github.com/claire-mata/control_asistencia/blob/main/ver_llegadas.php): php page · Lists recent arrivals · `ver_llegadas.php`
- [Show arrivals](https://github.com/claire-mata/control_asistencia/blob/main/mostrar_llegadas.php): php page · Filtered arrival display · `mostrar_llegadas.php`

### Reports

Reporting and schedule views

- [Schedule](https://github.com/claire-mata/control_asistencia/blob/main/config_horario.php): php page · Work-hours configuration · `config_horario.php`
- [Daily report](https://github.com/claire-mata/control_asistencia/blob/main/reporteDiario.php): php page · Day-based attendance report · `reporteDiario.php`
- [Annual report](https://github.com/claire-mata/control_asistencia/blob/main/reporteAnual.php): php page · Year-based attendance report · `reporteAnual.php`
- [Employee report](https://github.com/claire-mata/control_asistencia/blob/main/reporteEmp.php): php page · Employee-specific attendance report · `reporteEmp.php`

### Shared

Common includes and DB access

- [DB connect](https://github.com/claire-mata/control_asistencia/blob/main/conexion.php): php include · Shared MySQL connection layer · `conexion.php`
- [Helpers](https://github.com/claire-mata/control_asistencia/blob/main/funciones.php): php include · Reusable business logic and helpers · `funciones.php`
- [Header](https://github.com/claire-mata/control_asistencia/blob/main/head.php): ui include · Common page header fragment · `head.php`
- [Footer](https://github.com/claire-mata/control_asistencia/blob/main/foot.php): ui include · Common page footer fragment · `foot.php`
- [Menu](https://github.com/claire-mata/control_asistencia/blob/main/leftmenu.php): ui include · Shared navigation menu · `leftmenu.php`

### Assets

Small feature scripts

- [Clock](https://github.com/claire-mata/control_asistencia/blob/main/js/clock.js): js · Live time display behavior · `js/clock.js`
- [Mark UI](https://github.com/claire-mata/control_asistencia/blob/main/js/marcar.js): js · Attendance marking interaction · `js/marcar.js`
- [Sched UI](https://github.com/claire-mata/control_asistencia/blob/main/js/config_horario.js): js · Schedule form behavior · `js/config_horario.js`
- [Range UI](https://github.com/claire-mata/control_asistencia/blob/main/js/reporteRango.js): js · Date-range report controls · `js/reporteRango.js`
- [Arrivals UI](https://github.com/claire-mata/control_asistencia/blob/main/js/ver_llegadas.js): js · Arrival listing interaction · `js/ver_llegadas.js`

### Data

Database schema

- [Schema](https://github.com/claire-mata/control_asistencia/blob/main/empleados.sql): mysql schema · Authoritative database schema · `empleados.sql`

## Connections

- Browser → Login: start · User begins at the login page
- Login → Home: success · Successful login routes into the app
- Login → Admin desk: admin · Administrator landing path
- Home → Logout: logout · Session termination path
- Admin desk → Add form: add · Opens employee creation form
- Admin desk → Edit form: edit · Opens employee edit form
- Admin desk → Delete form: delete · Opens employee delete form
- Add form → Add employee: submit · Form posts to creation handler
- Edit form → Update employee: submit · Form posts to update handler
- Delete form → Delete employee: submit · Form posts to delete handler
- Home → Attendance: attendance · Employee-facing attendance access
- Attendance → Mark day: mark · Saves the day's attendance mark
- Attendance → View attendance: history · Shows attendance history
- View attendance → Arrivals: arrivals · Moves into arrival-focused views
- Arrivals → Show arrivals: filter · Displays filtered arrival lists
- Schedule → Daily report: basis · Schedule settings feed report interpretation
- Schedule → Annual report: basis · Schedule settings affect annual views
- Schedule → Employee report: basis · Schedule settings affect employee views
- Login → DB connect: db · Authentication uses the shared connection
- Admin desk → DB connect: db · Admin pages use the shared connection
- Attendance → DB connect: db · Attendance pages query the database
- Daily report → DB connect: db · Report pages query the database
- Annual report → DB connect: db · Report pages query the database
- Employee report → DB connect: db · Report pages query the database
- Add employee → Schema: write · Creates employee rows
- Update employee → Schema: write · Updates employee rows
- Delete employee → Schema: write · Deletes employee rows
- Mark day → Schema: write · Stores attendance records
- View attendance → Schema: read · Reads attendance history
- Daily report → Schema: read · Reads attendance data for daily reports
- Annual report → Schema: read · Reads attendance data for annual reports
- Employee report → Schema: read · Reads attendance data for employee reports
- Header → Home: layout · Shared header assembled into pages
- Footer → Home: layout · Shared footer assembled into pages
- Menu → Admin desk: layout · Shared menu assembled into admin pages
- Helpers → Add employee: helpers · Reusable logic supports CRUD actions
- Helpers → Mark day: helpers · Reusable logic supports attendance capture
- Clock → Attendance: ui · Live clock supports attendance marking
- Mark UI → Attendance: ui · Attendance UI behavior
- Sched UI → Schedule: ui · Schedule form behavior
- Range UI → Daily report: ui · Date-range controls for reports
- Arrivals UI → Arrivals: ui · Arrival list interactions
