# martinezaus/trace architecture

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

- Interactive diagram: https://gitdiagram.com/martinezaus/trace
- Repository: https://github.com/martinezaus/trace

## Overview

This is a PHP production-tracking application for glass/aluminum work: its modules cover orders, documents and plans, operator sessions, cutting/assembly processes, pauses and events, plus reporting and administration. A typical user-facing workflow is represented by these domain stages, though the supplied excerpts do not establish all runtime handoffs between them. The internal layer separates HTTP endpoints from service and calculation code. Evidence is limited to the supplied source index and excerpts; relationships without direct support are omitted.

Main entry points: [`src/api/documentos.php`](https://github.com/martinezaus/trace/blob/main/src/api/documentos.php) (Documents and PDFs), [`src/include/reportes_service.php`](https://github.com/martinezaus/trace/blob/main/src/include/reportes_service.php) (Reports), [`src/include/corte_pdf_service.php`](https://github.com/martinezaus/trace/blob/main/src/include/corte_pdf_service.php) (PDF cutting tasks), [`src/include/productividad_costos.php`](https://github.com/martinezaus/trace/blob/main/src/include/productividad_costos.php) (Productivity costs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Production workflow"]
  node_orders["Orders<br/>[ordenes.php]"]
  node_documents["Documents and PDFs<br/>[documentos.php]"]
  node_plan_import["Plan import<br/>[parse_pdf.php]"]
  node_glass_import["Glass plan parsing"]
  node_details["Order details<br/>[detalles.php]"]
  node_processes["Production processes"]
  node_cutting_tasks["PDF cutting tasks"]
end

subgraph group_operations["Operations and access"]
  node_operator_sessions["Operator sessions<br/>[sesiones.php]"]
  node_events["Pauses and events<br/>[eventos.php]"]
  node_admin["Administration<br/>[admin.php]"]
end

subgraph group_insights["Reporting and metrics"]
  node_reports["Reports"]
  node_productivity["Productivity metrics<br/>[productividad.php]"]
  node_productivity_costs["Productivity costs"]
end

subgraph group_foundation["Shared foundation"]
  node_database[("Application database<br/>[rb-mysql.php]")]
  node_auth["Authentication<br/>[auth.php]"]
  node_config["Application configuration<br/>[config.php]"]
  node_functions["Shared functions<br/>[functions.php]"]
  node_cut_auth["Cutting access checks<br/>[corte_auth.php]"]
  node_process_dates["Process date handling<br/>[procesos_fecha.php]"]
end

node_user(("Staff user"))

node_documents -->|"includes"| node_auth
node_documents -->|"includes"| node_config
node_documents -->|"loads"| node_database
node_documents -->|"uses"| node_functions
node_documents -->|"loads"| node_plan_import
node_documents -->|"loads"| node_glass_import
node_documents -->|"loads"| node_cut_auth
node_documents -->|"loads"| node_cutting_tasks
node_cutting_tasks -->|"uses"| node_process_dates
node_reports -->|"includes"| node_productivity
node_reports -->|"includes"| node_productivity_costs
node_productivity_costs -->|"includes"| node_productivity

click node_orders "https://github.com/martinezaus/trace/blob/main/src/api/ordenes.php"
click node_documents "https://github.com/martinezaus/trace/blob/main/src/api/documentos.php"
click node_plan_import "https://github.com/martinezaus/trace/blob/main/src/include/parse_pdf.php"
click node_glass_import "https://github.com/martinezaus/trace/blob/main/src/include/parse_pdfvidrio.php"
click node_details "https://github.com/martinezaus/trace/blob/main/src/api/detalles.php"
click node_processes "https://github.com/martinezaus/trace/blob/main/src/include/proceso_service.php"
click node_cutting_tasks "https://github.com/martinezaus/trace/blob/main/src/include/corte_pdf_service.php"
click node_operator_sessions "https://github.com/martinezaus/trace/blob/main/src/api/sesiones.php"
click node_events "https://github.com/martinezaus/trace/blob/main/src/api/eventos.php"
click node_admin "https://github.com/martinezaus/trace/blob/main/src/admin.php"
click node_reports "https://github.com/martinezaus/trace/blob/main/src/include/reportes_service.php"
click node_productivity "https://github.com/martinezaus/trace/blob/main/src/include/productividad.php"
click node_productivity_costs "https://github.com/martinezaus/trace/blob/main/src/include/productividad_costos.php"
click node_database "https://github.com/martinezaus/trace/blob/main/src/api/rb-mysql.php"
click node_auth "https://github.com/martinezaus/trace/blob/main/src/include/auth.php"
click node_config "https://github.com/martinezaus/trace/blob/main/src/include/config.php"
click node_functions "https://github.com/martinezaus/trace/blob/main/src/include/functions.php"
click node_cut_auth "https://github.com/martinezaus/trace/blob/main/src/include/corte_auth.php"
click node_process_dates "https://github.com/martinezaus/trace/blob/main/src/include/procesos_fecha.php"

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_orders,node_documents,node_plan_import,node_glass_import,node_details,node_processes,node_cutting_tasks,node_user toneBlue
class node_operator_sessions,node_events,node_admin toneAmber
class node_reports,node_productivity,node_productivity_costs toneMint
class node_database,node_auth,node_config,node_functions,node_cut_auth,node_process_dates toneRose
```

## Components

### Production workflow

- [Orders](https://github.com/martinezaus/trace/blob/main/src/api/ordenes.php): `src/api/ordenes.php`
- [Documents and PDFs](https://github.com/martinezaus/trace/blob/main/src/api/documentos.php): `src/api/documentos.php`
- [Plan import](https://github.com/martinezaus/trace/blob/main/src/include/parse_pdf.php): `src/include/parse_pdf.php`
- [Glass plan parsing](https://github.com/martinezaus/trace/blob/main/src/include/parse_pdfvidrio.php): `src/include/parse_pdfvidrio.php`
- [Order details](https://github.com/martinezaus/trace/blob/main/src/api/detalles.php): `src/api/detalles.php`
- [Production processes](https://github.com/martinezaus/trace/blob/main/src/include/proceso_service.php): `src/include/proceso_service.php`
- [PDF cutting tasks](https://github.com/martinezaus/trace/blob/main/src/include/corte_pdf_service.php): `src/include/corte_pdf_service.php`

### Operations and access

- [Operator sessions](https://github.com/martinezaus/trace/blob/main/src/api/sesiones.php): `src/api/sesiones.php`
- [Pauses and events](https://github.com/martinezaus/trace/blob/main/src/api/eventos.php): `src/api/eventos.php`
- [Administration](https://github.com/martinezaus/trace/blob/main/src/admin.php): `src/admin.php`

### Reporting and metrics

- [Reports](https://github.com/martinezaus/trace/blob/main/src/include/reportes_service.php): `src/include/reportes_service.php`
- [Productivity metrics](https://github.com/martinezaus/trace/blob/main/src/include/productividad.php): `src/include/productividad.php`
- [Productivity costs](https://github.com/martinezaus/trace/blob/main/src/include/productividad_costos.php): `src/include/productividad_costos.php`

### Shared foundation

- [Application database](https://github.com/martinezaus/trace/blob/main/src/api/rb-mysql.php): `src/api/rb-mysql.php`
- [Authentication](https://github.com/martinezaus/trace/blob/main/src/include/auth.php): `src/include/auth.php`
- [Application configuration](https://github.com/martinezaus/trace/blob/main/src/include/config.php): `src/include/config.php`
- [Shared functions](https://github.com/martinezaus/trace/blob/main/src/include/functions.php): `src/include/functions.php`
- [Cutting access checks](https://github.com/martinezaus/trace/blob/main/src/include/corte_auth.php): `src/include/corte_auth.php`
- [Process date handling](https://github.com/martinezaus/trace/blob/main/src/include/procesos_fecha.php): `src/include/procesos_fecha.php`

### Other components

- **Staff user**

## Connections

- Documents and PDFs → Authentication: includes (evidence: `src/api/documentos.php`)
- Documents and PDFs → Application configuration: includes (evidence: `src/api/documentos.php`)
- Documents and PDFs → Application database: loads (evidence: `src/api/documentos.php`)
- Documents and PDFs → Shared functions: uses (evidence: `src/api/documentos.php`)
- Documents and PDFs → Plan import: loads (evidence: `src/api/documentos.php`)
- Documents and PDFs → Glass plan parsing: loads (evidence: `src/api/documentos.php`)
- Documents and PDFs → Cutting access checks: loads (evidence: `src/api/documentos.php`)
- Documents and PDFs → PDF cutting tasks: loads (evidence: `src/api/documentos.php`)
- PDF cutting tasks → Process date handling: uses (evidence: `src/include/corte_pdf_service.php`)
- Reports → Productivity metrics: includes (evidence: `src/include/reportes_service.php`)
- Reports → Productivity costs: includes (evidence: `src/include/reportes_service.php`)
- Productivity costs → Productivity metrics: includes (evidence: `src/include/productividad_costos.php`)
